From 9cf1444eb7888f2d942d220f938aa893396a8a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 20:51:18 +0300 Subject: g_hInstance incapulated into PLUGIN<>, no need in the separate variable --- protocols/Omegle/src/main.cpp | 21 ++++++--------------- protocols/Omegle/src/proto.cpp | 4 ++-- protocols/Omegle/src/stdafx.h | 1 - protocols/Omegle/src/theme.cpp | 2 +- 4 files changed, 9 insertions(+), 19 deletions(-) (limited to 'protocols/Omegle') diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index d1226e7f6e..ce2dbcfa74 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -24,11 +24,9 @@ along with this program. If not, see . // TODO: Make following as "globals" structure? -CMPlugin g_plugin; CLIST_INTERFACE* pcli; int hLangpack; -HINSTANCE g_hInstance; std::string g_strUserAgent; DWORD g_mirandaVersion; @@ -45,18 +43,18 @@ PLUGININFOEX pluginInfo = { { 0x9e1d9244, 0x606c, 0x4ef4, { 0x99, 0xa0, 0x1d, 0x7d, 0x23, 0xcb, 0x76, 0x1 } } }; -DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) -{ - g_hInstance = hInstance; - return TRUE; -} - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { g_mirandaVersion = mirandaVersion; return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; + ///////////////////////////////////////////////////////////////////////////////////////// // Interface information @@ -65,15 +63,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC ///////////////////////////////////////////////////////////////////////////////////////// // Load -static HANDLE g_hEvents[1]; - extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); pcli = Clist_GetInterface(); InitIcons(); - //InitContactMenus(); // Init native User-Agent { @@ -103,9 +98,5 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - //UninitContactMenus(); - for (size_t i = 0; i < _countof(g_hEvents); i++) - UnhookEvent(g_hEvents[i]); - return 0; } diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 60361f1974..a09c8f491c 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -156,7 +156,7 @@ int OmegleProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) INT_PTR OmegleProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) { - return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_OmegleACCOUNT), + return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_OmegleACCOUNT), (HWND)lParam, OmegleAccountProc, (LPARAM)this); } @@ -176,7 +176,7 @@ int OmegleProto::OnModulesLoaded(WPARAM, LPARAM) int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.szTitle.w = m_tszUserName; odp.dwInitParam = LPARAM(this); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; diff --git a/protocols/Omegle/src/stdafx.h b/protocols/Omegle/src/stdafx.h index 70f5586598..b6aec36b82 100644 --- a/protocols/Omegle/src/stdafx.h +++ b/protocols/Omegle/src/stdafx.h @@ -75,7 +75,6 @@ class OmegleProto; #include "theme.h" #include "resource.h" -extern HINSTANCE g_hInstance; extern std::string g_strUserAgent; extern DWORD g_mirandaVersion; diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index fa89da9717..72af5190f4 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -31,7 +31,7 @@ static IconItem icons[] = void InitIcons(void) { - Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle"); + Icon_Register(g_plugin.getInst(), "Protocols/Omegle", icons, _countof(icons), "Omegle"); } HANDLE GetIconHandle(const char* name) -- cgit v1.2.3