From b172c4bbc75cdad0e8ccd22292aa671ba43cac45 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 18:14:33 +0300 Subject: PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside --- protocols/MSN/src/msn.cpp | 7 ++----- protocols/MSN/src/msn_auth.cpp | 6 +++--- protocols/MSN/src/msn_chat.cpp | 4 ++-- protocols/MSN/src/msn_links.cpp | 2 +- protocols/MSN/src/msn_lists.cpp | 2 +- protocols/MSN/src/msn_menu.cpp | 2 +- protocols/MSN/src/msn_opts.cpp | 6 +++--- protocols/MSN/src/msn_svcs.cpp | 4 ++-- protocols/MSN/src/stdafx.h | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) (limited to 'protocols/MSN') 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 . 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)¶m); + DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)¶m); 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)¶m); + DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_DELETECONTACT), nullptr, DlgDeleteContactUI, (LPARAM)¶m); 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; /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3