how to load API on Windows 7?
My intention is to be able to sucessfully load a .dll f开发者_运维问答ile that will hook the Windows API. I have researched and tried extensively, without success, any method that would load my .dll file on a 64bit machine running Windows 7. The two solutions that I have tried include loading the path of the .dll into the registry keys:
Computer/HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Windows\AppInit_DLLs
or
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\WindowsNT\CurrentVersion\Windows\AppInit_DLLs
please don't get me wrong, there are many online resources explaining how to load APIs to the registry, but none of them have worked for me. I apologize if the answer to this question is obvious, I have tried everything I could. Thanks so much for the time and help!
Don't use the AppInit_DLLs
mechanism as it is very dangerous and can lead to crashes and loader-lock deadlocks in other applications (see what the great Raymond Chen has to say on the subject). If you absolutely, positively must use this mechanism then you can only call functions in kernel32.dll. No runtime calls at all.
A better option is to look into using the detours library
There's a Technet document which might help - AppInit DLLs in Windows 7 and Windows Server 2008 R2
精彩评论