Debugging LoadLibrary Failures

It looks like the topic of Debugging LoadLibrary Failures has been covered pretty well, but it is worth repeating:

If you are seeing a ERROR_MOD_NOT_FOUND (0n126, 0x7E, 0x8007007E) failure during a LoadLibrary, make sure the DLL in question is in the DLL search path.  If it is in the DLL search path, then the next likely step is to determine if one of that DLL's load-time dependencies are missing.  To diagnose this:

Option 1: Loader Snaps Log (enabled via GFlags.exe) :

Enable loader snaps via gflags and re-run your scenario under a debugger.  You'll get swamped in debug spew, but a quick search for "ERROR" will yield the culprit.  The most likely failure spew will consist of 0xc0000135 (STATUS_DLL_NOT_FOUND).

Option 2: Fusion Log Viewer:

You can use the loader snaps method above (gflags), but there's another option here that doesn't require a debugger: Fuslogvw.exe.  It ships with Visual Studio and can be quickly accessed via the VS console.  Make sure to run this as admin to get everything logged.

For more information on Fuslogvw.exe, see this URL.