summaryrefslogtreecommitdiff
path: root/plugins/SecureIM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SecureIM')
-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
6 files changed, 28 insertions, 20 deletions
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");