Commit 82326be1 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Winvlc: add comments

parent d16bd481
...@@ -101,26 +101,30 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -101,26 +101,30 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
SetErrorMode(SEM_FAILCRITICALERRORS); SetErrorMode(SEM_FAILCRITICALERRORS);
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
/* SetProcessDEPPolicy */ /* SetProcessDEPPolicy, SetDllDirectory, & Co. */
HINSTANCE h_Kernel32 = GetModuleHandle(TEXT("kernel32.dll")); HINSTANCE h_Kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
if (h_Kernel32 != NULL) if (h_Kernel32 != NULL)
{ {
BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags); /* Enable DEP */
BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
# define PROCESS_DEP_ENABLE 1 # define PROCESS_DEP_ENABLE 1
BOOL (WINAPI * mySetProcessDEPPolicy)( DWORD dwFlags);
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. */ /* Do NOT load any library from cwd. */
BOOL (WINAPI * mySetDllDirectoryA)(const char* lpPathName);
mySetDllDirectoryA = (BOOL (WINAPI *)(const char*)) mySetDllDirectoryA = (BOOL (WINAPI *)(const char*))
GetProcAddress(h_Kernel32, "SetDllDirectoryA"); GetProcAddress(h_Kernel32, "SetDllDirectoryA");
if(mySetDllDirectoryA) if(mySetDllDirectoryA)
mySetDllDirectoryA(""); mySetDllDirectoryA("");
} }
/***
* The LoadLibrary* calls from the modules and the 3rd party code
* will search in SYSTEM32 only
* */
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);
/* Args */ /* Args */
......
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