Can you get the caller DLL or executable module from the callee

孤者浪人 提交于 2020-01-05 04:32:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!