Commit f87e9843 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf Committed by Rémi Duraffort

Win32: do not load DLL from cwd

Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent c4fa64d3
...@@ -128,12 +128,19 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -128,12 +128,19 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
if(h_Kernel32) if(h_Kernel32)
{ {
BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags); BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
# define PROCESS_DEP_ENABLE 1 # define PROCESS_DEP_ENABLE 1
mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD)) mySetProcessDEPPolicy = (BOOL WINAPI (*)(DWORD))
GetProcAddress(h_Kernel32, "SetProcessDEPPolicy"); GetProcAddress(h_Kernel32, "SetProcessDEPPolicy");
if(mySetProcessDEPPolicy) if(mySetProcessDEPPolicy)
mySetProcessDEPPolicy(PROCESS_DEP_ENABLE); mySetProcessDEPPolicy(PROCESS_DEP_ENABLE);
/* Do NOT load any library from cwd. */
mySetDllDirectoryA = (BOOL WINAPI (*)(const char*)) GetProcAddress(h_Kernel32, "SetDllDirectoryA");
if(mySetDllDirectoryA)
mySetDllDirectoryA("");
FreeLibrary(h_Kernel32); FreeLibrary(h_Kernel32);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment