summaryrefslogtreecommitdiff
path: root/src/htsmodules.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-06-04 16:10:38 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-06-04 16:10:38 +0000
commit7826a49f59563c754ccf88291792db5907f30cf1 (patch)
tree47d3ae9c47db664905b392d1bf147e4a407b9948 /src/htsmodules.c
parented79961b7a27c03eae6fc8953406ce4ee45d8729 (diff)
Do not depend on SetDllDirectory (Windows 2003) as it breaks Windows 2000
* closes: #45
Diffstat (limited to 'src/htsmodules.c')
-rw-r--r--src/htsmodules.c14
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");
}