How to get the missing DLL name after GetLastError () returns ERROR_MOD_NOT_FOUND

My application loads the DLL using LoadLibrary() , which suppresses the standard error message handler message window. When LoadLibrary() fails and GetLastError() returns ERROR_MOD_NOT_FOUND (0x7E) I would like to get the missing DLL name. This error code is set not only when the required DLL is missing , but also where any DLL is missing. .

It is worth noting that the standard message field (which is suppressed) displays the correct name of the missing DLL, and the question is how can I get it in the code.

thanks

+4
source share
2 answers

I am not sure if there is an easy way to get the missing dll name. But you can probably find it by going through LoadLibrary () in the debugger and seeing which function does not work with which file name in the parameters. depend.exe may also show dependencies.

In addition, it is worth trying to start the process monitor and use the appropriate filters, see what I / O errors are in your process and for which files.

+1
source

If you call LoadLibrary with the name of the DLL, don't you already know the name?

You can always try connecting LoadLibrary if it is not.

+1
source

All Articles