summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_crypto.h22
-rw-r--r--include/m_db_int.h4
-rw-r--r--libs/win32/mir_app.libbin213084 -> 215052 bytes
-rw-r--r--libs/win64/mir_app.libbin208782 -> 210806 bytes
-rw-r--r--plugins/Db3x_mmap/db3x_mmap.vcxproj1
-rw-r--r--plugins/Db3x_mmap/db3x_mmap.vcxproj.filters3
-rw-r--r--plugins/Db3x_mmap/res/db3x_mmap.rc46
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp32
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h3
-rw-r--r--plugins/Db3x_mmap/src/stdafx.h2
-rw-r--r--plugins/Db3x_mmap/src/ui.h55
-rw-r--r--plugins/Dbx_mdbx/res/dbx_mdbx.rc13
-rw-r--r--plugins/Dbx_mdbx/src/dbcrypt.cpp89
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h3
-rw-r--r--plugins/Dbx_mdbx/src/resource.h4
-rw-r--r--plugins/Dbx_mdbx/src/ui.cpp6
-rw-r--r--plugins/Dbx_sqlite/dbx_sqlite.vcxproj1
-rw-r--r--plugins/Dbx_sqlite/dbx_sqlite.vcxproj.filters3
-rw-r--r--plugins/Dbx_sqlite/res/dbx_sqlite.rc46
-rw-r--r--plugins/Dbx_sqlite/src/dbcrypt.cpp11
-rwxr-xr-xplugins/Dbx_sqlite/src/dbintf.h2
-rw-r--r--plugins/Dbx_sqlite/src/stdafx.h5
-rw-r--r--src/core/stdcrypt/src/encrypt.cpp2
-rw-r--r--src/mir_app/mir_app.vcxproj2
-rw-r--r--src/mir_app/mir_app.vcxproj.filters6
-rw-r--r--src/mir_app/res/resource.rc10
-rw-r--r--src/mir_app/src/MDatabaseCommon.cpp18
-rw-r--r--src/mir_app/src/MDatabaseCommonCrypt.cpp113
-rw-r--r--src/mir_app/src/MDatabaseReadonly.cpp2
-rw-r--r--src/mir_app/src/encrypt.cpp62
-rw-r--r--src/mir_app/src/encrypt.h45
-rw-r--r--src/mir_app/src/mir_app.def5
-rw-r--r--src/mir_app/src/mir_app64.def5
-rw-r--r--src/mir_app/src/modules.cpp2
-rw-r--r--src/mir_app/src/resource.h3
-rw-r--r--src/mir_app/src/utils.cpp16
36 files changed, 259 insertions, 383 deletions
diff --git a/include/m_crypto.h b/include/m_crypto.h
index 53a599c925..9d80ee3286 100644
--- a/include/m_crypto.h
+++ b/include/m_crypto.h
@@ -77,32 +77,16 @@ struct CRYPTO_PROVIDER
pfnCryptoProviderFactory pFactory;
};
-#define MS_CRYPTO_REGISTER_ENGINE "Crypto/RegisterEngine"
+MIR_APP_DLL(void) Crypto_RegisterEngine(const CRYPTO_PROVIDER *pProvider);
///////////////////////////////////////////////////////////////////////////////////////////////
// retrieves list of all available crypto providers
-// wParam = (WPARAM)(int*)piNumProviders
-// lParam = (CRYPTO_PROVIDER***)pointer to an array of CRYPTO_PROVIDER*
-// always returns 0
-#define MS_CRYPTO_ENUM_PROVIDERS "Crypto/EnumProviders"
-
-__forceinline void Crypto_EnumProviders(int *numProvs, CRYPTO_PROVIDER ***pResult)
-{
- CallService(MS_CRYPTO_ENUM_PROVIDERS, WPARAM(numProvs), LPARAM(pResult));
-}
+MIR_APP_DLL(void) Crypto_ListProviders(int *pCount, CRYPTO_PROVIDER ***pList);
///////////////////////////////////////////////////////////////////////////////////////////////
// retrieves a crypto provider by name
-// wParam = 0 (unused)
-// lParam = (const char*)pszProviderName = CRYPTO_PROVIDER::pszName
-// returns 0 on fail or CRYPTO_PROVIDER* on success
-#define MS_CRYPTO_GET_PROVIDER "Crypto/GetProvider"
-
-__forceinline CRYPTO_PROVIDER* Crypto_GetProvider(const char *pszName)
-{
- return (CRYPTO_PROVIDER*)CallService(MS_CRYPTO_GET_PROVIDER, 0, LPARAM(pszName));
-}
+MIR_APP_DLL(CRYPTO_PROVIDER*) Crypto_GetProvider(const char *pszName);
#endif // M_CRYPTO_H__
diff --git a/include/m_db_int.h b/include/m_db_int.h
index 600d478c14..45440ff981 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -168,6 +168,7 @@ interface MIR_APP_EXPORT MIDatabase
#pragma warning(disable:4275)
struct MICryptoEngine;
+struct CRYPTO_PROVIDER;
class MIR_APP_EXPORT MDatabaseCommon : public MIDatabase, public MNonCopyable
{
@@ -188,6 +189,9 @@ protected:
int CheckProto(DBCachedContact *cc, const char *proto);
void UnlockName();
+ CRYPTO_PROVIDER* SelectProvider();
+ STDMETHOD_(BOOL, StoreProvider)(CRYPTO_PROVIDER*);
+
STDMETHOD_(BOOL, GetContactSettingWorker)(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic);
STDMETHOD_(BOOL, WriteContactSettingWorker)(MCONTACT contactID, DBCONTACTWRITESETTING &dbcws) PURE;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 6a5b982b3a..5e57edf393 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 8904fa32d5..6d5ddf644f 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Db3x_mmap/db3x_mmap.vcxproj b/plugins/Db3x_mmap/db3x_mmap.vcxproj
index ef77eb5831..4018dd621c 100644
--- a/plugins/Db3x_mmap/db3x_mmap.vcxproj
+++ b/plugins/Db3x_mmap/db3x_mmap.vcxproj
@@ -44,7 +44,6 @@
<ClInclude Include="src\dbintf.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\ui.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/Db3x_mmap/db3x_mmap.vcxproj.filters b/plugins/Db3x_mmap/db3x_mmap.vcxproj.filters
index 7b06c45b0b..2ffffc35c5 100644
--- a/plugins/Db3x_mmap/db3x_mmap.vcxproj.filters
+++ b/plugins/Db3x_mmap/db3x_mmap.vcxproj.filters
@@ -52,9 +52,6 @@
<ClInclude Include="src\stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\ui.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Db3x_mmap/res/db3x_mmap.rc b/plugins/Db3x_mmap/res/db3x_mmap.rc
index 7b810e2ded..a2a65076cc 100644
--- a/plugins/Db3x_mmap/res/db3x_mmap.rc
+++ b/plugins/Db3x_mmap/res/db3x_mmap.rc
@@ -12,52 +12,6 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Русский (Россия) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-#pragma code_page(1251)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_SELECT_CRYPTOPROVIDER DIALOGEX 0, 0, 229, 76
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Select crypto provider"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,113,55,50,14
- PUSHBUTTON "Cancel",IDCANCEL,172,55,50,14
- COMBOBOX IDC_SELECTCRYPT_COMBO,16,14,199,30,CBS_DROPDOWNLIST,WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT
- LTEXT "",IDC_CRYPTOPROVIDER_DESCR,18,34,197,14,NOT WS_GROUP
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_SELECT_CRYPTOPROVIDER, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 222
- TOPMARGIN, 7
- BOTTOMMARGIN, 69
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // Русский (Россия) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
// Английский (США) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index c76f3feb4e..340464eed8 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -132,26 +132,10 @@ int CDb3Mmap::InitCrypt()
DBVARIANT dbv = { 0 };
dbv.type = DBVT_BLOB;
if (GetContactSetting(0, "CryptoEngine", "Provider", &dbv)) {
- LBL_CreateProvider:
- CRYPTO_PROVIDER **ppProvs;
- int iNumProvs;
- Crypto_EnumProviders(&iNumProvs, &ppProvs);
- if (iNumProvs == 0)
+LBL_CreateProvider:
+ pProvider = SelectProvider();
+ if (pProvider == nullptr)
return 1;
-
- if (iNumProvs > 1)
- {
- CSelectCryptoDialog dlg(ppProvs, iNumProvs);
- dlg.DoModal();
- pProvider = dlg.GetSelected();
- }
- else pProvider = ppProvs[0];
-
- DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" };
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.pbVal = (PBYTE)pProvider->pszName;
- dbcws.value.cpbVal = (WORD)mir_strlen(pProvider->pszName) + 1;
- WriteContactSetting(0, &dbcws);
}
else {
if (dbv.type != DBVT_BLOB) { // old version, clean it up
@@ -225,6 +209,16 @@ void CDb3Mmap::StoreKey()
SecureZeroMemory(pKey, iKeyLength);
}
+STDMETHODIMP_(BOOL) CDb3Mmap::StoreProvider(CRYPTO_PROVIDER *pProvider)
+{
+ DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" };
+ dbcws.value.type = DBVT_BLOB;
+ dbcws.value.pbVal = (PBYTE)pProvider->pszName;
+ dbcws.value.cpbVal = (WORD)mir_strlen(pProvider->pszName) + 1;
+ WriteContactSetting(0, &dbcws);
+ return TRUE;
+}
+
void CDb3Mmap::SetPassword(const wchar_t *ptszPassword)
{
if (ptszPassword == nullptr || *ptszPassword == 0) {
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 70d60e80df..ea3a99c364 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -203,7 +203,6 @@ struct CDb3Mmap : public MDatabaseCommon, public MZeroedObject
void WriteSignature(DBSignature&);
__forceinline HANDLE getFile() const { return m_hDbFile; }
- __forceinline bool isEncrypted() const { return m_bEncrypted; }
__forceinline bool usesPassword() const { return m_bUsesPassword; }
public:
@@ -232,6 +231,8 @@ public:
STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam) override;
+ STDMETHODIMP_(BOOL) StoreProvider(CRYPTO_PROVIDER*);
+
STDMETHODIMP_(BOOL) GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic) override;
STDMETHODIMP_(BOOL) WriteContactSettingWorker(MCONTACT contactID, DBCONTACTWRITESETTING &dbcws) override;
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting) override;
diff --git a/plugins/Db3x_mmap/src/stdafx.h b/plugins/Db3x_mmap/src/stdafx.h
index 354696969d..1c2844a671 100644
--- a/plugins/Db3x_mmap/src/stdafx.h
+++ b/plugins/Db3x_mmap/src/stdafx.h
@@ -65,8 +65,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
extern LIST<CDb3Mmap> g_Dbs;
extern DBSignature dbSignatureU, dbSignatureE, dbSignatureIM, dbSignatureSA, dbSignatureSD;
-#include "ui.h"
-
#ifdef __GNUC__
#define mir_i64(x) (x##LL)
#else
diff --git a/plugins/Db3x_mmap/src/ui.h b/plugins/Db3x_mmap/src/ui.h
deleted file mode 100644
index c52a479bc6..0000000000
--- a/plugins/Db3x_mmap/src/ui.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-
-class CSelectCryptoDialog : public CDlgBase
-{
- CCtrlCombo m_combo;
- CCtrlData m_descr;
- CRYPTO_PROVIDER **m_provs;
- size_t m_provscount;
- CRYPTO_PROVIDER *m_selected;
-
-public:
- CSelectCryptoDialog(CRYPTO_PROVIDER **provs, size_t count) :
- CDlgBase(g_plugin, IDD_SELECT_CRYPTOPROVIDER),
- m_combo(this, IDC_SELECTCRYPT_COMBO),
- m_descr(this, IDC_CRYPTOPROVIDER_DESCR),
- m_provs(provs),
- m_provscount(count),
- m_selected(nullptr)
- {
- m_combo.OnChange = Callback(this, &CSelectCryptoDialog::OnComboChanged);
- }
-
- bool OnInitDialog() override
- {
- for (size_t i = 0; i < m_provscount; i++)
- {
- CRYPTO_PROVIDER *prov = m_provs[i];
- m_combo.AddStringA(prov->pszName, i);
- }
- m_combo.SetCurSel(0);
- SetDescr(m_provs[0]);
- return true;
- }
-
- bool OnApply() override
- {
- m_selected = m_provs[ m_combo.GetItemData(m_combo.GetCurSel()) ];
- return true;
- }
-
- void OnComboChanged(CCtrlCombo*)
- {
- SetDescr(m_provs[m_combo.GetItemData(m_combo.GetCurSel())]);
- }
-
- void SetDescr(CRYPTO_PROVIDER *prov)
- {
- m_descr.SetText(prov->szDescr.w);
- }
-
- inline CRYPTO_PROVIDER* GetSelected()
- {
- return m_selected;
- }
-}; \ No newline at end of file
diff --git a/plugins/Dbx_mdbx/res/dbx_mdbx.rc b/plugins/Dbx_mdbx/res/dbx_mdbx.rc
index 81d739e697..61530296f2 100644
--- a/plugins/Dbx_mdbx/res/dbx_mdbx.rc
+++ b/plugins/Dbx_mdbx/res/dbx_mdbx.rc
@@ -23,19 +23,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Dialog
//
-IDD_SELECT_CRYPTOPROVIDER DIALOGEX 0, 0, 229, 76
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Select crypto provider"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,113,55,50,14
- PUSHBUTTON "Cancel",IDCANCEL,172,55,50,14
- COMBOBOX IDC_SELECTCRYPT_COMBO,16,12,199,30,CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP
- LTEXT "",IDC_CRYPTOPROVIDER_DESCR,17,29,197,14,NOT WS_GROUP
- CONTROL "Total encryption (Recommended only for paranoid users)",IDC_CHECK_TOTALCRYPT,
- "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,45,89,24
-END
-
IDD_LOGIN DIALOGEX 0, 0, 190, 86
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW
diff --git a/plugins/Dbx_mdbx/src/dbcrypt.cpp b/plugins/Dbx_mdbx/src/dbcrypt.cpp
index 2f8f10ce7e..d20315b773 100644
--- a/plugins/Dbx_mdbx/src/dbcrypt.cpp
+++ b/plugins/Dbx_mdbx/src/dbcrypt.cpp
@@ -23,96 +23,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-class CSelectCryptoDialog : public CDlgBase
-{
- CCtrlCombo m_combo;
- CCtrlData m_descr;
- CCtrlCheck m_chkTotalCrypt;
- CRYPTO_PROVIDER **m_provs;
- size_t m_provscount;
- CRYPTO_PROVIDER *m_selected;
- bool m_bTotalEncryption;
-
- bool OnInitDialog() override
- {
- for (size_t i = 0; i < m_provscount; i++) {
- CRYPTO_PROVIDER *prov = m_provs[i];
- m_combo.AddStringA(prov->pszName, i);
- }
- m_combo.SetCurSel(0);
- m_descr.SetText(m_provs[0]->szDescr.w);
- return true;
- }
-
- bool OnApply() override
- {
- m_selected = m_provs[m_combo.GetItemData(m_combo.GetCurSel())];
- m_bTotalEncryption = m_chkTotalCrypt.GetState() != 0;
- return true;
- }
-
- void OnComboChanged(CCtrlCombo*)
- {
- m_descr.SetText(m_provs[m_combo.GetItemData(m_combo.GetCurSel())]->szDescr.w);
- }
-
-public:
- CSelectCryptoDialog(CRYPTO_PROVIDER **provs, size_t count) :
- CDlgBase(g_plugin, IDD_SELECT_CRYPTOPROVIDER),
- m_combo(this, IDC_SELECTCRYPT_COMBO),
- m_descr(this, IDC_CRYPTOPROVIDER_DESCR),
- m_chkTotalCrypt(this, IDC_CHECK_TOTALCRYPT),
- m_provs(provs),
- m_provscount(count),
- m_selected(nullptr)
- {
- m_combo.OnChange = Callback(this, &CSelectCryptoDialog::OnComboChanged);
- }
-
- inline CRYPTO_PROVIDER* GetSelected()
- { return m_selected;
- }
- inline bool TotalSelected()
- { return m_bTotalEncryption;
- }
-};
-
char DBKey_Crypto_Provider[] = "Provider";
char DBKey_Crypto_Key[] = "Key";
char DBKey_Crypto_IsEncrypted[] = "EncryptedDB";
-CRYPTO_PROVIDER* CDbxMDBX::SelectProvider()
+STDMETHODIMP_(BOOL) CDbxMDBX::StoreProvider(CRYPTO_PROVIDER *pProv)
{
- CRYPTO_PROVIDER **ppProvs, *pProv;
- int iNumProvs;
- Crypto_EnumProviders(&iNumProvs, &ppProvs);
-
- if (iNumProvs == 0)
- return nullptr;
-
- bool bTotalCrypt = false;
-
- if (iNumProvs > 1) {
- CSelectCryptoDialog dlg(ppProvs, iNumProvs);
- dlg.DoModal();
- pProv = dlg.GetSelected();
- bTotalCrypt = dlg.TotalSelected();
- }
- else pProv = ppProvs[0];
-
- {
- txn_ptr trnlck(this);
- MDBX_val key = { DBKey_Crypto_Provider, sizeof(DBKey_Crypto_Provider) }, value = { pProv->pszName, mir_strlen(pProv->pszName) + 1 };
- if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
- return nullptr;
-
- key.iov_len = sizeof(DBKey_Crypto_IsEncrypted); key.iov_base = DBKey_Crypto_IsEncrypted; value.iov_len = sizeof(bool); value.iov_base = &bTotalCrypt;
- if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
- return nullptr;
- }
+ txn_ptr trnlck(this);
+ MDBX_val key = { DBKey_Crypto_Provider, sizeof(DBKey_Crypto_Provider) }, value = { pProv->pszName, mir_strlen(pProv->pszName) + 1 };
+ if (mdbx_put(trnlck, m_dbCrypto, &key, &value, MDBX_UPSERT) != MDBX_SUCCESS)
+ return FALSE;
DBFlush();
- return pProv;
+ return TRUE;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index c802b05d3b..1003c31c7c 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -225,8 +225,6 @@ class CDbxMDBX : public MDatabaseCommon, public MIDatabaseChecker, public MZeroe
MDBX_dbi m_dbCrypto;
int InitCrypt(void);
- CRYPTO_PROVIDER* SelectProvider();
-
void InitDialogs();
public:
@@ -283,6 +281,7 @@ public:
STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) override;
STDMETHODIMP_(BOOL) MetaRemoveSubHistory(DBCachedContact *ccSub) override;
+ STDMETHODIMP_(BOOL) StoreProvider(CRYPTO_PROVIDER*);
STDMETHODIMP_(BOOL) Compact();
STDMETHODIMP_(BOOL) Backup(const wchar_t*);
diff --git a/plugins/Dbx_mdbx/src/resource.h b/plugins/Dbx_mdbx/src/resource.h
index dfc3ffc748..a6c8f8644e 100644
--- a/plugins/Dbx_mdbx/src/resource.h
+++ b/plugins/Dbx_mdbx/src/resource.h
@@ -8,7 +8,6 @@
#define IDD_NEWPASS 103
#define IDD_CHANGEPASS 104
#define IDD_OPTIONS 105
-#define IDD_SELECT_CRYPTOPROVIDER 106
#define IDI_COMPACT 107
#define IDC_HEADERBAR 1001
#define IDC_LANG 1002
@@ -18,9 +17,6 @@
#define IDC_OLDPASS 1006
#define IDC_STANDARD 1007
#define IDC_TOTAL 1008
-#define IDC_SELECTCRYPT_COMBO 1010
-#define IDC_CRYPTOPROVIDER_DESCR 1011
-#define IDC_CHECK_TOTALCRYPT 1012
// Next default values for new objects
//
diff --git a/plugins/Dbx_mdbx/src/ui.cpp b/plugins/Dbx_mdbx/src/ui.cpp
index 971f31c8db..6b7ce1fe83 100644
--- a/plugins/Dbx_mdbx/src/ui.cpp
+++ b/plugins/Dbx_mdbx/src/ui.cpp
@@ -43,13 +43,11 @@ void LanguageChanged(HWND hwndDlg)
static bool CheckOldPassword(HWND hwndDlg, CDbxMDBX *db)
{
- if (db->usesPassword())
- {
+ if (db->usesPassword()) {
wchar_t buf[100];
GetDlgItemText(hwndDlg, IDC_OLDPASS, buf, _countof(buf));
pass_ptrA oldPass(mir_utf8encodeW(buf));
- if (!db->getCrypt()->checkPassword(oldPass))
- {
+ if (!db->getCrypt()->checkPassword(oldPass)) {
SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Wrong old password entered!"));
return false;
}
diff --git a/plugins/Dbx_sqlite/dbx_sqlite.vcxproj b/plugins/Dbx_sqlite/dbx_sqlite.vcxproj
index 3cfd971be6..ef4e8a8b49 100644
--- a/plugins/Dbx_sqlite/dbx_sqlite.vcxproj
+++ b/plugins/Dbx_sqlite/dbx_sqlite.vcxproj
@@ -32,6 +32,7 @@
</ImportGroup>
<ItemGroup>
<ClCompile Include="src\dbcontacts.cpp" />
+ <ClCompile Include="src\dbcrypt.cpp" />
<ClCompile Include="src\dbevents.cpp" />
<ClCompile Include="src\dbintf.cpp" />
<ClCompile Include="src\dbsettings.cpp" />
diff --git a/plugins/Dbx_sqlite/dbx_sqlite.vcxproj.filters b/plugins/Dbx_sqlite/dbx_sqlite.vcxproj.filters
index e1d6d3b7b0..cda2246184 100644
--- a/plugins/Dbx_sqlite/dbx_sqlite.vcxproj.filters
+++ b/plugins/Dbx_sqlite/dbx_sqlite.vcxproj.filters
@@ -20,6 +20,9 @@
<ClCompile Include="src\stdafx.cxx">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\dbcrypt.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\dbintf.h">
diff --git a/plugins/Dbx_sqlite/res/dbx_sqlite.rc b/plugins/Dbx_sqlite/res/dbx_sqlite.rc
index 94f7d5811b..141e211876 100644
--- a/plugins/Dbx_sqlite/res/dbx_sqlite.rc
+++ b/plugins/Dbx_sqlite/res/dbx_sqlite.rc
@@ -12,52 +12,6 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Русский (Россия) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-#pragma code_page(1251)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_SELECT_CRYPTOPROVIDER DIALOGEX 0, 0, 229, 76
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Select crypto provider"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,113,55,50,14
- PUSHBUTTON "Cancel",IDCANCEL,172,55,50,14
- COMBOBOX IDC_SELECTCRYPT_COMBO,16,14,199,30,CBS_DROPDOWNLIST,WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT
- LTEXT "",IDC_CRYPTOPROVIDER_DESCR,18,34,197,14,NOT WS_GROUP
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_SELECT_CRYPTOPROVIDER, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 222
- TOPMARGIN, 7
- BOTTOMMARGIN, 69
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // Русский (Россия) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
// Английский (США) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
diff --git a/plugins/Dbx_sqlite/src/dbcrypt.cpp b/plugins/Dbx_sqlite/src/dbcrypt.cpp
new file mode 100644
index 0000000000..f0dca5a0bc
--- /dev/null
+++ b/plugins/Dbx_sqlite/src/dbcrypt.cpp
@@ -0,0 +1,11 @@
+#include "stdafx.h"
+
+STDMETHODIMP_(BOOL) CDbxSQLite::StoreProvider(CRYPTO_PROVIDER *pProvider)
+{
+ DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" };
+ dbcws.value.type = DBVT_BLOB;
+ dbcws.value.pbVal = (PBYTE)pProvider->pszName;
+ dbcws.value.cpbVal = (WORD)mir_strlen(pProvider->pszName) + 1;
+ WriteContactSetting(0, &dbcws);
+ return TRUE;
+}
diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h
index 9fb06f84d8..ca220289c0 100755
--- a/plugins/Dbx_sqlite/src/dbintf.h
+++ b/plugins/Dbx_sqlite/src/dbintf.h
@@ -91,6 +91,8 @@ public:
STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam) override;
+ STDMETHODIMP_(BOOL) StoreProvider(CRYPTO_PROVIDER*);
+
STDMETHODIMP_(BOOL) WriteContactSettingWorker(MCONTACT contactID, DBCONTACTWRITESETTING &dbcws) override;
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting) override;
STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, void *param) override;
diff --git a/plugins/Dbx_sqlite/src/stdafx.h b/plugins/Dbx_sqlite/src/stdafx.h
index d1cbb5ec17..edeed11711 100644
--- a/plugins/Dbx_sqlite/src/stdafx.h
+++ b/plugins/Dbx_sqlite/src/stdafx.h
@@ -6,12 +6,11 @@
#include <memory>
#include <malloc.h>
-#include <newpluginapi.h>
#include <win2k.h>
#include <assert.h>
-#include <m_core.h>
-#include <m_system.h>
+#include <newpluginapi.h>
+#include <m_crypto.h>
#include <m_database.h>
#include <m_protocols.h>
#include <m_metacontacts.h>
diff --git a/src/core/stdcrypt/src/encrypt.cpp b/src/core/stdcrypt/src/encrypt.cpp
index a36e6f5bfb..2a8567460f 100644
--- a/src/core/stdcrypt/src/encrypt.cpp
+++ b/src/core/stdcrypt/src/encrypt.cpp
@@ -212,6 +212,6 @@ int LoadEncryptionModule(void)
cp.szDescr.a = LPGEN("Standard crypto provider");
cp.pFactory = builder;
cp.pPlugin = &g_plugin;
- CallService(MS_CRYPTO_REGISTER_ENGINE, 0, LPARAM(&cp));
+ Crypto_RegisterEngine(&cp);
return 0;
}
diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj
index 3241cf4fc9..e1281e19e6 100644
--- a/src/mir_app/mir_app.vcxproj
+++ b/src/mir_app/mir_app.vcxproj
@@ -92,6 +92,7 @@
<ClCompile Include="src\lpopts.cpp" />
<ClCompile Include="src\mdatabasecache.cpp" />
<ClCompile Include="src\MDatabaseCommon.cpp" />
+ <ClCompile Include="src\MDatabaseCommonCrypt.cpp" />
<ClCompile Include="src\MDatabaseReadonly.cpp" />
<ClCompile Include="src\menu_clist.cpp" />
<ClCompile Include="src\menu_frames.cpp" />
@@ -160,6 +161,7 @@
<ClInclude Include="src\chat.h" />
<ClInclude Include="src\clc.h" />
<ClInclude Include="src\database.h" />
+ <ClInclude Include="src\encrypt.h" />
<ClInclude Include="src\extraicons.h" />
<ClInclude Include="src\filter.h" />
<ClInclude Include="src\findadd.h" />
diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters
index 927addb7c9..49ad63544f 100644
--- a/src/mir_app/mir_app.vcxproj.filters
+++ b/src/mir_app/mir_app.vcxproj.filters
@@ -389,6 +389,9 @@
<ClCompile Include="src\pu_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\MDatabaseCommonCrypt.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\chat.h">
@@ -451,6 +454,9 @@
<ClInclude Include="src\usedIcons.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\encrypt.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index 8e88a2c601..30b353082e 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -879,6 +879,16 @@ CAPTION "Hidden window"
BEGIN
END
+IDD_SELECT_CRYPTOPROVIDER DIALOGEX 0, 0, 229, 45
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Select crypto provider"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,113,55,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,172,55,50,14
+ COMBOBOX IDC_SELECTCRYPT_COMBO,16,12,199,30,CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP
+ LTEXT "",IDC_CRYPTOPROVIDER_DESCR,17,29,197,14,NOT WS_GROUP
+END
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp
index a7240dc764..787c6609bd 100644
--- a/src/mir_app/src/MDatabaseCommon.cpp
+++ b/src/mir_app/src/MDatabaseCommon.cpp
@@ -183,24 +183,6 @@ STDMETHODIMP_(MCONTACT) MDatabaseCommon::FindNextContact(MCONTACT contactID, con
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Encryption support
-
-BOOL MDatabaseCommon::IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting)
-{
- if (!_strnicmp(szSetting, "password", 8)) return true;
- if (!mir_strcmp(szSetting, "NLProxyAuthPassword")) return true;
- if (!mir_strcmp(szSetting, "LNPassword")) return true;
- if (!mir_strcmp(szSetting, "FileProxyPassword")) return true;
- if (!mir_strcmp(szSetting, "TokenSecret")) return true;
-
- if (!mir_strcmp(szModule, "SecureIM")) {
- if (!mir_strcmp(szSetting, "pgp")) return true;
- if (!mir_strcmp(szSetting, "pgpPrivKey")) return true;
- }
- return false;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// Meta-contacts support
BOOL MDatabaseCommon::MetaDetouchSub(DBCachedContact *cc, int nSub)
diff --git a/src/mir_app/src/MDatabaseCommonCrypt.cpp b/src/mir_app/src/MDatabaseCommonCrypt.cpp
new file mode 100644
index 0000000000..0b3a135e46
--- /dev/null
+++ b/src/mir_app/src/MDatabaseCommonCrypt.cpp
@@ -0,0 +1,113 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-20 Miranda NG team,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+#include "database.h"
+#include "encrypt.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Provider selection dialog
+
+class CSelectCryptoDialog : public CDlgBase
+{
+ CCtrlCombo m_combo;
+ CCtrlData m_descr;
+ CRYPTO_PROVIDER *m_selected = nullptr;
+
+ CRYPTO_PROVIDER *getCurrent()
+ {
+ return (CRYPTO_PROVIDER*)m_combo.GetItemData(m_combo.GetCurSel());
+ }
+
+ bool OnInitDialog() override
+ {
+ for (auto &p : arCryptoProviders)
+ m_combo.AddStringA(p->pszName, LPARAM(p));
+
+ m_combo.SetCurSel(0);
+ m_descr.SetText(arCryptoProviders[0].szDescr.w);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ m_selected = getCurrent();
+ return true;
+ }
+
+ void OnComboChanged(CCtrlCombo*)
+ {
+ m_descr.SetText(getCurrent()->szDescr.w);
+ }
+
+public:
+ CSelectCryptoDialog() :
+ CDlgBase(g_plugin, IDD_SELECT_CRYPTOPROVIDER),
+ m_combo(this, IDC_SELECTCRYPT_COMBO),
+ m_descr(this, IDC_CRYPTOPROVIDER_DESCR)
+ {
+ m_combo.OnChange = Callback(this, &CSelectCryptoDialog::OnComboChanged);
+ }
+
+ inline CRYPTO_PROVIDER* GetSelected()
+ { return m_selected;
+ }
+};
+
+CRYPTO_PROVIDER* MDatabaseCommon::SelectProvider()
+{
+ if (arCryptoProviders.getCount() == 0)
+ return nullptr;
+
+ CRYPTO_PROVIDER *pProv;
+ if (arCryptoProviders.getCount() > 1) {
+ CSelectCryptoDialog dlg;
+ dlg.DoModal();
+ pProv = dlg.GetSelected();
+ }
+ else pProv = &arCryptoProviders[0];
+
+ return (StoreProvider(pProv)) ? pProv : nullptr;
+}
+
+STDMETHODIMP_(BOOL) MDatabaseCommon::StoreProvider(CRYPTO_PROVIDER *)
+{
+ return FALSE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+BOOL MDatabaseCommon::IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting)
+{
+ if (!_strnicmp(szSetting, "password", 8)) return true;
+ if (!mir_strcmp(szSetting, "NLProxyAuthPassword")) return true;
+ if (!mir_strcmp(szSetting, "LNPassword")) return true;
+ if (!mir_strcmp(szSetting, "FileProxyPassword")) return true;
+ if (!mir_strcmp(szSetting, "TokenSecret")) return true;
+
+ if (!mir_strcmp(szModule, "SecureIM")) {
+ if (!mir_strcmp(szSetting, "pgp")) return true;
+ if (!mir_strcmp(szSetting, "pgpPrivKey")) return true;
+ }
+ return false;
+}
diff --git a/src/mir_app/src/MDatabaseReadonly.cpp b/src/mir_app/src/MDatabaseReadonly.cpp
index 0f006160eb..7490eff643 100644
--- a/src/mir_app/src/MDatabaseReadonly.cpp
+++ b/src/mir_app/src/MDatabaseReadonly.cpp
@@ -39,7 +39,7 @@ void MDatabaseReadonly::SetCacheSafetyMode(BOOL)
BOOL MDatabaseReadonly::EnumModuleNames(DBMODULEENUMPROC, void*)
{
- return 0;
+ return FALSE;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp
index 3f1a9c9cde..53fdb9bb46 100644
--- a/src/mir_app/src/encrypt.cpp
+++ b/src/mir_app/src/encrypt.cpp
@@ -22,66 +22,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
+#include "encrypt.h"
/////////////////////////////////////////////////////////////////////////////////////////
-static int CompareFunc(const CRYPTO_PROVIDER *p1, const CRYPTO_PROVIDER *p2)
+static int CompareFunc(const MCryptoProvider *p1, const MCryptoProvider *p2)
{
return mir_strcmp(p1->pszName, p2->pszName);
}
-static LIST<CRYPTO_PROVIDER> arProviders(5, CompareFunc);
+OBJLIST<MCryptoProvider> arCryptoProviders(5, CompareFunc);
-static INT_PTR srvRegister(WPARAM, LPARAM lParam)
-{
- CRYPTO_PROVIDER *p = (CRYPTO_PROVIDER*)lParam;
- if (p == nullptr || p->dwSize != sizeof(CRYPTO_PROVIDER))
- return 1;
-
- CRYPTO_PROVIDER *pNew = new CRYPTO_PROVIDER(*p);
- pNew->pszName = mir_strdup(p->pszName);
- if (pNew->dwFlags & CPF_UNICODE)
- pNew->szDescr.w = mir_wstrdup(TranslateW_LP(p->szDescr.w, p->pPlugin));
- else
- pNew->szDescr.w = mir_a2u(TranslateA_LP(p->szDescr.a, p->pPlugin));
- arProviders.insert(pNew);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR srvEnumProviders(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(void) Crypto_RegisterEngine(const CRYPTO_PROVIDER *pProvider)
{
- if (wParam && lParam) {
- *(int*)wParam = arProviders.getCount();
- *(CRYPTO_PROVIDER***)lParam = arProviders.getArray();
- }
- return 0;
+ if (pProvider && pProvider->dwSize == sizeof(CRYPTO_PROVIDER))
+ arCryptoProviders.insert(new MCryptoProvider(pProvider));
}
-static INT_PTR srvGetProvider(WPARAM, LPARAM lParam)
+MIR_APP_DLL(void) Crypto_ListProviders(int *pCount, CRYPTO_PROVIDER ***pList)
{
- if (lParam == 0)
- return 0;
+ if (pCount)
+ *pCount = arCryptoProviders.getCount();
- CRYPTO_PROVIDER tmp;
- tmp.pszName = (LPSTR)lParam;
- return (INT_PTR)arProviders.find(&tmp);
+ if (pList)
+ *pList = (CRYPTO_PROVIDER**)arCryptoProviders.getArray();
}
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int InitCrypt(void)
+MIR_APP_DLL(CRYPTO_PROVIDER*) Crypto_GetProvider(const char *pszName)
{
- CreateServiceFunction(MS_CRYPTO_REGISTER_ENGINE, srvRegister);
- CreateServiceFunction(MS_CRYPTO_ENUM_PROVIDERS, srvEnumProviders);
- CreateServiceFunction(MS_CRYPTO_GET_PROVIDER, srvGetProvider);
- return 0;
-}
+ if (pszName == 0)
+ return nullptr;
-void UninitCrypt(void)
-{
- for (auto &p : arProviders) {
- mir_free(p->pszName);
- mir_free(p->szDescr.w);
- delete p;
- }
+ auto *tmp = (MCryptoProvider *)_alloca(sizeof(MCryptoProvider));
+ tmp->pszName = (LPSTR)pszName;
+ return arCryptoProviders.find(tmp);
}
diff --git a/src/mir_app/src/encrypt.h b/src/mir_app/src/encrypt.h
new file mode 100644
index 0000000000..cd709b9122
--- /dev/null
+++ b/src/mir_app/src/encrypt.h
@@ -0,0 +1,45 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright 2012-20 Miranda NG team,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#pragma once
+
+struct MCryptoProvider : public CRYPTO_PROVIDER
+{
+ MCryptoProvider(const CRYPTO_PROVIDER *pProvider)
+ {
+ memcpy(this, pProvider, sizeof(*pProvider));
+ pszName = mir_strdup(pszName);
+ if (dwFlags & CPF_UNICODE)
+ szDescr.w = mir_wstrdup(TranslateW_LP(pProvider->szDescr.w, pProvider->pPlugin));
+ else
+ szDescr.w = mir_a2u(TranslateA_LP(pProvider->szDescr.a, pProvider->pPlugin));
+ }
+
+ ~MCryptoProvider()
+ {
+ mir_free(pszName);
+ mir_free(szDescr.w);
+ }
+};
+
+extern OBJLIST<MCryptoProvider> arCryptoProviders;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 07ad4cb79b..70dc5372b8 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -756,3 +756,8 @@ _Netlib_GetTlsUnique@8 @831 NONAME
?WriteContactSetting@MDatabaseCommon@@UAGHIPAUDBCONTACTWRITESETTING@@@Z @844 NONAME
?getCrypt@MDatabaseCommon@@QBEPAUMICryptoEngine@@XZ @845 NONAME
?isEncrypted@MDatabaseCommon@@QBE_NXZ @846 NONAME
+?SelectProvider@MDatabaseCommon@@IAEPAUCRYPTO_PROVIDER@@XZ @847 NONAME
+?StoreProvider@MDatabaseCommon@@MAGHPAUCRYPTO_PROVIDER@@@Z @848 NONAME
+?Crypto_GetProvider@@YGPAUCRYPTO_PROVIDER@@PBD@Z @849 NONAME
+?Crypto_ListProviders@@YGXPAHPAPAPAUCRYPTO_PROVIDER@@@Z @850 NONAME
+?Crypto_RegisterEngine@@YGXPBUCRYPTO_PROVIDER@@@Z @851 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 542d44b8f6..804cbf7c55 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -756,3 +756,8 @@ Netlib_GetTlsUnique @831 NONAME
?WriteContactSetting@MDatabaseCommon@@UEAAHIPEAUDBCONTACTWRITESETTING@@@Z @844 NONAME
?getCrypt@MDatabaseCommon@@QEBAPEAUMICryptoEngine@@XZ @845 NONAME
?isEncrypted@MDatabaseCommon@@QEBA_NXZ @846 NONAME
+?SelectProvider@MDatabaseCommon@@IEAAPEAUCRYPTO_PROVIDER@@XZ @847 NONAME
+?StoreProvider@MDatabaseCommon@@MEAAHPEAUCRYPTO_PROVIDER@@@Z @848 NONAME
+?Crypto_GetProvider@@YAPEAUCRYPTO_PROVIDER@@PEBD@Z @849 NONAME
+?Crypto_ListProviders@@YAXPEAHPEAPEAPEAUCRYPTO_PROVIDER@@@Z @850 NONAME
+?Crypto_RegisterEngine@@YAXPEBUCRYPTO_PROVIDER@@@Z @851 NONAME
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp
index 2af9ae6b30..82399caca9 100644
--- a/src/mir_app/src/modules.cpp
+++ b/src/mir_app/src/modules.cpp
@@ -74,7 +74,6 @@ void UnloadProtocolsModule(void);
void UnloadSkinSounds(void);
void UnloadSkinHotkeys(void);
void UnloadSrmmModule(void);
-void UnloadUtilsModule(void);
int LoadHeaderbarModule();
int LoadDescButtonModule();
@@ -171,7 +170,6 @@ void UnloadDefaultModules(void)
UnloadSkinHotkeys();
UnloadSrmmModule();
UnloadIcoLibModule();
- UnloadUtilsModule();
UnloadExtraIconsModule();
UnloadClcModule();
UnloadContactListModule();
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 3879595446..9784e98b46 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -28,6 +28,7 @@
#define IDD_OPT_CLIST 119
#define IDD_OPT_CHAT_EVENTS 120
#define IDD_AUTHREQ 121
+#define IDD_SELECT_CRYPTOPROVIDER 122
#define IDD_DETAILS 125
#define IDD_HISTORY 127
#define IDI_AWAY 128
@@ -302,6 +303,8 @@
#define IDC_EDIT1 1105
#define IDC_BUILDTIME 1108
#define IDC_CREDITSFILE 1109
+#define IDC_SELECTCRYPT_COMBO 1110
+#define IDC_CRYPTOPROVIDER_DESCR 1111
#define IDC_NUMBER 1113
#define IDC_FINDWHAT 1131
#define IDC_FIND 1132
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp
index ce1260ea37..42f0d9ba07 100644
--- a/src/mir_app/src/utils.cpp
+++ b/src/mir_app/src/utils.cpp
@@ -26,13 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I"
-int InitCrypt(void);
-void UninitCrypt(void);
-
void InitClistCore(void);
-static BOOL bModuleInitialized = FALSE;
-
static CountryListEntry countries[] = {
{ 0, "", LPGEN("Unspecified") },
{ 9999, "", LPGEN("Other") },
@@ -379,21 +374,10 @@ bool ProcessFileDrop(HDROP hDrop, MCONTACT hContact)
int LoadUtilsModule(void)
{
- bModuleInitialized = TRUE;
-
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER, GetCountryByNumber);
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYISOCODE, GetCountryByISOCode);
CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList);
- InitCrypt();
InitClistCore();
return 0;
}
-
-void UnloadUtilsModule(void)
-{
- if (!bModuleInitialized)
- return;
-
- UninitCrypt();
-}