diff options
Diffstat (limited to 'src/htsmodules.c')
-rw-r--r-- | src/htsmodules.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/htsmodules.c b/src/htsmodules.c index 921c598..3377a63 100644 --- a/src/htsmodules.c +++ b/src/htsmodules.c @@ -246,15 +246,21 @@ void htspe_init(void) { /* See CVE-2010-5252 */ #if (defined(_WIN32) && (!defined(_DEBUG))) - /* See KB 2389418 - "If this parameter is an empty string (""), the call removes the - current directory from the default DLL search order" */ - if (!SetDllDirectory("")) { + { + /* >= Windows Server 2003 (Andy Hewitt) */ const DWORD dwVersion = GetVersion(); const DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); - /* Do no choke on NT or 98SE with KernelEx NT API (James Blough) */ - if (dwMajorVersion >= 5) { - assertf(!"SetDllDirectory failed"); + 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("")) { + /* Do no choke on NT or 98SE with KernelEx NT API (James Blough) */ + if (dwMajorVersion >= 5) { + assertf(!"SetDllDirectory failed"); + } } } #endif |