My application loads a DLL using LoadLibrary()
suppressing the standard critical-error-handler message box. When LoadLibrary()
fails and GetLastError()
returns ERROR_MOD_NOT_FOUND (0x7E) I'd like to retrieve the missing DLL name. This error code is set not only when the requested DLL is missing, but also when any DLL it depends on is missing.
It's worth noting that the standard message box (which is suppressed) displays the correct missing DLL name, and the question is how can I get it within 开发者_如何学JAVAthe code.
Thanks
I'm not sure there's an easy way of getting the missing DLL's name. But you can probably find it by stepping through LoadLibrary() in the debugger and seeing which function fails with what filename in the parameters. depends.exe can also show the dependencies.
Also, it might worth a try firing up the process monitor and using appropriate filters see what I/O errors there are in your process and for what files.
If you're calling LoadLibrary with a DLL name, shouldn't you already know the name?
You could always try hooking LoadLibrary if this isn't the case.
精彩评论