summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-13 14:14:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-13 14:14:35 +0300
commit00d71971d9cf831b991d391bb073dd846a15855f (patch)
treef121836446e42c395749d6e4ecdddb8d1aea72b6 /plugins
parent1723a03ef74caa86cbfde4144541afb92147395f (diff)
profile lock detection unbound from contact list services
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp12
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp2
2 files changed, 10 insertions, 4 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 21c6c3a988..4247806e0a 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -150,7 +150,7 @@ int CDbxMDBX::Load()
}
size_t iDefHeaderOffset = 0;
-BYTE bDefHeader[] = { 0 };
+BYTE bDefHeader[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0 };
int CDbxMDBX::Check(void)
{
@@ -215,6 +215,9 @@ STDMETHODIMP_(void) CDbxMDBX::SetCacheSafetyMode(BOOL bIsSet)
int CDbxMDBX::Map()
{
+ if (!LockName(m_tszProfileName))
+ return EGROKPRF_CANTREAD;
+
#ifdef _WIN64
__int64 upperLimit = 0x400000000ul;
#else
@@ -229,13 +232,16 @@ int CDbxMDBX::Map()
512ul << 10, // 512K shrink threshold
-1); // default page size
if (rc != MDBX_SUCCESS)
- return rc;
+ return EGROKPRF_CANTREAD;
unsigned int mode = MDBX_NOSUBDIR | MDBX_MAPASYNC | MDBX_WRITEMAP | MDBX_NOSYNC | MDBX_COALESCE;
if (m_bReadOnly)
mode |= MDBX_RDONLY;
- return mdbx_env_open(m_env, _T2A(m_tszProfileName), mode, 0664);
+ if (mdbx_env_open(m_env, _T2A(m_tszProfileName), mode, 0664) != MDBX_SUCCESS)
+ return EGROKPRF_CANTREAD;
+
+ return EGROKPRF_NOERROR;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index 3419fd6c78..6a85913bde 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -67,7 +67,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABA
static int makeDatabase(const TCHAR *profile)
{
std::unique_ptr<CDbxMDBX> db(new CDbxMDBX(profile, 0));
- return (db->Map() == MDBX_SUCCESS) ? 0 : EGROKPRF_CANTREAD;
+ return db->Map();
}
// returns 0 if the given profile has a valid header