diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-03-23 14:22:19 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-03-23 14:22:19 +0000 |
commit | 3c6870035701f37c6cb6acfb3240cf04e5559d40 (patch) | |
tree | abfe0524f510e05576c787b3c07055f9bb2ce222 | |
parent | b70ff055c404e3012418a426fa3204bbbb0c71a2 (diff) |
Do not choke on Windows 2000 because of missing SetDllDirectory() (Andy Hewitt)
-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 |