问题
I only want to allow specific DLLs to execute code I have written on a function I hooked. short of performing a stack trace how do you get the module name of your caller?
回答1:
Get a stack trace to find the return address of your function, for instance with CaptureStackBackTrace.
And then call GetModuleHandleEx passing GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
to obtain the module handle containing that code.
Finally, call GetModuleFileName to find the filename associated with that module.
来源:https://stackoverflow.com/questions/39540262/can-you-get-the-caller-dll-or-executable-module-from-the-callee