summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CryptoPP/src/main.cpp11
-rw-r--r--plugins/MirLua/src/m_icolib.cpp4
-rw-r--r--plugins/MirLua/src/m_options.cpp4
-rw-r--r--plugins/MirLua/src/main.cpp21
-rw-r--r--plugins/MirLua/src/mlua_icons.cpp2
-rw-r--r--plugins/MirLua/src/mlua_options.cpp2
-rw-r--r--plugins/MirLua/src/stdafx.h9
-rw-r--r--plugins/MirOTR/src/dialogs.cpp10
-rw-r--r--plugins/MirOTR/src/dllmain.cpp22
-rw-r--r--plugins/MirOTR/src/icons.cpp2
-rw-r--r--plugins/MirOTR/src/mirotrmenu.cpp6
-rw-r--r--plugins/MirOTR/src/options.cpp2
-rw-r--r--plugins/MirOTR/src/otr.cpp2
-rw-r--r--plugins/MirOTR/src/stdafx.h11
-rwxr-xr-xplugins/New_GPG/src/globals.h1
-rwxr-xr-xplugins/New_GPG/src/icons.cpp2
-rwxr-xr-xplugins/New_GPG/src/init.cpp13
-rwxr-xr-xplugins/New_GPG/src/options.cpp10
-rwxr-xr-xplugins/New_GPG/src/stdafx.h8
-rwxr-xr-xplugins/New_GPG/src/ui.cpp20
-rw-r--r--plugins/OpenSSL/src/main.cpp23
-rw-r--r--plugins/OpenSSL/src/stdafx.h3
-rw-r--r--plugins/SecureIM/src/commonheaders.cpp2
-rw-r--r--plugins/SecureIM/src/commonheaders.h10
-rw-r--r--plugins/SecureIM/src/loadicons.cpp2
-rw-r--r--plugins/SecureIM/src/main.cpp6
-rw-r--r--plugins/SecureIM/src/options.cpp26
-rw-r--r--plugins/SecureIM/src/popupOptions.cpp2
28 files changed, 129 insertions, 107 deletions
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp
index 6c735ccbbd..de8b9a178d 100644
--- a/plugins/CryptoPP/src/main.cpp
+++ b/plugins/CryptoPP/src/main.cpp
@@ -11,7 +11,10 @@ HANDLE hRSA4096 = nullptr;
mir_cs localQueueMutex;
mir_cs localContextMutex;
-PLUGININFOEX pluginInfoEx = {
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfoEx =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -29,6 +32,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
// updater plugin support
@@ -53,11 +58,15 @@ extern "C" __declspec(dllexport) int Load()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload()
{
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
BOOL ExtractFileFromResource(HANDLE FH, int ResType, int ResId, DWORD* Size)
{
HRSRC RH = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(ResId), MAKEINTRESOURCE(ResType));
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp
index f89e7a6dee..332d5273c5 100644
--- a/plugins/MirLua/src/m_icolib.cpp
+++ b/plugins/MirLua/src/m_icolib.cpp
@@ -28,7 +28,7 @@ static void MakeSKINICONDESC(lua_State *L, SKINICONDESC &sid)
if (sid.defaultFile.w == nullptr)
{
sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1);
- GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH);
+ GetModuleFileName(g_plugin.getInst(), sid.defaultFile.w, MAX_PATH);
}
lua_getfield(L, -1, "DefaultIndex");
@@ -64,7 +64,7 @@ static int lua_AddIcon(lua_State *L)
if (sid.defaultFile.w == nullptr)
{
sid.defaultFile.w = (wchar_t*)mir_calloc(MAX_PATH + 1);
- GetModuleFileName(g_hInstance, sid.defaultFile.w, MAX_PATH);
+ GetModuleFileName(g_plugin.getInst(), sid.defaultFile.w, MAX_PATH);
}
}
else if (lua_type(L, 1) == LUA_TTABLE)
diff --git a/plugins/MirLua/src/m_options.cpp b/plugins/MirLua/src/m_options.cpp
index 5e548aeeb6..56a41f4f98 100644
--- a/plugins/MirLua/src/m_options.cpp
+++ b/plugins/MirLua/src/m_options.cpp
@@ -9,7 +9,7 @@ private:
public:
CMLuaScriptOptionPage(lua_State *_L, int onInitDialogRef, int onApplyRef)
- : CDlgBase(g_hInstance, IDD_SCRIPTOPTIONSPAGE), L(_L),
+ : CDlgBase(g_plugin.getInst(), IDD_SCRIPTOPTIONSPAGE), L(_L),
m_onInitDialogRef(onInitDialogRef), m_onApplyRef(onApplyRef)
{
}
@@ -43,7 +43,7 @@ public:
void MakeOptionDialogPage(lua_State *L, OPTIONSDIALOGPAGE &odp)
{
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.hLangpack = CMLuaEnvironment::GetEnvironmentId(L);
lua_getfield(L, -1, "Flags");
diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp
index cee700e68b..31c5d93912 100644
--- a/plugins/MirLua/src/main.cpp
+++ b/plugins/MirLua/src/main.cpp
@@ -1,8 +1,7 @@
#include "stdafx.h"
int hLangpack;
-
-HINSTANCE g_hInstance;
+CMPlugin g_plugin;
CMLua *g_mLua;
@@ -11,6 +10,8 @@ HANDLE g_hScriptsFolder;
HNETLIBUSER hNetlib = nullptr;
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -26,29 +27,23 @@ PLUGININFOEX pluginInfo =
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
-
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.szGroup.w = LPGENW("Services");
odp.szTitle.w = L"Lua";
odp.szTab.w = LPGENW("Scripts");
odp.pDialog = new CMLuaOptions(g_mLua);
Options_AddPage(wParam, &odp);
-
return 0;
}
@@ -58,7 +53,6 @@ int OnModulesLoaded(WPARAM, LPARAM)
g_hScriptsFolder = FoldersRegisterCustomPathT(MODULE, "ScriptsFolder", MIRLUA_PATHT, TranslateT("Scripts folder"));
HookEvent(ME_OPT_INITIALISE, OnOptionsInit);
-
return 0;
}
@@ -83,10 +77,11 @@ extern "C" int __declspec(dllexport) Load(void)
g_mLua->Load();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
-
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
delete g_mLua;
diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp
index 64648484ed..5feb9bc833 100644
--- a/plugins/MirLua/src/mlua_icons.cpp
+++ b/plugins/MirLua/src/mlua_icons.cpp
@@ -11,7 +11,7 @@ IconItem Icons[] =
void InitIcons()
{
- Icon_Register(g_hInstance, MODULE, Icons, _countof(Icons), MODULE);
+ Icon_Register(g_plugin.getInst(), MODULE, Icons, _countof(Icons), MODULE);
}
HICON GetIcon(int iconId)
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp
index 9aff70ba3f..43451746d4 100644
--- a/plugins/MirLua/src/mlua_options.cpp
+++ b/plugins/MirLua/src/mlua_options.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
CMLuaOptions::CMLuaOptions(CMLua *mLua)
- : CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE),
+ : CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS, MODULE),
m_mLua(mLua), isScriptListInit(false),
m_popupOnError(this, IDC_POPUPONERROR),
m_popupOnObsolete(this, IDC_POPUPONOBSOLETE),
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index b61f7dfedc..54c6f64a4e 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -6,8 +6,6 @@
#include <map>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_core.h>
#include <m_utils.h>
@@ -48,7 +46,12 @@ class CMLuaScript;
#define MODULE "MirLua"
-extern HINSTANCE g_hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
extern CMLua *g_mLua;
diff --git a/plugins/MirOTR/src/dialogs.cpp b/plugins/MirOTR/src/dialogs.cpp
index 7bd50fefbd..35d7b32c42 100644
--- a/plugins/MirOTR/src/dialogs.cpp
+++ b/plugins/MirOTR/src/dialogs.cpp
@@ -153,7 +153,7 @@ static void SMPInitUpdateDialog(ConnContext *context, bool responder)
data->context = context;
data->oldlevel = otr_context_get_trust(context);
data->responder = responder;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_PROGRESS), nullptr, DlgSMPUpdateProc, (LPARAM)data);
}
static INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -304,7 +304,7 @@ void SMPInitResponseDialog(ConnContext *context, const wchar_t *question) {
data->oldlevel = TRUST_NOT_PRIVATE;
data->responder = true;
data->question = (question) ? mir_wstrdup(question) : NULL;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgSMPResponseProc, (LPARAM) data);
}
*/
@@ -570,7 +570,7 @@ static INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam
void SMPInitDialog(ConnContext *context)
{
if (context)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgProcSMPInitProc, (LPARAM)context);
}
void SMPDialogUpdate(ConnContext *context, int percent)
@@ -609,7 +609,7 @@ void SMPDialogReply(ConnContext *context, const char* question)
data->oldlevel = TRUST_NOT_PRIVATE;
data->responder = true;
data->question = (question) ? mir_utf8decodeW(question) : nullptr;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgSMPResponseProc, (LPARAM)data);
/*
ShowError(L"SMP requires user password (NOT IMPL YET)");
otr_abort_smp(context);
@@ -729,7 +729,7 @@ static unsigned int CALLBACK verify_context_thread(void *param)
ConnContext *context = (ConnContext *)param;
MCONTACT hContact = (UINT_PTR)context->app_data;
wchar_t msg[1024];
- switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) {
+ switch (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SMP_INPUT), nullptr, DlgBoxProcVerifyContext, (LPARAM)param)) {
case IDOK:
case IDYES:
lib_cs_lock();
diff --git a/plugins/MirOTR/src/dllmain.cpp b/plugins/MirOTR/src/dllmain.cpp
index e548c017dc..92dadd48a2 100644
--- a/plugins/MirOTR/src/dllmain.cpp
+++ b/plugins/MirOTR/src/dllmain.cpp
@@ -1,10 +1,10 @@
// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
#include "stdafx.h"
-HANDLE hEventWindow;
-HINSTANCE hInst;
-
int hLangpack;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -19,17 +19,13 @@ PLUGININFOEX pluginInfo={
{0x12d8faad, 0x78ab, 0x4e3c, {0x98, 0x54, 0x32, 0xe, 0x9e, 0xa5, 0xcc, 0x9f}}
};
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
int ModulesLoaded(WPARAM, LPARAM)
{
lib_cs_lock();
@@ -43,7 +39,7 @@ int ModulesLoaded(WPARAM, LPARAM)
InitSRMM();
- hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
+ HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);
if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) {
db_set_b(0, MODULENAME, "sim_warned", 1);
@@ -91,12 +87,10 @@ extern "C" __declspec(dllexport) int Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
- //UnhookEvent(hSettingChanged);
- UnhookEvent(hEventWindow);
- //UnhookEvent(hEventDbEventAddedFilter);
- //UnhookEvent(hEventDbEventAdded);
DEBUGOUTA("UNLOAD MIROTR");
DeinitSRMM();
DeinitDBFilter();
diff --git a/plugins/MirOTR/src/icons.cpp b/plugins/MirOTR/src/icons.cpp
index 9b952736b1..5fa631ecb6 100644
--- a/plugins/MirOTR/src/icons.cpp
+++ b/plugins/MirOTR/src/icons.cpp
@@ -11,5 +11,5 @@ static IconItem iconList[] = {
void InitIcons()
{
- Icon_Register(hInst, "OTR", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "OTR", iconList, _countof(iconList));
}
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp
index 21ae10a7f9..899b41e5c4 100644
--- a/plugins/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/src/mirotrmenu.cpp
@@ -148,11 +148,11 @@ void ShowOTRMenu(MCONTACT hContact, POINT pt)
void InitMirOTRMenu(void)
{
WNDCLASS wc = { 0 };
- wc.hInstance = hInst;
+ wc.hInstance = g_plugin.getInst();
wc.lpfnWndProc = PopupMenuWndProc;
wc.lpszClassName = L"MirOTRPopupMenuProcessor";
RegisterClass(&wc);
- hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, hInst, nullptr);
+ hDummyPaintWin = CreateWindowEx(0, L"MirOTRPopupMenuProcessor", nullptr, 0, 0, 0, 1, 1, nullptr, nullptr, g_plugin.getInst(), nullptr);
CreateServiceFunction("MirOTRMenuExecService", MirOTRMenuExecService);
CreateServiceFunction("MirOTRMenuCheckService", MirOTRMenuCheckService);
@@ -208,7 +208,7 @@ void UninitMirOTRMenu(void)
DestroyWindow(hDummyPaintWin);
hDummyPaintWin = nullptr;
- UnregisterClass(L"MirOTRPopupMenuProcessor", hInst);
+ UnregisterClass(L"MirOTRPopupMenuProcessor", g_plugin.getInst());
Menu_RemoveObject(hMirOTRMenuObject);
hMirOTRMenuObject = 0;
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp
index 3092cdd8e9..f8419c40c1 100644
--- a/plugins/MirOTR/src/options.cpp
+++ b/plugins/MirOTR/src/options.cpp
@@ -828,7 +828,7 @@ static int OpenOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Services");
odp.szTitle.w = L"OTR";
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
diff --git a/plugins/MirOTR/src/otr.cpp b/plugins/MirOTR/src/otr.cpp
index 5350bca1bb..56c51be1a8 100644
--- a/plugins/MirOTR/src/otr.cpp
+++ b/plugins/MirOTR/src/otr.cpp
@@ -108,7 +108,7 @@ extern "C" {
protocol = GetContactProto((UINT_PTR)opdata);
}
if (!protocol) return;
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_GENKEYNOTIFY), nullptr, GenKeyDlgBoxProc, (LPARAM)protocol);
}
diff --git a/plugins/MirOTR/src/stdafx.h b/plugins/MirOTR/src/stdafx.h
index 73bed096c4..06d1f2f45b 100644
--- a/plugins/MirOTR/src/stdafx.h
+++ b/plugins/MirOTR/src/stdafx.h
@@ -23,8 +23,6 @@ extern "C" {
}
using namespace std;
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_database.h>
@@ -76,7 +74,12 @@ using namespace std;
#define MODULENAME "MirOTR"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
#define PREF_BYPASS_OTR 0x8000
#define PREF_NO_HISTORY 0x10000
-
-extern HINSTANCE hInst;
diff --git a/plugins/New_GPG/src/globals.h b/plugins/New_GPG/src/globals.h
index 7580bd77ec..f84235975f 100755
--- a/plugins/New_GPG/src/globals.h
+++ b/plugins/New_GPG/src/globals.h
@@ -23,7 +23,6 @@ struct globals_s
wchar_t *inopentag = nullptr, *inclosetag = nullptr, *outopentag = nullptr, *outclosetag = nullptr, *password = nullptr;
wchar_t key_id_global[17] = { 0 };
list <JabberAccount*> Accounts;
- HINSTANCE hInst;
HFONT bold_font = nullptr;
HANDLE hLoadPubKey = nullptr, g_hCLIcon = nullptr, hExportGpgKeys = nullptr, hImportGpgKeys = nullptr;
HGENMENU hSendKey = nullptr, hToggleEncryption = nullptr;
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index 3f4925a08f..7a07ff2237 100755
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -25,7 +25,7 @@ static IconItem iconList[] =
void InitIconLib()
{
- Icon_Register(globals.hInst, szGPGModuleName, iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), szGPGModuleName, iconList, _countof(iconList));
}
HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook)
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 148555015d..039c33c3b0 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -18,6 +18,9 @@
//global variables
int hLangpack = 0;
+CMPlugin g_plugin;
+
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -32,18 +35,12 @@ PLUGININFOEX pluginInfo={
{ 0x4227c050, 0x8d97, 0x48d2, { 0x91, 0xec, 0x6a, 0x95, 0x2b, 0x3d, 0xab, 0x94 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- globals.hInst = hinstDLL;
- return TRUE;
-}
-
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
INT_PTR LoadKey(WPARAM w, LPARAM l);
INT_PTR ToggleEncryption(WPARAM w, LPARAM l);
@@ -202,6 +199,8 @@ extern "C" int __declspec(dllexport) Load()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern list<wstring> transfers;
extern "C" int __declspec(dllexport) Unload(void)
{
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 0fa5890093..2875bf795d 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -36,7 +36,7 @@ class COptGpgMainDlg : public CDlgBase
CCtrlButton btn_DELETE_KEY_BUTTON, btn_SELECT_KEY, btn_SAVE_KEY_BUTTON, btn_COPY_KEY, btn_LOG_FILE_SET;
public:
- COptGpgMainDlg() : CDlgBase(globals.hInst, IDD_OPT_GPG),
+ COptGpgMainDlg() : CDlgBase(g_plugin.getInst(), IDD_OPT_GPG),
list_USERLIST(this, IDC_USERLIST), lbl_CURRENT_KEY(this, IDC_CURRENT_KEY), edit_LOG_FILE_EDIT(this, IDC_LOG_FILE_EDIT),
check_DEBUG_LOG(this, IDC_DEBUG_LOG), check_JABBER_API(this, IDC_JABBER_API), check_AUTO_EXCHANGE(this, IDC_AUTO_EXCHANGE), check_FILE_TRANSFERS(this, IDC_FILE_TRANSFERS),
btn_DELETE_KEY_BUTTON(this, IDC_DELETE_KEY_BUTTON), btn_SELECT_KEY(this, IDC_SELECT_KEY), btn_SAVE_KEY_BUTTON(this, IDC_SAVE_KEY_BUTTON), btn_COPY_KEY(this, IDC_COPY_KEY), btn_LOG_FILE_SET(this, IDC_LOG_FILE_SET)
@@ -373,7 +373,7 @@ class COptGpgBinDlg : public CDlgBase
CCtrlButton btn_SET_BIN_PATH, btn_SET_HOME_DIR;
public:
- COptGpgBinDlg() : CDlgBase(globals.hInst, IDD_OPT_GPG_BIN),
+ COptGpgBinDlg() : CDlgBase(g_plugin.getInst(), IDD_OPT_GPG_BIN),
edit_BIN_PATH(this, IDC_BIN_PATH), edit_HOME_DIR(this, IDC_HOME_DIR),
btn_SET_BIN_PATH(this, IDC_SET_BIN_PATH), btn_SET_HOME_DIR(this, IDC_SET_HOME_DIR)
{
@@ -468,7 +468,7 @@ class COptGpgMsgDlg : public CDlgBase
CCtrlEdit edit_IN_OPEN_TAG, edit_IN_CLOSE_TAG, edit_OUT_OPEN_TAG, edit_OUT_CLOSE_TAG;
public:
- COptGpgMsgDlg() : CDlgBase(globals.hInst, IDD_OPT_GPG_MESSAGES),
+ COptGpgMsgDlg() : CDlgBase(g_plugin.getInst(), IDD_OPT_GPG_MESSAGES),
check_APPEND_TAGS(this, IDC_APPEND_TAGS), check_STRIP_TAGS(this, IDC_STRIP_TAGS),
edit_IN_OPEN_TAG(this, IDC_IN_OPEN_TAG), edit_IN_CLOSE_TAG(this, IDC_IN_CLOSE_TAG), edit_OUT_OPEN_TAG(this, IDC_OUT_OPEN_TAG), edit_OUT_CLOSE_TAG(this, IDC_OUT_CLOSE_TAG)
{}
@@ -514,7 +514,7 @@ class COptGpgAdvDlg : public CDlgBase
CCtrlCheck check_PRESCENSE_SUBSCRIPTION;
public:
- COptGpgAdvDlg() : CDlgBase(globals.hInst, IDD_OPT_GPG_ADVANCED),
+ COptGpgAdvDlg() : CDlgBase(g_plugin.getInst(), IDD_OPT_GPG_ADVANCED),
btn_EXPORT(this, IDC_EXPORT), btn_IMPORT(this, IDC_IMPORT),
check_PRESCENSE_SUBSCRIPTION(this, IDC_PRESCENSE_SUBSCRIPTION)
{
@@ -570,7 +570,7 @@ class CDlgLoadPubKeyDlg : public CDlgBase
CCtrlEdit edit_PUBLIC_KEY_EDIT;
public:
- CDlgLoadPubKeyDlg() : CDlgBase(globals.hInst, IDD_LOAD_PUBLIC_KEY),
+ CDlgLoadPubKeyDlg() : CDlgBase(g_plugin.getInst(), IDD_LOAD_PUBLIC_KEY),
chk_ENABLE_ENCRYPTION(this, IDC_ENABLE_ENCRYPTION),
btn_SELECT_EXISTING(this, IDC_SELECT_EXISTING), btn_OK(this, ID_OK), btn_LOAD_FROM_FILE(this, ID_LOAD_FROM_FILE), btn_IMPORT(this, IDC_IMPORT),
edit_PUBLIC_KEY_EDIT(this, IDC_PUBLIC_KEY_EDIT)
diff --git a/plugins/New_GPG/src/stdafx.h b/plugins/New_GPG/src/stdafx.h
index f66a3ef85f..2353feb602 100755
--- a/plugins/New_GPG/src/stdafx.h
+++ b/plugins/New_GPG/src/stdafx.h
@@ -55,7 +55,6 @@ using std::fstream;
#include <utf8.h>
//miranda
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_options.h>
@@ -88,4 +87,11 @@ using std::fstream;
#include "options.h"
#include "globals.h"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(szGPGModuleName)
+ {}
+};
+
#endif
diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp
index 396869d09d..29526406e8 100755
--- a/plugins/New_GPG/src/ui.cpp
+++ b/plugins/New_GPG/src/ui.cpp
@@ -27,7 +27,7 @@ void CDlgEncryptedFileMsgBox::OnInitDialog()
globals.bDecryptFiles = false;
}
-CDlgEncryptedFileMsgBox::CDlgEncryptedFileMsgBox() : CDlgBase(globals.hInst, IDD_ENCRYPTED_FILE_MSG_BOX),
+CDlgEncryptedFileMsgBox::CDlgEncryptedFileMsgBox() : CDlgBase(g_plugin.getInst(), IDD_ENCRYPTED_FILE_MSG_BOX),
chk_REMEMBER(this, IDC_REMEMBER),
btn_IGNORE(this, IDC_IGNORE), btn_DECRYPT(this, IDC_DECRYPT)
{
@@ -61,7 +61,7 @@ void CDlgEncryptedFileMsgBox::onClick_DECRYPT(CCtrlButton*)
-CDlgExportKeysMsgBox::CDlgExportKeysMsgBox() : CDlgBase(globals.hInst, IDD_EXPORT_TYPE),
+CDlgExportKeysMsgBox::CDlgExportKeysMsgBox() : CDlgBase(g_plugin.getInst(), IDD_EXPORT_TYPE),
btn_OK(this, IDC_OK), btn_CANCEL(this, IDC_CANCEL),
chk_PUBLIC(this, IDC_PUBLIC), chk_PRIVATE(this, IDC_PRIVATE), chk_ALL(this, IDC_ALL)
{
@@ -89,7 +89,7 @@ void CDlgExportKeysMsgBox::onClick_CANCEL(CCtrlButton*)
-CDlgChangePasswdMsgBox::CDlgChangePasswdMsgBox() : CDlgBase(globals.hInst, IDD_CHANGE_PASSWD),
+CDlgChangePasswdMsgBox::CDlgChangePasswdMsgBox() : CDlgBase(g_plugin.getInst(), IDD_CHANGE_PASSWD),
btn_OK(this, ID_OK),
edit_NEW_PASSWD1(this, IDC_NEW_PASSWD1), edit_NEW_PASSWD2(this, IDC_NEW_PASSWD2), edit_OLD_PASSWD(this, IDC_OLD_PASSWD)
{
@@ -160,7 +160,7 @@ void CDlgChangePasswdMsgBox::onClick_OK(CCtrlButton*)
-CDlgFirstRun::CDlgFirstRun() : CDlgBase(globals.hInst, IDD_FIRST_RUN),
+CDlgFirstRun::CDlgFirstRun() : CDlgBase(g_plugin.getInst(), IDD_FIRST_RUN),
list_KEY_LIST(this, IDC_KEY_LIST),
btn_COPY_PUBKEY(this, IDC_COPY_PUBKEY), btn_EXPORT_PRIVATE(this, IDC_EXPORT_PRIVATE), btn_CHANGE_PASSWD(this, IDC_CHANGE_PASSWD), btn_GENERATE_RANDOM(this, IDC_GENERATE_RANDOM),
btn_GENERATE_KEY(this, IDC_GENERATE_KEY), btn_OTHER(this, IDC_OTHER), btn_DELETE_KEY(this, IDC_DELETE_KEY), btn_OK(this, ID_OK),
@@ -734,7 +734,7 @@ void CDlgFirstRun::refresh_key_list()
-CDlgGpgBinOpts::CDlgGpgBinOpts() : CDlgBase(globals.hInst, IDD_BIN_PATH),
+CDlgGpgBinOpts::CDlgGpgBinOpts() : CDlgBase(g_plugin.getInst(), IDD_BIN_PATH),
btn_SET_BIN_PATH(this, IDC_SET_BIN_PATH), btn_SET_HOME_DIR(this, IDC_SET_HOME_DIR), btn_OK(this, ID_OK), btn_GENERATE_RANDOM(this, IDC_GENERATE_RANDOM),
edit_BIN_PATH(this, IDC_BIN_PATH), edit_HOME_DIR(this, IDC_HOME_DIR),
chk_AUTO_EXCHANGE(this, IDC_AUTO_EXCHANGE)
@@ -895,7 +895,7 @@ void CDlgGpgBinOpts::OnDestroy()
InitCheck();
}
-CDlgNewKey::CDlgNewKey(MCONTACT _hContact, wstring _new_key) : CDlgBase(globals.hInst, IDD_NEW_KEY),
+CDlgNewKey::CDlgNewKey(MCONTACT _hContact, wstring _new_key) : CDlgBase(g_plugin.getInst(), IDD_NEW_KEY),
lbl_KEY_FROM(this, IDC_KEY_FROM), lbl_MESSAGE(this, IDC_MESSAGE),
btn_IMPORT(this, ID_IMPORT), btn_IMPORT_AND_USE(this, IDC_IMPORT_AND_USE), btn_IGNORE_KEY(this, IDC_IGNORE_KEY)
{
@@ -946,7 +946,7 @@ void CDlgNewKey::onClick_IGNORE_KEY(CCtrlButton*)
this->Close();
}
-CDlgKeyGen::CDlgKeyGen() : CDlgBase(globals.hInst, IDD_KEY_GEN),
+CDlgKeyGen::CDlgKeyGen() : CDlgBase(g_plugin.getInst(), IDD_KEY_GEN),
combo_KEY_TYPE(this, IDC_KEY_TYPE),
edit_KEY_LENGTH(this, IDC_KEY_LENGTH), edit_KEY_PASSWD(this, IDC_KEY_PASSWD), edit_KEY_REAL_NAME(this, IDC_KEY_REAL_NAME), edit_KEY_EMAIL(this, IDC_KEY_EMAIL), edit_KEY_COMMENT(this, IDC_KEY_COMMENT),
edit_KEY_EXPIRE_DATE(this, IDC_KEY_EXPIRE_DATE),
@@ -1140,7 +1140,7 @@ void CDlgKeyGen::OnDestroy()
db_set_dw(NULL, szGPGModuleName, "KeyGenWindowY", globals.key_gen_rect.top);
}
-CDlgLoadExistingKey::CDlgLoadExistingKey() : CDlgBase(globals.hInst, IDD_LOAD_EXISTING_KEY),
+CDlgLoadExistingKey::CDlgLoadExistingKey() : CDlgBase(g_plugin.getInst(), IDD_LOAD_EXISTING_KEY),
btn_OK(this, IDOK), btn_CANCEL(this, IDCANCEL),
list_EXISTING_KEY_LIST(this, IDC_EXISTING_KEY_LIST)
{
@@ -1323,7 +1323,7 @@ void CDlgLoadExistingKey::onChange_EXISTING_KEY_LIST(CCtrlListView::TEventInfo *
btn_OK.Enable();
}
-CDlgImportKey::CDlgImportKey(MCONTACT _hContact) : CDlgBase(globals.hInst, IDD_IMPORT_KEY),
+CDlgImportKey::CDlgImportKey(MCONTACT _hContact) : CDlgBase(g_plugin.getInst(), IDD_IMPORT_KEY),
combo_KEYSERVER(this, IDC_KEYSERVER),
btn_IMPORT(this, IDC_IMPORT)
{
@@ -1362,7 +1362,7 @@ void CDlgImportKey::onClick_IMPORT(CCtrlButton*)
-CDlgKeyPasswordMsgBox::CDlgKeyPasswordMsgBox(MCONTACT _hContact) : CDlgBase(globals.hInst, IDD_KEY_PASSWD),
+CDlgKeyPasswordMsgBox::CDlgKeyPasswordMsgBox(MCONTACT _hContact) : CDlgBase(g_plugin.getInst(), IDD_KEY_PASSWD),
lbl_KEYID(this, IDC_KEYID),
edit_KEY_PASSWORD(this, IDC_KEY_PASSWORD),
chk_DEFAULT_PASSWORD(this, IDC_DEFAULT_PASSWORD), chk_SAVE_PASSWORD(this, IDC_SAVE_PASSWORD),
diff --git a/plugins/OpenSSL/src/main.cpp b/plugins/OpenSSL/src/main.cpp
index 05416b7eb6..36c5691730 100644
--- a/plugins/OpenSSL/src/main.cpp
+++ b/plugins/OpenSSL/src/main.cpp
@@ -23,9 +23,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadSslModule(void);
void UnloadSslModule(void);
-HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+}
+g_plugin;
+
int hLangpack;
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -39,19 +48,17 @@ PLUGININFOEX pluginInfo = {
{ 0xb649702c, 0x13de, 0x408a, { 0xb6, 0xc2, 0xfb, 0x8f, 0xed, 0x2a, 0x2c, 0x90 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SSL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -59,6 +66,8 @@ extern "C" int __declspec(dllexport) Load(void)
return LoadSslModule();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
UnloadSslModule();
diff --git a/plugins/OpenSSL/src/stdafx.h b/plugins/OpenSSL/src/stdafx.h
index bc90991127..b107c70ef8 100644
--- a/plugins/OpenSSL/src/stdafx.h
+++ b/plugins/OpenSSL/src/stdafx.h
@@ -35,7 +35,6 @@ typedef struct SslHandle *HSSL;
#define DELAYIMP_INSECURE_WRITABLE_HOOKS
#include <delayimp.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_netlib.h>
#include <m_langpack.h>
@@ -46,5 +45,3 @@ typedef struct SslHandle *HSSL;
#include <openssl/rand.h>
#include "version.h"
-
-extern HINSTANCE hInst;
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp
index 0c46b53bdd..b042f486f6 100644
--- a/plugins/SecureIM/src/commonheaders.cpp
+++ b/plugins/SecureIM/src/commonheaders.cpp
@@ -1,6 +1,6 @@
#include "commonheaders.h"
-HINSTANCE g_hInst, g_hIconInst;
+HINSTANCE g_hIconInst;
char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h
index e345a3fa51..6770296d73 100644
--- a/plugins/SecureIM/src/commonheaders.h
+++ b/plugins/SecureIM/src/commonheaders.h
@@ -19,7 +19,6 @@
#include <process.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -63,11 +62,18 @@
#define MODULENAME "SecureIM"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
extern char TEMP[MAX_PATH];
extern int TEMP_SIZE;
// shared vars
-extern HINSTANCE g_hInst, g_hIconInst;
+extern HINSTANCE g_hIconInst;
#define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending
#define PREF_SIMNOMETA 0x4000 //!< Flag to indicate message should not be inspected by filter on metacontact
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp
index 756a235b4c..7614b3a630 100644
--- a/plugins/SecureIM/src/loadicons.cpp
+++ b/plugins/SecureIM/src/loadicons.cpp
@@ -89,7 +89,7 @@ void InitIcons(void)
hNewIconInst = LoadIconsPack("plugins\\secureim_icons.dll");
if (hNewIconInst == nullptr)
- g_hIconInst = g_hInst;
+ g_hIconInst = g_plugin.getInst();
else
g_hIconInst = hNewIconInst;
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index fd9dbd2f17..611081ae2a 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -1,7 +1,10 @@
#include "commonheaders.h"
+CMPlugin g_plugin;
int hLangpack = 0;
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -24,7 +27,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID)
{
- g_hInst = hInst;
if (dwReason == DLL_PROCESS_ATTACH) {
INITCOMMONCONTROLSEX icce = { sizeof(icce), ICC_LISTVIEW_CLASSES | ICC_TAB_CLASSES };
InitCommonControlsEx(&icce);
@@ -288,7 +290,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
{
mir_getLP(&pluginInfoEx);
- DisableThreadLibraryCalls(g_hInst);
+ DisableThreadLibraryCalls(g_plugin.getInst());
char temp[MAX_PATH];
GetTempPath(sizeof(temp), temp);
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp
index 03977ca69a..f0cad3c731 100644
--- a/plugins/SecureIM/src/options.cpp
+++ b/plugins/SecureIM/src/options.cpp
@@ -93,19 +93,19 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
iInit = TRUE;
tci.mask = TCIF_PARAM | TCIF_TEXT;
- tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TAB_GENERAL), hwnd, DlgProcOptionsGeneral);
+ tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TAB_GENERAL), hwnd, DlgProcOptionsGeneral);
tci.pszText = (LPSTR)sim201;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci);
EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
- tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TAB_PROTO), hwnd, DlgProcOptionsProto);
+ tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TAB_PROTO), hwnd, DlgProcOptionsProto);
tci.pszText = (LPSTR)sim202;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 2, &tci);
EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
ShowWindow((HWND)tci.lParam, SW_HIDE);
if (bPGP && bPGPloaded) {
- tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TAB_PGP), hwnd, DlgProcOptionsPGP);
+ tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TAB_PGP), hwnd, DlgProcOptionsPGP);
tci.pszText = (LPSTR)sim214;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 3, &tci);
EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
@@ -113,7 +113,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
}
if (bGPG && bGPGloaded) {
- tci.lParam = (LPARAM)CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_TAB_GPG), hwnd, DlgProcOptionsGPG);
+ tci.lParam = (LPARAM)CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TAB_GPG), hwnd, DlgProcOptionsGPG);
tci.pszText = (LPSTR)sim226;
TC_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 4, &tci);
EnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB);
@@ -280,7 +280,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
if (ptr) {
LPSTR buffer = (LPSTR)alloca(PSKSIZE + 1);
getContactName(ptr->hContact, buffer);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PSK), nullptr, DlgProcSetPSK, (LPARAM)buffer);
+ int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PSK), nullptr, DlgProcSetPSK, (LPARAM)buffer);
if (res == IDOK) {
setListViewPSK(hLV, idx, 1);
db_set_s(ptr->hContact, MODULENAME, "tPSK", buffer);
@@ -433,17 +433,17 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
if (ptr->tmode == MODE_NATIVE || ptr->tmode == MODE_RSAAES) {
switch (lpLV->iSubItem) {
case 2: // mode
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDM_CLIST2));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDM_CLIST2));
break;
case 3: // status
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST01 : IDM_CLIST11));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST01 : IDM_CLIST11));
break;
case 4: // PSK/PUB
case 5: // SHA1
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST02 : IDM_CLIST12));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST02 : IDM_CLIST12));
break;
default: // full menu
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST0 : IDM_CLIST1));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE((ptr->tmode == MODE_NATIVE) ? IDM_CLIST0 : IDM_CLIST1));
break;
}
CheckMenuItem(hMenu, ID_DISABLED + ptr->tstatus, MF_CHECKED);
@@ -458,7 +458,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR
}
}
if (!hMenu)
- hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDM_CLIST2));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDM_CLIST2));
TranslateMenu(hMenu);
CheckMenuItem(hMenu, ID_SIM_NATIVE + ptr->tmode, MF_CHECKED);
if (!bPGP) EnableMenuItem(hMenu, ID_SIM_PGP, MF_GRAYED);
@@ -534,7 +534,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
case IDC_RSA_EXPPRIV:
{
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
LPSTR priv = (LPSTR)alloca(RSASIZE);
mir_exp->rsa_export_keypair(CPP_MODE_RSA, priv, nullptr, passphrase);
@@ -551,7 +551,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM
return TRUE;
LPSTR passphrase = (LPSTR)alloca(RSASIZE);
- int res = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
+ int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PASSPHRASE), nullptr, DlgProcSetPassphrase, (LPARAM)passphrase);
if (res == IDOK) {
if (!mir_exp->rsa_import_keypair(CPP_MODE_RSA, priv, passphrase))
msgbox(hDlg, sim113, MODULENAME, MB_OK | MB_ICONEXCLAMATION);
@@ -1687,7 +1687,7 @@ BOOL LoadImportRSAKeyDlg(HWND hParent, LPSTR key, BOOL priv)
int onRegisterOptions(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSTAB);
odp.szTitle.a = (char*)MODULENAME;
odp.szGroup.a = LPGEN("Services");
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp
index 9206d01681..ee9dfcf19d 100644
--- a/plugins/SecureIM/src/popupOptions.cpp
+++ b/plugins/SecureIM/src/popupOptions.cpp
@@ -163,7 +163,7 @@ int onRegisterPopOptions(WPARAM wParam, LPARAM)
{
if (bPopupExists) {
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP);
odp.szTitle.a = (char*)MODULENAME;
odp.szGroup.a = LPGEN("Popups");