summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-13 14:10:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-13 14:10:49 +0300
commit1e2176029a94fd8c8e404e4d6b969abef08be40f (patch)
treed35f9d19d2b87c090b023928a58eaab20ac61205 /plugins/Dbx_mdbx/src
parent516cbe82f0191a9ff3b2c43e4b2330fb48fa07e3 (diff)
fixes #2181 ("Miranda was unable to open <profile_name>, it's in an unknown format")
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp9
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h16
2 files changed, 17 insertions, 8 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index db87bcca74..07307cd22a 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -60,6 +60,15 @@ int CDbxMDBX::Load()
unsigned int defFlags = MDBX_CREATE;
{
txn_ptr trnlck(StartTran());
+ if (trnlck == nullptr) {
+ if (m_dbError == MDBX_TXN_FULL) {
+ if (IDOK == MessageBox(NULL, TranslateT("Your database is in the obsolete format. Click Ok to read the upgrade instructions or Cancel to exit"), TranslateT("Error"), MB_ICONERROR | MB_OKCANCEL))
+ Utils_OpenUrl("https://www.miranda-ng.org/news/unknown_profile_format");
+ return EGROKPRF_OBSOLETE;
+ }
+ return EGROKPRF_DAMAGED;
+ }
+
mdbx_dbi_open(trnlck, "global", defFlags | MDBX_INTEGERKEY, &m_dbGlobal);
mdbx_dbi_open(trnlck, "crypto", defFlags, &m_dbCrypto);
mdbx_dbi_open(trnlck, "contacts", defFlags | MDBX_INTEGERKEY, &m_dbContacts);
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index acba02260d..53d598b406 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -158,13 +158,12 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
}
} m_impl;
- __forceinline MDBX_txn* StartTran() const
+ __forceinline MDBX_txn* StartTran()
{
MDBX_txn *res = 0;
- int rc = mdbx_txn_begin(m_env, nullptr, (m_bReadOnly) ? MDBX_RDONLY : 0, &res);
+ m_dbError = mdbx_txn_begin(m_env, nullptr, (m_bReadOnly) ? MDBX_RDONLY : 0, &res);
/* FIXME: throw an exception */
- _ASSERT(rc == MDBX_SUCCESS);
- UNREFERENCED_PARAMETER(rc);
+ _ASSERT(m_dbError == MDBX_SUCCESS);
return res;
}
@@ -181,8 +180,9 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
TCHAR* m_tszProfileName;
bool m_safetyMode, m_bReadOnly, m_bShared, m_bEncrypted, m_bUsesPassword;
- MDBX_env *m_env;
+ MDBX_env *m_env;
CMDBX_txn_ro m_txn_ro;
+ int m_dbError;
MDBX_dbi m_dbGlobal;
DBHeader m_header;
@@ -192,7 +192,7 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
////////////////////////////////////////////////////////////////////////////
// settings
- MDBX_dbi m_dbSettings;
+ MDBX_dbi m_dbSettings;
MDBX_cursor *m_curSettings;
HANDLE hService[2], hHook;
@@ -219,7 +219,7 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
////////////////////////////////////////////////////////////////////////////
// modules
- MDBX_dbi m_dbModules;
+ MDBX_dbi m_dbModules;
MDBX_cursor *m_curModules;
std::map<uint32_t, std::string> m_Modules;
@@ -232,7 +232,7 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
////////////////////////////////////////////////////////////////////////////
// encryption
- MDBX_dbi m_dbCrypto;
+ MDBX_dbi m_dbCrypto;
int InitCrypt(void);
CRYPTO_PROVIDER* SelectProvider();