From 3d0be38e91be4704cc5ab6c1d1710fe834545906 Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 30 Nov 2015 14:00:40 +0000 Subject: [PATCH] Dialer plugin does not have to unload WinInet git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6648 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Dialer/dialer.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Contrib/Dialer/dialer.c b/Contrib/Dialer/dialer.c index 4d48bd52..df33f9fc 100644 --- a/Contrib/Dialer/dialer.c +++ b/Contrib/Dialer/dialer.c @@ -16,8 +16,6 @@ BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved * LOADER * \*************/ -HMODULE g_hWinInet = NULL; - HMODULE NSISCALL LoadSystemLibrary(LPCSTR name) { LPCTSTR fmt = sizeof(*fmt) > 1 ? TEXT("%s%S.dll") : TEXT("%s%s.dll"); // The module name is always ANSI BYTE bytebuf[(MAX_PATH+1+20+1+3+!0) * sizeof(*fmt)]; // 20+4 is more than enough for @@ -32,17 +30,10 @@ HMODULE NSISCALL LoadSystemLibrary(LPCSTR name) { } FARPROC GetWinInetFunc(LPCSTR funcname) { - g_hWinInet = LoadSystemLibrary("WININET"); - if (g_hWinInet) - return GetProcAddress(g_hWinInet, funcname); - return NULL; + HMODULE hWinInet = LoadSystemLibrary("WININET"); + return hWinInet ? GetProcAddress(hWinInet, funcname) : (FARPROC) hWinInet; } -void FreeWinInet() { - if (g_hWinInet) - FreeLibrary(g_hWinInet); - g_hWinInet = NULL; -} /*************\ * FUNCTIONS * @@ -62,8 +53,6 @@ NSISFunction(AutodialOnline) { pushstring(_T("online")); else pushstring(_T("offline")); - - FreeWinInet(); } NSISFunction(AutodialUnattended) { @@ -80,8 +69,6 @@ NSISFunction(AutodialUnattended) { pushstring(_T("online")); else pushstring(_T("offline")); - - FreeWinInet(); } NSISFunction(AttemptConnect) { @@ -98,8 +85,6 @@ NSISFunction(AttemptConnect) { pushstring(_T("online")); else pushstring(_T("offline")); - - FreeWinInet(); } NSISFunction(GetConnectedState) { @@ -118,8 +103,6 @@ NSISFunction(GetConnectedState) { pushstring(_T("online")); else pushstring(_T("offline")); - - FreeWinInet(); } NSISFunction(AutodialHangup) { @@ -136,6 +119,4 @@ NSISFunction(AutodialHangup) { pushstring(_T("success")); else pushstring(_T("failure")); - - FreeWinInet(); }