浏览代码

use the actual module handle instead of the calling process handle (windows) (#240)

Dan Korostelev 6 年之前
父节点
当前提交
d23e13b1a0
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/module.c

+ 2 - 1
src/module.c

@@ -24,7 +24,8 @@
 
 #ifdef HL_WIN
 #	include <windows.h>
-#	define dlopen(l,p)		(void*)( (l) ? LoadLibraryA(l) : GetModuleHandle(NULL))
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+#	define dlopen(l,p)		(void*)( (l) ? LoadLibraryA(l) : (HMODULE)&__ImageBase)
 #	define dlsym(h,n)		GetProcAddress((HANDLE)h,n)
 #else
 #	include <dlfcn.h>