summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 21:37:53 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 21:37:53 +0300
commit88b04fed4966b0f1686690cb6101854afb52a5ee (patch)
tree79b4e574c0849f24907168075c8d0babfde2fde4 /plugins/Db3x_mmap
parent5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff)
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r--plugins/Db3x_mmap/src/init.cpp31
-rw-r--r--plugins/Db3x_mmap/src/stdafx.h9
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp10
-rw-r--r--plugins/Db3x_mmap/src/ui.h2
4 files changed, 27 insertions, 25 deletions
diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp
index c2860ecfef..6084f09ffa 100644
--- a/plugins/Db3x_mmap/src/init.cpp
+++ b/plugins/Db3x_mmap/src/init.cpp
@@ -24,6 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
int hLangpack;
+CMPlugin g_plugin;
+
+LIST<CDb3Mmap> g_Dbs(1, HandleKeySortT);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
static PLUGININFOEX pluginInfo =
{
@@ -39,9 +48,10 @@ static PLUGININFOEX pluginInfo =
{ 0xf7a6b27c, 0x9d9c, 0x4a42, { 0xbe, 0x86, 0xa4, 0x48, 0xae, 0x10, 0x91, 0x61 } }
};
-HINSTANCE g_hInst = nullptr;
-
-LIST<CDb3Mmap> g_Dbs(1, HandleKeySortT);
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -129,26 +139,15 @@ static DATABASELINK dblink =
/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST };
-
extern "C" __declspec(dllexport) int Load(void)
{
RegisterDatabasePlugin(&dblink);
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
}
-
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
-{
- g_hInst = hInstDLL;
- return TRUE;
-}
diff --git a/plugins/Db3x_mmap/src/stdafx.h b/plugins/Db3x_mmap/src/stdafx.h
index d009117695..012e9bb510 100644
--- a/plugins/Db3x_mmap/src/stdafx.h
+++ b/plugins/Db3x_mmap/src/stdafx.h
@@ -33,8 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <process.h>
#include <memory>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <win2k.h>
#include <m_system.h>
@@ -55,8 +53,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "resource.h"
#include "version.h"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
-extern HINSTANCE g_hInst;
extern LIST<CDb3Mmap> g_Dbs;
extern DBSignature dbSignatureU, dbSignatureE, dbSignatureIM, dbSignatureSA, dbSignatureSD;
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp
index 02ed2acfc4..9a5583e778 100644
--- a/plugins/Db3x_mmap/src/ui.cpp
+++ b/plugins/Db3x_mmap/src/ui.cpp
@@ -63,7 +63,7 @@ static INT_PTR CALLBACK sttEnterPassword(HWND hwndDlg, UINT uMsg, WPARAM wParam,
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_HEADERBAR, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInst, MAKEINTRESOURCE(iconList[0].defIconID)));
+ SendDlgItemMessage(hwndDlg, IDC_HEADERBAR, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(iconList[0].defIconID)));
param = (DlgChangePassParam*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
@@ -140,7 +140,7 @@ bool CDb3Mmap::EnterPassword(const BYTE *pKey, const size_t keyLen)
CredFree(pCred);
}
else {
- if (IDOK != DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LOGIN), nullptr, sttEnterPassword, (LPARAM)&param))
+ if (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LOGIN), nullptr, sttEnterPassword, (LPARAM)&param))
return false;
m_crypto->setPassword(T2Utf(param.newPass));
}
@@ -258,7 +258,7 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM)
{
CDb3Mmap *db = (CDb3Mmap*)obj;
DlgChangePassParam param = { db };
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(db->usesPassword() ? IDD_CHANGEPASS : IDD_NEWPASS), nullptr, sttChangePassword, (LPARAM)&param);
return 0;
}
@@ -304,7 +304,7 @@ static int OnOptionsInit(PVOID obj, WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.flags = ODPF_BOLDGROUPS;
odp.szTitle.a = LPGEN("Database");
@@ -325,7 +325,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
{
CDb3Mmap *db = (CDb3Mmap*)obj;
- Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mmap");
+ Icon_Register(g_plugin.getInst(), LPGEN("Database"), iconList, _countof(iconList), "mmap");
HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db);
diff --git a/plugins/Db3x_mmap/src/ui.h b/plugins/Db3x_mmap/src/ui.h
index aee1ff0d82..ae438fcab7 100644
--- a/plugins/Db3x_mmap/src/ui.h
+++ b/plugins/Db3x_mmap/src/ui.h
@@ -9,7 +9,7 @@ class CSelectCryptoDialog : public CDlgBase
CRYPTO_PROVIDER *m_selected;
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_provs(provs),