[vlc-commits] vlc: do not load kernel32.dll

Rémi Denis-Courmont git at videolan.org
Fri Nov 18 19:15:22 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 18 20:10:25 2016 +0200| [11400bc5171270ff4650792b3995a1f670e48fb1] | committer: Rémi Denis-Courmont

vlc: do not load kernel32.dll

vlc.exe already depends on kernel32.dll, so there is no need to load it
explicitly. It can simply be looked up.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11400bc5171270ff4650792b3995a1f670e48fb1
---

 bin/winvlc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/bin/winvlc.c b/bin/winvlc.c
index 327ae07..dfe8878 100644
--- a/bin/winvlc.c
+++ b/bin/winvlc.c
@@ -102,8 +102,8 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
 
     /* SetProcessDEPPolicy */
-    HINSTANCE h_Kernel32 = LoadLibraryW(L"kernel32.dll");
-    if(h_Kernel32)
+    HINSTANCE h_Kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+    if (h_Kernel32 != NULL)
     {
         BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
         BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
@@ -119,8 +119,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                             GetProcAddress(h_Kernel32, "SetDllDirectoryA");
         if(mySetDllDirectoryA)
             mySetDllDirectoryA("");
-
-        FreeLibrary(h_Kernel32);
     }
 
     SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);



More information about the vlc-commits mailing list