win32: remove SetDllDirectoryW dynamic loading

All Windows versions we support have this API.
This commit is contained in:
James Ross-Gowan 2015-12-06 11:36:30 +11:00
parent 5790bbba61
commit d2013b3f50
1 changed files with 1 additions and 4 deletions

View File

@ -38,15 +38,12 @@ static void microsoft_nonsense(void)
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
WINBOOL (WINAPI *pSetDllDirectory)(LPCWSTR lpPathName) =
(WINBOOL (WINAPI *)(LPCWSTR))GetProcAddress(kernel32, "SetDllDirectoryW");
WINBOOL (WINAPI *pSetSearchPathMode)(DWORD Flags) = WINBOOL (WINAPI *pSetSearchPathMode)(DWORD Flags) =
(WINBOOL (WINAPI *)(DWORD))GetProcAddress(kernel32, "SetSearchPathMode"); (WINBOOL (WINAPI *)(DWORD))GetProcAddress(kernel32, "SetSearchPathMode");
// Always use safe search paths for DLLs and other files, ie. never use the // Always use safe search paths for DLLs and other files, ie. never use the
// current directory // current directory
if (pSetSearchPathMode) SetDllDirectoryW(L"");
pSetDllDirectory(L"");
if (pSetSearchPathMode) if (pSetSearchPathMode)
pSetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE); pSetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
} }