summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
commit9cf1444eb7888f2d942d220f938aa893396a8a1b (patch)
treeea87e4cb78e9c26a651af00b2d423324ce4a85a6
parent3936ebbc665c9653d9f62527c1e136944d52e2ca (diff)
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
-rw-r--r--include/m_plugin.h9
-rw-r--r--libs/win32/mir_app.libbin156358 -> 156628 bytes
-rw-r--r--libs/win64/mir_app.libbin151382 -> 151658 bytes
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp4
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp4
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp4
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp4
-rw-r--r--plugins/CloudFile/src/icons.cpp2
-rw-r--r--plugins/CloudFile/src/main.cpp11
-rw-r--r--plugins/CloudFile/src/oauth.cpp2
-rw-r--r--plugins/CloudFile/src/options.cpp2
-rw-r--r--plugins/CloudFile/src/stdafx.h8
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp63
-rw-r--r--plugins/ConnectionNotify/src/filter.cpp3
-rw-r--r--plugins/ConnectionNotify/src/stdafx.h9
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp73
-rw-r--r--plugins/LotusNotify/src/LotusNotify.h9
-rw-r--r--plugins/NewsAggregator/Src/Authentication.cpp2
-rw-r--r--plugins/NewsAggregator/Src/Icons.cpp2
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp23
-rw-r--r--plugins/NewsAggregator/Src/Options.cpp10
-rw-r--r--plugins/NewsAggregator/Src/stdafx.h11
-rw-r--r--plugins/Non-IM Contact/src/dialog.cpp16
-rw-r--r--plugins/Non-IM Contact/src/main.cpp75
-rw-r--r--plugins/Non-IM Contact/src/stdafx.h18
-rw-r--r--plugins/Quotes/src/CreateFilePath.cpp2
-rw-r--r--plugins/Quotes/src/CurrencyConverter.cpp2
-rw-r--r--plugins/Quotes/src/Forex.cpp61
-rw-r--r--plugins/Quotes/src/IconLib.cpp2
-rw-r--r--plugins/Quotes/src/QuoteInfoDlg.cpp4
-rw-r--r--plugins/Quotes/src/SettingsDlg.cpp10
-rw-r--r--plugins/Quotes/src/WinCtrlHelper.cpp2
-rw-r--r--plugins/Quotes/src/stdafx.h10
-rw-r--r--plugins/StartPosition/src/main.cpp9
-rw-r--r--plugins/Weather/src/stdafx.h15
-rw-r--r--plugins/Weather/src/weather.cpp25
-rw-r--r--plugins/Weather/src/weather_addstn.cpp2
-rw-r--r--plugins/Weather/src/weather_contacts.cpp2
-rw-r--r--plugins/Weather/src/weather_icons.cpp2
-rw-r--r--plugins/Weather/src/weather_ini.cpp2
-rw-r--r--plugins/Weather/src/weather_mwin.cpp8
-rw-r--r--plugins/Weather/src/weather_opt.cpp6
-rw-r--r--plugins/Weather/src/weather_popup.cpp10
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp8
-rw-r--r--plugins/WebView/src/main.cpp116
-rw-r--r--plugins/WebView/src/webview.cpp19
-rw-r--r--plugins/WebView/src/webview.h39
-rw-r--r--plugins/WebView/src/webview_alerts.cpp10
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp28
-rw-r--r--plugins/WebView/src/webview_opts.cpp6
-rw-r--r--plugins/WebView/src/webview_services.cpp8
-rw-r--r--plugins/YAMN/src/browser/badconnect.cpp2
-rw-r--r--plugins/YAMN/src/browser/mailbrowser.cpp4
-rw-r--r--plugins/YAMN/src/main.cpp24
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3opt.cpp4
-rw-r--r--plugins/YAMN/src/stdafx.h13
-rw-r--r--protocols/Discord/src/main.cpp26
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Discord/src/stdafx.h1
-rw-r--r--protocols/Dummy/src/dummy.h73
-rw-r--r--protocols/Dummy/src/dummy_options.cpp2
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp8
-rw-r--r--protocols/Dummy/src/main.cpp15
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp47
-rw-r--r--protocols/EmLanProto/src/stdafx.h16
-rw-r--r--protocols/FacebookRM/src/captcha.cpp2
-rw-r--r--protocols/FacebookRM/src/main.cpp12
-rw-r--r--protocols/FacebookRM/src/proto.cpp6
-rw-r--r--protocols/FacebookRM/src/stdafx.h1
-rw-r--r--protocols/FacebookRM/src/theme.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp7
-rw-r--r--protocols/Gadu-Gadu/src/gg.h1
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/icolib.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/token.cpp2
-rw-r--r--protocols/IRCG/src/main.cpp15
-rw-r--r--protocols/IRCG/src/options.cpp4
-rw-r--r--protocols/IRCG/src/stdafx.h2
-rw-r--r--protocols/IRCG/src/userinfo.cpp2
-rw-r--r--protocols/IcqOscarJ/src/dlgproc.cpp2
-rw-r--r--protocols/IcqOscarJ/src/editlist.cpp2
-rw-r--r--protocols/IcqOscarJ/src/editstring.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_firstrun.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_opts.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_uploadui.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_xstatus.cpp4
-rw-r--r--protocols/IcqOscarJ/src/init.cpp10
-rw-r--r--protocols/IcqOscarJ/src/loginpassword.cpp2
-rw-r--r--protocols/IcqOscarJ/src/userinfotab.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber.cpp36
-rw-r--r--protocols/JabberG/src/jabber_adhoc.cpp10
-rw-r--r--protocols/JabberG/src/jabber_bookmarks.cpp6
-rw-r--r--protocols/JabberG/src/jabber_captcha.cpp2
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp2
-rw-r--r--protocols/JabberG/src/jabber_filterlist.cpp2
-rw-r--r--protocols/JabberG/src/jabber_form.cpp18
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp8
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp8
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp6
-rw-r--r--protocols/JabberG/src/jabber_password.cpp2
-rw-r--r--protocols/JabberG/src/jabber_search.cpp8
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_userinfo.cpp2
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp10
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp2
-rwxr-xr-xprotocols/JabberG/src/stdafx.h2
-rw-r--r--protocols/MRA/src/Mra.cpp35
-rw-r--r--protocols/MRA/src/MraAdvancedSearch.cpp4
-rw-r--r--protocols/MRA/src/MraIcons.cpp10
-rw-r--r--protocols/MRA/src/MraPopUp.cpp4
-rw-r--r--protocols/MRA/src/MraProto.cpp2
-rw-r--r--protocols/MRA/src/MraSelectEMail.cpp2
-rw-r--r--protocols/MRA/src/Mra_functions.cpp4
-rw-r--r--protocols/MRA/src/Mra_options.cpp2
-rw-r--r--protocols/MRA/src/stdafx.h11
-rw-r--r--protocols/MSN/src/msn.cpp42
-rw-r--r--protocols/MSN/src/msn_auth.cpp6
-rw-r--r--protocols/MSN/src/msn_chat.cpp4
-rw-r--r--protocols/MSN/src/msn_links.cpp2
-rw-r--r--protocols/MSN/src/msn_lists.cpp2
-rw-r--r--protocols/MSN/src/msn_menu.cpp2
-rw-r--r--protocols/MSN/src/msn_opts.cpp6
-rw-r--r--protocols/MSN/src/msn_proto.h1
-rw-r--r--protocols/MSN/src/msn_svcs.cpp4
-rw-r--r--protocols/MSN/src/stdafx.h1
-rw-r--r--protocols/MinecraftDynmap/src/dialogs.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/main.cpp13
-rw-r--r--protocols/MinecraftDynmap/src/proto.cpp4
-rw-r--r--protocols/MinecraftDynmap/src/stdafx.h1
-rw-r--r--protocols/Omegle/src/main.cpp21
-rw-r--r--protocols/Omegle/src/proto.cpp4
-rw-r--r--protocols/Omegle/src/stdafx.h1
-rw-r--r--protocols/Omegle/src/theme.cpp2
-rw-r--r--protocols/Sametime/src/options.cpp2
-rw-r--r--protocols/Sametime/src/sametime.cpp28
-rw-r--r--protocols/Sametime/src/sametime.h1
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp2
-rw-r--r--protocols/Sametime/src/sametime_session.cpp2
-rw-r--r--protocols/SkypeWeb/src/main.cpp38
-rw-r--r--protocols/SkypeWeb/src/skype_icons.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp2
-rw-r--r--protocols/SkypeWeb/src/stdafx.h1
-rw-r--r--protocols/Steam/src/main.cpp16
-rw-r--r--protocols/Steam/src/stdafx.h1
-rw-r--r--protocols/Steam/src/steam_options.cpp2
-rw-r--r--protocols/Steam/src/steam_proto.cpp2
-rw-r--r--protocols/Tox/src/main.cpp18
-rw-r--r--protocols/Tox/src/stdafx.h1
-rw-r--r--protocols/Tox/src/tox_contacts.cpp2
-rw-r--r--protocols/Tox/src/tox_icons.cpp2
-rw-r--r--protocols/Tox/src/tox_options.cpp2
-rw-r--r--protocols/Tox/src/tox_search.cpp2
-rw-r--r--protocols/Twitter/src/main.cpp13
-rw-r--r--protocols/Twitter/src/proto.cpp10
-rw-r--r--protocols/Twitter/src/stdafx.h2
-rw-r--r--protocols/Twitter/src/theme.cpp2
-rw-r--r--protocols/VKontakte/src/main.cpp14
-rw-r--r--protocols/VKontakte/src/misc.cpp2
-rw-r--r--protocols/VKontakte/src/stdafx.h2
-rw-r--r--protocols/VKontakte/src/vk.h2
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp9
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp4
-rw-r--r--src/mir_app/src/CMPluginBase.cpp5
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
173 files changed, 836 insertions, 826 deletions
diff --git a/include/m_plugin.h b/include/m_plugin.h
index ae56eeb49a..340b3100fe 100644
--- a/include/m_plugin.h
+++ b/include/m_plugin.h
@@ -4,8 +4,6 @@
#include <m_database.h>
#include <m_protocols.h>
-extern HINSTANCE g_hInstance;
-
class MIR_APP_EXPORT CMPluginBase
{
void tryOpenLog();
@@ -15,7 +13,7 @@ protected:
HANDLE m_hLogger = nullptr;
HINSTANCE m_hInst;
- CMPluginBase(HINSTANCE, const char *moduleName);
+ CMPluginBase(const char *moduleName);
~CMPluginBase();
// pass one of PROTOTYPE_* constants as type
@@ -30,6 +28,7 @@ public:
void debugLogW(LPCWSTR wszFormat, ...);
__forceinline HINSTANCE getInst() const { return m_hInst; }
+ __forceinline void setInst(HINSTANCE hInst) { m_hInst = hInst; }
__forceinline INT_PTR delSetting(const char *name)
{
@@ -172,13 +171,13 @@ template<class T> class PLUGIN : public CMPluginBase
public:
static BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD, LPVOID)
{
- g_hInstance = hInstance;
+ g_plugin.setInst(hInstance);
return TRUE;
}
protected:
PLUGIN(const char *moduleName)
- : CSuper(g_hInstance, moduleName)
+ : CSuper(moduleName)
{}
__forceinline HANDLE CreatePluginEvent(const char *name)
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 4683944b12..7f0eefa35b 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 fe6e27db36..1e1752ad4e 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index 1dacf3112e..a738bbe09b 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -313,9 +313,9 @@ struct CMPluginDropbox : public PLUGIN<CMPluginDropbox>
CMPluginDropbox() :
PLUGIN<CMPluginDropbox>(MODULE "/Dropbox")
{
+ m_hInst = g_plugin.getInst();
+
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit);
}
}
g_pluginDropbox;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPluginDropbox::RawDllMain;
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index 665f5bc511..e3a7a95d15 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -295,8 +295,10 @@ UINT CGDriveService::Upload(FileTransferParam *ftp)
struct CMPluginGoogle : public CMPluginBase
{
CMPluginGoogle() :
- CMPluginBase(g_hInstance, MODULE "/GDrive")
+ CMPluginBase(MODULE "/GDrive")
{
+ m_hInst = g_plugin.getInst();
+
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit);
}
}
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 656ccbdd4b..c4ec053eaa 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -280,8 +280,10 @@ UINT COneDriveService::Upload(FileTransferParam *ftp)
struct CMPluginOnedrive : public CMPluginBase
{
CMPluginOnedrive() :
- CMPluginBase(g_hInstance, MODULE "/OneDrive")
+ CMPluginBase(MODULE "/OneDrive")
{
+ m_hInst = g_plugin.getInst();
+
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit);
}
}
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index 3212814db5..e05f216698 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -290,8 +290,10 @@ UINT CYandexService::Upload(FileTransferParam *ftp)
struct CMPluginYandex : public CMPluginBase
{
CMPluginYandex() :
- CMPluginBase(g_hInstance, MODULE "/YandexDisk")
+ CMPluginBase(MODULE "/YandexDisk")
{
+ m_hInst = g_plugin.getInst();
+
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit);
}
}
diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp
index bb9dd9096c..7f012e1815 100644
--- a/plugins/CloudFile/src/icons.cpp
+++ b/plugins/CloudFile/src/icons.cpp
@@ -11,7 +11,7 @@ static IconItem iconList[] =
void InitializeIcons()
{
- Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
+ Icon_Register(g_plugin.getInst(), "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
}
HANDLE GetIconHandle(int iconId)
diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp
index e9c8a6fdd2..147d477771 100644
--- a/plugins/CloudFile/src/main.cpp
+++ b/plugins/CloudFile/src/main.cpp
@@ -1,7 +1,6 @@
#include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInstance;
PLUGININFOEX pluginInfo =
{
@@ -22,6 +21,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -34,6 +41,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp
index 0e0503f639..cad2bd8651 100644
--- a/plugins/CloudFile/src/oauth.cpp
+++ b/plugins/CloudFile/src/oauth.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread)
- : CDlgBase(g_hInstance, IDD_OAUTH), m_service(service),
+ : CDlgBase(g_plugin.getInst(), IDD_OAUTH), m_service(service),
m_requestAccessTokenThread(requestAccessTokenThread),
m_authorize(this, IDC_OAUTH_AUTHORIZE, authUrl),
m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK)
diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp
index 09fb7df117..88f411646a 100644
--- a/plugins/CloudFile/src/options.cpp
+++ b/plugins/CloudFile/src/options.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COptionsMainDlg::COptionsMainDlg()
- : CPluginDlgBase(g_hInstance, IDD_OPTIONS_MAIN, MODULE),
+ : CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS_MAIN, MODULE),
m_defaultService(this, IDC_DEFAULTSERVICE),
m_doNothingOnConflict(this, IDC_DONOTHINGONCONFLICT),
m_renameOnConflict(this, IDC_RENAMEONCONFLICT),
diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h
index 85ce23b8d7..d475b54c11 100644
--- a/plugins/CloudFile/src/stdafx.h
+++ b/plugins/CloudFile/src/stdafx.h
@@ -41,7 +41,6 @@ class CCloudService;
#include "options.h"
-extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibConnection;
class Exception
@@ -118,4 +117,11 @@ void Report(MCONTACT hContact, const wchar_t *data);
CCloudService* FindService(const char *szProto);
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
+
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index c53ac57712..7b2c7b0fd7 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -1,6 +1,5 @@
#include "stdafx.h"
-HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
//PLUGINLINK *pluginLink=NULL;
@@ -54,12 +53,23 @@ PLUGININFOEX pluginInfo = {
{ 0x4bb5b4aa, 0xc364, 0x4f23, { 0x97, 0x46, 0xd5, 0xb7, 0x8, 0xa2, 0x86, 0xa5 } }
};
+extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
// authentication callback futnction from extension manager
-// ======================================
-//=========================================================================================
-
BOOL strrep(wchar_t *src, wchar_t *needle, wchar_t *newstring)
{
@@ -83,11 +93,6 @@ BOOL strrep(wchar_t *src, wchar_t *needle, wchar_t *newstring)
return TRUE;
}
-extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
void saveSettingsConnections(struct CONNECTION *connHead)
{
char buff[128];
@@ -319,10 +324,10 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
hwnd = GetDlgItem(hwndDlg, IDC_FGCOLOR);
EnableWindow(hwnd, FALSE);
}
- SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_ADD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0));
+ SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0));
// initialise and fill listbox
hwndList = GetDlgItem(hwndDlg, IDC_STATUS);
ListView_DeleteAllItems(hwndList);
@@ -388,7 +393,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
cur->strExtIp[0] = '*';
cur->strIntIp[0] = '*';
- if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
mir_free(cur);
cur = nullptr;
}
@@ -552,7 +557,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
while (pos--) {
cur = cur->next;
}
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur);
fillExceptionsListView(hwndDlg);
ListView_SetItemState(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS), pos1, LVNI_FOCUSED | LVIS_SELECTED, LVNI_FOCUSED | LVIS_SELECTED);
SetFocus(GetDlgItem(hwndDlg, IDC_LIST_EXCEPTIONS));
@@ -585,7 +590,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
int ConnectionNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG);
odp.szTitle.w = _A2W(PLUGINNAME);
odp.szGroup.w = LPGENW("Plugins");
@@ -626,7 +631,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM)
default:
return 0;
}
- return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return (INT_PTR)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
//=======================================================
//SetStatus
@@ -775,7 +780,7 @@ void showMsg(wchar_t *pName, DWORD pid, wchar_t *intIp, wchar_t *extIp, int intP
//MessageBox(NULL,"aaa","aaa",1);
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL;//(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
wchar_t hostName[128];
getDnsName(extIp, hostName, _countof(hostName));
@@ -839,12 +844,6 @@ static int preshutdown(WPARAM, LPARAM)
return 0;
}
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
#ifdef _DEBUG
@@ -878,6 +877,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
WaitForSingleObjectEx(hConnectionCheckThread, INFINITE, FALSE);
@@ -897,17 +898,3 @@ extern "C" int __declspec(dllexport) Unload(void)
#endif
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(PLUGINNAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp
index a9d9774048..faad01bc96 100644
--- a/plugins/ConnectionNotify/src/filter.cpp
+++ b/plugins/ConnectionNotify/src/filter.cpp
@@ -1,7 +1,6 @@
#include "stdafx.h"
HWND filterAddDlg = nullptr;
-extern HINSTANCE g_hInstance;
extern struct CONNECTION *connExceptions;
extern HANDLE hFilterOptionsThread;
extern DWORD FilterOptionsThreadId;
@@ -27,7 +26,7 @@ static unsigned __stdcall filterQueue(void *)
if (msg.message == WM_ADD_FILTER)
{
struct CONNECTION *conn = (struct CONNECTION *)msg.lParam;
- filterAddDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
+ filterAddDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
ShowWindow(filterAddDlg, SW_SHOW);
}
diff --git a/plugins/ConnectionNotify/src/stdafx.h b/plugins/ConnectionNotify/src/stdafx.h
index 32187cefcd..fda6ae7b09 100644
--- a/plugins/ConnectionNotify/src/stdafx.h
+++ b/plugins/ConnectionNotify/src/stdafx.h
@@ -39,6 +39,15 @@
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PLUGINNAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ }
+};
+
void showMsg(wchar_t *pName,DWORD pid,wchar_t *intIp,wchar_t *extIp,int intPort,int extPort,int state);
//int __declspec(dllexport) Load(PLUGINLINK *link);
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index 8c105de7c7..e8d3277e4b 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -23,7 +23,6 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam);
char PLUGINNAME[64] = {0}; //init at init_pluginname();
int hLangpack = 0;
-HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HINSTANCE hLotusDll;
@@ -65,6 +64,7 @@ wchar_t *startuperrors[] = {
LPGENW("In notes.ini file there is no required entry EXTMGR_ADDINS=plugindllnamewithout\".dll\"")
};
+/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -78,9 +78,27 @@ PLUGININFOEX pluginInfo = {
{ 0x23eacc0d, 0xbab0, 0x49c0, { 0x8f, 0x37, 0x5e, 0x25, 0x9e, 0xce, 0x52, 0x7f } } // {23EACC0D-BAB0-49c0-8F37-5E259ECE527F}
};
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
+{
+#ifdef _WIN64
+#error LotusNotify.dll cannot work with 64bit Miranda. (Lotus client is 32bit only)
+#endif
+ return &pluginInfo;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
// authentication callback futnction from extension manager called by nnotes.dll
+
STATUS LNPUBLIC __stdcall EMCallBack (EMRECORD * pData)
{
VARARG_PTR pArgs;
@@ -209,7 +227,7 @@ void init_pluginname()
WIN32_FIND_DATAA ffd;
// Try to find name of the file having original letter sizes
- GetModuleFileNameA(g_hInstance, text, sizeof(text));
+ GetModuleFileNameA(g_plugin.getInst(), text, sizeof(text));
HANDLE hFind = FindFirstFileA(text, &ffd);
if(hFind != INVALID_HANDLE_VALUE) {
@@ -450,7 +468,7 @@ void showMsg(wchar_t* sender,wchar_t* text, DWORD id, char *strUID)
POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
memset(&ppd, 0, sizeof(ppd)); //This is always a good thing to do.
ppd.lchContact = NULL; //(HANDLE)hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON1));
wcscpy_s(ppd.lptzContactName, _countof(ppd.lptzContactName), sender);
wcscpy_s(ppd.lptzText, _countof(ppd.lptzText), text);
if(settingSetColours)
@@ -1453,7 +1471,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARA
int LotusNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Plugins");
odp.szTitle.w = _A2W(__PLUGIN_NAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -1509,7 +1527,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM)
default:
return 0;
}
- return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
+ return (INT_PTR)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
@@ -1700,7 +1718,7 @@ extern "C" int __declspec(dllexport) Load(void)
SET_UID(mi, 0x4519458, 0xb55a, 0x4e22, 0xac, 0x95, 0x5e, 0xa4, 0x4d, 0x92, 0x65, 0x65);
mi.position = -0x7FFFFFFF; //on top menu position
mi.flags = CMIF_UNICODE;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON1));
mi.name.w = LPGENW("&Check Lotus");
mi.pszService = "LotusNotify/MenuCommand"; //service name thet listning for menu call
hMenuHandle = Menu_AddMainMenuItem(&mi); //create menu pos.
@@ -1730,6 +1748,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload()
{
log(L"Unload: start");
@@ -1741,45 +1761,6 @@ extern "C" int __declspec(dllexport) Unload()
log(L"Unload: ok");
logUnregister();
+ ExtClear();
return 0;
}
-
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
-{
-#ifdef _WIN64
-#error LotusNotify.dll cannot work with 64bit Miranda. (Lotus client is 32bit only)
-#endif
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID )
-{
- switch (dwReason) {
- case DLL_PROCESS_ATTACH:
- /* Save the instance handle */
- Plugin_Terminated = false;
- break;
- case DLL_PROCESS_DETACH:
- /* Deregister extension manager callbacks */
- Plugin_Terminated = true;
- ExtClear();
- break;
- }
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(PLUGINNAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/LotusNotify/src/LotusNotify.h b/plugins/LotusNotify/src/LotusNotify.h
index 89b2ff6762..49b0ca4e99 100644
--- a/plugins/LotusNotify/src/LotusNotify.h
+++ b/plugins/LotusNotify/src/LotusNotify.h
@@ -27,3 +27,12 @@ __declspec(dllexport) STATUS LNPUBLIC MainEntryPoint (void);
void ErMsgT(wchar_t* msg);
void checkthread(void*);
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PLUGINNAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ }
+};
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp
index e656206e9f..c2dc409947 100644
--- a/plugins/NewsAggregator/Src/Authentication.cpp
+++ b/plugins/NewsAggregator/Src/Authentication.cpp
@@ -43,7 +43,7 @@ void CreateAuthString(char *auth, MCONTACT hContact, CFeedEditor *pDlg)
}
CAuthRequest::CAuthRequest(CFeedEditor *pDlg, MCONTACT hContact)
- : CSuper(g_hInstance, IDD_AUTHENTICATION),
+ : CSuper(g_plugin.getInst(), IDD_AUTHENTICATION),
m_feedname(this, IDC_FEEDNAME), m_username(this, IDC_FEEDUSERNAME),
m_password(this, IDC_FEEDPASSWORD), m_ok(this, IDOK)
{
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp
index 206238b4bd..7171000a30 100644
--- a/plugins/NewsAggregator/Src/Icons.cpp
+++ b/plugins/NewsAggregator/Src/Icons.cpp
@@ -33,7 +33,7 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(g_hInstance, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
+ Icon_Register(g_plugin.getInst(), LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
}
HICON LoadIconEx(const char *name, bool big)
diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp
index 66f0af69b8..548621b96f 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -19,8 +19,6 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HINSTANCE g_hInstance = nullptr;
-
int hLangpack;
HANDLE hPrebuildMenuHook = nullptr;
CDlgBase *pAddFeedDialog = nullptr, *pImportDialog = nullptr, *pExportDialog = nullptr;
@@ -51,6 +49,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
/////////////////////////////////////////////////////////////////////////////////////////
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
@@ -105,18 +109,3 @@ extern "C" __declspec(dllexport) int Unload(void)
CloseHandle(hUpdateMutex);
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULE)
- {
- RegisterProtocol(PROTOTYPE_VIRTUAL);
- SetUniqueId("URL");
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp
index 4d96fb10e3..ca050741fa 100644
--- a/plugins/NewsAggregator/Src/Options.cpp
+++ b/plugins/NewsAggregator/Src/Options.cpp
@@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
CExportFeed::CExportFeed()
- : CSuper(g_hInstance, IDD_FEEDEXPORT),
+ : CSuper(g_plugin.getInst(), IDD_FEEDEXPORT),
m_feedslist(this, IDC_FEEDSLIST), m_feedsexportlist(this, IDC_FEEDSEXPORTLIST),
m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
m_addallfeeds(this, IDC_ADDALLFEEDS), m_removeallfeeds(this, IDC_REMOVEALLFEEDS),
@@ -251,7 +251,7 @@ void CExportFeed::OnClose()
}
CImportFeed::CImportFeed(CCtrlListView *m_feeds)
- : CSuper(g_hInstance, IDD_FEEDIMPORT),
+ : CSuper(g_plugin.getInst(), IDD_FEEDIMPORT),
m_importfile(this, IDC_IMPORTFILEPATH), m_browsefile(this, IDC_BROWSEIMPORTFILE),
m_feedslist(this, IDC_FEEDSLIST), m_feedsimportlist(this, IDC_FEEDSIMPORTLIST),
m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
@@ -661,7 +661,7 @@ void CImportFeed::OnClose()
}
CFeedEditor::CFeedEditor(int iItem, CCtrlListView *m_feeds, MCONTACT Contact)
- : CSuper(g_hInstance, IDD_ADDFEED),
+ : CSuper(g_plugin.getInst(), IDD_ADDFEED),
m_feedtitle(this, IDC_FEEDTITLE), m_feedurl(this, IDC_FEEDURL),
m_checktime(this, IDC_CHECKTIME), m_checktimespin(this, IDC_TIMEOUT_VALUE_SPIN),
m_checkfeed(this, IDC_DISCOVERY), m_useauth(this, IDC_USEAUTH),
@@ -893,7 +893,7 @@ void COptionsMain::UpdateList()
}
COptionsMain::COptionsMain()
- : CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE),
+ : CPluginDlgBase(g_plugin.getInst(), IDD_OPTIONS, MODULE),
m_feeds(this, IDC_FEEDLIST),
m_add(this, IDC_ADD),
m_change(this, IDC_CHANGE),
@@ -1064,7 +1064,7 @@ void COptionsMain::OnFeedListDoubleClick(CCtrlBase*)
int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szGroup.w = LPGENW("Network");
odp.szTitle.w = LPGENW("News Aggregator");
diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h
index 60c5bcf593..f0f8cd793e 100644
--- a/plugins/NewsAggregator/Src/stdafx.h
+++ b/plugins/NewsAggregator/Src/stdafx.h
@@ -60,7 +60,6 @@ Boston, MA 02111-1307, USA.
#define DEFAULT_AVATARS_FOLDER "NewsAggregator"
#define DEFAULT_UPDATE_TIME 60
-extern HINSTANCE g_hInstance;
extern CDlgBase *pAddFeedDialog, *pImportDialog, *pExportDialog;
extern HNETLIBUSER hNetlibUser;
extern UINT_PTR timerId;
@@ -70,6 +69,16 @@ extern bool ThreadRunning;
extern bool UpdateListFlag;
extern wchar_t tszRoot[MAX_PATH];
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {
+ RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId("URL");
+ }
+};
+
//============ STRUCT USED TO MAKE AN UPDATE LIST ============
struct NEWSCONTACTLIST {
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp
index 5923e9794f..fe21a066f3 100644
--- a/plugins/Non-IM Contact/src/dialog.cpp
+++ b/plugins/Non-IM Contact/src/dialog.cpp
@@ -123,7 +123,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_HELPMSG:
- CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
break;
case IDCANCEL:
@@ -205,13 +205,13 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM)
INT_PTR testStringReplacer(WPARAM, LPARAM)
{
- CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
return 0;
}
INT_PTR LoadFilesDlg(WPARAM, LPARAM)
{
- CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
return 0;
}
@@ -241,7 +241,7 @@ void DoPropertySheet(MCONTACT hContact)
/* contact info */
psp[0].dwSize = sizeof(PROPSHEETPAGE);
psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[0].hInstance = g_hInstance;
+ psp[0].hInstance = g_plugin.getInst();
psp[0].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_INFO);
psp[0].pszIcon = nullptr;
psp[0].pfnDlgProc = DlgProcContactInfo;
@@ -252,7 +252,7 @@ void DoPropertySheet(MCONTACT hContact)
/* other settings */
psp[1].dwSize = sizeof(PROPSHEETPAGE);
psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[1].hInstance = g_hInstance;
+ psp[1].hInstance = g_plugin.getInst();
psp[1].pszTemplate = MAKEINTRESOURCEA(IDD_OTHER_STUFF);
psp[1].pszIcon = nullptr;
psp[1].pfnDlgProc = DlgProcOtherStuff;
@@ -263,7 +263,7 @@ void DoPropertySheet(MCONTACT hContact)
/* copy contact */
psp[2].dwSize = sizeof(PROPSHEETPAGE);
psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[2].hInstance = g_hInstance;
+ psp[2].hInstance = g_plugin.getInst();
psp[2].pszTemplate = MAKEINTRESOURCEA(IDD_CONTACT_COPYEXPORT);
psp[2].pszIcon = nullptr;
psp[2].pfnDlgProc = DlgProcCopy;
@@ -274,7 +274,7 @@ void DoPropertySheet(MCONTACT hContact)
/* files */
psp[3].dwSize = sizeof(PROPSHEETPAGE);
psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
- psp[3].hInstance = g_hInstance;
+ psp[3].hInstance = g_plugin.getInst();
psp[3].pszTemplate = MAKEINTRESOURCEA(IDD_ADD_FILE);
psp[3].pszIcon = nullptr;
psp[3].pfnDlgProc = DlgProcFiles;
@@ -285,7 +285,7 @@ void DoPropertySheet(MCONTACT hContact)
/* propery sheet header.. dont touch !!!! */
PROPSHEETHEADERA psh = { sizeof(psh) };
psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE | PSH_USECALLBACK;
- psh.hInstance = g_hInstance;
+ psh.hInstance = g_plugin.getInst();
psh.pszIcon = MAKEINTRESOURCEA(IDI_MAIN);
if (!db_get_static(hContact, MODNAME, "Nick", nick, _countof(nick))) {
char title[256];
diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp
index 36e2d33361..1a10038b7c 100644
--- a/plugins/Non-IM Contact/src/main.cpp
+++ b/plugins/Non-IM Contact/src/main.cpp
@@ -7,22 +7,8 @@
#include "Version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
int hLangpack;
-PLUGININFOEX pluginInfoEx = {
- sizeof(pluginInfoEx),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- //2e0d2ae3-e123-4607-8539-d4448d675ddb
- { 0x2e0d2ae3, 0xe123, 0x4607, {0x85, 0x39, 0xd4, 0x44, 0x8d, 0x67, 0x5d, 0xdb} }
-};
-
INT_PTR doubleClick(WPARAM wParam, LPARAM)
{
char program[MAX_PATH], params[MAX_PATH];
@@ -63,7 +49,7 @@ int LCStatus = ID_STATUS_OFFLINE;
int NimcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szGroup.a = LPGEN("Plugins");
odp.szTitle.a = LPGEN("Non-IM Contacts");
@@ -77,12 +63,33 @@ int NimcOptInit(WPARAM wParam, LPARAM)
// Returns :
// Description : Sets plugin info
//=====================================================
-//
+
+PLUGININFOEX pluginInfoEx = {
+ sizeof(pluginInfoEx),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ //2e0d2ae3-e123-4607-8539-d4448d675ddb
+ { 0x2e0d2ae3, 0xe123, 0x4607, {0x85, 0x39, 0xd4, 0x44, 0x8d, 0x67, 0x5d, 0xdb} }
+};
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
//=====================================================
@@ -91,12 +98,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
// Returns : BOOL
// Description :
//=====================================================
-//
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
-{
- g_hInstance = hinst;
- return TRUE;
-}
int ModulesLoaded(WPARAM, LPARAM)
{
@@ -104,24 +105,24 @@ int ModulesLoaded(WPARAM, LPARAM)
return 0;
}
-IconItem icoList[] =
-{
- { LPGEN("Main Icon"), MODNAME, IDI_MAIN },
-};
-
//=====================================================
// Name : Load
// Parameters: PLUGINLINK *link
// Returns : int
// Description : Called when plugin is loaded into Miranda
//=====================================================
-//
+
+IconItem icoList[] =
+{
+ { LPGEN("Main Icon"), MODNAME, IDI_MAIN },
+};
+
extern "C" __declspec(dllexport) int Load()
{
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- Icon_Register(g_hInstance, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
+ Icon_Register(g_plugin.getInst(), LPGEN("Non-IM Contact"), icoList, _countof(icoList));
HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
HookEvent(ME_OPT_INITIALISE, NimcOptInit);
@@ -195,23 +196,9 @@ extern "C" __declspec(dllexport) int Load()
// Returns :
// Description : Unloads plugin
//=====================================================
-//
+
extern "C" __declspec(dllexport) int Unload(void)
{
killTimer();
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODNAME)
- {
- RegisterProtocol(PROTOTYPE_VIRTUAL);
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Non-IM Contact/src/stdafx.h b/plugins/Non-IM Contact/src/stdafx.h
index 857bb66680..c8f6738916 100644
--- a/plugins/Non-IM Contact/src/stdafx.h
+++ b/plugins/Non-IM Contact/src/stdafx.h
@@ -68,12 +68,12 @@ struct DLGTEMPLATEEX
//=======================================================
// Defines
//=======================================================
-//General
-extern HINSTANCE g_hInstance;
+// General
+
extern int LCStatus;
extern IconItem icoList[];
-//Services.c
+// Services.c
INT_PTR GetLCCaps(WPARAM wParam,LPARAM lParam);
INT_PTR GetLCName(WPARAM wParam,LPARAM lParam);
INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam);
@@ -108,17 +108,25 @@ void replaceAllStrings(MCONTACT hContact);
void WriteSetting(MCONTACT hContact, char* module1, char* setting1 , char* module12, char* setting2);
//timer.c
-void CALLBACK timerProc();
int startTimer(int interval);
int killTimer();
// http.c
void NetlibInit();
-int InternetDownloadFile (CHAR *szUrl);
+int InternetDownloadFile (char *szUrl);
extern char *szInfo;
extern char *szData;
extern HNETLIBUSER hNetlibUser;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODNAME)
+ {
+ RegisterProtocol(PROTOTYPE_VIRTUAL);
+ }
+};
+
#endif
#pragma comment(lib,"comctl32.lib")
diff --git a/plugins/Quotes/src/CreateFilePath.cpp b/plugins/Quotes/src/CreateFilePath.cpp
index 6c73da75b0..f2a28621fb 100644
--- a/plugins/Quotes/src/CreateFilePath.cpp
+++ b/plugins/Quotes/src/CreateFilePath.cpp
@@ -19,7 +19,7 @@ void prepare_name(tstring& rsName)
tstring CreateFilePath(const tstring& rsName)
{
wchar_t szPath[_MAX_PATH];
- ::GetModuleFileName(g_hInstance, szPath, _MAX_PATH);
+ ::GetModuleFileName(g_plugin.getInst(), szPath, _MAX_PATH);
wchar_t* p = wcsrchr(szPath, '\\');
if (p)
diff --git a/plugins/Quotes/src/CurrencyConverter.cpp b/plugins/Quotes/src/CurrencyConverter.cpp
index bf0550e8e5..39de2a3805 100644
--- a/plugins/Quotes/src/CurrencyConverter.cpp
+++ b/plugins/Quotes/src/CurrencyConverter.cpp
@@ -259,7 +259,7 @@ INT_PTR QuotesMenu_CurrencyConverter(WPARAM, LPARAM)
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), nullptr, CurrencyConverterDlgProc, 0);
+ else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CURRENCY_CONVERTER), nullptr, CurrencyConverterDlgProc, 0);
return 0;
}
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp
index c1f6625f62..0c26e4f717 100644
--- a/plugins/Quotes/src/Forex.cpp
+++ b/plugins/Quotes/src/Forex.cpp
@@ -4,7 +4,6 @@
#include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInstance = nullptr;
HANDLE g_hEventWorkThreadStop;
//int g_nStatus = ID_STATUS_OFFLINE;
bool g_bAutoUpdate = true;
@@ -25,20 +24,6 @@ HANDLE g_hTBButton;
LPSTR g_pszAutoUpdateCmd = "Quotes/Enable-Disable Auto Update";
LPSTR g_pszCurrencyConverter = "Quotes/CurrencyConverter";
-PLUGININFOEX Global_pluginInfo =
-{
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {E882056D-0D1D-4131-9A98-404CBAEA6A9C}
- { 0xe882056d, 0xd1d, 0x4131, { 0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c } }
-};
-
void UpdateMenu(bool bAutoUpdate)
{
if (bAutoUpdate) // to enable auto-update
@@ -276,7 +261,7 @@ int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 910000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = _T(QUOTES_PROTOCOL_NAME);
odp.szGroup.w = LPGENW("Network");
odp.flags = ODPF_USERINFOTAB | ODPF_UNICODE;
@@ -290,13 +275,39 @@ inline int Quotes_UnhookEvent(HANDLE h)
return UnhookEvent(h);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX Global_pluginInfo =
+{
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {E882056D-0D1D-4131-9A98-404CBAEA6A9C}
+ { 0xe882056d, 0xd1d, 0x4131, { 0x9a, 0x98, 0x40, 0x4c, 0xba, 0xea, 0x6a, 0x9c } }
+};
+
EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &Global_pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C int __declspec(dllexport) Load(void)
{
mir_getLP(&Global_pluginInfo);
@@ -321,26 +332,12 @@ EXTERN_C int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
EXTERN_C __declspec(dllexport) int Unload(void)
{
WaitForWorkingThreads();
::CloseHandle(g_hEventWorkThreadStop);
-
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME)
- {
- RegisterProtocol(PROTOTYPE_VIRTUAL);
- SetUniqueId(DB_STR_QUOTE_SYMBOL);
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp
index 60a7880328..cd2eac896e 100644
--- a/plugins/Quotes/src/IconLib.cpp
+++ b/plugins/Quotes/src/IconLib.cpp
@@ -18,7 +18,7 @@ static IconItem iconList[] =
void Quotes_IconsInit()
{
- ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
+ ::Icon_Register(g_plugin.getInst(), QUOTES_PROTOCOL_NAME, iconList, _countof(iconList), QUOTES_PROTOCOL_NAME);
}
HICON Quotes_LoadIconEx(int iconId, bool bBig /*= false*/)
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp
index 4a9922e76b..482597d12a 100644
--- a/plugins/Quotes/src/QuoteInfoDlg.cpp
+++ b/plugins/Quotes/src/QuoteInfoDlg.cpp
@@ -108,7 +108,7 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp)
g_hContact = hContact;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = QuoteInfoDlgProc;
odp.position = -2000000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_QUOTE_INFO);
@@ -221,7 +221,7 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/)
SetFocus(hWnd);
}
else if (true == IsMyContact(hContact))
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact));
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), nullptr, QuoteInfoDlgProc1, LPARAM(hContact));
return 1;
}
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp
index e9595d65d6..a3d7fb8aaf 100644
--- a/plugins/Quotes/src/SettingsDlg.cpp
+++ b/plugins/Quotes/src/SettingsDlg.cpp
@@ -110,7 +110,7 @@ void select_log_file(HWND hDlg)
ofn.nMaxFile = (DWORD)aFileBuffer.size();
ofn.lpstrFilter = pszFilter;
ofn.nFilterIndex = 1;
- ofn.hInstance = g_hInstance;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrDefExt = L"log";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
@@ -351,7 +351,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L
pParam->m_pPopupSettings->InitForContact(pParam->m_hContact);
}
- DialogBoxParam(g_hInstance,
+ DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_POPUP),
hWnd,
EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pParam->m_pPopupSettings));
@@ -470,7 +470,7 @@ void ShowSettingsDlg(MCONTACT hContact)
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
- else CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), nullptr, EditSettingsPerContactDlgProc, LPARAM(hContact));
+ else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_SETTINGS), nullptr, EditSettingsPerContactDlgProc, LPARAM(hContact));
}
//////////////////////////////////////////////////////////////////////////
@@ -623,7 +623,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp,
case IDC_BUTTON_POPUP_SETTINGS:
const CAdvProviderSettings* pAdvSettings = reinterpret_cast<CAdvProviderSettings*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
- DialogBoxParam(g_hInstance,
+ DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_POPUP),
hWnd,
EditPopupSettingsDlgProc, reinterpret_cast<LPARAM>(pAdvSettings->GetPopupSettingsPtr()));
@@ -948,7 +948,7 @@ bool ShowSettingsDlg(HWND hWndParent, CAdvProviderSettings* pAdvSettings)
{
assert(pAdvSettings);
- return (IDOK == DialogBoxParam(g_hInstance,
+ return (IDOK == DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_PROVIDER_ADV_SETTINGS),
hWndParent,
EditSettingsPerProviderDlgProc,
diff --git a/plugins/Quotes/src/WinCtrlHelper.cpp b/plugins/Quotes/src/WinCtrlHelper.cpp
index 78be2d2ced..300612dcf1 100644
--- a/plugins/Quotes/src/WinCtrlHelper.cpp
+++ b/plugins/Quotes/src/WinCtrlHelper.cpp
@@ -32,7 +32,7 @@ static INT_PTR CALLBACK VariableListDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPAR
void show_variable_list(HWND hwndParent, const IQuotesProvider* pProvider)
{
- ::DialogBoxParam(g_hInstance,
+ ::DialogBoxParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_DIALOG_VARIABLE_LIST),
hwndParent,
VariableListDlgProc,
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h
index abdfcb6ea4..5f9f29486d 100644
--- a/plugins/Quotes/src/stdafx.h
+++ b/plugins/Quotes/src/stdafx.h
@@ -117,4 +117,12 @@ inline tstring quotes_a2t(const char* s)
#include "IXMLEngine.h"
#include "XMLEngineMI.h"
-extern HINSTANCE g_hInstance;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(QUOTES_PROTOCOL_NAME)
+ {
+ RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId(DB_STR_QUOTE_SYMBOL);
+ }
+};
diff --git a/plugins/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp
index e802790da2..1290400046 100644
--- a/plugins/StartPosition/src/main.cpp
+++ b/plugins/StartPosition/src/main.cpp
@@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CMPlugin g_plugin;
HINSTANCE g_hInstance;
int hLangpack;
@@ -45,8 +44,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
@@ -56,6 +61,8 @@ extern "C" __declspec(dllexport) int Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h
index a6e0354d14..26c46861ea 100644
--- a/plugins/Weather/src/stdafx.h
+++ b/plugins/Weather/src/stdafx.h
@@ -351,7 +351,6 @@ typedef struct DATALIST WIDATALIST;
extern WIDATALIST *WIHead, *WITail;
-extern HINSTANCE g_hInstance;
extern HWND hPopupWindow, hWndSetup;
extern MYOPTIONS opt;
@@ -518,3 +517,17 @@ void InitIcons(void);
HICON LoadIconEx(const char* name, bool big);
HANDLE GetIconHandle(const char* name);
void ReleaseIconEx(HICON hIcon);
+
+//============ Plugin Class ============
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(WEATHERPROTONAME)
+ {
+ opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
+ RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
+ SetUniqueId("ID");
+ }
+};
+
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index afa14ccf0c..55c5b92c25 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -31,7 +31,6 @@ belong to any other file.
WIDATALIST *WIHead;
WIDATALIST *WITail;
-HINSTANCE g_hInstance;
HWND hPopupWindow;
HANDLE hHookWeatherUpdated;
@@ -59,6 +58,12 @@ BOOL ModuleLoaded;
HANDLE hTBButton = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// plugin info
static const PLUGININFOEX pluginInfoEx =
@@ -204,7 +209,7 @@ extern "C" int __declspec(dllexport) Load(void)
wchar_t SvcFunc[100];
mir_snwprintf(SvcFunc, L"%s__PopupWindow", _A2W(WEATHERPROTONAME));
hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr);
+ CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
return 0;
}
@@ -233,19 +238,3 @@ extern "C" int __declspec(dllexport) Unload(void)
CloseHandle(hUpdateMutex);
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(WEATHERPROTONAME)
- {
- opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
- RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
- SetUniqueId("ID");
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp
index 87a9374cbd..45afe6cfcd 100644
--- a/plugins/Weather/src/weather_addstn.cpp
+++ b/plugins/Weather/src/weather_addstn.cpp
@@ -200,7 +200,7 @@ INT_PTR WeatherCreateAdvancedSearchUI(WPARAM, LPARAM lParam)
{
HWND parent = (HWND)lParam;
if (parent)
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SEARCHCITY), parent, WeatherSearchAdvancedDlgProc, 0);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCHCITY), parent, WeatherSearchAdvancedDlgProc, 0);
return 0;
}
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp
index e685f3d4de..2348e9b69b 100644
--- a/plugins/Weather/src/weather_contacts.cpp
+++ b/plugins/Weather/src/weather_contacts.cpp
@@ -418,7 +418,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM)
else {
// if the dialog box is not opened, open a new one
if (IsMyContact(wParam))
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
}
return 0;
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp
index de876f00c1..cb11cd0232 100644
--- a/plugins/Weather/src/weather_icons.cpp
+++ b/plugins/Weather/src/weather_icons.cpp
@@ -39,7 +39,7 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
+ Icon_Register(g_plugin.getInst(), WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
}
HICON LoadIconEx(const char* name, bool big)
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp
index 7e79387f55..994f80ce11 100644
--- a/plugins/Weather/src/weather_ini.cpp
+++ b/plugins/Weather/src/weather_ini.cpp
@@ -518,7 +518,7 @@ bool LoadWIData(bool dial)
if (WIHead == nullptr) {
// no ini found, display an error message box.
if (dial)
- hWndSetup = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
+ hWndSetup = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
else
MessageBox(nullptr,
TranslateT("No update data file is found. Please check your Plugins\\Weather directory."),
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp
index 0775bcfff6..5b0eeee3d7 100644
--- a/plugins/Weather/src/weather_mwin.cpp
+++ b/plugins/Weather/src/weather_mwin.cpp
@@ -48,7 +48,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
data->hContact = (DWORD_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD,
- 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, g_hInstance, nullptr);
+ 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, g_plugin.getInst(), nullptr);
if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact);
break;
@@ -238,7 +238,7 @@ static void addWindow(MCONTACT hContact)
db_free(&dbv);
HWND hWnd = CreateWindow(L"WeatherFrame", L"", WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, nullptr, g_hInstance, (void*)hContact);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, g_plugin.getInst(), (void*)hContact);
WindowList_Add(hMwinWindowList, hWnd, hContact);
CLISTFrame Frame = { 0 };
@@ -308,7 +308,7 @@ void InitMwin(void)
wndclass.lpfnWndProc = wndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInstance;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
@@ -362,7 +362,7 @@ void DestroyMwin(void)
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
}
- UnregisterClass(L"WeatherFrame", g_hInstance);
+ UnregisterClass(L"WeatherFrame", g_plugin.getInst());
WindowList_Destroy(hMwinWindowList);
UnhookEvent(hFontHook);
}
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index 981b8e9f3e..0d611997e2 100644
--- a/plugins/Weather/src/weather_opt.cpp
+++ b/plugins/Weather/src/weather_opt.cpp
@@ -483,7 +483,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
// display the menu
button = GetDlgItem(hdlg, LOWORD(wParam));
GetWindowRect(button, &pos);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TMMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TMMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
@@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
// left click action selection menu
button = GetDlgItem(hdlg, IDC_RESET);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
switch (TrackPopupMenu(hMenu1, TPM_LEFTBUTTON | TPM_RETURNCMD, pos.left, pos.bottom, 0, hdlg, nullptr)) {
@@ -571,7 +571,7 @@ static INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM l
int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
// plugin options
odp.position = 95600;
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index 32d0969307..d40cc5e99f 100644
--- a/plugins/Weather/src/weather_popup.cpp
+++ b/plugins/Weather/src/weather_popup.cpp
@@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
SaveOptions();
// click actions
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.LeftClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_LeftClick, TranslateW(str));
@@ -330,7 +330,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
button = GetDlgItem(hdlg, IDC_RightClick);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.RightClickAction);
@@ -339,7 +339,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
opt.RightClickAction = ID;
DestroyMenu(hMenu);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.RightClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_RightClick, TranslateW(str));
@@ -351,7 +351,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
button = GetDlgItem(hdlg, IDC_LeftClick);
GetWindowRect(button, &pos);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
TranslateMenu(hMenu1);
SelectMenuItem(hMenu1, opt.LeftClickAction);
@@ -359,7 +359,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
if (ID) opt.LeftClickAction = ID;
DestroyMenu(hMenu);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_PMENU));
hMenu1 = GetSubMenu(hMenu, 0);
GetMenuString(hMenu1, opt.LeftClickAction, str, _countof(str), MF_BYCOMMAND);
SetDlgItemText(hdlg, IDC_LeftClick, TranslateW(str));
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index 694b03b068..d18c2ace97 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -143,7 +143,7 @@ static INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, L
GetWindowRect(hList, &rc);
ListView_SetColumnWidth(hList, 1, ListView_GetColumnWidth(hList, 1) + (int)LOWORD(lParam) - (rc.right - rc.left));
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
}
break;
@@ -294,7 +294,7 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
case IDC_MOREDETAIL:
HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
if (hMoreDataDlg == nullptr)
- hMoreDataDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
+ hMoreDataDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
else {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
@@ -314,7 +314,7 @@ static INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
int UserInfoInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.position = 100000000;
odp.szTitle.a = WEATHERPROTONAME;
@@ -348,7 +348,7 @@ int BriefInfo(WPARAM wParam, LPARAM)
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else hMoreDataDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
+ else hMoreDataDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 0);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 1);
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp
index 978e938e0a..4a99ab3cd4 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -43,7 +43,13 @@ PLUGININFOEX pluginInfoEx = {
{0xcd5427fb, 0x5320, 0x4f65, {0xb4, 0xbf, 0x86, 0xb7, 0xcf, 0x7b, 0x50, 0x87}}
};
-/*****************************************************************************/
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfoEx;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void InitServices()
{
CreateProtoServiceFunction(MODULENAME, PS_GETCAPS, GetCaps);
@@ -56,7 +62,8 @@ void InitServices()
CreateProtoServiceFunction(MODULENAME, PSS_GETINFO, GetInfo);
}
-/*****************************************************************************/
+/////////////////////////////////////////////////////////////////////////////////////////
+
void ChangeContactStatus(int con_stat)
{
WORD status_code = 0;
@@ -73,55 +80,25 @@ void ChangeContactStatus(int con_stat)
db_set_w(hContact, MODULENAME, "Status", status_code);
}
-/*****************************************************************************/
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfoEx;
-}
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-/*****************************************************************************/
-extern "C" int __declspec(dllexport) Unload(void)
-{
- ChangeContactStatus(0);
+/////////////////////////////////////////////////////////////////////////////////////////
- KillTimer(nullptr, timerId);
- KillTimer(nullptr, Countdown);
+CMPlugin g_plugin;
- db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
- SavewinSettings();
- if (hRichEd)
- FreeLibrary(hRichEd);
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
- if (hNetlibUser) {
- Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = nullptr;
- }
-
- if (hHookDisplayDataAlert)
- DestroyHookableEvent(hHookDisplayDataAlert);
- if (hHookAlertPopup)
- DestroyHookableEvent(hHookAlertPopup);
- if (hHookAlertWPopup)
- DestroyHookableEvent(hHookAlertWPopup);
-
- if (h_font != nullptr)
- DeleteObject(h_font);
- if (hMenu)
- DestroyMenu(hMenu);
- WindowList_Destroy(hWindowList);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-/*****************************************************************************/
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfoEx);
HookEvent(ME_CLIST_DOUBLECLICKED, Doubleclick);
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
hRichEd = LoadLibrary(L"Msftedit.dll");
/*TIMERS*/
@@ -164,7 +141,7 @@ extern "C" int __declspec(dllexport) Load()
/*DISABLE WEBVIEW*/
SET_UID(mi, 0xdedeb697, 0xfc10, 0x4622, 0x8b, 0x97, 0x74, 0x39, 0x32, 0x68, 0xa7, 0x7b);
CreateServiceFunction("DisableWebview", AutoUpdateMCmd);
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
mi.name.w = LPGENW("Auto update disabled");
else
@@ -176,7 +153,7 @@ extern "C" int __declspec(dllexport) Load()
SET_UID(mi, 0xf324ede, 0xfdf, 0x498a, 0x8f, 0x49, 0x6d, 0x2a, 0x9f, 0xda, 0x58, 0x6);
CreateServiceFunction("UpdateAll", UpdateAllMenuCommand);
mi.position = 500090002;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = LPGENW("Update all Webview sites");
mi.pszService = "UpdateAll";
Menu_AddMainMenuItem(&mi);
@@ -185,7 +162,7 @@ extern "C" int __declspec(dllexport) Load()
SET_UID(mi, 0x1fa5fa21, 0x2ee1, 0x4372, 0xae, 0x3e, 0x3b, 0x96, 0xac, 0xd, 0xe8, 0x49);
CreateServiceFunction("MarkAllSitesRead", MarkAllReadMenuCommand);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MARKALLREAD));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MARKALLREAD));
mi.name.w = LPGENW("Mark all Webview sites as read");
mi.pszService = "MarkAllSitesRead";
Menu_AddMainMenuItem(&mi);
@@ -194,7 +171,7 @@ extern "C" int __declspec(dllexport) Load()
SET_UID(mi, 0xfed046a8, 0xaae5, 0x4cbe, 0xa8, 0xc, 0x3c, 0x50, 0x3e, 0x3e, 0x9b, 0x15);
CreateServiceFunction("OpenCacheFolder", OpenCacheDir);
mi.position = 500090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FOLDER));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FOLDER));
mi.name.w = LPGENW("Open cache folder");
mi.pszService = "OpenCacheFolder";
Menu_AddMainMenuItem(&mi);
@@ -206,7 +183,7 @@ extern "C" int __declspec(dllexport) Load()
wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
mi.pszService = "Countdown";
hMenuItemCountdown = Menu_AddMainMenuItem(&mi);
@@ -218,7 +195,7 @@ extern "C" int __declspec(dllexport) Load()
SET_UID(mi, 0xadc6a9a4, 0xdf7, 0x4f63, 0x89, 0x11, 0x8e, 0x42, 0x1d, 0xd6, 0x29, 0x31);
CreateServiceFunction("Open web page", WebsiteMenuCommand);
mi.position = 100;
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_URL));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_URL));
mi.pszService = "Open web page";
mi.name.w = LPGENW("Open web page");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -226,42 +203,42 @@ extern "C" int __declspec(dllexport) Load()
SET_UID(mi, 0x9d803e61, 0xc929, 0x4c6e, 0x9e, 0x7, 0x93, 0x0, 0xab, 0x14, 0x13, 0x50);
CreateServiceFunction("OpenClose Window", DataWndMenuCommand);
mi.pszService = "OpenClose Window";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SHOW_HIDE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SHOW_HIDE));
mi.name.w = LPGENW("Open/Close window");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x3840cc71, 0xcc85, 0x448d, 0xb5, 0xc8, 0x1a, 0x7d, 0xfe, 0xf0, 0x8, 0x85);
mi.position = 2222220;
mi.pszService = "UpdateData";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATE));
mi.name.w = LPGENW("Update data");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xd1ab586c, 0x2c71, 0x429c, 0xb1, 0x79, 0x7b, 0x3a, 0x1d, 0x4a, 0xc1, 0x7d);
CreateServiceFunction("ContactOptions", CntOptionsMenuCommand);
mi.pszService = "ContactOptions";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS));
mi.name.w = LPGENW("Contact options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0xe4cda597, 0x9def, 0x4f54, 0x8a, 0xc6, 0x69, 0x3b, 0x5a, 0x7d, 0x77, 0xb6);
CreateServiceFunction("ContactAlertOpts", CntAlertMenuCommand);
mi.pszService = "ContactAlertOpts";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT));
mi.name.w = LPGENW("Contact alert options");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x63fdeed8, 0xf880, 0x423f, 0x95, 0xae, 0x20, 0x8c, 0x86, 0x3c, 0x5, 0xd8);
CreateServiceFunction("PingWebsite", PingWebsiteMenuCommand);
mi.pszService = "PingWebsite";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_PING));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PING));
mi.name.w = LPGENW("Ping web site");
Menu_AddContactMenuItem(&mi, MODULENAME);
SET_UID(mi, 0x28fd36de, 0x6ce1, 0x43d0, 0xa1, 0x6e, 0x98, 0x71, 0x53, 0xe8, 0xc9, 0xf4);
CreateServiceFunction("StopDataProcessing", StpPrcssMenuCommand);
mi.pszService = "StopDataProcessing";
- mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_STOP));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STOP));
mi.name.w = LPGENW("Stop data processing");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -277,15 +254,34 @@ extern "C" int __declspec(dllexport) Load()
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public PLUGIN<CMPlugin>
+extern "C" int __declspec(dllexport) Unload(void)
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- SetUniqueId("PreserveName");
+ ChangeContactStatus(0);
+
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
+
+ db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
+ SavewinSettings();
+ if (hRichEd)
+ FreeLibrary(hRichEd);
+
+ if (hNetlibUser) {
+ Netlib_CloseHandle(hNetlibUser);
+ hNetlibUser = nullptr;
}
-}
- g_plugin;
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+ if (hHookDisplayDataAlert)
+ DestroyHookableEvent(hHookDisplayDataAlert);
+ if (hHookAlertPopup)
+ DestroyHookableEvent(hHookAlertPopup);
+ if (hHookAlertWPopup)
+ DestroyHookableEvent(hHookAlertWPopup);
+
+ if (h_font != nullptr)
+ DeleteObject(h_font);
+ if (hMenu)
+ DestroyMenu(hMenu);
+ WindowList_Destroy(hWindowList);
+ return 0;
+}
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index be2b8635bc..1206e4774f 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -38,7 +38,6 @@ UINT_PTR Countdown;
LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
-HINSTANCE g_hInstance;
HMENU hMenu;
int bpStatus;
HGENMENU hMenuItem1;
@@ -54,14 +53,14 @@ void ChangeMenuItem1()
else
ptszName = LPGENW("Auto update disabled");
- Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
+ Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)));
}
/*****************************************************************************/
void ChangeMenuItemCountdown()
{
// countdown
- HICON hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
+ HICON hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATEALL));
wchar_t countername[100];
mir_snwprintf(countername, TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
@@ -185,9 +184,9 @@ int Doubleclick(WPARAM wParam, LPARAM)
SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
@@ -293,7 +292,7 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD)
static int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = MODULENAME;
@@ -368,8 +367,8 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
}
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
@@ -474,7 +473,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +488,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h
index c9bfd998a4..2f8304f051 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -101,7 +101,6 @@
#define RCLK_WINDOW_KEY "RightClkWindow"
#define RCLK_WEB_PGE_KEY "RightClkWebPage"
#define RCLK_DISMISS_KEY "RightClkDismiss"
-//#define INBUILTPOP_KEY "UseInbuiltPopupAlert"
#define TIME 60
#define Def_color_bg 0x00ffffff
@@ -117,7 +116,9 @@
#define Def_win_height 152
#define Def_win_width 250
-//lets get rid of some warnings
+/////////////////////////////////////////////////////////////////////////////////////////
+// lets get rid of some warnings
+
void CodetoSymbol(char *truncated);
void GetData(void *param);
void FillFontListThread(void *);
@@ -133,9 +134,8 @@ int OSDAlert(WPARAM wParam, LPARAM lParam);
void ReadFromFile(void *hContact);
-/*
- * some globals for window settings
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// some globals for window settings
extern int Xposition, Yposition, WindowHeight, WindowWidth;
extern COLORREF BackgoundClr, TextClr;
@@ -150,7 +150,9 @@ extern MWindowList hWindowList;
extern HGENMENU hMenuItem1, hMenuItemCountdown;
extern char optionsname[80];
-//lets get rid of some warnings
+/////////////////////////////////////////////////////////////////////////////////////////
+// lets get rid of some warnings
+
void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD);
void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD);
void SavewinSettings(void);
@@ -164,7 +166,9 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam);
int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgbBack);
-//Services
+/////////////////////////////////////////////////////////////////////////////////////////
+// Services
+
INT_PTR GetCaps(WPARAM wParam, LPARAM lParam);
INT_PTR GetName(WPARAM wParam, LPARAM lParam);
INT_PTR BPLoadIcon(WPARAM wParam, LPARAM lParam); // BPLoadIcon
@@ -183,23 +187,21 @@ INT_PTR CountdownMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR MarkAllReadMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR AddContactMenuCommand(WPARAM wParam, LPARAM lParam);
-INT_PTR ContactOptionsMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM lParam);
-INT_PTR ShowHideContactCommand(WPARAM wParam, LPARAM lParam);
INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam);
INT_PTR StpPrcssMenuCommand(WPARAM wParam, LPARAM lParam);
int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, MCONTACT singlecontact);
int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, MCONTACT singlecontact);
-//
+/////////////////////////////////////////////////////////////////////////////////////////
void ChangeContactStatus(int con_stat);
void InitialiseGlobals(void);
void FontSettings(void);
-///
+/////////////////////////////////////////////////////////////////////////////////////////
void Removewhitespace(char *truncated);
void RemoveInvis(char *truncated, int AmountWspcRem);
@@ -227,7 +229,7 @@ int SiteDeleted(WPARAM wParam, LPARAM lParam);
int WErrorPopup(MCONTACT hContact, wchar_t *textdisplay);
int WAlertPopup(MCONTACT hContact, wchar_t *displaytext);
-//////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// wrappers
extern HANDLE hHookDisplayDataAlert;
@@ -241,3 +243,16 @@ extern HANDLE hHookErrorPopup;
extern HANDLE hHookAlertOSD;
#define ME_OSD_ALERT "Miranda/ALERT/OSD"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("PreserveName");
+ }
+};
+
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index a21b19f693..0610c9be34 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -122,7 +122,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam)
else mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
ppd.lchContact = wParam;
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
wchar_t *displaytext = (wchar_t*)lParam;
if ((mir_wstrlen(displaytext) == MAX_SECONDLINE) || (mir_wstrlen(displaytext) > MAX_SECONDLINE))
@@ -413,7 +413,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
else if (eventIndex == 1) { // webpage changed
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -625,7 +625,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -763,9 +763,9 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM)
if ( WindowList_Find(hWindowList, hContact))
return 0;
- HWND hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index 425b43e7ae..f4159e24f3 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -39,7 +39,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SetWindowText(hwndDlg, TranslateT("Find"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FIND)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FIND)));
return TRUE;
case WM_COMMAND:
@@ -175,36 +175,36 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
else preservename[0] = 0;
SetWindowTextA(hwndDlg, preservename);
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE)));
// //////
COLORREF colour = BackgoundClr;
COLORREF txtcolor;
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_SETBKGNDCOLOR, 0, colour);
- SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_UPDATE_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Update data"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Find"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Contact options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Alert options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STOP, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stop processing"), BATF_UNICODE);
SendDlgItemMessage(hwndDlg, IDC_OPEN_URL, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Click here to open this URL in a browser window."), BATF_UNICODE);
if (!db_get_b(hContact2, MODULENAME, ON_TOP_KEY, 0)) {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stick to the front"), BATF_UNICODE);
}
else {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Disable stick to the front"), BATF_UNICODE);
}
@@ -368,7 +368,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
hTopmost = HWND_TOPMOST;
ptszToolTip = TranslateT("Disable stick to the front");
}
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BUTTONADDTOOLTIP, (WPARAM)ptszToolTip, BATF_UNICODE);
SetWindowPos(hwndDlg, hTopmost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
}
@@ -376,7 +376,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_FIND_BUTTON:
{
- HWND hwndFind = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
+ HWND hwndFind = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
ShowWindow(hwndFind, SW_SHOW);
EnableWindow(GetDlgItem(hwndDlg, IDC_FIND_BUTTON), 0);
}
@@ -384,7 +384,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_OPTIONS_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- ContactHwnd = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
+ ContactHwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
ShowWindow(ContactHwnd, SW_SHOW);
SetActiveWindow(ContactHwnd);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTIONS_BUTTON), 0);
@@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDC_ALERT_BUTTON:
if (hContact = FindContactByUrl(hwndDlg)) {
- HWND hwndAlertOpt = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
+ HWND hwndAlertOpt = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
ShowWindow(hwndAlertOpt, SW_SHOW);
SetActiveWindow(hwndAlertOpt);
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_BUTTON), 0);
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
InvalidateRect(hwndDlg, nullptr, TRUE);
// global
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index 348185a01d..7cbcebb0c0 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -207,7 +207,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
}
ppd.lchContact = NULL;
mir_wstrcpy(ppd.lptzContactName, _A2W(MODULENAME));
- ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_SITE));
mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
@@ -279,7 +279,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SetWindowText(hwndDlg, TranslateT("Alert options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ALERT)));
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
@@ -819,7 +819,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowText(hwndDlg, TranslateT("Contact options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_OPTIONS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 277683ea74..0784da7750 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -80,7 +80,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -118,7 +118,7 @@ int SiteDeleted(WPARAM wParam, LPARAM)
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -143,7 +143,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM)
{
//GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH];
- GetModuleFileName(g_hInstance, cachepath, _countof(cachepath));
+ GetModuleFileName(g_plugin.getInst(), cachepath, _countof(cachepath));
wchar_t *cacheend = wcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
@@ -292,7 +292,7 @@ INT_PTR BPLoadIcon(WPARAM wParam, LPARAM)
default:
return 0;
}
- return (INT_PTR)LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
+ return (INT_PTR)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON,
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp
index 7b84b15c44..894b0bace0 100644
--- a/plugins/YAMN/src/browser/badconnect.cpp
+++ b/plugins/YAMN/src/browser/badconnect.cpp
@@ -220,7 +220,7 @@ void __cdecl BadConnection(void *Param)
SetEvent(MyParam.ThreadRunningEV);
__try {
- hBadConnect = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
+ hBadConnect = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3));
#ifdef DEBUG_SYNCHRO
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp
index 7ecab8374d..60ca3431e3 100644
--- a/plugins/YAMN/src/browser/mailbrowser.cpp
+++ b/plugins/YAMN/src/browser/mailbrowser.cpp
@@ -1604,7 +1604,7 @@ void __cdecl ShowEmailThread(void *Param)
}
else {
CREADTEVIEWMESSAGEWINDOW:
- MyParam.mail->MsgWindow = CreateDialogParamW(g_hInstance, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam);
+ MyParam.mail->MsgWindow = CreateDialogParamW(g_plugin.getInst(), MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam);
WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow);
MSG msg;
while (GetMessage(&msg, nullptr, 0, 0)) {
@@ -2318,7 +2318,7 @@ void __cdecl MailBrowser(void *Param)
WndFound = TRUE;
if ((hMailBrowser == nullptr) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) {
- hMailBrowser = CreateDialogParamW(g_hInstance, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam);
+ hMailBrowser = CreateDialogParamW(g_plugin.getInst(), MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam);
Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2));
MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE);
}
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp
index 7491051500..53ff5dbf6a 100644
--- a/plugins/YAMN/src/main.cpp
+++ b/plugins/YAMN/src/main.cpp
@@ -23,7 +23,6 @@ int YAMN_STATUS;
BOOL UninstallPlugins;
HANDLE hAccountFolder;
-HINSTANCE g_hInstance;
HINSTANCE *hDllPlugins;
static int iDllPlugins = 0;
@@ -70,6 +69,12 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath)
/////////////////////////////////////////////////////////////////////////////////////////
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
@@ -163,7 +168,7 @@ static IconItem iconList[] =
void LoadIcons()
{
- Icon_Register(g_hInstance, "YAMN", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "YAMN", iconList, _countof(iconList));
}
HANDLE WINAPI g_GetIconHandle(int idx)
@@ -354,18 +359,3 @@ extern "C" int __declspec(dllexport) Unload(void)
delete[] CodePageNamesSupp;
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(YAMN_DBMODULE)
- {
- RegisterProtocol(PROTOTYPE_VIRTUAL);
- SetUniqueId("Id");
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
index 405e27ab4a..f4ca57cb49 100644
--- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp
+++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp
@@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM)
int YAMNOptInitSvc(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = LPGEN("YAMN");
odp.flags = ODPF_BOLDGROUPS;
@@ -809,7 +809,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case IDC_BTNSTATUS:
- DialogBoxParamW(g_hInstance, MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
+ DialogBoxParamW(g_plugin.getInst(), MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
break;
case IDC_BTNADD:
diff --git a/plugins/YAMN/src/stdafx.h b/plugins/YAMN/src/stdafx.h
index 55af23dff3..eb842b2efa 100644
--- a/plugins/YAMN/src/stdafx.h
+++ b/plugins/YAMN/src/stdafx.h
@@ -43,8 +43,17 @@
#include "proto/pop3/pop3comm.h"
#include "proto/pop3/pop3opt.h"
-
-//From services.cpp
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(YAMN_DBMODULE)
+ {
+ RegisterProtocol(PROTOTYPE_VIRTUAL);
+ SetUniqueId("Id");
+ }
+};
+
+// From services.cpp
void CreateServiceFunctions(void);
void HookEvents(void);
void RefreshContact(void);
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp
index 3b50bc946b..c0c06bb5cc 100644
--- a/protocols/Discord/src/main.cpp
+++ b/protocols/Discord/src/main.cpp
@@ -17,20 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CMPlugin g_plugin;
CHAT_MANAGER *pci;
-HINSTANCE g_hInstance;
int hLangpack = 0;
HWND g_hwndHeartbeat;
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
-IconItem g_iconList[] =
-{
- { LPGEN("Main icon"), "main", IDI_MAIN },
- { LPGEN("Group chats"), "groupchat", IDI_GROUPCHAT }
-};
-
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -44,12 +34,18 @@ PLUGININFOEX pluginInfo = {
{ 0x88928401, 0x2ce8, 0x4568, { 0xaa, 0xa7, 0x22, 0x61, 0x41, 0x87, 0x0c, 0xbf } }
};
- extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -57,6 +53,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
+IconItem g_iconList[] =
+{
+ { LPGEN("Main icon"), "main", IDI_MAIN },
+ { LPGEN("Group chats"), "groupchat", IDI_GROUPCHAT }
+};
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -64,7 +66,7 @@ extern "C" int __declspec(dllexport) Load(void)
g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
- Icon_Register(g_hInstance, "Discord", g_iconList, _countof(g_iconList));
+ Icon_Register(g_plugin.getInst(), "Discord", g_iconList, _countof(g_iconList));
return 0;
}
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index c3cd1eda57..f15f31bb1b 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -164,7 +164,7 @@ static INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
HWND CDiscordProto::CreateExtendedSearchUI(HWND hwndParent)
{
if (hwndParent)
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_EXTSEARCH), hwndParent, AdvancedSearchDlgProc, 0);
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_EXTSEARCH), hwndParent, AdvancedSearchDlgProc, 0);
return nullptr;
}
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index 5c83a50ef0..76a0d44862 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -44,7 +44,6 @@
#include "../../libs/zlib/src/zlib.h"
extern IconItem g_iconList[];
-extern HINSTANCE g_hInstance;
extern HWND g_hwndHeartbeat;
#define DB_KEY_ID "id"
diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h
index 90b08dd243..32ddb8d345 100644
--- a/protocols/Dummy/src/dummy.h
+++ b/protocols/Dummy/src/dummy.h
@@ -18,8 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
struct CDummyProto;
-extern LIST<CDummyProto> dummy_Instances;
-extern HINSTANCE g_hInstance;
#define DUMMY_ID_TEMPLATE "Template"
#define DUMMY_ID_TEXT "UniqueIdText"
@@ -34,36 +32,51 @@ struct message_data
int msgid;
};
-typedef struct {
+struct ttemplate
+{
const char *name;
const char *setting;
const char *text;
-} ttemplate;
+};
+
+static const ttemplate templates[] =
+{
+ { LPGEN("Custom"), "", "" },
+ { "AIM", "SN", LPGEN("Screen name") },
+ { "EmLAN", "Nick", LPGEN("User name") },
+ { "Facebook", "ID", LPGEN("Facebook ID") },
+ { "GG", "UIN", LPGEN("Gadu-Gadu number") },
+ { "ICQ", "UIN", LPGEN("User ID") },
+ { "ICQCorp", "UIN", LPGEN("ICQ number") },
+ { "IRC", "Nick", LPGEN("Nickname") },
+ { "Jabber", "jid", LPGEN("JID") },
+ { "MinecraftDynmap", "Nick", LPGEN("Visible name") },
+ { "MRA", "e-mail", LPGEN("E-mail address") },
+ { "MSN", "e-mail", LPGEN("Live ID") },
+ { "Omegle", "nick", LPGEN("Visible name") },
+ { "Sametime", "stid", LPGEN("ID") },
+ { "Skype (SkypeKit)", "sid", LPGEN("Skype name") },
+ { "Skype (Classic)", "Username", LPGEN("Skype name") },
+ { "Skype (Web)", "Username", LPGEN("Skype name") },
+ { "Steam", "SteamID", LPGEN("Steam ID") },
+ { "Tlen", "jid", LPGEN("Tlen login") },
+ { "Tox", "ToxID", LPGEN("Tox ID") },
+ { "Twitter", "Username", LPGEN("Username") },
+ { "VK", "ID", LPGEN("VKontakte ID") },
+ { "WhatsApp", "ID", LPGEN("WhatsApp ID") },
+ { "XFire", "Username", LPGEN("Username") },
+ { "Yahoo", "yahoo_id", LPGEN("ID") },
+};
-static const ttemplate templates[] = {
- { LPGEN("Custom"), "", "" },
- { "AIM", "SN", LPGEN("Screen name") },
- { "EmLAN", "Nick", LPGEN("User name") },
- { "Facebook", "ID", LPGEN("Facebook ID") },
- { "GG", "UIN", LPGEN("Gadu-Gadu number") },
- { "ICQ", "UIN", LPGEN("User ID") },
- { "ICQCorp", "UIN", LPGEN("ICQ number") },
- { "IRC", "Nick", LPGEN("Nickname") },
- { "Jabber", "jid", LPGEN("JID") },
- { "MinecraftDynmap", "Nick", LPGEN("Visible name") },
- { "MRA", "e-mail", LPGEN("E-mail address") },
- { "MSN", "e-mail", LPGEN("Live ID") },
- { "Omegle", "nick", LPGEN("Visible name") },
- { "Sametime", "stid", LPGEN("ID") },
- { "Skype (SkypeKit)", "sid", LPGEN("Skype name") },
- { "Skype (Classic)", "Username", LPGEN("Skype name") },
- { "Skype (Web)", "Username", LPGEN("Skype name") },
- { "Steam", "SteamID", LPGEN("Steam ID") },
- { "Tlen", "jid", LPGEN("Tlen login") },
- { "Tox", "ToxID", LPGEN("Tox ID") },
- { "Twitter", "Username", LPGEN("Username") },
- { "VK", "ID", LPGEN("VKontakte ID") },
- { "WhatsApp", "ID", LPGEN("WhatsApp ID") },
- { "XFire", "Username", LPGEN("Username") },
- { "Yahoo", "yahoo_id", LPGEN("ID") },
+struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CDummyProto>("Dummy")
+ {
+ int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
+ if (id < 0 || id >= _countof(templates))
+ SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
+ else
+ SetUniqueId(templates[id].setting);
+ }
};
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp
index 701d647589..3312d83f35 100644
--- a/protocols/Dummy/src/dummy_options.cpp
+++ b/protocols/Dummy/src/dummy_options.cpp
@@ -116,5 +116,5 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
INT_PTR CDummyProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this);
}
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp
index f95c8ccfb4..c68b687c18 100644
--- a/protocols/Dummy/src/dummy_proto.cpp
+++ b/protocols/Dummy/src/dummy_proto.cpp
@@ -52,8 +52,6 @@ static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2)
return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
-LIST<CDummyProto> dummy_Instances(1, sttCompareProtocols);
-
CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) :
PROTO<CDummyProto>(szModuleName, ptszUserName)
{
@@ -70,14 +68,12 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName)
else uniqueIdText[0] = '\0';
uniqueIdSetting[0] = '\0';
-
- dummy_Instances.insert(this);
}
CDummyProto::~CDummyProto()
{
- Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = nullptr;
- dummy_Instances.remove(this);
+ Netlib_CloseHandle(m_hNetlibUser);
+ m_hNetlibUser = nullptr;
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp
index 93492c1df6..453a68b51c 100644
--- a/protocols/Dummy/src/main.cpp
+++ b/protocols/Dummy/src/main.cpp
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "version.h"
-HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -75,18 +74,6 @@ extern "C" int __declspec(dllexport) Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CDummyProto>("Dummy")
- {
- int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
- if (id < 0 || id >= _countof(templates))
- SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
- else
- SetUniqueId(templates[id].setting);
- }
-}
- g_plugin;
+CMPlugin g_plugin;
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 9efd5a1ac3..4e5db0990e 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -3,6 +3,21 @@
#include "stdafx.h"
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+//////////////////////////////////////////////////////////////////////////
+
+CMLan* g_lan = nullptr;
+
+int hLangpack;
+bool g_InitOptions = false;
+
+#ifdef VERBOSE
+std::fstream emlanLog("EmLanLog.txt", std::ios::out|std::ios::app);
+#endif
+
//////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
@@ -18,22 +33,12 @@ PLUGININFOEX pluginInfo = {
{ 0xe08ce7c4, 0x9eeb, 0x4272, { 0xb5, 0x44, 0xd, 0x32, 0xe1, 0x8d, 0x90, 0xde } }
};
-HINSTANCE g_hInstance = nullptr;
-CMLan* g_lan = nullptr;
-
-int hLangpack;
-bool g_InitOptions = false;
-
-#ifdef VERBOSE
-std::fstream emlanLog("EmLanLog.txt", std::ios::out|std::ios::app);
-#endif
-
extern "C" __declspec(dllexport) PLUGININFOEX* __cdecl MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
-//////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -42,7 +47,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID)
{
- g_hInstance = hInstDLL;
if (reason == DLL_PROCESS_ATTACH) {
EMLOG("EmLan Started");
DisableThreadLibraryCalls(hInstDLL);
@@ -84,7 +88,7 @@ static INT_PTR __cdecl EMPLoadIcon(WPARAM wParam, LPARAM)
if ((wParam & 0xFFFF) != PLI_PROTOCOL)
return 0;
- return (INT_PTR)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON_ONLINE));
+ return (INT_PTR)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON_ONLINE));
}
static INT_PTR __cdecl EMPGetStatus(WPARAM, LPARAM)
@@ -272,7 +276,7 @@ int __cdecl EMPCreateOptionsDlg(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_EMP_FORM_OPT);
odp.szTitle.a = LPGEN("E-mage LAN protocol");
odp.szGroup.a = LPGEN("Network");
@@ -359,18 +363,3 @@ extern "C" int __declspec(dllexport) __cdecl Unload()
delete g_lan;
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(PROTONAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- SetUniqueId("Nick");
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/EmLanProto/src/stdafx.h b/protocols/EmLanProto/src/stdafx.h
index d80030c4b1..f3156dd280 100644
--- a/protocols/EmLanProto/src/stdafx.h
+++ b/protocols/EmLanProto/src/stdafx.h
@@ -26,13 +26,15 @@
#define PROTONAME "EM_LAN_PROTO"
-//#define ME_ICQ_STATUSMSGREQ "ICQ/StatusMsgReq"
-//
-//#define ICQ_MSGTYPE_GETAWAYMSG 0xE8
-//#define ICQ_MSGTYPE_GETOCCUMSG 0xE9
-//#define ICQ_MSGTYPE_GETNAMSG 0xEA
-//#define ICQ_MSGTYPE_GETDNDMSG 0xEB
-//#define ICQ_MSGTYPE_GETFFCMSG 0xEC
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PROTONAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("Nick");
+ }
+};
//#define VERBOSE
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp
index 96f13447d5..4ab92bd91b 100644
--- a/protocols/FacebookRM/src/captcha.cpp
+++ b/protocols/FacebookRM/src/captcha.cpp
@@ -126,7 +126,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result)
GetObject(param.bmp, sizeof(bmp), &bmp);
param.w = bmp.bmWidth;
param.h = bmp.bmHeight;
- int res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, CaptchaFormDlgProc, (LPARAM)&param);
+ int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, CaptchaFormDlgProc, (LPARAM)&param);
if (res == 0)
return false;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index a2d89766aa..cb1d42f23b 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -22,12 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-// TODO: Make following as "globals" structure?
-
-CMPlugin g_plugin;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -51,6 +47,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
}
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -91,5 +93,3 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index f8c66e68b5..61b3d8de79 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -415,7 +415,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
INT_PTR FacebookProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
(HWND)lParam, FBAccountProc, (LPARAM)this);
}
@@ -442,7 +442,7 @@ int FacebookProto::OnPreShutdown(WPARAM, LPARAM)
int FacebookProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
@@ -516,7 +516,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM)
for (auto &iter : facy.pages)
data->walls.push_back(new wall_data(iter.first, mir_utf8decodeW(iter.second.c_str()), true));
- HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast<LPARAM>(data));
+ HWND hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MIND), (HWND)nullptr, FBMindProc, reinterpret_cast<LPARAM>(data));
ShowWindow(hDlg, SW_SHOW);
return 0;
diff --git a/protocols/FacebookRM/src/stdafx.h b/protocols/FacebookRM/src/stdafx.h
index 5d6a51b0ac..f41eb6c7f1 100644
--- a/protocols/FacebookRM/src/stdafx.h
+++ b/protocols/FacebookRM/src/stdafx.h
@@ -80,7 +80,6 @@ class FacebookProto;
#include "resource.h"
#include "version.h"
-extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index ce5fb25df3..71fb869c95 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -54,7 +54,7 @@ static IconItem icons[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Facebook", icons, _countof(icons), "Facebook");
+ Icon_Register(g_plugin.getInst(), "Protocols/Facebook", icons, _countof(icons), "Facebook");
}
HANDLE GetIconHandle(const char* name)
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 5ebdb40815..bc311e486a 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -357,19 +357,19 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
dat.gg = gg;
if (LOWORD(wParam) == IDC_CREATEACCOUNT) {
dat.mode = GG_USERUTIL_CREATE;
- ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else if (LOWORD(wParam) == IDC_CHPASS) {
dat.mode = GG_USERUTIL_PASS;
- ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else if (LOWORD(wParam) == IDC_CHEMAIL) {
dat.mode = GG_USERUTIL_EMAIL;
- ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else {
dat.mode = GG_USERUTIL_REMOVE;
- ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_REMOVEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_REMOVEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
if (ret == IDOK) {
@@ -759,7 +759,7 @@ int GaduProto::options_init(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_UNICODE;
odp.position = 1003000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Network");
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = (LPARAM)this;
@@ -809,7 +809,7 @@ int GaduProto::details_init(WPARAM wParam, LPARAM lParam)
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_DONTTRANSLATE | ODPF_UNICODE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = gg_detailsdlgproc;
odp.position = -1900000000;
odp.pszTemplate = pszTemplate;
@@ -867,7 +867,7 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat.email = email;
dat.gg = gg;
dat.mode = GG_USERUTIL_CREATE;
- int ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ int ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
if (ret == IDOK) {
DBVARIANT dbv;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index bec809277c..8bd715294d 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -38,15 +38,16 @@ PLUGININFOEX pluginInfo = {
};
// Other variables
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
-
SSL_API sslApi;
CLIST_INTERFACE *pcli;
int hLangpack;
static unsigned long crc_table[256];
+//////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index f96f613fdd..f02dc0be26 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -258,7 +258,6 @@ struct GGGETAVATARDATA
struct GaduProto;
-extern HINSTANCE g_hInstance;
extern CLIST_INTERFACE *pcli;
extern PLUGININFOEX pluginInfo;
extern IconItem iconList[];
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 2b2c9eefc5..7e086f9060 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -507,7 +507,7 @@ static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg, UINT message, WPA
HWND GaduProto::CreateExtendedSearchUI(HWND owner)
{
- return CreateDialogParam(g_hInstance,
+ return CreateDialogParam(g_plugin.getInst(),
MAKEINTRESOURCE(IDD_GGADVANCEDSEARCH), owner, gg_advancedsearchdlgproc, (LPARAM)this);
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 1ea195a83b..d46c8584df 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -600,7 +600,7 @@ INT_PTR GaduProto::gc_openconf(WPARAM, LPARAM)
return 0;
}
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this);
return 1;
}
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp
index 7ee2a5e5fd..93cd157edc 100644
--- a/protocols/Gadu-Gadu/src/icolib.cpp
+++ b/protocols/Gadu-Gadu/src/icolib.cpp
@@ -43,7 +43,7 @@ extern IconItem iconList[] =
void gg_icolib_init()
{
- Icon_Register(g_hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
+ Icon_Register(g_plugin.getInst(), "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
}
HICON LoadIconEx(const char* name, bool big)
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 909ee5c078..2dc6c14b41 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -256,7 +256,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat)
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwnd;
- ofn.hInstance = g_hInstance;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrFile = szFileName;
ofn.lpstrFilter = szFilter;
ofn.nMaxFile = MAX_PATH;
@@ -439,7 +439,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return TRUE;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer);
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
InvalidateRect(hwndDlg, nullptr, FALSE);
return 0;
@@ -669,7 +669,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
*szFileName = 0;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = g_hInstance;
+ ofn.hInstance = g_plugin.getInst();
ofn.lpstrFilter = szFilter;
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
@@ -708,7 +708,7 @@ void __cdecl GaduProto::img_dlgcallthread(void *param)
HWND hMIWnd = nullptr;
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)param;
- DialogBoxParam(g_hInstance, dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND),
+ DialogBoxParam(g_plugin.getInst(), dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND),
hMIWnd, gg_img_dlgproc, (LPARAM)dat);
#ifdef DEBUGMODE
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index 7ef2ec6cf6..c1f56f702c 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -108,7 +108,7 @@ void gg_links_init()
{
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
CreateServiceFunction(GGS_PARSELINK, gg_parselink);
- AssocMgr_AddNewUrlTypeW("gg:", TranslateT("Gadu-Gadu Link Protocol"), g_hInstance, IDI_GG, GGS_PARSELINK, 0);
+ AssocMgr_AddNewUrlTypeW("gg:", TranslateT("Gadu-Gadu Link Protocol"), g_plugin.getInst(), IDI_GG, GGS_PARSELINK, 0);
}
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index 425eb044a2..f58bcc2e50 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -379,7 +379,7 @@ extern INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwnd, UINT msg, WPARAM wParam
//
INT_PTR GaduProto::get_acc_mgr_gui(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this);
}
//////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 63ba37d099..10b4dc5c42 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -360,7 +360,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
return 0;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer);
return 0;
case WM_SETCURSOR:
@@ -397,7 +397,7 @@ INT_PTR GaduProto::sessions_view(WPARAM, LPARAM)
SetFocus(hwndSessionsDlg);
}
else
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this);
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp
index 9f7f80b87c..322021b80b 100644
--- a/protocols/Gadu-Gadu/src/token.cpp
+++ b/protocols/Gadu-Gadu/src/token.cpp
@@ -145,7 +145,7 @@ int GaduProto::gettoken(GGTOKEN *token)
}
// Load token dialog
- if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
+ if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
return FALSE;
// Fillup patterns
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index 8b4c3597ad..af7f13d4b5 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -22,10 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "version.h"
-CMPlugin g_plugin;
CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
int hLangpack;
@@ -49,16 +47,23 @@ PLUGININFOEX pluginInfo =
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
- {0x92382b4d, 0x5572, 0x48a0, {0xb0, 0xb9, 0x13, 0x36, 0xa6, 0x1, 0xd6, 0x89}} // {92382B4D-5572-48a0-B0B9-1336A601D689}
+ // {92382B4D-5572-48a0-B0B9-1336A601D689}
+ { 0x92382b4d, 0x5572, 0x48a0, {0xb0, 0xb9, 0x13, 0x36, 0xa6, 0x1, 0xd6, 0x89 }}
};
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 344999e511..dc4a82a630 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -204,7 +204,7 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/IRC", iconList, _countof(iconList), "IRC");
+ Icon_Register(g_plugin.getInst(), "Protocols/IRC", iconList, _countof(iconList), "IRC");
}
HICON LoadIconEx(int iconId, bool big)
@@ -1848,7 +1848,7 @@ void InitServers()
wchar_t *szIniFile = Utils_ReplaceVarsW(L"%temp%\\default_servers.ini");
FILE *serverFile = _wfopen(szIniFile, L"a");
if (serverFile) {
- char* pszSvrs = (char*)LockResource(LoadResource(g_hInstance, FindResource(g_hInstance, MAKEINTRESOURCE(IDR_SERVERS), L"TEXT")));
+ char* pszSvrs = (char*)LockResource(LoadResource(g_plugin.getInst(), FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SERVERS), L"TEXT")));
if (pszSvrs)
fwrite(pszSvrs, 1, mir_strlen(pszSvrs) + 1, serverFile);
fclose(serverFile);
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index 896d6a6097..fff9477127 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -200,8 +200,6 @@ using namespace irc;
// Functions
// main.cpp
-extern HINSTANCE g_hInstance;
-
extern OBJLIST<SERVER_INFO> g_servers;
CIrcProto* GetTimerOwner(UINT_PTR eventId);
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index c04c7036a9..56946ec121 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -212,7 +212,7 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam)
odp.flags = ODPF_DONTTRANSLATE;
odp.szTitle.a = m_szModuleName;
odp.dwInitParam = (LPARAM)this;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.position = -1900000000;
odp.pfnDlgProc = UserDetailsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp
index d7c91e5e8c..8a83351565 100644
--- a/protocols/IcqOscarJ/src/dlgproc.cpp
+++ b/protocols/IcqOscarJ/src/dlgproc.cpp
@@ -440,7 +440,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (IsIconic(hwndDlg))
break;
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize);
{
RECT rc; // update listview column widths
GetClientRect(dat->hwndList, &rc);
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp
index f0d88461dd..8f919b577f 100644
--- a/protocols/IcqOscarJ/src/editlist.cpp
+++ b/protocols/IcqOscarJ/src/editlist.cpp
@@ -80,7 +80,7 @@ void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey
dataListEdit = this;
hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"LISTBOX", L"", WS_POPUP | WS_BORDER | WS_VSCROLL,
- rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, g_hInstance, nullptr);
+ rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
int itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp
index feb334b34b..010f38e068 100644
--- a/protocols/IcqOscarJ/src/editstring.cpp
+++ b/protocols/IcqOscarJ/src/editstring.cpp
@@ -188,7 +188,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wPa
SendMessage(hwndEdit, EM_GETSEL, (WPARAM)&selStart, (LPARAM)&selEnd);
DestroyWindow(hwndEdit);
EscapesToMultiline(text, &selStart, &selEnd);
- hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, nullptr, nullptr, g_hInstance, nullptr);
+ hwndEdit = CreateWindowExA(WS_EX_TOOLWINDOW, "EDIT", "", WS_POPUP | WS_BORDER | WS_VISIBLE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL | ES_MULTILINE, rcStart.left, rcStart.top, rcStart.right - rcStart.left, rcStart.bottom - rcStart.top, nullptr, nullptr, g_plugin.getInst(), nullptr);
SetWindowTextUcs(hwndEdit, text);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
SendMessage(hwndEdit, WM_SETFONT, (WPARAM)dataStringEdit->hListFont, 0);
@@ -251,13 +251,13 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey)
if ((si.displayType & LIM_TYPE) == LI_LONGSTRING) {
rc->right -= rc->bottom - rc->top;
- hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, nullptr, g_hInstance, nullptr);
+ hwndExpandButton = CreateWindowA("BUTTON", "", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_ICON, rc->right, rc->top, rc->bottom - rc->top, rc->bottom - rc->top, hwndList, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndExpandButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(iconList[0].hIcolib));
mir_subclassWindow(hwndExpandButton, ExpandButtonSubclassProc);
}
dataStringEdit = this;
- hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, nullptr, g_hInstance, nullptr);
+ hwndEdit = CreateWindow(L"EDIT", L"", WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ((si.displayType&LIM_TYPE) == LI_NUMBER ? ES_NUMBER : 0) | (si.displayType&LIF_PASSWORD ? ES_PASSWORD : 0), rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, hwndList, nullptr, g_plugin.getInst(), nullptr);
SetWindowTextUtf(hwndEdit, szValue);
if (alloced) SAFE_FREE(&szValue);
mir_subclassWindow(hwndEdit, StringEditSubclassProc);
@@ -265,7 +265,7 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey)
if ((si.displayType & LIM_TYPE) == LI_NUMBER) {
int *range = (int*)si.pList;
RECT rcUpDown;
- hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, nullptr, g_hInstance, nullptr);
+ hwndUpDown = CreateWindow(UPDOWN_CLASS, L"", WS_VISIBLE | WS_CHILD | UDS_AUTOBUDDY | UDS_ALIGNRIGHT | UDS_HOTTRACK | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 0, 0, 0, 0, hwndList, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndUpDown, UDM_SETRANGE32, range[0], range[1]);
SendMessage(hwndUpDown, UDM_SETPOS32, 0, sid.value);
if (!(si.displayType & LIF_ZEROISVALID) && sid.value == 0)
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp
index ea5254cf05..6dc0cb6e8f 100644
--- a/protocols/IcqOscarJ/src/icq_firstrun.cpp
+++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp
@@ -104,5 +104,5 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
INT_PTR CIcqProto::OnCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp
index f19dcaef7a..83229a25e2 100644
--- a/protocols/IcqOscarJ/src/icq_opts.cpp
+++ b/protocols/IcqOscarJ/src/icq_opts.cpp
@@ -506,7 +506,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -800000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Network");
odp.dwInitParam = LPARAM(this);
odp.szTitle.w = m_tszUserName;
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index a3ec27ff40..ba2ca46ae5 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -808,8 +808,8 @@ HANDLE __cdecl CIcqProto::SearchByName(const wchar_t *nick, const wchar_t *first
HWND __cdecl CIcqProto::CreateExtendedSearchUI(HWND parent)
{
- if (parent && g_hInstance)
- return CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
+ if (parent && g_plugin.getInst())
+ return CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
return nullptr; // Failure
}
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp
index a7eb3bf6cd..fcf7058703 100644
--- a/protocols/IcqOscarJ/src/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp
@@ -866,7 +866,7 @@ void CIcqProto::ShowUploadContactsDialog(void)
{
if (hwndUploadContacts == nullptr) {
hItemAll = nullptr;
- hwndUploadContacts = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
+ hwndUploadContacts = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
}
SetForegroundWindow(hwndUploadContacts);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp
index 0505ca7d43..2e0dba715b 100644
--- a/protocols/IcqOscarJ/src/icq_xstatus.cpp
+++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp
@@ -807,7 +807,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet)
init.bXStatus = bXStatus;
init.szXStatusName = szName;
init.szXStatusMsg = szMsg;
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
}
else {
setByte(DBSETTING_XSTATUS_ID, bXStatus);
@@ -916,7 +916,7 @@ INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM)
init.ppro = this;
init.bAction = 1; // retrieve
init.hContact = hContact;
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
return 0;
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index 55d8c21fe8..8d21b12056 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -28,8 +28,6 @@
#include "m_extraicons.h"
#include "m_icolib.h"
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
int hLangpack;
bool g_bTerminated;
@@ -54,8 +52,14 @@ extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD)
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -101,7 +105,7 @@ extern "C" int __declspec(dllexport) Load(void)
hExtraXStatus = ExtraIcon_RegisterIcolib("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13");
- Icon_Register(g_hInstance, "ICQ", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "ICQ", iconList, _countof(iconList));
g_MenuInit();
return 0;
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp
index 1a6d8c1e51..9cff0ea568 100644
--- a/protocols/IcqOscarJ/src/loginpassword.cpp
+++ b/protocols/IcqOscarJ/src/loginpassword.cpp
@@ -84,5 +84,5 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
void CIcqProto::RequestPassword()
{
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp
index 8bd0911293..76ec477cca 100644
--- a/protocols/IcqOscarJ/src/userinfotab.cpp
+++ b/protocols/IcqOscarJ/src/userinfotab.cpp
@@ -270,7 +270,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = LPARAM(this);
odp.pfnDlgProc = IcqDlgProc;
odp.position = -1900000000;
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 9e8c7e3204..aef6f638ac 100755
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -35,10 +35,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma comment(lib, "Dnsapi.lib")
#pragma comment(lib, "Secur32.lib")
-HINSTANCE g_hInstance;
HMODULE hMsftedit;
-CMPlugin g_plugin;
int hLangpack;
unsigned int g_nTempFileId;
CHAT_MANAGER *pci;
@@ -48,18 +46,6 @@ CountryListEntry *g_countries;
wchar_t szCoreVersion[100];
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- {0x144e80a2, 0xd198, 0x428b, {0xac, 0xbe, 0x9d, 0x55, 0xda, 0xcc, 0x7f, 0xde}} // {144E80A2-D198-428b-ACBE-9D55DACC7FDE}
-};
-
CLIST_INTERFACE* pcli;
HANDLE hExtraActivity = nullptr;
@@ -71,15 +57,33 @@ void JabberUserInfoUninit(void);
bool bSecureIM, bMirOTR, bNewGPG, bPlatform;
-/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ { 0x144e80a2, 0xd198, 0x428b, {0xac, 0xbe, 0x9d, 0x55, 0xda, 0xcc, 0x7f, 0xde }} // {144E80A2-D198-428b-ACBE-9D55DACC7FDE}
+};
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
///////////////////////////////////////////////////////////////////////////////
@@ -108,7 +112,7 @@ static int OnModulesLoaded(WPARAM, LPARAM)
// file associations manager plugin support
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
CreateServiceFunction("JABBER/*" JS_PARSE_XMPP_URI, g_SvcParseXmppUri);
- AssocMgr_AddNewUrlTypeW("xmpp:", TranslateT("Jabber Link Protocol"), g_hInstance, IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0);
+ AssocMgr_AddNewUrlTypeW("xmpp:", TranslateT("Jabber Link Protocol"), g_plugin.getInst(), IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0);
}
// init fontservice for info frame
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp
index fccbbcdbd0..e69c40b6c0 100644
--- a/protocols/JabberG/src/jabber_adhoc.cpp
+++ b/protocols/JabberG/src/jabber_adhoc.cpp
@@ -339,7 +339,7 @@ int CJabberProto::AdHoc_AddCommandRadio(HWND hFrame, wchar_t * labelStr, int id,
ctrlWidth = min(ctrlWidth, strRect.right - strRect.left + 20);
ReleaseDC(hFrame, hdc);
- HWND hCtrl = CreateWindowEx(0, L"button", labelStr, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, ctrlOffset, ypos, ctrlWidth, labelHeight, hFrame, (HMENU)id, g_hInstance, nullptr);
+ HWND hCtrl = CreateWindowEx(0, L"button", labelStr, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, ctrlOffset, ypos, ctrlWidth, labelHeight, hFrame, (HMENU)id, g_plugin.getInst(), nullptr);
SendMessage(hCtrl, WM_SETFONT, (WPARAM)SendMessage(GetParent(hFrame), WM_GETFONT, 0, 0), 0);
SendMessage(hCtrl, BM_SETCHECK, value, 0);
return (ypos + labelHeight + verticalStep);
@@ -527,7 +527,7 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
HMENU hMenu = CreatePopupMenu();
for (int i = 0; i < item->arResources.getCount(); i++)
AppendMenu(hMenu, MF_STRING, i + 1, item->arResources[i]->m_tszResourceName);
- HWND hwndTemp = CreateWindowEx(WS_EX_TOOLWINDOW, L"button", L"PopupMenuHost", 0, 0, 0, 10, 10, nullptr, nullptr, g_hInstance, nullptr);
+ HWND hwndTemp = CreateWindowEx(WS_EX_TOOLWINDOW, L"button", L"PopupMenuHost", 0, 0, 0, 10, 10, nullptr, nullptr, g_plugin.getInst(), nullptr);
SetForegroundWindow(hwndTemp);
RECT rc;
POINT pt;
@@ -551,11 +551,11 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
if (item == nullptr || selected) {
CJabberAdhocStartupParams* pStartupParams = new CJabberAdhocStartupParams(this, jid, nullptr);
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)pStartupParams);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)pStartupParams);
}
}
else if (lParam != 0)
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, lParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, lParam);
}
return res;
}
@@ -563,5 +563,5 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam)
void CJabberProto::ContactMenuAdhocCommands(CJabberAdhocStartupParams* param)
{
if (param)
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)param);
}
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp
index 829d3dbfbe..bceb2b9689 100644
--- a/protocols/JabberG/src/jabber_bookmarks.cpp
+++ b/protocols/JabberG/src/jabber_bookmarks.cpp
@@ -197,7 +197,7 @@ private:
JabberAddBookmarkDlgParam param;
param.ppro = m_proto;
param.m_item = nullptr;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
}
void btnEdit_OnClick(CCtrlFilterListView *)
@@ -216,7 +216,7 @@ private:
JabberAddBookmarkDlgParam param;
param.ppro = m_proto;
param.m_item = item;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
}
void btnRemove_OnClick(CCtrlFilterListView *)
@@ -443,7 +443,7 @@ int CJabberProto::AddEditBookmark(JABBER_LIST_ITEM *item)
JabberAddBookmarkDlgParam param;
param.ppro = this;
param.m_item = item;//(JABBER_LIST_ITEM*)lParam;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), nullptr, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_BOOKMARK_ADD), nullptr, JabberAddBookmarkDlgProc, (LPARAM)&param);
}
return 0;
}
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp
index d9127e822c..f866614093 100644
--- a/protocols/JabberG/src/jabber_captcha.cpp
+++ b/protocols/JabberG/src/jabber_captcha.cpp
@@ -152,7 +152,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info)
GetObject(param.bmp, sizeof(bmp), &bmp);
param.w = bmp.bmWidth;
param.h = bmp.bmHeight;
- int res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, JabberCaptchaFormDlgProc, (LPARAM)&param);
+ int res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, JabberCaptchaFormDlgProc, (LPARAM)&param);
if (mir_wstrcmp(param.Result, L"") == 0 || !res)
sendCaptchaError(info, param.from, param.to, param.challenge);
else
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 3f7c381a15..e989a1e4d3 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -1036,7 +1036,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
dat->him = him;
dat->item = item;
dat->ppro = ppro;
- HWND hwndInfo = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_GROUPCHAT_INFO), nullptr, sttUserInfoDlgProc, (LPARAM)dat);
+ HWND hwndInfo = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_GROUPCHAT_INFO), nullptr, sttUserInfoDlgProc, (LPARAM)dat);
ShowWindow(hwndInfo, SW_SHOW);
}
break;
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp
index 269468958e..a48a7fddd8 100644
--- a/protocols/JabberG/src/jabber_filterlist.cpp
+++ b/protocols/JabberG/src/jabber_filterlist.cpp
@@ -183,7 +183,7 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara
fdat->m_hwndEditBox = CreateWindow(L"edit", fdat->m_filterText,
WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_LEFT|ES_AUTOHSCROLL,
0, 0, 0, 0,
- ::GetParent(m_hwnd), (HMENU)-1, g_hInstance, nullptr);
+ ::GetParent(m_hwnd), (HMENU)-1, g_plugin.getInst(), nullptr);
SendMessage(fdat->m_hwndEditBox, WM_SETFONT, (WPARAM)fdat->m_hfntNormal, 0);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index e7763d10da..3e427452fb 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -282,7 +282,7 @@ void JabberFormLayoutSingleControl(TJabberFormControlInfo *item, TJabberFormLayo
#define JabberFormCreateLabel() \
CreateWindow(L"static", labelStr, WS_CHILD|WS_VISIBLE|SS_CENTERIMAGE, \
- 0, 0, 0, 0, hwndStatic, (HMENU)-1, g_hInstance, nullptr)
+ 0, 0, 0, 0, hwndStatic, (HMENU)-1, g_plugin.getInst(), nullptr)
TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayoutInfo *layout_info, TJabberFormControlType type, const wchar_t *labelStr, const wchar_t *valueStr)
{
@@ -302,7 +302,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", valueStr,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL | ES_PASSWORD,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
++layout_info->id;
break;
@@ -311,7 +311,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", valueStr,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
mir_subclassWindow(item->hCtrl, JabberFormMultiLineWndProc);
++layout_info->id;
break;
@@ -320,7 +320,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowEx(0, L"button", labelStr,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
if (valueStr && !mir_wstrcmp(valueStr, L"1"))
SendMessage(item->hCtrl, BM_SETCHECK, 1, 0);
++layout_info->id;
@@ -331,7 +331,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "combobox", nullptr,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
++layout_info->id;
break;
@@ -340,7 +340,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowExA(WS_EX_CLIENTEDGE, "listbox",
nullptr, WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_MULTIPLESEL,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
++layout_info->id;
break;
@@ -348,7 +348,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindow(L"edit", valueStr,
WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY | ES_AUTOHSCROLL,
0, 0, 0, 0,
- hwndStatic, (HMENU)-1, g_hInstance, nullptr);
+ hwndStatic, (HMENU)-1, g_plugin.getInst(), nullptr);
break;
case JFORM_CTYPE_HIDDEN:
@@ -359,7 +359,7 @@ TJabberFormControlInfo *JabberFormAppendControl(HWND hwndStatic, TJabberFormLayo
item->hCtrl = CreateWindowEx(WS_EX_CLIENTEDGE, L"edit", valueStr,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL,
0, 0, 0, 0,
- hwndStatic, (HMENU)layout_info->id, g_hInstance, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_plugin.getInst(), nullptr);
++layout_info->id;
break;
}
@@ -849,7 +849,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
static VOID CALLBACK JabberFormCreateDialogApcProc(void* param)
{
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberFormDlgProc, (LPARAM)param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FORM), nullptr, JabberFormDlgProc, (LPARAM)param);
}
void CJabberProto::FormCreateDialog(HXML xNode, wchar_t* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata)
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 10a0a4218a..aff1bd2720 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -79,7 +79,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
CLISTFrame frame = { sizeof(frame) };
HWND hwndClist = pcli->hwndContactList;
- frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_hInstance, this);
+ frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_plugin.getInst(), this);
frame.align = alBottom;
frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_UNICODE;
@@ -98,7 +98,7 @@ CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- m_hwnd, nullptr, g_hInstance, nullptr);
+ m_hwnd, nullptr, g_plugin.getInst(), nullptr);
SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
CreateInfoItem("$", true);
@@ -136,7 +136,7 @@ void CJabberInfoFrame::InitClass()
wcx.cbSize = sizeof(wcx);
wcx.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
wcx.lpfnWndProc = GlobalWndProc;
- wcx.hInstance = g_hInstance;
+ wcx.hInstance = g_plugin.getInst();
wcx.lpszClassName = L"JabberInfoFrameClass";
wcx.hCursor = LoadCursor(nullptr, IDC_ARROW);
RegisterClassEx(&wcx);
@@ -297,7 +297,7 @@ void CJabberInfoFrame::SetToolTip(int id, RECT *rc, wchar_t *pszText)
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = m_hwnd;
ti.uId = id;
- ti.hinst = g_hInstance;
+ ti.hinst = g_plugin.getInst();
ti.lpszText = pszText;
ti.rect = *rc;
SendMessage(m_hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 4c105cb6ae..05bb6107f4 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -522,10 +522,10 @@ static IconItem sharedIconList4[] =
void g_IconsInit()
{
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
}
HANDLE g_GetIconHandle(int iconId)
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 98a2dadf9f..aaed20c1d3 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
return TRUE;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_JIDLIST), sttJidListResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_JIDLIST), sttJidListResizer);
RECT listrc;
LVCOLUMN lvc;
@@ -472,7 +472,7 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param)
SetForegroundWindow(*pHwndJidList);
SendMessage(*pHwndJidList, WM_JABBER_REFRESH, 0, (LPARAM)jidListInfo);
}
- else *pHwndJidList = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_JIDLIST), GetForegroundWindow(), JabberMucJidListDlgProc, (LPARAM)jidListInfo);
+ else *pHwndJidList = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_JIDLIST), GetForegroundWindow(), JabberMucJidListDlgProc, (LPARAM)jidListInfo);
}
void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType)
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index ba8d77b14c..6d6946eca3 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -1357,7 +1357,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam,
wchar_t buff[260];
ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS, &rc);
ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff));
- HWND hEditor = CreateWindow(TEXT("EDIT"), buff, WS_CHILD | ES_AUTOHSCROLL, rc.left + 3, rc.top + 2, rc.right - rc.left - 3, rc.bottom - rc.top - 3, hList, nullptr, g_hInstance, nullptr);
+ HWND hEditor = CreateWindow(TEXT("EDIT"), buff, WS_CHILD | ES_AUTOHSCROLL, rc.left + 3, rc.top + 2, rc.right - rc.left - 3, rc.bottom - rc.top - 3, hList, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hEditor, WM_SETFONT, (WPARAM)SendMessage(hList, WM_GETFONT, 0, 0), 0);
ShowWindow(hEditor, SW_SHOW);
SetWindowText(hEditor, buff);
@@ -1448,7 +1448,7 @@ static INT_PTR CALLBACK JabberRosterOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_OPT_JABBER3), sttRosterEditorResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_OPT_JABBER3), sttRosterEditorResizer);
break;
case WM_COMMAND:
@@ -1486,7 +1486,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRosterControl(WPARAM, LPARAM)
if (rrud.hwndDlg && IsWindow(rrud.hwndDlg))
SetForegroundWindow(rrud.hwndDlg);
else
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_OPT_JABBER3), nullptr, JabberRosterOptDlgProc, (LPARAM)this);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OPT_JABBER3), nullptr, JabberRosterOptDlgProc, (LPARAM)this);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp
index 018446a3ab..6715ab5605 100644
--- a/protocols/JabberG/src/jabber_password.cpp
+++ b/protocols/JabberG/src/jabber_password.cpp
@@ -33,7 +33,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleChangePassword(WPARAM, LPARAM)
if (IsWindow(m_hwndJabberChangePassword))
SetForegroundWindow(m_hwndJabberChangePassword);
else
- m_hwndJabberChangePassword = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CHANGEPASSWORD), nullptr, JabberChangePasswordDlgProc, (LPARAM)this);
+ m_hwndJabberChangePassword = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHANGEPASSWORD), nullptr, JabberChangePasswordDlgProc, (LPARAM)this);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index 204876b73a..85037d7630 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -105,8 +105,8 @@ static int JabberSearchAddField(HWND hwndDlg, Data* FieldDat)
int Order = (FieldDat->bHidden) ? -1 : FieldDat->Order;
- HWND hwndLabel = CreateWindowEx(0, L"STATIC", (const wchar_t *)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, g_hInstance, nullptr);
- HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (const wchar_t *)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, g_hInstance, nullptr);
+ HWND hwndLabel = CreateWindowEx(0, L"STATIC", (const wchar_t *)TranslateW(FieldDat->Label), WS_CHILD, CornerX, CornerY + Order * 40, width, 13, hwndParent, nullptr, g_plugin.getInst(), nullptr);
+ HWND hwndVar = CreateWindowEx(0 | WS_EX_CLIENTEDGE, L"EDIT", (const wchar_t *)FieldDat->defValue, WS_CHILD | WS_TABSTOP, CornerX + 5, CornerY + Order * 40 + 14, width, 20, hwndParent, nullptr, g_plugin.getInst(), nullptr);
SendMessage(hwndLabel, WM_SETFONT, (WPARAM)hFont, 0);
SendMessage(hwndVar, WM_SETFONT, (WPARAM)hFont, 0);
if (!FieldDat->bHidden) {
@@ -707,10 +707,10 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
HWND __cdecl CJabberProto::CreateExtendedSearchUI(HWND parent)
{
- if (parent && g_hInstance) {
+ if (parent && g_plugin.getInst()) {
ptrW szServer(getWStringA("LoginServer"));
if (szServer == nullptr || mir_wstrcmpi(szServer, L"S.ms"))
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this);
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this);
}
return nullptr; // Failure
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index fdf951ad47..82bd29a43e 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -116,7 +116,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
static VOID CALLBACK JabberPasswordCreateDialogApcProc(void* param)
{
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_PASSWORD), nullptr, JabberPasswordDlgProc, (LPARAM)param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_PASSWORD), nullptr, JabberPasswordDlgProc, (LPARAM)param);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 35da917865..73f017b910 100755
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -822,7 +822,7 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
char *szProto = GetContactProto(hContact);
if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = (LPARAM)this;
odp.pfnDlgProc = JabberUserInfoDlgProc;
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index f82b2e8c70..51676949ab 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -842,9 +842,9 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
EditDlgParam param = { -1, ppro };
int res;
if (nm->hdr.idFrom == IDC_PHONES)
- res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
else
- res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
if (res != IDOK)
break;
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
@@ -882,9 +882,9 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
EditDlgParam param = { (int)lvi.lParam, ppro };
int res;
if (nm->hdr.idFrom == IDC_PHONES)
- res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
else
- res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
if (res != IDOK)
break;
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
@@ -1178,7 +1178,7 @@ void CJabberProto::OnUserInfoInit_VCard(WPARAM wParam, LPARAM)
m_szPhotoFileName[0] = 0;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = (LPARAM)this;
odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE;
odp.szTitle.w = m_tszUserName;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index df48a3d90c..070af7048e 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -1496,7 +1496,7 @@ wchar_t* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, co
void g_XstatusIconsInit()
{
wchar_t szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, _countof(szFile));
+ GetModuleFileName(g_plugin.getInst(), szFile, _countof(szFile));
if (wchar_t *p = wcsrchr(szFile, '\\'))
mir_wstrcpy(p + 1, L"..\\Icons\\xstatus_jabber.dll");
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 37dacc2085..72833d8381 100755
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -577,8 +577,6 @@ private:
/*******************************************************************
* Global variables
*******************************************************************/
-extern HINSTANCE g_hInstance;
-
extern HANDLE hExtraMood;
extern HANDLE hExtraActivity;
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp
index 68373ab59b..58f455fc23 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -1,10 +1,18 @@
#include "stdafx.h"
-CMPlugin g_plugin;
-
int hLangpack;
CLIST_INTERFACE *pcli;
+HMODULE g_hDLLXStatusIcons;
+HICON g_hMainIcon;
+
+bool g_bChatExist, g_bShutdown = false;
+
+size_t g_dwMirWorkDirPathLen;
+WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
+
+void IconsLoad();
+
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
PROTOCOL_DISPLAY_NAME_ORIGA,
@@ -18,25 +26,20 @@ PLUGININFOEX pluginInfoEx = {
{ 0xe7c48bab, 0x8ace, 0x4cb3, { 0x84, 0x46, 0xd4, 0xb7, 0x34, 0x81, 0xf4, 0x97 } }
};
-HINSTANCE g_hInstance;
-HMODULE g_hDLLXStatusIcons;
-HICON g_hMainIcon;
-
-bool g_bChatExist, g_bShutdown = false;
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfoEx;
+}
-size_t g_dwMirWorkDirPathLen;
-WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
+/////////////////////////////////////////////////////////////////////////////////////////
-void IconsLoad();
+CMPlugin g_plugin;
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfoEx;
-}
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
///////////////////////////////////////////////////////////////////////////////
@@ -58,6 +61,8 @@ extern "C" __declspec(dllexport) int Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
DestroyXStatusIcons();
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp
index bb365c8c67..7377f97d1b 100644
--- a/protocols/MRA/src/MraAdvancedSearch.cpp
+++ b/protocols/MRA/src/MraAdvancedSearch.cpp
@@ -306,8 +306,8 @@ HWND CMraProto::SearchAdvanced(HWND hWndDlg)
HWND CMraProto::CreateExtendedSearchUI(HWND owner)
{
- if (g_hInstance && owner)
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAADVANCEDSEARCH), owner, AdvancedSearchDlgProc, (LPARAM)this);
+ if (g_plugin.getInst() && owner)
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MRAADVANCEDSEARCH), owner, AdvancedSearchDlgProc, (LPARAM)this);
return nullptr;
}
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp
index 99471e9fd4..2be25ea965 100644
--- a/protocols/MRA/src/MraIcons.cpp
+++ b/protocols/MRA/src/MraIcons.cpp
@@ -69,10 +69,10 @@ HICON IconLibGetIconEx(HANDLE hIcon, DWORD dwFlags)
void IconsLoad()
{
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA"), gdiMainIcon, 1, "MRA_");
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Main Menu"), gdiMenuItems, MAIN_MENU_ITEMS_COUNT, "MRA_");
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Contact Menu"), gdiContactMenuItems, CONTACT_MENU_ITEMS_COUNT, "MRA_");
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Extra status"), gdiExtraStatusIconsItems, ADV_ICON_MAX, "MRA_");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("MRA"), gdiMainIcon, 1, "MRA_");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Main Menu"), gdiMenuItems, MAIN_MENU_ITEMS_COUNT, "MRA_");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Contact Menu"), gdiContactMenuItems, CONTACT_MENU_ITEMS_COUNT, "MRA_");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("MRA") "/" LPGEN("Extra status"), gdiExtraStatusIconsItems, ADV_ICON_MAX, "MRA_");
g_hMainIcon = IconLibGetIcon(gdiMainIcon[0].hIcolib);
}
@@ -104,7 +104,7 @@ void InitXStatusIcons()
}
}
- GetModuleFileName((g_hDLLXStatusIcons != nullptr) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
+ GetModuleFileName((g_hDLLXStatusIcons != nullptr) ? g_hDLLXStatusIcons : g_plugin.getInst(), szBuff, _countof(szBuff));
SKINICONDESC sid = {};
sid.section.w = LPGENW("Protocols")L"/" LPGENW("MRA") L"/" LPGENW("Custom Status");
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp
index 6b0d4fd4bd..4d27b75bb3 100644
--- a/protocols/MRA/src/MraPopUp.cpp
+++ b/protocols/MRA/src/MraPopUp.cpp
@@ -129,7 +129,7 @@ int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.dwInitParam = (LPARAM)this;
odp.position = 100000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
odp.szTitle.w = m_tszUserName;
odp.szGroup.w = LPGENW("Popups");
@@ -242,7 +242,7 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle,
ppd.lchIcon = (HICON)LoadImage(nullptr, IDI_ERROR, IMAGE_ICON, 0, 0, LR_SHARED);
break;
case MRA_POPUP_TYPE_EMAIL_STATUS:
- ppd.lchIcon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_MAIL_NOTIFY), IMAGE_ICON, 0, 0, LR_SHARED);
+ ppd.lchIcon = (HICON)LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MAIL_NOTIFY), IMAGE_ICON, 0, 0, LR_SHARED);
break;
}
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index 9d4cff4987..dc6b540008 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -75,7 +75,7 @@ CMraProto::~CMraProto()
INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MRAACCOUNT),
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MRAACCOUNT),
(HWND)lParam, DlgProcAccount, LPARAM(this));
}
diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp
index 68b1e65b31..19dac7a061 100644
--- a/protocols/MRA/src/MraSelectEMail.cpp
+++ b/protocols/MRA/src/MraSelectEMail.cpp
@@ -146,7 +146,7 @@ DWORD CMraProto::MraSelectEMailDlgShow(MCONTACT hContact, DWORD dwType)
dat->ppro = this;
dat->hContact = hContact;
dat->dwType = dwType;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), nullptr, MraSelectEMailDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DIALOG_SELECT_EMAIL), nullptr, MraSelectEMailDlgProc, (LPARAM)dat);
}
return 0;
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 1549e50769..1b2ec046c2 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -1066,7 +1066,7 @@ bool CMraProto::MraRequestXStatusDetails(DWORD dwXStatus)
SetXStatusData *dat = (SetXStatusData*)mir_calloc(sizeof(SetXStatusData));
dat->dwXStatus = dwXStatus;
dat->ppro = this;
- return DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)dat) != -1;
+ return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)dat) != -1;
}
return false;
@@ -1182,7 +1182,7 @@ bool CMraProto::MraSendReplyBlogStatus(MCONTACT hContact)
SetBlogStatusData* dat = (SetBlogStatusData*)mir_calloc(sizeof(SetBlogStatusData));
dat->ppro = this;
dat->hContact = hContact;
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MINIBLOG), nullptr, SendReplyBlogStatusDlgProc, (LPARAM)dat) != nullptr;
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MINIBLOG), nullptr, SendReplyBlogStatusDlgProc, (LPARAM)dat) != nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp
index aad1ff9c7c..794c7db3ea 100644
--- a/protocols/MRA/src/Mra_options.cpp
+++ b/protocols/MRA/src/Mra_options.cpp
@@ -215,7 +215,7 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.dwInitParam = (LPARAM)this;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.szGroup.w = LPGENW("Network");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h
index 2e7594abef..bd34263f9b 100644
--- a/protocols/MRA/src/stdafx.h
+++ b/protocols/MRA/src/stdafx.h
@@ -157,14 +157,13 @@ extern IconItem gdiExtraStatusIconsItems[];
/////////////////////////////////////////////////////////////////////////////////////////
// plugin options
-extern HINSTANCE g_hInstance;
-extern HMODULE g_hDLLXStatusIcons;
-extern HICON g_hMainIcon;
+extern HMODULE g_hDLLXStatusIcons;
+extern HICON g_hMainIcon;
-extern bool g_bChatExist, g_bShutdown;
+extern bool g_bChatExist, g_bShutdown;
-extern size_t g_dwMirWorkDirPathLen;
-extern WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
+extern size_t g_dwMirWorkDirPathLen;
+extern WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
/////////////////////////////////////////////////////////////////////////////////////////
// External variables
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp
index fe24b511e2..703df9323c 100644
--- a/protocols/MSN/src/msn.cpp
+++ b/protocols/MSN/src/msn.cpp
@@ -24,9 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "msn_proto.h"
#include "version.h"
-CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -55,33 +53,36 @@ static const PLUGININFOEX pluginInfo =
{0x97724af9, 0xf3fb, 0x47d3, {0xa3, 0xbf, 0xea, 0xa9, 0x35, 0xc7, 0x4e, 0x6d}}
};
-// Protocol instances
-static int sttCompareProtocols(const CMsnProto *p1, const CMsnProto *p2)
+extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return &pluginInfo;
}
-// Main DLL function
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
-{
- if (fdwReason == DLL_PROCESS_ATTACH) {
- g_hInstance = hinstDLL;
- DisableThreadLibraryCalls(hinstDLL);
- }
- return TRUE;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// MirandaInterfaces - returns the protocol interface to the core
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// OnModulesLoaded - finalizes plugin's configuration on load
+
static int OnModulesLoaded(WPARAM, LPARAM)
{
avsPresent = ServiceExists(MS_AV_SETMYAVATARW) != 0;
MsnLinks_Init();
-
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// Performs a primary set of actions upon plugin loading
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -94,19 +95,12 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// Unload a plugin
+
extern "C" int __declspec(dllexport) Unload(void)
{
MSN_RemoveContactMenus();
MsnLinks_Destroy();
return 0;
}
-
-// MirandaPluginInfoEx - returns an information about a plugin
-extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
-// MirandaInterfaces - returns the protocol interface to the core
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index db67f3cbb1..135ffaf6c1 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -886,14 +886,14 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam)
wc.cbSize = sizeof(WNDCLASSEX);
wc.cbWndExtra = sizeof(void*);
- wc.hInstance = g_hInstance;
+ wc.hInstance = g_plugin.getInst();
wc.lpfnWndProc = AuthWindowProc;
wc.lpszClassName = ClassName;
RegisterClassEx(&wc);
if ((hWnd = CreateWindowEx(0, ClassName, L"MSN Login", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
- HWND_DESKTOP, nullptr, g_hInstance, pParam))) {
+ HWND_DESKTOP, nullptr, g_plugin.getInst(), pParam))) {
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
@@ -903,7 +903,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam)
}
}
- UnregisterClass(ClassName, g_hInstance);
+ UnregisterClass(ClassName, g_plugin.getInst());
CoUninitialize();
}
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index a10a43a2d6..61397d677b 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -495,7 +495,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
break;
case GC_USER_CHANMGR:
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
@@ -506,7 +506,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
case GC_USER_LOGMENU:
switch (gch->dwData) {
case 10:
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp
index 16345a3b49..0235544138 100644
--- a/protocols/MSN/src/msn_links.cpp
+++ b/protocols/MSN/src/msn_links.cpp
@@ -135,7 +135,7 @@ void MsnLinks_Init(void)
static const char szService[] = "MSN/ParseMsnimLink";
CreateServiceFunction(szService, ServiceParseMsnimLink);
- AssocMgr_AddNewUrlTypeW("msnim:", TranslateT("MSN Link Protocol"), g_hInstance, IDI_MSN, szService, 0);
+ AssocMgr_AddNewUrlTypeW("msnim:", TranslateT("MSN Link Protocol"), g_plugin.getInst(), IDI_MSN, szService, 0);
}
void MsnLinks_Destroy(void)
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index 6823338996..490a089a5d 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -397,7 +397,7 @@ static void SaveListItem(MCONTACT hContact, const char* szEmail, int list, int i
if (iNewValue == 0) {
if (list & LIST_FL) {
DeleteParam param = { proto, hContact };
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
return;
}
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index 161258a4b7..43b1edfe27 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -100,7 +100,7 @@ INT_PTR CMsnProto::MsnEditProfile(WPARAM, LPARAM)
// MsnInviteCommand - invite command callback function
INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
{
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
LPARAM(new InviteChatParam(nullptr, NULL, this)));
return 0;
}
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index 77b042b0c4..32b3c54cdc 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -47,7 +47,7 @@ static IconItem iconList[] =
void MsnInitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/MSN", iconList, _countof(iconList), "MSN");
+ Icon_Register(g_plugin.getInst(), "Protocols/MSN", iconList, _countof(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
@@ -593,7 +593,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN);
odp.szTitle.w = m_tszUserName;
odp.szGroup.w = LPGENW("Network");
@@ -623,7 +623,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM)
INT_PTR CMsnProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI),
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ACCMGRUI),
(HWND)lParam, DlgProcAccMgrUI, (LPARAM)this);
}
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index 3f9af6c5d3..e8a327452b 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -497,6 +497,7 @@ struct CMPlugin : public ACCPROTOPLUGIN<CMsnProto>
CMPlugin() :
ACCPROTOPLUGIN<CMsnProto>("MSN")
{
+ ::DisableThreadLibraryCalls(m_hInst);
SetUniqueId("wlid");
}
};
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index 2e50f2548f..657aa54881 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -267,7 +267,7 @@ int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM)
if (Lists_IsInList(LIST_FL, szEmail)) {
DeleteParam param = { this, MCONTACT(hContact) };
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
MsnContact *msc = Lists_Get(szEmail);
if (msc)
@@ -406,7 +406,7 @@ int CMsnProto::OnWindowPopup(WPARAM, LPARAM lParam)
case MSG_WINDOWPOPUP_SELECTED:
if (mwpd->selection == 13465)
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, LPARAM(new InviteChatParam(nullptr, mwpd->hContact, this)));
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, LPARAM(new InviteChatParam(nullptr, mwpd->hContact, this)));
break;
}
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h
index 48fd351dfc..f996fcdecc 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -919,7 +919,6 @@ const char msnStoreAppId[] = "Skype";
const char msnProductVer[] = "0/6.16.0.105/259/";
const char msnProtID[] = "MSNP24";
-extern HINSTANCE g_hInstance;
extern bool g_bTerminated;
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp
index 20585717d0..6bedca6e8b 100644
--- a/protocols/MinecraftDynmap/src/dialogs.cpp
+++ b/protocols/MinecraftDynmap/src/dialogs.cpp
@@ -24,8 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Icons
-extern HINSTANCE g_hInstance;
-
static IconItem icons[] = {
{ "proto", LPGEN("Protocol icon"), IDI_PROTO },
};
@@ -33,7 +31,7 @@ static IconItem icons[] = {
static HANDLE hIconLibItem[_countof(icons)];
void InitIcons(void) {
- Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap");
+ Icon_Register(g_plugin.getInst(), "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap");
}
HANDLE GetIconHandle(const char* name) {
diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp
index 3c39f05077..d0edbe2b34 100644
--- a/protocols/MinecraftDynmap/src/main.cpp
+++ b/protocols/MinecraftDynmap/src/main.cpp
@@ -22,11 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -44,13 +42,12 @@ PLUGININFOEX pluginInfo = {
};
/////////////////////////////////////////////////////////////////////////////
-// Protocol instances
-DWORD WINAPI DllMain(HINSTANCE hInstance,DWORD,LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp
index ea486cc3a7..871cc511f3 100644
--- a/protocols/MinecraftDynmap/src/proto.cpp
+++ b/protocols/MinecraftDynmap/src/proto.cpp
@@ -153,7 +153,7 @@ int MinecraftDynmapProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lPar
INT_PTR MinecraftDynmapProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_MinecraftDynmapACCOUNT), (HWND)lParam, MinecraftDynmapAccountProc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(),MAKEINTRESOURCE(IDD_MinecraftDynmapACCOUNT), (HWND)lParam, MinecraftDynmapAccountProc, (LPARAM)this);
}
int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
@@ -170,7 +170,7 @@ int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
/*int MinecraftDynmapProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
diff --git a/protocols/MinecraftDynmap/src/stdafx.h b/protocols/MinecraftDynmap/src/stdafx.h
index e164bf1c39..7613c4181d 100644
--- a/protocols/MinecraftDynmap/src/stdafx.h
+++ b/protocols/MinecraftDynmap/src/stdafx.h
@@ -71,6 +71,5 @@ class MinecraftDynmapProto;
#include "dialogs.h"
#include "resource.h"
-extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp
index d1226e7f6e..ce2dbcfa74 100644
--- a/protocols/Omegle/src/main.cpp
+++ b/protocols/Omegle/src/main.cpp
@@ -24,11 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// TODO: Make following as "globals" structure?
-CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
int hLangpack;
-HINSTANCE g_hInstance;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
@@ -45,12 +43,6 @@ PLUGININFOEX pluginInfo = {
{ 0x9e1d9244, 0x606c, 0x4ef4, { 0x99, 0xa0, 0x1d, 0x7d, 0x23, 0xcb, 0x76, 0x1 } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
g_mirandaVersion = mirandaVersion;
@@ -58,6 +50,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
}
/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -65,15 +63,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static HANDLE g_hEvents[1];
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
InitIcons();
- //InitContactMenus();
// Init native User-Agent
{
@@ -103,9 +98,5 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
- //UninitContactMenus();
- for (size_t i = 0; i < _countof(g_hEvents); i++)
- UnhookEvent(g_hEvents[i]);
-
return 0;
}
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 60361f1974..a09c8f491c 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -156,7 +156,7 @@ int OmegleProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
INT_PTR OmegleProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_OmegleACCOUNT),
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OmegleACCOUNT),
(HWND)lParam, OmegleAccountProc, (LPARAM)this);
}
@@ -176,7 +176,7 @@ int OmegleProto::OnModulesLoaded(WPARAM, LPARAM)
int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = LPARAM(this);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
diff --git a/protocols/Omegle/src/stdafx.h b/protocols/Omegle/src/stdafx.h
index 70f5586598..b6aec36b82 100644
--- a/protocols/Omegle/src/stdafx.h
+++ b/protocols/Omegle/src/stdafx.h
@@ -75,7 +75,6 @@ class OmegleProto;
#include "theme.h"
#include "resource.h"
-extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp
index fa89da9717..72af5190f4 100644
--- a/protocols/Omegle/src/theme.cpp
+++ b/protocols/Omegle/src/theme.cpp
@@ -31,7 +31,7 @@ static IconItem icons[] =
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle");
+ Icon_Register(g_plugin.getInst(), "Protocols/Omegle", icons, _countof(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp
index 4c140e9f38..b2a50a5fce 100644
--- a/protocols/Sametime/src/options.cpp
+++ b/protocols/Sametime/src/options.cpp
@@ -343,7 +343,7 @@ int CSametimeProto::OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTNET);
odp.szTitle.w = m_tszUserName;
odp.szGroup.w = LPGENW("Network");
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index 7e842b1501..6adc868b82 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -3,6 +3,9 @@
#include "version.h"
// plugin stuff
+
+int hLangpack;
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -13,23 +16,26 @@ PLUGININFOEX pluginInfo =
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
- { 0xf1b0ba1b, 0xc91, 0x4313, { 0x85, 0xeb, 0x22, 0x50, 0x69, 0xd4, 0x4d, 0x1 } } // {F1B0BA1B-0C91-4313-85EB-225069D44D01}
+ // {F1B0BA1B-0C91-4313-85EB-225069D44D01}
+ { 0xf1b0ba1b, 0xc91, 0x4313, { 0x85, 0xeb, 0x22, 0x50, 0x69, 0xd4, 0x4d, 0x1 } }
};
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
-LIST<CSametimeProto> g_Instances(1, PtrKeySortT);
-int hLangpack;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
// protocol related services
/** Copy the name of the protocol into lParam
@@ -60,7 +66,7 @@ INT_PTR CSametimeProto::SametimeLoadIcon(WPARAM wParam, LPARAM lParam)
return NULL;
}
- return (INT_PTR) LoadImage(g_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
+ return (INT_PTR) LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(id), IMAGE_ICON,
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON),
GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
@@ -79,7 +85,7 @@ static IconItem iconList[] =
void SametimeInitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
+ Icon_Register(g_plugin.getInst(), "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
}
HANDLE GetIconHandle(int iconId)
diff --git a/protocols/Sametime/src/sametime.h b/protocols/Sametime/src/sametime.h
index 9afa3230ad..b0e807489b 100644
--- a/protocols/Sametime/src/sametime.h
+++ b/protocols/Sametime/src/sametime.h
@@ -105,7 +105,6 @@ typedef struct FileTransferClientData_tag {
// Global variables
struct CSametimeProto;
-extern HINSTANCE g_hInstance;
extern PLUGININFOEX pluginInfo;
#include "sametime_proto.h"
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index d1c5a0dcfe..6b34208431 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -174,7 +174,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner)
HWND CSametimeProto::CreateExtendedSearchUI(HWND owner)
{
debugLogW(L"CSametimeProto::CreateExtendedSearchUI() start");
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index 7f87cd8456..fc029ee5ea 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -563,7 +563,7 @@ INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam)
SessionAnnounceDialogProc_arg* sadpArg = (SessionAnnounceDialogProc_arg*)mir_calloc(sizeof(SessionAnnounceDialogProc_arg));
sadpArg->proto = this;
sadpArg->sendAnnouncementFunc = SendAnnouncement;
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
return 0;
}
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index bc5ebf60f3..1b358e0651 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -17,9 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-CMPlugin g_plugin;
int hLangpack;
-HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
char g_szMirVer[100];
HANDLE g_hCallEvent;
@@ -39,15 +37,32 @@ PLUGININFOEX pluginInfo =
{ 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f } }
};
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
+{
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
+ CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService);
+ AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_plugin.getInst(), IDI_SKYPE, MODULE "/ParseUri", 0);
+ }
+ return 0;
+}
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -69,21 +84,10 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
-
DestroyHookableEvent(g_hCallEvent);
-
- return 0;
-}
-
-
-int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM)
-{
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService);
- AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_hInstance, IDI_SKYPE, MODULE "/ParseUri", 0);
- }
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp
index 412d0c0043..7aba64a40a 100644
--- a/protocols/SkypeWeb/src/skype_icons.cpp
+++ b/protocols/SkypeWeb/src/skype_icons.cpp
@@ -32,7 +32,7 @@ IconItemT CSkypeProto::Icons[] =
void CSkypeProto::InitIcons()
{
- Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE);
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE);
}
HICON CSkypeProto::GetIcon(int iconId)
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index a8941a18ee..2bac189297 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -71,7 +71,7 @@ void CSkypeOptionsMain::OnApply()
int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
odp.szGroup.w = LPGENW("Network");
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index 2cb4883414..0be6ba5730 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -58,7 +58,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct CSkypeProto;
-extern HINSTANCE g_hInstance;
extern char g_szMirVer[];
extern HANDLE g_hCallEvent;
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index f674bc4a09..2bf3ee3bdc 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -1,8 +1,6 @@
#include "stdafx.h"
int hLangpack;
-HINSTANCE g_hInstance;
-CMPlugin g_plugin;
HANDLE hExtraXStatus;
@@ -20,15 +18,23 @@ PLUGININFOEX pluginInfo =
{ 0x68f5a030, 0xba32, 0x48ec, { 0x95, 0x7, 0x5c, 0x2f, 0xbd, 0xea, 0x52, 0x17 }}
};
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -44,6 +50,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h
index 744cbb7f6d..4a70cb0159 100644
--- a/protocols/Steam/src/stdafx.h
+++ b/protocols/Steam/src/stdafx.h
@@ -49,7 +49,6 @@
#define STEAM_API_POLLING_ERRORS_LIMIT 5
class CSteamProto;
-extern HINSTANCE g_hInstance;
extern HANDLE hExtraXStatus;
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp
index 21ecd18828..ed5fc00e36 100644
--- a/protocols/Steam/src/steam_options.cpp
+++ b/protocols/Steam/src/steam_options.cpp
@@ -76,7 +76,7 @@ void CSteamOptionsBlockList::OnBlock(CCtrlButton*)
int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szTitle.w = m_tszUserName;
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szGroup.w = LPGENW("Network");
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index fde2920507..6ca91ace53 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -19,7 +19,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName)
// icons
wchar_t filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, MAX_PATH);
+ GetModuleFileName(g_plugin.getInst(), filePath, MAX_PATH);
wchar_t sectionName[100];
mir_snwprintf(sectionName, L"%s/%s", LPGENW("Protocols"), _A2W(MODULE));
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index ec6ae99f82..1b4c10f526 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -1,10 +1,8 @@
#include "stdafx.h"
int hLangpack;
-CMPlugin g_plugin;
CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
HANDLE hProfileFolderPath;
PLUGININFOEX pluginInfo =
@@ -21,15 +19,23 @@ PLUGININFOEX pluginInfo =
{0x272a3e, 0xf5fa, 0x4090, {0x8b, 0x67, 0x3e, 0x62, 0xac, 0x1e, 0xe0, 0xb4}}
};
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
int OnModulesLoaded(WPARAM, LPARAM)
{
CToxProto::InitIcons();
@@ -38,7 +44,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
CreateServiceFunction(MODULE "/ParseUri", CToxProto::ParseToxUri);
- AssocMgr_AddNewUrlTypeW("tox:", TranslateT("Tox link protocol"), g_hInstance, IDI_TOX, MODULE "/ParseUri", 0);
+ AssocMgr_AddNewUrlTypeW("tox:", TranslateT("Tox link protocol"), g_plugin.getInst(), IDI_TOX, MODULE "/ParseUri", 0);
}
return 0;
@@ -55,6 +61,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index c59439eae6..be29bd7edb 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -90,7 +90,6 @@ struct CToxProto;
#include "http_request.h"
-extern HINSTANCE g_hInstance;
extern HANDLE hProfileFolderPath;
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 4920e71e44..6c93559463 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -353,7 +353,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = (LPARAM)this;
odp.szTitle.w = m_tszUserName;
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp
index a94405982e..762266799f 100644
--- a/protocols/Tox/src/tox_icons.cpp
+++ b/protocols/Tox/src/tox_icons.cpp
@@ -9,7 +9,7 @@ IconItemT CToxProto::Icons[] =
void CToxProto::InitIcons()
{
- Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE);
+ Icon_RegisterT(g_plugin.getInst(), LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE);
}
HANDLE CToxProto::GetIconHandle(int iconId)
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index dfaa9d528d..952bf194f9 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -247,7 +247,7 @@ void CToxOptionsMain::OnApply()
/////////////////////////////////////////////////////////////////////////////////
CToxNodeEditor::CToxNodeEditor(int iItem, CCtrlListView *m_nodes)
- : CSuper(g_hInstance, IDD_NODE_EDITOR),
+ : CSuper(g_plugin.getInst(), IDD_NODE_EDITOR),
m_ipv4(this, IDC_IPV4), m_ipv6(this, IDC_IPV6),
m_port(this, IDC_PORT), m_pkey(this, IDC_PKEY),
m_ok(this, IDOK), m_iItem(iItem)
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp
index 840436b149..ebbddf2ad8 100644
--- a/protocols/Tox/src/tox_search.cpp
+++ b/protocols/Tox/src/tox_search.cpp
@@ -112,5 +112,5 @@ HWND CToxProto::OnSearchAdvanced(HWND owner)
HWND CToxProto::OnCreateExtendedSearchUI(HWND owner)
{
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SEARCH), owner, SearchDlgProc, (LPARAM)this);
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCH), owner, SearchDlgProc, (LPARAM)this);
}
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index de7559e55e..94dd556b24 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -22,10 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "proto.h"
#include "theme.h"
-CMPlugin g_plugin;
-CLIST_INTERFACE* pcli;
+CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
int hLangpack = 0;
PLUGININFOEX pluginInfo = {
@@ -41,15 +39,18 @@ PLUGININFOEX pluginInfo = {
{ 0xbc09a71b, 0xb86e, 0x4d33, { 0xb1, 0x8d, 0x82, 0xd3, 0x4, 0x51, 0xdd, 0x3c } }
};
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Interface information
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index f25e7d86df..b57cf5d452 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -191,14 +191,14 @@ int TwitterProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
INT_PTR TwitterProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWITTERACCOUNT), (HWND)lParam, first_run_dialog, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TWITTERACCOUNT), (HWND)lParam, first_run_dialog, (LPARAM)this);
}
INT_PTR TwitterProto::ReplyToTweet(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT) wParam;
// TODO: support replying to tweets instead of just users
- HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
DBVARIANT dbv;
if (!getString(hContact, TWITTER_KEY_UN, &dbv)) {
@@ -252,7 +252,7 @@ int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 271828;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Network");
odp.szTitle.w = m_tszUserName;
odp.dwInitParam = LPARAM(this);
@@ -277,7 +277,7 @@ INT_PTR TwitterProto::OnTweet(WPARAM, LPARAM)
if (m_iStatus != ID_STATUS_ONLINE)
return 1;
- HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TWEET), nullptr, tweet_proc, reinterpret_cast<LPARAM>(this));
ShowWindow(hDlg, SW_SHOW);
return 0;
}
@@ -343,7 +343,7 @@ int TwitterProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
int TwitterProto::ShowPinDialog()
{
- HWND hDlg = (HWND)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_TWITTERPIN), nullptr, pin_proc, reinterpret_cast<LPARAM>(this));
+ HWND hDlg = (HWND)DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_TWITTERPIN), nullptr, pin_proc, reinterpret_cast<LPARAM>(this));
ShowWindow(hDlg, SW_SHOW);
return 0;
}
diff --git a/protocols/Twitter/src/stdafx.h b/protocols/Twitter/src/stdafx.h
index 1183be966a..eaae38768d 100644
--- a/protocols/Twitter/src/stdafx.h
+++ b/protocols/Twitter/src/stdafx.h
@@ -65,8 +65,6 @@ typedef std::basic_string<wchar_t> wstring;
#include "StringUtil.h"
-extern HINSTANCE g_hInstance;
-
#define TWITTER_KEY_NICK "Nick" // we need one called Nick for the chat thingo to work
#define TWITTER_KEY_UN "Username"
#define TWITTER_KEY_PASS "Password"
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 75c5252f34..e3b967caf3 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -38,7 +38,7 @@ void TwitterInitSounds(void)
// TODO: uninit
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Twitter", icons, _countof(icons), "Twitter");
+ Icon_Register(g_plugin.getInst(), "Protocols/Twitter", icons, _countof(icons), "Twitter");
icons[_countof(icons) - 1].hIcolib = Skin_GetIconHandle(SKINICON_EVENT_URL);
}
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp
index 01a6dfb66d..d87612bf7b 100644
--- a/protocols/VKontakte/src/main.cpp
+++ b/protocols/VKontakte/src/main.cpp
@@ -18,8 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "version.h"
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -37,15 +35,19 @@ PLUGININFOEX pluginInfo =
{ 0x32579908, 0x724b, 0x467f, {0xad, 0xad, 0x22, 0xb6, 0x35, 0x9a, 0x74, 0x9a}}
};
-/////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 1b18bc382b..78408b5e3e 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -79,7 +79,7 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
}
HANDLE GetIconHandle(int iCommand)
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h
index e60368369e..5695d1bbf1 100644
--- a/protocols/VKontakte/src/stdafx.h
+++ b/protocols/VKontakte/src/stdafx.h
@@ -57,8 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "win2k.h"
-extern HINSTANCE g_hInstance;
-
#include "resource.h"
#include "vk.h"
#include "vk_struct.h"
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h
index b40f8980ba..e894a6304e 100644
--- a/protocols/VKontakte/src/vk.h
+++ b/protocols/VKontakte/src/vk.h
@@ -101,9 +101,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
struct CVkProto;
-extern LIST<CVkProto> vk_Instances;
extern mir_cs csInstances;
-extern HINSTANCE g_hInstance;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
bool wlstrstr(wchar_t *_s1, wchar_t *_s2);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 0253c96d6d..cdb207555a 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -29,7 +29,6 @@ static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHtt
return (int)p2->m_priority - (int)p1->m_priority;
}
-LIST<CVkProto> vk_Instances(1, sttCompareProtocols);
mir_cs csInstances;
CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
@@ -78,10 +77,6 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
// Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
- {
- mir_cslock lck(csInstances);
- vk_Instances.insert(this);
- }
}
CVkProto::~CVkProto()
@@ -95,10 +90,6 @@ CVkProto::~CVkProto()
Popup_UnregisterClass(m_hPopupClassError);
if (m_hPopupClassNotification)
Popup_UnregisterClass(m_hPopupClassNotification);
- {
- mir_cslock lck(csInstances);
- vk_Instances.remove(this);
- }
}
int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index dc434c5606..1986b3a240 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -52,7 +52,7 @@ void CVkProto::ConnectionFailed(int iReason)
static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
mir_cslock lck(csInstances);
- for (auto &it : vk_Instances)
+ for (auto &it : g_plugin.g_arInstances)
if (it->IsOnline()) {
it->debugLogA("Tic timer for %s", it->m_szModuleName);
it->OnTimerTic();
@@ -124,7 +124,7 @@ void CVkProto::OnLoggedOut()
bool bOnline = false;
{
mir_cslock lck(csInstances);
- for (auto &it : vk_Instances)
+ for (auto &it : g_plugin.g_arInstances)
bOnline = bOnline || it->IsOnline();
}
if (!bOnline)
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index b2fd90b048..55b557c0cc 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -24,9 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-CMPluginBase::CMPluginBase(HINSTANCE hInst, const char *moduleName) :
- m_szModuleName(moduleName),
- m_hInst(hInst)
+CMPluginBase::CMPluginBase(const char *moduleName) :
+ m_szModuleName(moduleName)
{
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 74e2bb6bbb..8038d95dc8 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -487,7 +487,7 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IAE@PAUHINSTANCE__@@PBD@Z @513 NONAME
+??0CMPluginBase@@IAE@PBD@Z @513 NONAME
??1CMPluginBase@@IAE@XZ @514 NONAME
??4CMPluginBase@@QAEAAV0@ABV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QAAXPBDZZ @516 NONAME
@@ -579,3 +579,4 @@ Proto_GetStatus @601
?getCache@MDatabaseCommon@@QBEPAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UAGHXZ @603 NONAME
?getInst@CMPluginBase@@QBEPAUHINSTANCE__@@XZ @604 NONAME
+?setInst@CMPluginBase@@QAEXPAUHINSTANCE__@@@Z @605 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index d0e558a650..0a954143b1 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -487,7 +487,7 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IEAA@PEAUHINSTANCE__@@PEBD@Z @513 NONAME
+??0CMPluginBase@@IEAA@PEBD@Z @513 NONAME
??1CMPluginBase@@IEAA@XZ @514 NONAME
??4CMPluginBase@@QEAAAEAV0@AEBV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QEAAXPEBDZZ @516 NONAME
@@ -579,3 +579,4 @@ Proto_GetStatus @601
?getCache@MDatabaseCommon@@QEBAPEAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UEAAHXZ @603 NONAME
?getInst@CMPluginBase@@QEBAPEAUHINSTANCE__@@XZ @604 NONAME
+?setInst@CMPluginBase@@QEAAXPEAUHINSTANCE__@@@Z @605 NONAME