diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-06-04 16:10:38 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-06-04 16:10:38 +0000 |
commit | 7826a49f59563c754ccf88291792db5907f30cf1 (patch) | |
tree | 47d3ae9c47db664905b392d1bf147e4a407b9948 /src | |
parent | ed79961b7a27c03eae6fc8953406ce4ee45d8729 (diff) |
Do not depend on SetDllDirectory (Windows 2003) as it breaks Windows 2000
* closes: #45
Diffstat (limited to 'src')
-rw-r--r-- | src/htsmodules.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/htsmodules.c b/src/htsmodules.c index 656cd6a..e49bd7c 100644 --- a/src/htsmodules.c +++ b/src/htsmodules.c @@ -218,17 +218,17 @@ void htspe_init(void) { /* See CVE-2010-5252 */ #if (defined(_WIN32) && (!defined(_DEBUG))) { - /* >= Windows Server 2003 (Andy Hewitt) */ - const DWORD dwVersion = GetVersion(); - const DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); - const DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); - const int hasSetDllDirectory = - dwMajorVersion >= 6 || ( dwMajorVersion == 5 && dwMinorVersion >= 2 ); /* See KB 2389418 "If this parameter is an empty string (""), the call removes the current directory from the default DLL search order" */ - if (hasSetDllDirectory && !SetDllDirectory("")) { + BOOL (WINAPI*const k32_SetDllDirectoryA)(LPCSTR) = + (BOOL (WINAPI *)(LPCSTR)) + GetProcAddress(GetModuleHandle("kernel32.dll"), "SetDllDirectoryA"); + if (k32_SetDllDirectoryA != NULL && !k32_SetDllDirectoryA("")) { /* Do no choke on NT or 98SE with KernelEx NT API (James Blough) */ + const DWORD dwVersion = GetVersion(); + const DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + const DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); if (dwMajorVersion >= 5) { assertf(!"SetDllDirectory failed"); } |