标签:
1.There‘s an undocumented hack that works on any version of 32-bit and 64-bit Windows that I‘ve seen. The HMODULE of a DLL is the same value as the module‘s base address: static HMODULE GetThisDllHandle(){ MEMORY_BASIC_INFORMATION info; size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)GetThisDllHandle, &info, sizeof(info)); assert(len == sizeof(info)); return len ? (HMODULE)info.AllocationBase : NULL;}
标签:
原文地址:http://my.oschina.net/yangxb0202/blog/483440