From 88b04fed4966b0f1686690cb6101854afb52a5ee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 May 2018 21:37:53 +0300 Subject: Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin --- plugins/Dbx_mdbx/src/dbintf.cpp | 2 +- plugins/Dbx_mdbx/src/init.cpp | 3 +-- plugins/Dbx_mdbx/src/stdafx.h | 10 +++++++--- plugins/Dbx_mdbx/src/ui.cpp | 4 ++-- plugins/Dbx_mdbx/src/ui.h | 8 ++++---- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'plugins/Dbx_mdbx') diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index 23d332ad8a..21c6c3a988 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -32,7 +32,7 @@ CDbxMDBX::CDbxMDBX(const TCHAR *tszFileName, int iMode) : m_tszProfileName = mir_wstrdup(tszFileName); if (!m_bReadOnly) { - m_hwndTimer = CreateWindowExW(0, L"STATIC", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInst, nullptr); + m_hwndTimer = CreateWindowExW(0, L"STATIC", nullptr, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr); ::SetWindowLongPtr(m_hwndTimer, GWLP_USERDATA, (LONG_PTR)this); } diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index 2500cd30ad..bedddf12fa 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -25,12 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. EXTERN_C void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved); -HINSTANCE g_hInst = nullptr; int hLangpack; +CMPlugin g_plugin; BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) { - g_hInst = hInstDLL; tls_callback(hInstDLL, reason, reserved); return TRUE; } diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h index f394e09f3a..50031647f5 100644 --- a/plugins/Dbx_mdbx/src/stdafx.h +++ b/plugins/Dbx_mdbx/src/stdafx.h @@ -34,8 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -164,6 +162,12 @@ public: #include "resource.h" #include "version.h" -extern HINSTANCE g_hInst; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(nullptr) + {} +}; #include "ui.h" + diff --git a/plugins/Dbx_mdbx/src/ui.cpp b/plugins/Dbx_mdbx/src/ui.cpp index a45fb02082..a7d9566dca 100644 --- a/plugins/Dbx_mdbx/src/ui.cpp +++ b/plugins/Dbx_mdbx/src/ui.cpp @@ -146,7 +146,7 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM) { CDbxMDBX *db = (CDbxMDBX*)obj; DlgChangePassParam param = { db }; - DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)¶m); + DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)¶m); return 0; } @@ -182,7 +182,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) { CDbxMDBX *db = (CDbxMDBX*)obj; - Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mdbx"); + Icon_Register(g_plugin.getInst(), LPGEN("Database"), iconList, _countof(iconList), "mdbx"); HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db); diff --git a/plugins/Dbx_mdbx/src/ui.h b/plugins/Dbx_mdbx/src/ui.h index dc1a87c2e9..a76cedf625 100644 --- a/plugins/Dbx_mdbx/src/ui.h +++ b/plugins/Dbx_mdbx/src/ui.h @@ -40,7 +40,7 @@ class COptionsDialog : public CDlgBase public: COptionsDialog(CDbxMDBX *db) : - CDlgBase(g_hInst, IDD_OPTIONS), + CDlgBase(g_plugin.getInst(), IDD_OPTIONS), m_chkStandart(this, IDC_STANDARD), m_chkTotal(this, IDC_TOTAL), m_btnChangePass(this, IDC_USERPASS), @@ -84,7 +84,7 @@ class CSelectCryptoDialog : public CDlgBase public: CSelectCryptoDialog(CRYPTO_PROVIDER **provs, size_t count) : - CDlgBase(g_hInst, IDD_SELECT_CRYPTOPROVIDER), + CDlgBase(g_plugin.getInst(), IDD_SELECT_CRYPTOPROVIDER), m_combo(this, IDC_SELECTCRYPT_COMBO), m_descr(this, IDC_CRYPTOPROVIDER_DESCR), m_chkTotalCrypt(this, IDC_CHECK_TOTALCRYPT), @@ -146,7 +146,7 @@ class CEnterPasswordDialog : public CDlgBase void OnInitDialog() { - m_header.SendMsg(WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInst, MAKEINTRESOURCE(iconList[0].defIconID))); + m_header.SendMsg(WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(iconList[0].defIconID))); if (m_param->wrongPass) { if (m_param->wrongPass > 2) @@ -180,7 +180,7 @@ class CEnterPasswordDialog : public CDlgBase public: CEnterPasswordDialog(DlgChangePassParam *param) : - CDlgBase(g_hInst, IDD_LOGIN), + CDlgBase(g_plugin.getInst(), IDD_LOGIN), m_header(this, IDC_HEADERBAR), m_language(this, IDC_LANG), m_passwordEdit(this, IDC_USERPASS), -- cgit v1.2.3