summaryrefslogtreecommitdiff
path: root/src/htsmodules.c
diff options
context:
space:
mode:
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");
}