stevemk14ebr / PolyHook_2_0

C++20, x86/x64 Hooking Libary v2.0
MIT License
1.59k stars 224 forks source link

Question regarding static compiled dll /headers #120

Closed duketwo closed 2 years ago

duketwo commented 2 years ago

Hey,

I've created a msvc dll project and installed the static version of polyhook2 with vcpkg. Enabled the usage of static libs in the vcpkg settings and enabled the /MT flag. I can hook dx11present without any issues in that scenario with the directx11 headers included. But the application where I'm injecting my dll into has the python27.dll loaded, which I want to use too. Is there any way that I can include the python headers in my project and my dll is then using the already loaded python27.dll? Like in a dynamic context? Or do I need to use loadlib/getmodhandle -> getprocadress?

Also, do system dll imports/includes behave differently in static environments?

stevemk14ebr commented 2 years ago

Is there any way that I can include the python headers in my project and my dll is then using the already loaded python27.dll

Depends on how you load your dll. If you load via a standard mechanism like loadlibrary and your headers match the correct DLL version in the target process I'm fairly sure it should work just fine. If you're manual mapping, it depends on if your mapper supports checking the already loaded modules. Either way, that's something you need to test and is not related to this library.