summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_plugin.h18
-rw-r--r--include/m_protocols.h17
-rw-r--r--libs/win32/mir_app.libbin155932 -> 156358 bytes
-rw-r--r--libs/win64/mir_app.libbin150942 -> 151382 bytes
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp6
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp2
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp2
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp2
-rw-r--r--plugins/CloudFile/src/icons.cpp2
-rw-r--r--plugins/CloudFile/src/main.cpp8
-rw-r--r--plugins/CloudFile/src/oauth.cpp2
-rw-r--r--plugins/CloudFile/src/options.cpp2
-rw-r--r--plugins/CloudFile/src/stdafx.h2
-rw-r--r--plugins/ConnectionNotify/src/ConnectionNotify.cpp28
-rw-r--r--plugins/ConnectionNotify/src/filter.cpp4
-rw-r--r--plugins/ExternalAPI/m_yamn.h1
-rw-r--r--plugins/GmailNotifier/src/main.cpp14
-rw-r--r--plugins/GmailNotifier/src/options.cpp2
-rw-r--r--plugins/GmailNotifier/src/stdafx.h2
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp19
-rw-r--r--plugins/NewsAggregator/Src/Authentication.cpp2
-rw-r--r--plugins/NewsAggregator/Src/Icons.cpp2
-rw-r--r--plugins/NewsAggregator/Src/NewsAggregator.cpp24
-rw-r--r--plugins/NewsAggregator/Src/Options.cpp10
-rw-r--r--plugins/NewsAggregator/Src/stdafx.h2
-rw-r--r--plugins/Non-IM Contact/src/dialog.cpp16
-rw-r--r--plugins/Non-IM Contact/src/main.cpp14
-rw-r--r--plugins/Non-IM Contact/src/stdafx.h2
-rw-r--r--plugins/Quotes/src/Forex.cpp12
-rw-r--r--plugins/StartPosition/src/main.cpp27
-rw-r--r--plugins/StartPosition/src/options.cpp169
-rw-r--r--plugins/StartPosition/src/options.h4
-rw-r--r--plugins/StartPosition/src/startposition.cpp93
-rw-r--r--plugins/StartPosition/src/startposition.h13
-rw-r--r--plugins/StartPosition/src/stdafx.h3
-rw-r--r--plugins/Weather/src/stdafx.h2
-rw-r--r--plugins/Weather/src/weather.cpp72
-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.cpp39
-rw-r--r--plugins/WebView/src/webview.cpp20
-rw-r--r--plugins/WebView/src/webview.h2
-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.cpp43
-rw-r--r--plugins/YAMN/src/proto/pop3/pop3opt.cpp4
-rw-r--r--protocols/Discord/src/main.cpp24
-rw-r--r--protocols/Discord/src/proto.h11
-rw-r--r--protocols/Discord/src/stdafx.h6
-rw-r--r--protocols/Dummy/src/dummy.h2
-rw-r--r--protocols/Dummy/src/dummy_options.cpp2
-rw-r--r--protocols/Dummy/src/main.cpp14
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp6
-rw-r--r--protocols/FacebookRM/src/main.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp18
-rw-r--r--protocols/Gadu-Gadu/src/gg.h2
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h3
-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.cpp10
-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.cpp8
-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/globals.h1
-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.cpp11
-rw-r--r--protocols/IcqOscarJ/src/loginpassword.cpp2
-rw-r--r--protocols/IcqOscarJ/src/userinfotab.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber.cpp10
-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.cpp12
-rw-r--r--protocols/MSN/src/msn.cpp7
-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_svcs.cpp4
-rw-r--r--protocols/MSN/src/stdafx.h2
-rw-r--r--protocols/Sametime/src/options.cpp2
-rw-r--r--protocols/Sametime/src/sametime.cpp13
-rw-r--r--protocols/Sametime/src/sametime.h2
-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.cpp7
-rw-r--r--protocols/Steam/src/main.cpp7
-rw-r--r--protocols/Tox/src/main.cpp7
-rw-r--r--protocols/Twitter/src/main.cpp6
-rw-r--r--protocols/VKontakte/src/main.cpp21
-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.h11
-rw-r--r--src/mir_app/src/CMPluginBase.cpp6
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/protocols.cpp1
138 files changed, 582 insertions, 668 deletions
diff --git a/include/m_plugin.h b/include/m_plugin.h
index 592aa565bf..ae56eeb49a 100644
--- a/include/m_plugin.h
+++ b/include/m_plugin.h
@@ -4,6 +4,8 @@
#include <m_database.h>
#include <m_protocols.h>
+extern HINSTANCE g_hInstance;
+
class MIR_APP_EXPORT CMPluginBase
{
void tryOpenLog();
@@ -11,8 +13,9 @@ class MIR_APP_EXPORT CMPluginBase
protected:
const char *m_szModuleName;
HANDLE m_hLogger = nullptr;
+ HINSTANCE m_hInst;
- CMPluginBase(const char *moduleName);
+ CMPluginBase(HINSTANCE, const char *moduleName);
~CMPluginBase();
// pass one of PROTOTYPE_* constants as type
@@ -26,6 +29,8 @@ public:
void debugLogA(LPCSTR szFormat, ...);
void debugLogW(LPCWSTR wszFormat, ...);
+ __forceinline HINSTANCE getInst() const { return m_hInst; }
+
__forceinline INT_PTR delSetting(const char *name)
{
return db_unset(0, m_szModuleName, name);
@@ -158,13 +163,22 @@ extern struct CMPlugin g_plugin;
/////////////////////////////////////////////////////////////////////////////////////////
// Basic class for plugins (not protocols) written in C++
+typedef BOOL(WINAPI * const _pfnCrtInit)(HINSTANCE, DWORD, LPVOID);
+
template<class T> class PLUGIN : public CMPluginBase
{
typedef CMPluginBase CSuper;
+public:
+ static BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD, LPVOID)
+ {
+ g_hInstance = hInstance;
+ return TRUE;
+ }
+
protected:
PLUGIN(const char *moduleName)
- : CSuper(moduleName)
+ : CSuper(g_hInstance, moduleName)
{}
__forceinline HANDLE CreatePluginEvent(const char *name)
diff --git a/include/m_protocols.h b/include/m_protocols.h
index 3c8a70a444..db32e1f94a 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -151,20 +151,17 @@ typedef struct PROTO_INTERFACE* (*pfnInitProto)(const char* szModuleName, const
// deallocates an account instance
typedef int (*pfnUninitProto)(PROTO_INTERFACE*);
-// removes an account from the database
-typedef int (*pfnDestroyProto)(PROTO_INTERFACE*);
-
-typedef struct {
+struct PROTOCOLDESCRIPTOR
+{
size_t cbSize;
char *szName; // unique name of the module
int type; // module type, see PROTOTYPE_ constants
- // 0.8.0+ additions
- pfnInitProto fnInit; // initializes an empty account
- pfnUninitProto fnUninit; // deallocates an account instance
- pfnDestroyProto fnDestroy; // removes an account
-}
- PROTOCOLDESCRIPTOR;
+ // these fields should be filled only for protos with accounts
+ pfnInitProto fnInit; // initializes an empty account
+ pfnUninitProto fnUninit; // deallocates an account instance
+ HINSTANCE hInst; // module to which that proto belongs to
+};
/////////////////////////////////////////////////////////////////////////////////////////
// Enumerate the currently running protocols
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 273772867e..4683944b12 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 77ee2e481b..fe6e27db36 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 34e779df1c..1dacf3112e 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -308,12 +308,14 @@ UINT CDropboxService::Upload(FileTransferParam *ftp)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPluginDropbox : public CMPluginBase
+struct CMPluginDropbox : public PLUGIN<CMPluginDropbox>
{
CMPluginDropbox() :
- CMPluginBase(MODULE "/Dropbox")
+ PLUGIN<CMPluginDropbox>(MODULE "/Dropbox")
{
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 c7c24333ac..665f5bc511 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -295,7 +295,7 @@ UINT CGDriveService::Upload(FileTransferParam *ftp)
struct CMPluginGoogle : public CMPluginBase
{
CMPluginGoogle() :
- CMPluginBase(MODULE "/GDrive")
+ CMPluginBase(g_hInstance, MODULE "/GDrive")
{
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 05c4c5ca81..656ccbdd4b 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -280,7 +280,7 @@ UINT COneDriveService::Upload(FileTransferParam *ftp)
struct CMPluginOnedrive : public CMPluginBase
{
CMPluginOnedrive() :
- CMPluginBase(MODULE "/OneDrive")
+ CMPluginBase(g_hInstance, MODULE "/OneDrive")
{
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 c3e32aa8c8..3212814db5 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -290,7 +290,7 @@ UINT CYandexService::Upload(FileTransferParam *ftp)
struct CMPluginYandex : public CMPluginBase
{
CMPluginYandex() :
- CMPluginBase(MODULE "/YandexDisk")
+ CMPluginBase(g_hInstance, MODULE "/YandexDisk")
{
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit);
}
diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp
index ed496f2430..bb9dd9096c 100644
--- a/plugins/CloudFile/src/icons.cpp
+++ b/plugins/CloudFile/src/icons.cpp
@@ -11,7 +11,7 @@ static IconItem iconList[] =
void InitializeIcons()
{
- Icon_Register(hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
+ Icon_Register(g_hInstance, "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 91d8a82f7c..e9c8a6fdd2 100644
--- a/plugins/CloudFile/src/main.cpp
+++ b/plugins/CloudFile/src/main.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
int hLangpack;
-HINSTANCE hInstance;
+HINSTANCE g_hInstance;
PLUGININFOEX pluginInfo =
{
@@ -17,12 +17,6 @@ PLUGININFOEX pluginInfo =
{ 0xe876fe63, 0x701, 0x4cda, { 0xbe, 0xd5, 0x7c, 0x73, 0xa3, 0x79, 0xc1, 0xd1 }}
};
-DWORD WINAPI DllMain(HINSTANCE hInst, DWORD, LPVOID)
-{
- hInstance = hInst;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp
index 9d8e40cf73..0e0503f639 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(hInstance, IDD_OAUTH), m_service(service),
+ : CDlgBase(g_hInstance, 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 32eb485a31..09fb7df117 100644
--- a/plugins/CloudFile/src/options.cpp
+++ b/plugins/CloudFile/src/options.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COptionsMainDlg::COptionsMainDlg()
- : CPluginDlgBase(hInstance, IDD_OPTIONS_MAIN, MODULE),
+ : CPluginDlgBase(g_hInstance, 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 9e91769740..85ce23b8d7 100644
--- a/plugins/CloudFile/src/stdafx.h
+++ b/plugins/CloudFile/src/stdafx.h
@@ -41,7 +41,7 @@ class CCloudService;
#include "options.h"
-extern HINSTANCE hInstance;
+extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibConnection;
class Exception
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
index 8b3e44aead..c53ac57712 100644
--- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
//PLUGINLINK *pluginLink=NULL;
@@ -319,10 +319,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(hInst, MAKEINTRESOURCE(IDI_ICON6), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DELETE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_DOWN, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON4), IMAGE_ICON, 16, 16, 0));
- SendDlgItemMessage(hwndDlg, ID_UP, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON5), IMAGE_ICON, 16, 16, 0));
+ 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));
// initialise and fill listbox
hwndList = GetDlgItem(hwndDlg, IDC_STATUS);
ListView_DeleteAllItems(hwndList);
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
cur->strExtIp[0] = '*';
cur->strIntIp[0] = '*';
- if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
+ if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur) == IDCANCEL) {
mir_free(cur);
cur = nullptr;
}
@@ -552,7 +552,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
while (pos--) {
cur = cur->next;
}
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), hwndDlg, FilterEditProc, (LPARAM)cur);
+ DialogBoxParam(g_hInstance, 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 +585,7 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar
int ConnectionNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_DIALOG);
odp.szTitle.w = _A2W(PLUGINNAME);
odp.szGroup.w = LPGENW("Plugins");
@@ -626,7 +626,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM)
default:
return 0;
}
- return (INT_PTR)LoadImage(hInst, 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_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam&PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam&PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
//=======================================================
//SetStatus
@@ -775,7 +775,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(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
if (settingResolveIp) {
wchar_t hostName[128];
getDnsName(extIp, hostName, _countof(hostName));
@@ -841,7 +841,7 @@ static int preshutdown(WPARAM, LPARAM)
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- hInst = hinstDLL;
+ g_hInstance = hinstDLL;
return TRUE;
}
@@ -900,12 +900,14 @@ extern "C" int __declspec(dllexport) Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PLUGINNAME)
+ 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 5d3d778517..a9d9774048 100644
--- a/plugins/ConnectionNotify/src/filter.cpp
+++ b/plugins/ConnectionNotify/src/filter.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
HWND filterAddDlg = nullptr;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern struct CONNECTION *connExceptions;
extern HANDLE hFilterOptionsThread;
extern DWORD FilterOptionsThreadId;
@@ -27,7 +27,7 @@ static unsigned __stdcall filterQueue(void *)
if (msg.message == WM_ADD_FILTER)
{
struct CONNECTION *conn = (struct CONNECTION *)msg.lParam;
- filterAddDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
+ filterAddDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FILTER_DIALOG), nullptr, ConnectionFilterEditProc, (LPARAM)conn);
ShowWindow(filterAddDlg, SW_SHOW);
}
diff --git a/plugins/ExternalAPI/m_yamn.h b/plugins/ExternalAPI/m_yamn.h
index 2be7c32712..f19d2eaf27 100644
--- a/plugins/ExternalAPI/m_yamn.h
+++ b/plugins/ExternalAPI/m_yamn.h
@@ -10,7 +10,6 @@
typedef struct CYAMNVariables
{
#define YAMN_VARIABLESVERSION 3
- HINSTANCE hInst;
MWindowList MessageWnds;
MWindowList NewMailAccountWnd;
int Shutdown;
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp
index 9dccc5965d..945ab5984d 100644
--- a/plugins/GmailNotifier/src/main.cpp
+++ b/plugins/GmailNotifier/src/main.cpp
@@ -11,7 +11,7 @@ There is no warranty.
#include "version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
int hLangpack;
UINT hTimer;
HANDLE hMirandaStarted, hOptionsInitial;
@@ -56,12 +56,6 @@ INT_PTR GetName(WPARAM wParam, LPARAM lParam)
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
PluginMenuCommand(0, 0);
@@ -170,12 +164,14 @@ extern "C" int __declspec(dllexport) Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULE_NAME)
+ PLUGIN<CMPlugin>(MODULE_NAME)
{
RegisterProtocol(PROTOTYPE_VIRTUAL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp
index cc2bd0ffa9..4aafb314f6 100644
--- a/plugins/GmailNotifier/src/options.cpp
+++ b/plugins/GmailNotifier/src/options.cpp
@@ -272,7 +272,7 @@ int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szTitle.a = LPGEN("GmailNotifier");
odp.szGroup.a = LPGEN("Network");
diff --git a/plugins/GmailNotifier/src/stdafx.h b/plugins/GmailNotifier/src/stdafx.h
index 78d5c08275..c098816cef 100644
--- a/plugins/GmailNotifier/src/stdafx.h
+++ b/plugins/GmailNotifier/src/stdafx.h
@@ -73,7 +73,7 @@ struct optionSettings
extern OBJLIST<Account> g_accs;
extern optionSettings opt;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibUser;
extern UINT hTimer;
extern short ID_STATUS_NONEW;
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index b9c5335b1c..8c105de7c7 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -23,7 +23,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam);
char PLUGINNAME[64] = {0}; //init at init_pluginname();
int hLangpack = 0;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HINSTANCE hLotusDll;
@@ -209,7 +209,7 @@ void init_pluginname()
WIN32_FIND_DATAA ffd;
// Try to find name of the file having original letter sizes
- GetModuleFileNameA(hInst, text, sizeof(text));
+ GetModuleFileNameA(g_hInstance, text, sizeof(text));
HANDLE hFind = FindFirstFileA(text, &ffd);
if(hFind != INVALID_HANDLE_VALUE) {
@@ -450,7 +450,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(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ ppd.lchIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON1));
wcscpy_s(ppd.lptzContactName, _countof(ppd.lptzContactName), sender);
wcscpy_s(ppd.lptzText, _countof(ppd.lptzText), text);
if(settingSetColours)
@@ -1453,7 +1453,7 @@ static INT_PTR CALLBACK DlgProcLotusNotifyMiscOpts(HWND hwndDlg, UINT msg, WPARA
int LotusNotifyOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.szGroup.w = LPGENW("Plugins");
odp.szTitle.w = _A2W(__PLUGIN_NAME);
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
@@ -1509,7 +1509,7 @@ INT_PTR TMLoadIcon(WPARAM wParam, LPARAM)
default:
return 0;
}
- return (INT_PTR)LoadImage(hInst, 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_hInstance, MAKEINTRESOURCE(id), IMAGE_ICON, GetSystemMetrics(wParam & PLIF_SMALL ? SM_CXSMICON : SM_CXICON), GetSystemMetrics(wParam & PLIF_SMALL ? SM_CYSMICON : SM_CYICON), 0);
}
@@ -1700,7 +1700,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(hInst, MAKEINTRESOURCE(IDI_ICON1));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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.
@@ -1760,7 +1760,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID )
case DLL_PROCESS_ATTACH:
/* Save the instance handle */
Plugin_Terminated = false;
- hInst = hinstDLL;
break;
case DLL_PROCESS_DETACH:
/* Deregister extension manager callbacks */
@@ -1773,12 +1772,14 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID )
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PLUGINNAME)
+ PLUGIN<CMPlugin>(PLUGINNAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp
index 7ff29ede9a..e656206e9f 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(hInst, IDD_AUTHENTICATION),
+ : CSuper(g_hInstance, 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 763890c580..206238b4bd 100644
--- a/plugins/NewsAggregator/Src/Icons.cpp
+++ b/plugins/NewsAggregator/Src/Icons.cpp
@@ -33,7 +33,7 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(hInst, LPGEN("News Aggregator"), iconList, _countof(iconList), MODULE);
+ Icon_Register(g_hInstance, 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 d0b1547f22..66f0af69b8 100644
--- a/plugins/NewsAggregator/Src/NewsAggregator.cpp
+++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp
@@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HINSTANCE hInst = nullptr;
+HINSTANCE g_hInstance = nullptr;
int hLangpack;
HANDLE hPrebuildMenuHook = nullptr;
@@ -29,6 +29,8 @@ HANDLE hUpdateMutex;
LIST<CFeedEditor> g_arFeeds(1, PtrKeySortT);
+/////////////////////////////////////////////////////////////////////////////////////////
+
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -42,18 +44,16 @@ PLUGININFOEX pluginInfoEx = {
{0x56cc3f29, 0xccbf, 0x4546, {0xa8, 0xba, 0x98, 0x56, 0x24, 0x8a, 0x41, 0x2a}}
};
-bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- hInst = hinstDLL;
- return TRUE;
+ return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfoEx;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
extern "C" __declspec(dllexport) int Load(void)
{
@@ -97,6 +97,8 @@ extern "C" __declspec(dllexport) int Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
DestroyUpdateList();
@@ -106,13 +108,15 @@ extern "C" __declspec(dllexport) int Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULE)
+ 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 b84aabe6a2..4d96fb10e3 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(hInst, IDD_FEEDEXPORT),
+ : CSuper(g_hInstance, 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(hInst, IDD_FEEDIMPORT),
+ : CSuper(g_hInstance, 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(hInst, IDD_ADDFEED),
+ : CSuper(g_hInstance, 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(hInst, IDD_OPTIONS, MODULE),
+ : CPluginDlgBase(g_hInstance, 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 = hInst;
+ odp.hInstance = g_hInstance;
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 40fc6f7002..60c5bcf593 100644
--- a/plugins/NewsAggregator/Src/stdafx.h
+++ b/plugins/NewsAggregator/Src/stdafx.h
@@ -60,7 +60,7 @@ Boston, MA 02111-1307, USA.
#define DEFAULT_AVATARS_FOLDER "NewsAggregator"
#define DEFAULT_UPDATE_TIME 60
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern CDlgBase *pAddFeedDialog, *pImportDialog, *pExportDialog;
extern HNETLIBUSER hNetlibUser;
extern UINT_PTR timerId;
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp
index c3c550eb59..5923e9794f 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_hInst, MAKEINTRESOURCE(IDD_HELP), nullptr, HelpWindowDlgProc);
+ CreateDialog(g_hInstance, 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_hInst, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
+ CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_TEST_LINE), nullptr, TestWindowDlgProc);
return 0;
}
INT_PTR LoadFilesDlg(WPARAM, LPARAM)
{
- CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_ADD_FILE), nullptr, DlgProcFiles);
+ CreateDialog(g_hInstance, 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_hInst;
+ psp[0].hInstance = g_hInstance;
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_hInst;
+ psp[1].hInstance = g_hInstance;
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_hInst;
+ psp[2].hInstance = g_hInstance;
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_hInst;
+ psp[3].hInstance = g_hInstance;
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_hInst;
+ psh.hInstance = g_hInstance;
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 fd7de1059d..36e2d33361 100644
--- a/plugins/Non-IM Contact/src/main.cpp
+++ b/plugins/Non-IM Contact/src/main.cpp
@@ -7,7 +7,7 @@
#include "Version.h"
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst;
+HINSTANCE g_hInstance;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -63,7 +63,7 @@ int LCStatus = ID_STATUS_OFFLINE;
int NimcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szGroup.a = LPGEN("Plugins");
odp.szTitle.a = LPGEN("Non-IM Contacts");
@@ -94,7 +94,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
//
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD, LPVOID)
{
- g_hInst = hinst;
+ g_hInstance = hinst;
return TRUE;
}
@@ -121,7 +121,7 @@ extern "C" __declspec(dllexport) int Load()
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- Icon_Register(g_hInst, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
+ Icon_Register(g_hInstance, LPGEN("Non-IM Contact"), icoList, _countof(icoList));
HookEvent(ME_CLIST_DOUBLECLICKED, (MIRANDAHOOK)doubleClick);
HookEvent(ME_OPT_INITIALISE, NimcOptInit);
@@ -204,12 +204,14 @@ extern "C" __declspec(dllexport) int Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODNAME)
+ 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 ef713be562..857bb66680 100644
--- a/plugins/Non-IM Contact/src/stdafx.h
+++ b/plugins/Non-IM Contact/src/stdafx.h
@@ -69,7 +69,7 @@ struct DLGTEMPLATEEX
// Defines
//=======================================================
//General
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInstance;
extern int LCStatus;
extern IconItem icoList[];
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp
index 55c5e6379b..c1f6625f62 100644
--- a/plugins/Quotes/src/Forex.cpp
+++ b/plugins/Quotes/src/Forex.cpp
@@ -290,12 +290,6 @@ inline int Quotes_UnhookEvent(HANDLE h)
return UnhookEvent(h);
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
EXTERN_C __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
EXTERN_C __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
@@ -338,13 +332,15 @@ EXTERN_C __declspec(dllexport) int Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(QUOTES_PROTOCOL_NAME)
+ 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/StartPosition/src/main.cpp b/plugins/StartPosition/src/main.cpp
index 24ae37c529..e802790da2 100644
--- a/plugins/StartPosition/src/main.cpp
+++ b/plugins/StartPosition/src/main.cpp
@@ -23,10 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-
-HINSTANCE g_hInst;
+CMPlugin g_plugin;
+HINSTANCE g_hInstance;
int hLangpack;
-StartPositionPlugin* startposition;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -41,31 +40,23 @@ PLUGININFOEX pluginInfo = {
{0x211f6277, 0x6f9b, 0x4b77, {0xa9, 0x39, 0x84, 0xd0, 0x4b, 0x26, 0xb3, 0x8c}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfo;
}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
extern "C" __declspec(dllexport) int Load(void)
{
- mir_getLP(&pluginInfo);
- startposition = new StartPositionPlugin;
+ mir_getLP(&pluginInfo);
- startposition->positionClist();
+ g_plugin.positionClist();
- return 0;
+ return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- delete startposition;
- startposition = nullptr;
-
- return 0;
+ return 0;
}
diff --git a/plugins/StartPosition/src/options.cpp b/plugins/StartPosition/src/options.cpp
index da33fc6ef3..f797c1d030 100644
--- a/plugins/StartPosition/src/options.cpp
+++ b/plugins/StartPosition/src/options.cpp
@@ -1,124 +1,123 @@
#include "stdafx.h"
-
StartPositionOptions::StartPositionOptions() :
- setTopPosition(MODULE_NAME, "CLEnableTop", 1),
- setBottomPosition(MODULE_NAME, "CLEnableBottom", 0),
- setSidePosition(MODULE_NAME, "CLEnableSide", 1),
- clistAlign(MODULE_NAME, "CLAlign", ClistAlign::right),
- setClistWidth(MODULE_NAME, "CLEnableWidth", 0),
- setClistStartState(MODULE_NAME, "CLEnableState", 0),
- clistState(MODULE_NAME, "CLState", ClistState::normal),
- pixelsFromTop(MODULE_NAME, "CLpixelsTop", 3),
- pixelsFromBottom(MODULE_NAME, "CLpixelsBottom", 3),
- pixelsFromSide(MODULE_NAME, "CLpixelsSide", 3),
- clistWidth(MODULE_NAME, "CLWidth", 180)
-{}
-
-COptionsDlg::COptionsDlg(StartPositionPlugin* instance) :
- CPluginDlgBase(g_hInst, IDD_OPTIONS, MODULE_NAME),
- m_plugin(instance),
- chkPositionTop(this, IDC_CLTOPENABLE),
- edtPositionTop(this, IDC_CLTOP),
- chkPositionBottom(this, IDC_CLBOTTOMENABLE),
- edtPositionBottom(this, IDC_CLBOTTOM),
- chkPositionSide(this, IDC_CLSIDEENABLE),
- edtPositionSide(this, IDC_CLSIDE),
- chkFromLeft(this, IDC_CLALIGNLEFT),
- chkFromRight(this, IDC_CLALIGNRIGHT),
- chkWidth(this, IDC_CLWIDTHENABLE),
- edtWidth(this, IDC_CLWIDTH),
- chkStartState(this, IDC_CLSTATEENABLE),
- chkStartHidden(this, IDC_CLSTATETRAY),
- chkStartNormal(this, IDC_CLSTATEOPENED)
+ setTopPosition(MODULE_NAME, "CLEnableTop", 1),
+ setBottomPosition(MODULE_NAME, "CLEnableBottom", 0),
+ setSidePosition(MODULE_NAME, "CLEnableSide", 1),
+ clistAlign(MODULE_NAME, "CLAlign", ClistAlign::right),
+ setClistWidth(MODULE_NAME, "CLEnableWidth", 0),
+ setClistStartState(MODULE_NAME, "CLEnableState", 0),
+ clistState(MODULE_NAME, "CLState", ClistState::normal),
+ pixelsFromTop(MODULE_NAME, "CLpixelsTop", 3),
+ pixelsFromBottom(MODULE_NAME, "CLpixelsBottom", 3),
+ pixelsFromSide(MODULE_NAME, "CLpixelsSide", 3),
+ clistWidth(MODULE_NAME, "CLWidth", 180)
+{
+}
+
+COptionsDlg::COptionsDlg() :
+ CPluginDlgBase(g_hInstance, IDD_OPTIONS, MODULE_NAME),
+ chkPositionTop(this, IDC_CLTOPENABLE),
+ edtPositionTop(this, IDC_CLTOP),
+ chkPositionBottom(this, IDC_CLBOTTOMENABLE),
+ edtPositionBottom(this, IDC_CLBOTTOM),
+ chkPositionSide(this, IDC_CLSIDEENABLE),
+ edtPositionSide(this, IDC_CLSIDE),
+ chkFromLeft(this, IDC_CLALIGNLEFT),
+ chkFromRight(this, IDC_CLALIGNRIGHT),
+ chkWidth(this, IDC_CLWIDTHENABLE),
+ edtWidth(this, IDC_CLWIDTH),
+ chkStartState(this, IDC_CLSTATEENABLE),
+ chkStartHidden(this, IDC_CLSTATETRAY),
+ chkStartNormal(this, IDC_CLSTATEOPENED)
{
- CreateLink(chkPositionTop, m_plugin->spOptions.setTopPosition);
- CreateLink(chkPositionBottom, m_plugin->spOptions.setBottomPosition);
- CreateLink(chkPositionSide, m_plugin->spOptions.setSidePosition);
- CreateLink(chkWidth, m_plugin->spOptions.setClistWidth);
- CreateLink(chkStartState, m_plugin->spOptions.setClistStartState);
-
- CreateLink(edtPositionTop, m_plugin->spOptions.pixelsFromTop);
- CreateLink(edtPositionBottom, m_plugin->spOptions.pixelsFromBottom);
- CreateLink(edtPositionSide, m_plugin->spOptions.pixelsFromSide);
- CreateLink(edtWidth, m_plugin->spOptions.clistWidth);
-
- chkPositionTop.OnChange = Callback(this, &COptionsDlg::onCheck_PositionTop);
- chkPositionBottom.OnChange = Callback(this, &COptionsDlg::onCheck_PositionBottom);
- chkPositionSide.OnChange = Callback(this, &COptionsDlg::onCheck_PositionSide);
- chkWidth.OnChange = Callback(this, &COptionsDlg::onCheck_Width);
- chkStartState.OnChange = Callback(this, &COptionsDlg::onCheck_StartState);
+ CreateLink(chkPositionTop, g_plugin.spOptions.setTopPosition);
+ CreateLink(chkPositionBottom, g_plugin.spOptions.setBottomPosition);
+ CreateLink(chkPositionSide, g_plugin.spOptions.setSidePosition);
+ CreateLink(chkWidth, g_plugin.spOptions.setClistWidth);
+ CreateLink(chkStartState, g_plugin.spOptions.setClistStartState);
+
+ CreateLink(edtPositionTop, g_plugin.spOptions.pixelsFromTop);
+ CreateLink(edtPositionBottom, g_plugin.spOptions.pixelsFromBottom);
+ CreateLink(edtPositionSide, g_plugin.spOptions.pixelsFromSide);
+ CreateLink(edtWidth, g_plugin.spOptions.clistWidth);
+
+ chkPositionTop.OnChange = Callback(this, &COptionsDlg::onCheck_PositionTop);
+ chkPositionBottom.OnChange = Callback(this, &COptionsDlg::onCheck_PositionBottom);
+ chkPositionSide.OnChange = Callback(this, &COptionsDlg::onCheck_PositionSide);
+ chkWidth.OnChange = Callback(this, &COptionsDlg::onCheck_Width);
+ chkStartState.OnChange = Callback(this, &COptionsDlg::onCheck_StartState);
}
void COptionsDlg::OnInitDialog()
{
- if (m_plugin->spOptions.clistState == ClistState::normal)
- chkStartNormal.SetState(true);
- else
- chkStartHidden.SetState(true);
-
- chkStartHidden.Enable(chkStartState.GetState());
- chkStartNormal.Enable(chkStartState.GetState());
-
- if (m_plugin->spOptions.clistAlign == ClistAlign::right)
- chkFromRight.SetState(true);
- else
- chkFromLeft.SetState(true);
-
- chkFromLeft.Enable(chkPositionSide.GetState());
- chkFromRight.Enable(chkPositionSide.GetState());
-
- edtPositionTop.Enable(chkPositionTop.GetState());
- edtPositionBottom.Enable(chkPositionBottom.GetState());
- edtPositionSide.Enable(chkPositionSide.GetState());
- edtWidth.Enable(chkWidth.GetState());
+ if (g_plugin.spOptions.clistState == ClistState::normal)
+ chkStartNormal.SetState(true);
+ else
+ chkStartHidden.SetState(true);
+
+ chkStartHidden.Enable(chkStartState.GetState());
+ chkStartNormal.Enable(chkStartState.GetState());
+
+ if (g_plugin.spOptions.clistAlign == ClistAlign::right)
+ chkFromRight.SetState(true);
+ else
+ chkFromLeft.SetState(true);
+
+ chkFromLeft.Enable(chkPositionSide.GetState());
+ chkFromRight.Enable(chkPositionSide.GetState());
+
+ edtPositionTop.Enable(chkPositionTop.GetState());
+ edtPositionBottom.Enable(chkPositionBottom.GetState());
+ edtPositionSide.Enable(chkPositionSide.GetState());
+ edtWidth.Enable(chkWidth.GetState());
}
void COptionsDlg::OnApply()
{
- removeOldSettings();
+ removeOldSettings();
- if (chkStartNormal.GetState())
- m_plugin->spOptions.clistState = ClistState::normal;
- else
- m_plugin->spOptions.clistState = ClistState::hidden;
+ if (chkStartNormal.GetState())
+ g_plugin.spOptions.clistState = ClistState::normal;
+ else
+ g_plugin.spOptions.clistState = ClistState::hidden;
- if (chkFromRight.GetState())
- m_plugin->spOptions.clistAlign = ClistAlign::right;
- else
- m_plugin->spOptions.clistAlign = ClistAlign::left;
+ if (chkFromRight.GetState())
+ g_plugin.spOptions.clistAlign = ClistAlign::right;
+ else
+ g_plugin.spOptions.clistAlign = ClistAlign::left;
}
void COptionsDlg::removeOldSettings()
{
- m_plugin->delSetting("CLEnable");
- m_plugin->delSetting("CLuseLastWidth");
+ g_plugin.delSetting("CLEnable");
+ g_plugin.delSetting("CLuseLastWidth");
}
void COptionsDlg::onCheck_PositionTop(CCtrlCheck*)
{
- edtPositionTop.Enable(chkPositionTop.GetState());
+ edtPositionTop.Enable(chkPositionTop.GetState());
}
void COptionsDlg::onCheck_PositionBottom(CCtrlCheck*)
{
- edtPositionBottom.Enable(chkPositionBottom.GetState());
+ edtPositionBottom.Enable(chkPositionBottom.GetState());
}
void COptionsDlg::onCheck_PositionSide(CCtrlCheck*)
{
- edtPositionSide.Enable(chkPositionSide.GetState());
- chkFromLeft.Enable(chkPositionSide.GetState());
- chkFromRight.Enable(chkPositionSide.GetState());
+ edtPositionSide.Enable(chkPositionSide.GetState());
+ chkFromLeft.Enable(chkPositionSide.GetState());
+ chkFromRight.Enable(chkPositionSide.GetState());
}
void COptionsDlg::onCheck_Width(CCtrlCheck*)
{
- edtWidth.Enable(chkWidth.GetState());
+ edtWidth.Enable(chkWidth.GetState());
}
void COptionsDlg::onCheck_StartState(CCtrlCheck*)
{
- chkStartHidden.Enable(chkStartState.GetState());
- chkStartNormal.Enable(chkStartState.GetState());
+ chkStartHidden.Enable(chkStartState.GetState());
+ chkStartNormal.Enable(chkStartState.GetState());
}
diff --git a/plugins/StartPosition/src/options.h b/plugins/StartPosition/src/options.h
index 9208157f24..ed3dcfb5f3 100644
--- a/plugins/StartPosition/src/options.h
+++ b/plugins/StartPosition/src/options.h
@@ -77,7 +77,7 @@ class COptionsDlg : public CPluginDlgBase
CCtrlCheck chkStartState, chkStartHidden, chkStartNormal;
public:
- COptionsDlg(StartPositionPlugin* instance);
+ COptionsDlg();
void OnInitDialog() override;
void OnApply() override;
@@ -90,6 +90,4 @@ private:
void onCheck_PositionSide(CCtrlCheck*);
void onCheck_Width(CCtrlCheck*);
void onCheck_StartState(CCtrlCheck*);
-
- StartPositionPlugin* m_plugin;
};
diff --git a/plugins/StartPosition/src/startposition.cpp b/plugins/StartPosition/src/startposition.cpp
index 3f661f9f96..26c845b5ca 100644
--- a/plugins/StartPosition/src/startposition.cpp
+++ b/plugins/StartPosition/src/startposition.cpp
@@ -1,57 +1,56 @@
#include "stdafx.h"
-
-StartPositionPlugin::StartPositionPlugin() :
- PLUGIN<StartPositionPlugin>(MODULE_NAME)
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
{
- HookPluginEvent(ME_OPT_INITIALISE, &StartPositionPlugin::OnOptionsInit);
+ HookPluginEvent(ME_OPT_INITIALISE, &CMPlugin::OnOptionsInit);
}
-void StartPositionPlugin::positionClist()
+void CMPlugin::positionClist()
{
- ClistOptions clOptions;
-
- if (spOptions.setClistStartState)
- clOptions.state = static_cast<BYTE>(spOptions.clistState);
-
- if (spOptions.setClistWidth && spOptions.clistWidth > 0)
- clOptions.width = static_cast<DWORD>(spOptions.clistWidth);
- else
- spOptions.clistWidth = static_cast<DWORD>(clOptions.width);
-
- if (spOptions.setTopPosition || spOptions.setBottomPosition || spOptions.setSidePosition)
- clOptions.isDocked = false;
-
- if (spOptions.setTopPosition)
- clOptions.y = static_cast<DWORD>(spOptions.pixelsFromTop);
-
- RECT WorkArea;
- SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0);
-
- if (spOptions.setBottomPosition) {
- if (spOptions.setTopPosition)
- clOptions.height = WorkArea.bottom - WorkArea.top - spOptions.pixelsFromTop - spOptions.pixelsFromBottom;
- else
- clOptions.y = WorkArea.bottom - spOptions.pixelsFromBottom - clOptions.height;
- }
-
- if (spOptions.setSidePosition) {
- if (spOptions.clistAlign == ClistAlign::right)
- clOptions.x = WorkArea.right - spOptions.clistWidth - spOptions.pixelsFromSide;
- else
- clOptions.x = WorkArea.left + spOptions.pixelsFromSide;
- }
+ ClistOptions clOptions;
+
+ if (spOptions.setClistStartState)
+ clOptions.state = static_cast<BYTE>(spOptions.clistState);
+
+ if (spOptions.setClistWidth && spOptions.clistWidth > 0)
+ clOptions.width = static_cast<DWORD>(spOptions.clistWidth);
+ else
+ spOptions.clistWidth = static_cast<DWORD>(clOptions.width);
+
+ if (spOptions.setTopPosition || spOptions.setBottomPosition || spOptions.setSidePosition)
+ clOptions.isDocked = false;
+
+ if (spOptions.setTopPosition)
+ clOptions.y = static_cast<DWORD>(spOptions.pixelsFromTop);
+
+ RECT WorkArea;
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0);
+
+ if (spOptions.setBottomPosition) {
+ if (spOptions.setTopPosition)
+ clOptions.height = WorkArea.bottom - WorkArea.top - spOptions.pixelsFromTop - spOptions.pixelsFromBottom;
+ else
+ clOptions.y = WorkArea.bottom - spOptions.pixelsFromBottom - clOptions.height;
+ }
+
+ if (spOptions.setSidePosition) {
+ if (spOptions.clistAlign == ClistAlign::right)
+ clOptions.x = WorkArea.right - spOptions.clistWidth - spOptions.pixelsFromSide;
+ else
+ clOptions.x = WorkArea.left + spOptions.pixelsFromSide;
+ }
}
-int StartPositionPlugin::OnOptionsInit(WPARAM wParam, LPARAM)
+int CMPlugin::OnOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = g_hInst;
- odp.szGroup.a = LPGEN("Contact list");
- odp.szTitle.a = LPGEN("Start position");
- odp.pDialog = new COptionsDlg(this);
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
-
- return 0;
+ OPTIONSDIALOGPAGE odp = {};
+ odp.hInstance = g_hInstance;
+ odp.szGroup.a = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Start position");
+ odp.pDialog = new COptionsDlg();
+ odp.flags = ODPF_BOLDGROUPS;
+ Options_AddPage(wParam, &odp);
+
+ return 0;
}
diff --git a/plugins/StartPosition/src/startposition.h b/plugins/StartPosition/src/startposition.h
index b4ce8dc896..fe5235e521 100644
--- a/plugins/StartPosition/src/startposition.h
+++ b/plugins/StartPosition/src/startposition.h
@@ -19,16 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-
-class StartPositionPlugin : public PLUGIN<StartPositionPlugin>
+class CMPlugin : public PLUGIN<CMPlugin>
{
- friend COptionsDlg;
+ friend COptionsDlg;
public:
- StartPositionPlugin();
+ CMPlugin();
- int __cdecl OnOptionsInit(WPARAM, LPARAM);
- void positionClist();
+ int __cdecl OnOptionsInit(WPARAM, LPARAM);
+ void positionClist();
- StartPositionOptions spOptions;
+ StartPositionOptions spOptions;
};
diff --git a/plugins/StartPosition/src/stdafx.h b/plugins/StartPosition/src/stdafx.h
index 5ecea86a97..a4995fad9b 100644
--- a/plugins/StartPosition/src/stdafx.h
+++ b/plugins/StartPosition/src/stdafx.h
@@ -33,11 +33,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "resource.h"
#include "version.h"
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInstance;
#define MODULE_NAME "StartPosition"
#define CLIST_MODULE_NAME "CList"
-class StartPositionPlugin;
#include "options.h"
#include "startposition.h"
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h
index 17eca030b2..a6e0354d14 100644
--- a/plugins/Weather/src/stdafx.h
+++ b/plugins/Weather/src/stdafx.h
@@ -351,7 +351,7 @@ typedef struct DATALIST WIDATALIST;
extern WIDATALIST *WIHead, *WITail;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern HWND hPopupWindow, hWndSetup;
extern MYOPTIONS opt;
diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp
index 00ceba9e93..afa14ccf0c 100644
--- a/plugins/Weather/src/weather.cpp
+++ b/plugins/Weather/src/weather.cpp
@@ -31,7 +31,7 @@ belong to any other file.
WIDATALIST *WIHead;
WIDATALIST *WITail;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
HWND hPopupWindow;
HANDLE hHookWeatherUpdated;
@@ -58,7 +58,9 @@ BOOL ModuleLoaded;
HANDLE hTBButton = nullptr;
+/////////////////////////////////////////////////////////////////////////////////////////
// plugin info
+
static const PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
@@ -73,18 +75,16 @@ static const PLUGININFOEX pluginInfoEx =
{0x6b612a34, 0xdcf2, 0x4e32, {0x85, 0xcf, 0xb6, 0xfd, 0x0, 0x6b, 0x74, 0x5e}}
};
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-
extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
int WeatherShutdown(WPARAM, LPARAM)
{
@@ -152,29 +152,6 @@ void InitVar()
ModuleLoaded = FALSE;
}
-// unload function
-extern "C" int __declspec(dllexport) Unload(void)
-{
- DestroyMwin();
- DestroyWindow(hPopupWindow);
-
- DestroyHookableEvent(hHookWeatherUpdated);
- DestroyHookableEvent(hHookWeatherError);
-
- NetlibHttpDisconnect();
- Netlib_CloseHandle(hNetlibUser);
-
- DestroyUpdateList();
- DestroyOptions();
- DestroyWIList(); // unload all ini data from memory
-
- WindowList_Destroy(hDataWindowList);
- WindowList_Destroy(hWindowList);
-
- CloseHandle(hUpdateMutex);
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfoEx);
@@ -227,17 +204,42 @@ 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, hInst, nullptr);
+ CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr);
SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
+// unload function
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ DestroyMwin();
+ DestroyWindow(hPopupWindow);
+
+ DestroyHookableEvent(hHookWeatherUpdated);
+ DestroyHookableEvent(hHookWeatherError);
+
+ NetlibHttpDisconnect();
+ Netlib_CloseHandle(hNetlibUser);
+
+ DestroyUpdateList();
+ DestroyOptions();
+ DestroyWIList(); // unload all ini data from memory
+
+ WindowList_Destroy(hDataWindowList);
+ WindowList_Destroy(hWindowList);
+
+ CloseHandle(hUpdateMutex);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(WEATHERPROTONAME)
+ PLUGIN<CMPlugin>(WEATHERPROTONAME)
{
opt.NoProtoCondition = db_get_b(NULL, WEATHERPROTONAME, "NoStatus", true);
RegisterProtocol((opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL);
@@ -245,3 +247,5 @@ struct CMPlugin : public CMPluginBase
}
}
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 59f5720d22..87a9374cbd 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(hInst, MAKEINTRESOURCE(IDD_SEARCHCITY), parent, WeatherSearchAdvancedDlgProc, 0);
+ return (INT_PTR)CreateDialogParam(g_hInstance, 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 efde7bc6d2..e685f3d4de 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(hInst, MAKEINTRESOURCE(IDD_EDIT), nullptr, DlgProcChange, (LPARAM)wParam);
+ CreateDialogParam(g_hInstance, 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 1840dcde66..de876f00c1 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(hInst, WEATHERPROTONAME, iconList, _countof(iconList), WEATHERPROTONAME);
+ Icon_Register(g_hInstance, 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 303fa5366c..7e79387f55 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(hInst, MAKEINTRESOURCE(IDD_SETUP), nullptr, DlgProcSetup);
+ hWndSetup = CreateDialog(g_hInstance, 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 6a5151429f..0775bcfff6 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, hInst, nullptr);
+ 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, nullptr, g_hInstance, 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, hInst, (void*)hContact);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, g_hInstance, (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 = hInst;
+ wndclass.hInstance = g_hInstance;
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", hInst);
+ UnregisterClass(L"WeatherFrame", g_hInstance);
WindowList_Destroy(hMwinWindowList);
UnhookEvent(hFontHook);
}
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp
index 8f4ec006ef..981b8e9f3e 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(hInst, MAKEINTRESOURCE(IDR_TMMENU));
+ hMenu = LoadMenu(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDR_TMENU));
+ hMenu = LoadMenu(g_hInstance, 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 = hInst;
+ odp.hInstance = g_hInstance;
// plugin options
odp.position = 95600;
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp
index 6ab96255b2..32d0969307 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(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDR_PMENU));
+ hMenu = LoadMenu(g_hInstance, 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 32b4dbf87b..694b03b068 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, hInst, MAKEINTRESOURCEA(IDD_BRIEF), BriefDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, hContact);
+ hMoreDataDlg = CreateDialogParam(g_hInstance, 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 = hInst;
+ odp.hInstance = g_hInstance;
odp.position = 100000000;
odp.szTitle.a = WEATHERPROTONAME;
@@ -348,7 +348,7 @@ int BriefInfo(WPARAM wParam, LPARAM)
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), nullptr, DlgProcMoreData, (LPARAM)wParam);
+ else hMoreDataDlg = CreateDialogParam(g_hInstance, 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 b56ba33794..978e938e0a 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -74,13 +74,6 @@ void ChangeContactStatus(int con_stat)
}
/*****************************************************************************/
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-/*****************************************************************************/
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
@@ -128,7 +121,7 @@ extern "C" int __declspec(dllexport) Load()
HookEvent(ME_CLIST_DOUBLECLICKED, Doubleclick);
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_CONTEXT));
hRichEd = LoadLibrary(L"Msftedit.dll");
/*TIMERS*/
@@ -171,7 +164,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(hInst, MAKEINTRESOURCE(IDI_SITE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE));
if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
mi.name.w = LPGENW("Auto update disabled");
else
@@ -183,7 +176,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(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = LPGENW("Update all Webview sites");
mi.pszService = "UpdateAll";
Menu_AddMainMenuItem(&mi);
@@ -192,7 +185,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(hInst, MAKEINTRESOURCE(IDI_MARKALLREAD));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MARKALLREAD));
mi.name.w = LPGENW("Mark all Webview sites as read");
mi.pszService = "MarkAllSitesRead";
Menu_AddMainMenuItem(&mi);
@@ -201,7 +194,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(hInst, MAKEINTRESOURCE(IDI_FOLDER));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_FOLDER));
mi.name.w = LPGENW("Open cache folder");
mi.pszService = "OpenCacheFolder";
Menu_AddMainMenuItem(&mi);
@@ -213,7 +206,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(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.name.w = countername;
mi.pszService = "Countdown";
hMenuItemCountdown = Menu_AddMainMenuItem(&mi);
@@ -225,7 +218,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(hInst, MAKEINTRESOURCE(IDI_URL));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_URL));
mi.pszService = "Open web page";
mi.name.w = LPGENW("Open web page");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -233,42 +226,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(hInst, MAKEINTRESOURCE(IDI_SHOW_HIDE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_UPDATE));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_ALERT));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_PING));
+ mi.hIcolibItem = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_STOP));
+ mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_STOP));
mi.name.w = LPGENW("Stop data processing");
Menu_AddContactMenuItem(&mi, MODULENAME);
@@ -284,13 +277,15 @@ extern "C" int __declspec(dllexport) Load()
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(MODULENAME)
+ PLUGIN<CMPlugin>(MODULENAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
SetUniqueId("PreserveName");
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index bd83ccab8b..be2b8635bc 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -38,7 +38,7 @@ UINT_PTR Countdown;
LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
HMENU hMenu;
int bpStatus;
HGENMENU hMenuItem1;
@@ -54,14 +54,14 @@ void ChangeMenuItem1()
else
ptszName = LPGENW("Auto update disabled");
- Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)));
+ Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SITE)));
}
/*****************************************************************************/
void ChangeMenuItemCountdown()
{
// countdown
- HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ HICON hIcon = LoadIcon(g_hInstance, 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 +185,9 @@ int Doubleclick(WPARAM wParam, LPARAM)
SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(g_hInstance, 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(hInst, 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_hInstance, 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 +293,7 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD)
static int OptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
odp.szGroup.a = LPGEN("Network");
odp.szTitle.a = MODULENAME;
@@ -368,8 +368,8 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
}
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
@@ -474,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +489,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(g_hInstance, 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 b144ade234..c9bfd998a4 100644
--- a/plugins/WebView/src/webview.h
+++ b/plugins/WebView/src/webview.h
@@ -143,7 +143,6 @@ extern UINT_PTR timerId, Countdown;
extern LOGFONT g_lf;
extern HFONT h_font;
extern HWND ContactHwnd;
-extern HINSTANCE hInst;
extern HMENU hMenu;
extern int bpStatus;
extern HNETLIBUSER hNetlibUser;
@@ -157,7 +156,6 @@ void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD);
void SavewinSettings(void);
void ValidatePosition(HWND hwndDlg);
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
-void ChangeMenuItem3();
wchar_t* FixButtonText(wchar_t *url, size_t len);
int ContactMenuItemUpdateData (WPARAM wParam, LPARAM lParam);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index d3dc4fc415..a21b19f693 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(hInst, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_hInstance, 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(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, 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(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(g_hInstance, 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(hInst, 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_hInstance, 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 2bd17e4863..425b43e7ae 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(hInst, MAKEINTRESOURCE(IDI_FIND)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_SITE)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_UPDATE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Update data"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_FIND_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_FIND), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Find"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_OPTIONS_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONS), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Contact options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_ALERT_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_ALERT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Alert options"), BATF_UNICODE);
- SendDlgItemMessage(hwndDlg, IDC_STOP, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, 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(hInst, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 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, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Stick to the front"), BATF_UNICODE);
}
else {
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ 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, 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(hInst, MAKEINTRESOURCE(IDI_UNSTICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 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, 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(hInst, MAKEINTRESOURCE(IDD_FIND), hwndDlg, DlgProcFind, (LPARAM) wParam);
+ HWND hwndFind = CreateDialogParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), hwndDlg, DlgProcContactOpt, (LPARAM) hContact);
+ ContactHwnd = CreateDialogParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), hwndDlg, DlgProcAlertOpt, (LPARAM) hContact);
+ HWND hwndAlertOpt = CreateDialogParam(g_hInstance, 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, hInst, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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 4ad9519b4a..348185a01d 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(hInst, MAKEINTRESOURCE(IDI_SITE));
+ ppd.lchIcon = LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(g_hInstance, 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 3d0f27c556..277683ea74 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(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, 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(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, 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(hInst, cachepath, _countof(cachepath));
+ GetModuleFileName(g_hInstance, 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(hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ 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);
}
diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp
index 6bc632e730..7b84b15c44 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(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
+ hBadConnect = CreateDialogParam(g_hInstance, 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 d26db00f7b..7ecab8374d 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(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam);
+ MyParam.mail->MsgWindow = CreateDialogParamW(g_hInstance, 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(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam);
+ hMailBrowser = CreateDialogParamW(g_hInstance, 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 edfbf9c6ec..7491051500 100644
--- a/plugins/YAMN/src/main.cpp
+++ b/plugins/YAMN/src/main.cpp
@@ -23,6 +23,7 @@ int YAMN_STATUS;
BOOL UninstallPlugins;
HANDLE hAccountFolder;
+HINSTANCE g_hInstance;
HINSTANCE *hDllPlugins;
static int iDllPlugins = 0;
@@ -32,19 +33,6 @@ YAMN_VARIABLES YAMNVar;
CLIST_INTERFACE *pcli;
int hLangpack;
-PLUGININFOEX pluginInfo = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {B047A7E5-027A-4CFC-8B18-EDA8345D2790}
- {0xb047a7e5, 0x27a, 0x4cfc, {0x8b, 0x18, 0xed, 0xa8, 0x34, 0x5d, 0x27, 0x90}}
-};
-
HANDLE hNewMailHook;
HANDLE NoWriterEV;
HANDLE hTTButton;
@@ -82,15 +70,22 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath)
/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- YAMNVar.hInst = hinstDLL;
- return TRUE;
-}
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
+PLUGININFOEX pluginInfo = {
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {B047A7E5-027A-4CFC-8B18-EDA8345D2790}
+ {0xb047a7e5, 0x27a, 0x4cfc, {0x8b, 0x18, 0xed, 0xa8, 0x34, 0x5d, 0x27, 0x90}}
+};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
@@ -98,8 +93,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
}
/////////////////////////////////////////////////////////////////////////////////////////
-
// The callback function
+
BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr)
{
// Convert code page string to number
@@ -168,7 +163,7 @@ static IconItem iconList[] =
void LoadIcons()
{
- Icon_Register(YAMNVar.hInst, "YAMN", iconList, _countof(iconList));
+ Icon_Register(g_hInstance, "YAMN", iconList, _countof(iconList));
}
HANDLE WINAPI g_GetIconHandle(int idx)
@@ -362,13 +357,15 @@ extern "C" int __declspec(dllexport) Unload(void)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(YAMN_DBMODULE)
+ 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 07889eaee3..405e27ab4a 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 = YAMNVar.hInst;
+ odp.hInstance = g_hInstance;
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(pYAMNVar->hInst, MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
+ DialogBoxParamW(g_hInstance, MAKEINTRESOURCEW(IDD_CHOOSESTATUSMODES), hDlg, DlgProcPOP3AccStatusOpt, NULL);
break;
case IDC_BTNADD:
diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp
index 4437ee1864..3b50bc946b 100644
--- a/protocols/Discord/src/main.cpp
+++ b/protocols/Discord/src/main.cpp
@@ -17,11 +17,14 @@ 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 },
@@ -41,13 +44,7 @@ PLUGININFOEX pluginInfo = {
{ 0x88928401, 0x2ce8, 0x4568, { 0xaa, 0xa7, 0x22, 0x61, 0x41, 0x87, 0x0c, 0xbf } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -79,16 +76,3 @@ extern "C" int __declspec(dllexport) Unload(void)
DestroyWindow(g_hwndHeartbeat);
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public ACCPROTOPLUGIN<CDiscordProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CDiscordProto>("Discord")
- {
- SetUniqueId(DB_KEY_ID);
- }
-}
- g_plugin;
-
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 99fb50ecf6..a33511d3bd 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -350,3 +350,14 @@ public:
static void CALLBACK HeartbeatTimerProc(HWND hwnd, UINT msg, UINT_PTR id, DWORD);
static void CALLBACK MarkReadTimerProc(HWND hwnd, UINT msg, UINT_PTR id, DWORD);
};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public ACCPROTOPLUGIN<CDiscordProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CDiscordProto>("Discord")
+ {
+ SetUniqueId(DB_KEY_ID);
+ }
+};
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index d09c1a7499..5c83a50ef0 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -47,9 +47,6 @@ extern IconItem g_iconList[];
extern HINSTANCE g_hInstance;
extern HWND g_hwndHeartbeat;
-#include "version.h"
-#include "proto.h"
-
#define DB_KEY_ID "id"
#define DB_KEY_EMAIL "Email"
#define DB_KEY_PASSWORD "Password"
@@ -65,6 +62,9 @@ extern HWND g_hwndHeartbeat;
#define DB_KEY_GROUP "GroupName"
#define DB_KEYVAL_GROUP L"Discord"
+#include "version.h"
+#include "proto.h"
+
SnowFlake getId(const JSONNode &pNode);
CMStringW PrepareMessageText(const JSONNode &pRoot);
int StrToStatus(const CMStringW &str);
diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h
index 67f7da5716..90b08dd243 100644
--- a/protocols/Dummy/src/dummy.h
+++ b/protocols/Dummy/src/dummy.h
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct CDummyProto;
extern LIST<CDummyProto> dummy_Instances;
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
#define DUMMY_ID_TEMPLATE "Template"
#define DUMMY_ID_TEXT "UniqueIdText"
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp
index c2a156bd4e..701d647589 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(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this);
}
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp
index 6a57644bf3..93492c1df6 100644
--- a/protocols/Dummy/src/main.cpp
+++ b/protocols/Dummy/src/main.cpp
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "version.h"
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -36,19 +36,13 @@ PLUGININFOEX pluginInfo =
{ 0x2a1081d1, 0xaee3, 0x4091, {0xb7, 0xd, 0xae, 0x46, 0xd0, 0x9f, 0x9a, 0x7f}}
};
-/////////////////////////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -94,3 +88,5 @@ struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 8305850048..9efd5a1ac3 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -362,13 +362,15 @@ extern "C" int __declspec(dllexport) __cdecl Unload()
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public CMPluginBase
+struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin() :
- CMPluginBase(PROTONAME)
+ PLUGIN<CMPlugin>(PROTONAME)
{
RegisterProtocol(PROTOTYPE_PROTOCOL);
SetUniqueId("Nick");
}
}
g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index ee2810a5c7..a2d89766aa 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -44,12 +44,6 @@ PLUGININFOEX pluginInfo = {
{ 0x8432b009, 0xff32, 0x4727, { 0xaa, 0xe6, 0xa9, 0x3, 0x50, 0x38, 0xfd, 0x58 } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
g_mirandaVersion = mirandaVersion;
@@ -97,3 +91,5 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 28a69f80c9..5ebdb40815 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(hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else if (LOWORD(wParam) == IDC_CHPASS) {
dat.mode = GG_USERUTIL_PASS;
- ret = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHPASS), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else if (LOWORD(wParam) == IDC_CHEMAIL) {
dat.mode = GG_USERUTIL_EMAIL;
- ret = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_CHEMAIL), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
}
else {
dat.mode = GG_USERUTIL_REMOVE;
- ret = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_REMOVEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ ret = DialogBoxParam(g_hInstance, 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 = hInstance;
+ odp.hInstance = g_hInstance;
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 = hInstance;
+ odp.hInstance = g_hInstance;
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(hInstance, MAKEINTRESOURCE(IDD_CREATEACCOUNT), hwndDlg, gg_userutildlgproc, (LPARAM)&dat);
+ int ret = DialogBoxParam(g_hInstance, 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 8aeffc1391..bec809277c 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -39,7 +39,7 @@ PLUGININFOEX pluginInfo = {
// Other variables
CMPlugin g_plugin;
-HINSTANCE hInstance;
+HINSTANCE g_hInstance;
SSL_API sslApi;
CLIST_INTERFACE *pcli;
@@ -47,6 +47,8 @@ int hLangpack;
static unsigned long crc_table[256];
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
//////////////////////////////////////////////////////////
// Extra winsock function for error description
//
@@ -407,17 +409,3 @@ void gg_debughandler(int level, const char *format, va_list ap)
free(szFormat);
}
#endif
-
-//////////////////////////////////////////////////////////
-// main DLL function
-//
-BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD, LPVOID)
-{
- crc_gentable();
- hInstance = hInst;
-#ifdef DEBUGMODE
- gg_debug_level = GG_DEBUG_FUNCTION;
- gg_debug_handler = gg_debughandler;
-#endif
- return TRUE;
-}
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index da4cc74c01..f96f613fdd 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -258,7 +258,7 @@ struct GGGETAVATARDATA
struct GaduProto;
-extern HINSTANCE hInstance;
+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 a54e6100da..2b2c9eefc5 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(hInstance,
+ return CreateDialogParam(g_hInstance,
MAKEINTRESOURCE(IDD_GGADVANCEDSEARCH), owner, gg_advancedsearchdlgproc, (LPARAM)this);
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index ddeaa82cb9..87555b9d06 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -303,11 +303,14 @@ inline void GaduProto::gg_sleep(DWORD miliseconds, BOOL alterable, char* calling
#endif
}
+void crc_gentable(void);
+
struct CMPlugin : public ACCPROTOPLUGIN<GaduProto>
{
CMPlugin() :
ACCPROTOPLUGIN<GaduProto>(GGDEF_PROTO)
{
+ crc_gentable();
SetUniqueId(GG_KEY_UIN);
}
};
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index e8db07c499..1ea195a83b 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(hInstance, MAKEINTRESOURCE(IDD_CONFERENCE), nullptr, gg_gc_openconfdlg, (LPARAM)this);
+ CreateDialogParam(g_hInstance, 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 040583299c..7ee2a5e5fd 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(hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
+ Icon_Register(g_hInstance, "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 8d86ada520..909ee5c078 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 = hInstance;
+ ofn.hInstance = g_hInstance;
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, hInstance, dat->bReceiving ? MAKEINTRESOURCEA(IDD_IMAGE_RECV) : MAKEINTRESOURCEA(IDD_IMAGE_SEND), sttImageDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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 = hInstance;
+ ofn.hInstance = g_hInstance;
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(hInstance, dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND),
+ DialogBoxParam(g_hInstance, dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND),
hMIWnd, gg_img_dlgproc, (LPARAM)dat);
#ifdef DEBUGMODE
@@ -747,7 +747,7 @@ int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat)
if (_wstat(szPath, &st) != 0)
return 0;
- if ((long)st.st_size == dat->nSize)
+ if (st.st_size == (long)dat->nSize)
{
FILE *fp = _wfopen(szPath, L"rb");
if (!fp) return 0;
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index 523be087a9..7ef2ec6cf6 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"), hInstance, IDI_GG, GGS_PARSELINK, 0);
+ AssocMgr_AddNewUrlTypeW("gg:", TranslateT("Gadu-Gadu Link Protocol"), g_hInstance, IDI_GG, GGS_PARSELINK, 0);
}
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index b127f19852..425eb044a2 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(hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_hInstance, 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 2c4f80318c..63ba37d099 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, hInstance, MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_SESSIONS), sttSessionsDlgResizer);
return 0;
case WM_SETCURSOR:
@@ -397,7 +397,7 @@ INT_PTR GaduProto::sessions_view(WPARAM, LPARAM)
SetFocus(hwndSessionsDlg);
}
else
- CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_SESSIONS), nullptr, gg_sessions_viewdlg, (LPARAM)this);
+ CreateDialogParam(g_hInstance, 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 ebb9535726..9f7f80b87c 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(hInstance, MAKEINTRESOURCE(IDD_TOKEN), nullptr, gg_tokendlgproc, (LPARAM)&dat) == IDCANCEL)
+ if (DialogBoxParam(g_hInstance, 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 1dd78c6e77..8b4c3597ad 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CMPlugin g_plugin;
CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
-HINSTANCE hInst = nullptr;
+HINSTANCE g_hInstance;
int hLangpack;
@@ -52,11 +52,7 @@ PLUGININFOEX pluginInfo =
{0x92382b4d, 0x5572, 0x48a0, {0xb0, 0xb9, 0x13, 0x36, 0xa6, 0x1, 0xd6, 0x89}} // {92382B4D-5572-48a0-B0B9-1336A601D689}
};
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 33a1bc7030..344999e511 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(hInst, "Protocols/IRC", iconList, _countof(iconList), "IRC");
+ Icon_Register(g_hInstance, "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(hInst, FindResource(hInst, MAKEINTRESOURCE(IDR_SERVERS), L"TEXT")));
+ char* pszSvrs = (char*)LockResource(LoadResource(g_hInstance, FindResource(g_hInstance, 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 61e086bb1e..896d6a6097 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -200,7 +200,7 @@ using namespace irc;
// Functions
// main.cpp
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
extern OBJLIST<SERVER_INFO> g_servers;
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index faa5809241..c04c7036a9 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 = hInst;
+ odp.hInstance = g_hInstance;
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 992cbe8ad7..d7c91e5e8c 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, hInst, MAKEINTRESOURCEA(IDD_INFO_CHANGEINFO), ChangeInfoDlg_Resize);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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 bcbccb281d..f0d88461dd 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, hInst, nullptr);
+ rc->left, rc->bottom, rc->right - rc->left, 150, nullptr, nullptr, g_hInstance, 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 8e190aad47..feb334b34b 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, hInst, 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_hInstance, 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, hInst, 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_hInstance, 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, hInst, 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_hInstance, 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, hInst, 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_hInstance, 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/globals.h b/protocols/IcqOscarJ/src/globals.h
index 0af42b4c6c..16870b1657 100644
--- a/protocols/IcqOscarJ/src/globals.h
+++ b/protocols/IcqOscarJ/src/globals.h
@@ -36,7 +36,6 @@
typedef char uid_str[MAX_PATH];
// from init.cpp
-extern HINSTANCE hInst;
extern DWORD MIRANDA_VERSION;
extern HANDLE hExtraXStatus;
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp
index c0ed75645f..ea5254cf05 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(hInst, MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this));
+ return (INT_PTR)CreateDialogParam(g_hInstance, 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 6c27c46de4..f19dcaef7a 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 = hInst;
+ odp.hInstance = g_hInstance;
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 6cc998712c..a3ec27ff40 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 && hInst)
- return CreateDialog(hInst, MAKEINTRESOURCE(IDD_ICQADVANCEDSEARCH), parent, AdvancedSearchDlgProc);
+ if (parent && g_hInstance)
+ return CreateDialog(g_hInstance, 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 7fbdeca635..a7eb3bf6cd 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(hInst, MAKEINTRESOURCE(IDD_ICQUPLOADLIST), nullptr, DlgProcUploadList, LPARAM(this));
+ hwndUploadContacts = CreateDialogParam(g_hInstance, 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 95f584be87..0505ca7d43 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(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETXSTATUS), nullptr, SetXStatusDlgProc, (LPARAM)&init);
return 0;
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index 4f6cd06873..55d8c21fe8 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -29,7 +29,7 @@
#include "m_icolib.h"
CMPlugin g_plugin;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
int hLangpack;
bool g_bTerminated;
@@ -56,11 +56,7 @@ extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD)
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -105,7 +101,7 @@ extern "C" int __declspec(dllexport) Load(void)
hExtraXStatus = ExtraIcon_RegisterIcolib("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13");
- Icon_Register(hInst, "ICQ", iconList, _countof(iconList));
+ Icon_Register(g_hInstance, "ICQ", iconList, _countof(iconList));
g_MenuInit();
return 0;
@@ -159,4 +155,3 @@ void CIcqProto::UpdateGlobalSettings()
m_bXStatusEnabled = getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED);
m_bMoodsEnabled = getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED);
}
-
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp
index 5fbb2bc601..1a6d8c1e51 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(hInst, MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
+ DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_LOGINPW), nullptr, LoginPasswdDlgProc, LPARAM(this));
}
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp
index bbeb69ef07..8bd0911293 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 = hInst;
+ odp.hInstance = g_hInstance;
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 d82b7a50fd..9e8c7e3204 100755
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma comment(lib, "Dnsapi.lib")
#pragma comment(lib, "Secur32.lib")
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
HMODULE hMsftedit;
CMPlugin g_plugin;
@@ -73,11 +73,7 @@ bool bSecureIM, bMirOTR, bNewGPG, bPlatform;
/////////////////////////////////////////////////////////////////////////////
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
@@ -112,7 +108,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"), hInst, IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0);
+ AssocMgr_AddNewUrlTypeW("xmpp:", TranslateT("Jabber Link Protocol"), g_hInstance, 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 9a5e8a84e4..fccbbcdbd0 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, hInst, nullptr);
+ 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);
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, hInst, nullptr);
+ HWND hwndTemp = CreateWindowEx(WS_EX_TOOLWINDOW, L"button", L"PopupMenuHost", 0, 0, 0, 10, 10, nullptr, nullptr, g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)pStartupParams);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)pStartupParams);
}
}
else if (lParam != 0)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, lParam);
+ CreateDialogParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberAdHoc_CommandDlgProc, (LPARAM)param);
+ CreateDialogParam(g_hInstance, 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 56f1faa408..829d3dbfbe 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(hInst, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), m_hwnd, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_BOOKMARK_ADD), nullptr, JabberAddBookmarkDlgProc, (LPARAM)&param);
+ DialogBoxParam(g_hInstance, 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 f4ea12630f..d9127e822c 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(hInst, MAKEINTRESOURCE(IDD_CAPTCHAFORM), nullptr, JabberCaptchaFormDlgProc, (LPARAM)&param);
+ int res = DialogBoxParam(g_hInstance, 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 ce0f6ba36e..3f7c381a15 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(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_INFO), nullptr, sttUserInfoDlgProc, (LPARAM)dat);
+ HWND hwndInfo = CreateDialogParam(g_hInstance, 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 6759596178..269468958e 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, hInst, nullptr);
+ ::GetParent(m_hwnd), (HMENU)-1, g_hInstance, 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 1b4219d5b7..e7763d10da 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, hInst, nullptr)
+ 0, 0, 0, 0, hwndStatic, (HMENU)-1, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)-1, g_hInstance, 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, hInst, nullptr);
+ hwndStatic, (HMENU)layout_info->id, g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_FORM), nullptr, JabberFormDlgProc, (LPARAM)param);
+ CreateDialogParam(g_hInstance, 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 6f15bf4780..10a0a4218a 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, hInst, this);
+ frame.hWnd = CreateWindowEx(0, L"JabberInfoFrameClass", nullptr, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, nullptr, g_hInstance, 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, hInst, nullptr);
+ m_hwnd, nullptr, g_hInstance, 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 = hInst;
+ wcx.hInstance = g_hInstance;
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 = hInst;
+ ti.hinst = g_hInstance;
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 082aa5af29..4c105cb6ae 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(hInst, LPGEN("Protocols") "/" LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Jabber") "/" LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("Dialogs") "/" LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ 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);
}
HANDLE g_GetIconHandle(int iconId)
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index c678f54387..98a2dadf9f 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, hInst, MAKEINTRESOURCEA(IDD_JIDLIST), sttJidListResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_JIDLIST), GetForegroundWindow(), JabberMucJidListDlgProc, (LPARAM)jidListInfo);
+ else *pHwndJidList = CreateDialogParam(g_hInstance, 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 049e11a2c2..ba8d77b14c 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, hInst, 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_hInstance, 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, hInst, MAKEINTRESOURCEA(IDD_OPT_JABBER3), sttRosterEditorResizer);
+ Utils_ResizeDialog(hwndDlg, g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_OPT_JABBER3), nullptr, JabberRosterOptDlgProc, (LPARAM)this);
+ CreateDialogParam(g_hInstance, 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 674a480c57..018446a3ab 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(hInst, MAKEINTRESOURCE(IDD_CHANGEPASSWORD), nullptr, JabberChangePasswordDlgProc, (LPARAM)this);
+ m_hwndJabberChangePassword = CreateDialogParam(g_hInstance, 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 d0dfcfcbe3..204876b73a 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, hInst, 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, hInst, nullptr);
+ 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);
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 && hInst) {
+ if (parent && g_hInstance) {
ptrW szServer(getWStringA("LoginServer"));
if (szServer == nullptr || mir_wstrcmpi(szServer, L"S.ms"))
- return CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEARCHUSER), parent, JabberSearchAdvancedDlgProc, (LPARAM)this);
+ return CreateDialogParam(g_hInstance, 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 653e8af1bb..fdf951ad47 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(hInst, MAKEINTRESOURCE(IDD_PASSWORD), nullptr, JabberPasswordDlgProc, (LPARAM)param);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_PASSWORD), nullptr, JabberPasswordDlgProc, (LPARAM)param);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 203c1022e2..35da917865 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 = hInst;
+ odp.hInstance = g_hInstance;
odp.dwInitParam = (LPARAM)this;
odp.pfnDlgProc = JabberUserInfoDlgProc;
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index 5fd5cd0521..f82b2e8c70 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(hInst, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
else
- res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_hInstance, 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(hInst, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_VCARD_ADDPHONE), hwndDlg, EditPhoneDlgProc, (LPARAM)&param);
else
- res = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VCARD_ADDEMAIL), hwndDlg, EditEmailDlgProc, (LPARAM)&param);
+ res = DialogBoxParam(g_hInstance, 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 = hInst;
+ odp.hInstance = g_hInstance;
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 f71bc05754..df48a3d90c 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(hInst, szFile, _countof(szFile));
+ GetModuleFileName(g_hInstance, 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 464d3e8259..37dacc2085 100755
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -577,7 +577,7 @@ private:
/*******************************************************************
* Global variables
*******************************************************************/
-extern HINSTANCE hInst;
+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 79dfebf977..68373ab59b 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -29,17 +29,7 @@ WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
void IconsLoad();
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
-{
- switch (dwReason) {
- case DLL_PROCESS_ATTACH:
- g_hInstance = hInstance;
- DisableThreadLibraryCalls(hInstance);
- break;
- }
-
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp
index bc2d78b797..fe24b511e2 100644
--- a/protocols/MSN/src/msn.cpp
+++ b/protocols/MSN/src/msn.cpp
@@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst, g_hOpenssl = nullptr;
+HINSTANCE g_hInstance;
int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -65,7 +65,7 @@ static int sttCompareProtocols(const CMsnProto *p1, const CMsnProto *p2)
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
{
if (fdwReason == DLL_PROCESS_ATTACH) {
- g_hInst = hinstDLL;
+ g_hInstance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
}
return TRUE;
@@ -97,9 +97,6 @@ extern "C" int __declspec(dllexport) Load(void)
// Unload a plugin
extern "C" int __declspec(dllexport) Unload(void)
{
- if (g_hOpenssl)
- FreeLibrary(g_hOpenssl);
-
MSN_RemoveContactMenus();
MsnLinks_Destroy();
return 0;
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index f9420029cd..db67f3cbb1 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_hInst;
+ wc.hInstance = g_hInstance;
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_hInst, pParam))) {
+ HWND_DESKTOP, nullptr, g_hInstance, pParam))) {
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
@@ -903,7 +903,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam)
}
}
- UnregisterClass(ClassName, g_hInst);
+ UnregisterClass(ClassName, g_hInstance);
CoUninitialize();
}
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 45f37fb39f..a10a43a2d6 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_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_hInstance, 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_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_hInstance, 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 884c9275ce..16345a3b49 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_hInst, IDI_MSN, szService, 0);
+ AssocMgr_AddNewUrlTypeW("msnim:", TranslateT("MSN Link Protocol"), g_hInstance, 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 393e1d085d..6823338996 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_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
+ DialogBoxParam(g_hInstance, 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 397fabc8ec..161258a4b7 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_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat,
+ DialogBoxParam(g_hInstance, 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 8549350c1d..77b042b0c4 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_hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
+ Icon_Register(g_hInstance, "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_hInst;
+ odp.hInstance = g_hInstance;
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_hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI),
(HWND)lParam, DlgProcAccMgrUI, (LPARAM)this);
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index 4c2aa72335..2e50f2548f 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_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)&param);
+ DialogBoxParam(g_hInstance, 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_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), nullptr, DlgInviteToChat, LPARAM(new InviteChatParam(nullptr, mwpd->hContact, this)));
+ DialogBoxParam(g_hInstance, 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 84fc8292b3..48fd351dfc 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -919,7 +919,7 @@ const char msnStoreAppId[] = "Skype";
const char msnProductVer[] = "0/6.16.0.105/259/";
const char msnProtID[] = "MSNP24";
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInstance;
extern bool g_bTerminated;
///////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp
index 188f0afd79..4c140e9f38 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 = hInst;
+ odp.hInstance = g_hInstance;
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 e02d755a40..7e842b1501 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -17,16 +17,11 @@ PLUGININFOEX pluginInfo =
};
CMPlugin g_plugin;
-HINSTANCE hInst;
+HINSTANCE g_hInstance;
LIST<CSametimeProto> g_Instances(1, PtrKeySortT);
int hLangpack;
-// sametime.cpp: Defines the entry point for the DLL application.
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
@@ -65,7 +60,7 @@ INT_PTR CSametimeProto::SametimeLoadIcon(WPARAM wParam, LPARAM lParam)
return NULL;
}
- return (INT_PTR) LoadImage(hInst, MAKEINTRESOURCE(id), IMAGE_ICON,
+ 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);
}
@@ -84,7 +79,7 @@ static IconItem iconList[] =
void SametimeInitIcons(void)
{
- Icon_Register(hInst, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
+ Icon_Register(g_hInstance, "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 f5da14c480..9afa3230ad 100644
--- a/protocols/Sametime/src/sametime.h
+++ b/protocols/Sametime/src/sametime.h
@@ -105,7 +105,7 @@ typedef struct FileTransferClientData_tag {
// Global variables
struct CSametimeProto;
-extern HINSTANCE hInst;
+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 382c941c51..d1c5a0dcfe 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(hInst, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
+ return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_USERSEARCH), owner, SearchDialogFunc, (LPARAM)this);
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index 3646cc2f34..7f87cd8456 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(hInst, MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
+ CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SESSIONANNOUNCE), GetDesktopWindow(), SessionAnnounceDialogProc, (LPARAM)sadpArg);
return 0;
}
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index a748c396e4..bc5ebf60f3 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -39,12 +39,7 @@ PLUGININFOEX pluginInfo =
{ 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
-
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index 7464db16e2..f674bc4a09 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -20,12 +20,7 @@ PLUGININFOEX pluginInfo =
{ 0x68f5a030, 0xba32, 0x48ec, { 0x95, 0x7, 0x5c, 0x2f, 0xbd, 0xea, 0x52, 0x17 }}
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
-
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index 88a13bc13b..ec6ae99f82 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -21,12 +21,7 @@ PLUGININFOEX pluginInfo =
{0x272a3e, 0xf5fa, 0x4090, {0x8b, 0x67, 0x3e, 0x62, 0xac, 0x1e, 0xe0, 0xb4}}
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
-
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index 14e91dc39e..de7559e55e 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -41,11 +41,7 @@ PLUGININFOEX pluginInfo = {
{ 0xbc09a71b, 0xb86e, 0x4d33, { 0xb1, 0x8d, 0x82, 0xd3, 0x4, 0x51, 0xdd, 0x3c } }
};
-DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
-{
- g_hInstance = hInstance;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp
index 71e8ddd3cd..01a6dfb66d 100644
--- a/protocols/VKontakte/src/main.cpp
+++ b/protocols/VKontakte/src/main.cpp
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "version.h"
-HINSTANCE hInst;
+CMPlugin g_plugin;
+HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -38,11 +39,7 @@ PLUGININFOEX pluginInfo =
/////////////////////////////////////////////////////////////////////////////////////////
-BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID)
-{
- hInst = hModule;
- return TRUE;
-}
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
@@ -70,15 +67,3 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public ACCPROTOPLUGIN<CVkProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CVkProto>("VKontakte")
- {
- SetUniqueId("ID");
- }
-}
- g_plugin;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 2f3aeca9c7..1b18bc382b 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -79,7 +79,7 @@ static IconItem iconList[] =
void InitIcons()
{
- Icon_Register(hInst, LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
+ Icon_Register(g_hInstance, 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 da91ad030d..e60368369e 100644
--- a/protocols/VKontakte/src/stdafx.h
+++ b/protocols/VKontakte/src/stdafx.h
@@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "win2k.h"
-extern HINSTANCE hInst;
+extern HINSTANCE g_hInstance;
#include "resource.h"
#include "vk.h"
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h
index 4fd3060912..b40f8980ba 100644
--- a/protocols/VKontakte/src/vk.h
+++ b/protocols/VKontakte/src/vk.h
@@ -103,7 +103,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct CVkProto;
extern LIST<CVkProto> vk_Instances;
extern mir_cs csInstances;
-extern HINSTANCE hInst;
+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.h b/protocols/VKontakte/src/vk_proto.h
index 8b7abdbb8a..5c050cf2a4 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -399,4 +399,13 @@ private:
void SetChatStatus(MCONTACT hContact, int iStatus);
CVkChatInfo* GetChatById(LPCWSTR pwszId);
INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM);
-}; \ No newline at end of file
+};
+
+struct CMPlugin : public ACCPROTOPLUGIN<CVkProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CVkProto>("VKontakte")
+ {
+ SetUniqueId("ID");
+ }
+};
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index 8a17a6ac8e..b2fd90b048 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -24,8 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-CMPluginBase::CMPluginBase(const char *moduleName) :
- m_szModuleName(moduleName)
+CMPluginBase::CMPluginBase(HINSTANCE hInst, const char *moduleName) :
+ m_szModuleName(moduleName),
+ m_hInst(hInst)
{
}
@@ -74,5 +75,6 @@ void CMPluginBase::RegisterProtocol(int type, pfnInitProto fnInit, pfnUninitProt
pd.type = type;
pd.fnInit = fnInit;
pd.fnUninit = fnUninit;
+ pd.hInst = m_hInst;
Proto_RegisterModule(&pd);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 6b296a7b83..74e2bb6bbb 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@PBD@Z @513 NONAME
+??0CMPluginBase@@IAE@PAUHINSTANCE__@@PBD@Z @513 NONAME
??1CMPluginBase@@IAE@XZ @514 NONAME
??4CMPluginBase@@QAEAAV0@ABV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QAAXPBDZZ @516 NONAME
@@ -578,3 +578,4 @@ Clist_GetGeneralizedStatus @600
Proto_GetStatus @601
?getCache@MDatabaseCommon@@QBEPAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UAGHXZ @603 NONAME
+?getInst@CMPluginBase@@QBEPAUHINSTANCE__@@XZ @604 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 6e3946adff..d0e558a650 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@PEBD@Z @513 NONAME
+??0CMPluginBase@@IEAA@PEAUHINSTANCE__@@PEBD@Z @513 NONAME
??1CMPluginBase@@IEAA@XZ @514 NONAME
??4CMPluginBase@@QEAAAEAV0@AEBV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QEAAXPEBDZZ @516 NONAME
@@ -578,3 +578,4 @@ Clist_GetGeneralizedStatus @600
Proto_GetStatus @601
?getCache@MDatabaseCommon@@QEBAPEAUMIDatabaseCache@@XZ @602 NONAME
?Compact@MDatabaseCommon@@UEAAHXZ @603 NONAME
+?getInst@CMPluginBase@@QEBAPEAUHINSTANCE__@@XZ @604 NONAME
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 477dbd2083..3384bef71d 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -110,6 +110,7 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
p->cbSize = pd->cbSize;
p->szName = mir_strdup(pd->szName);
p->type = pd->type;
+ p->hInst = pd->hInst;
if (pd->cbSize == sizeof(PROTOCOLDESCRIPTOR)) {
p->fnInit = pd->fnInit;
p->fnUninit = pd->fnUninit;