On Wed Apr 26 08:38:54 2023 +0000, Matteo Bruni wrote:
Have you checked that's actually the case? Just curious.
Sadly yeah, something like this
``` ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (void *)D3DCompile, &mod2); ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (void *)load_d3dassemble_once, &mod3); ERR("mod2 %p, mod3 %p, d3dcompile %p, this function %p, d3dassemble %p, d3dcompiler.dll %p\n", mod2, mod3, D3DCompile, load_d3dassemble_once, *assemble, mod); ```
Gives
`26f8:err:d3dx:load_d3dassemble_once mod2 5C510000, mod3 5C510000, d3dcompile 5C56D190, this function 5C5F4220, d3dassemble 5BE64D30, d3dcompiler.dll 5BD00000`
So getting the pointer of a implib imported function gives the IAT stub inside our own DLL. If Raymond Chen is correct that would not be the case if we compiled this thing as C++ though ( https://devblogs.microsoft.com/oldnewthing/20060725-00/?p=30383 ). I'm not going to test this :-)