Monday, February 16, 2009

LoadLibrary failed - a DLL initialization routine failed


Resolving 'LoadLibrary failed - a DLL initialization routine failed' error

LoadLibrary failed - a DLL initialization routine failed
There might be other reasons for this error as well, but the most common one is probably because of a missing dependent DLL. While trying to register SOAPIS30.dll (for those who are new to DLL installation - that's done by using RegSvr32.exe OR Gacutil.exe), I encountered this error.

Identifying the problem and fixing that - using Dependency Walker

As we commonly do with other DLL registration errors, I started with analyzing the DLL and trying to register it from within Dependency Walker tool. While trying to register, it straightaway gave me three errors, all indicating the same missing dependent DLL. It actually tried to look for this DLL in three directories and hence three errors for the same missing DLL.



LoadLibraryExA("C:\Program Files\Common Files\MSSoap\Binaries\Resources\2057\MSSOAPR3.DLL", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).

LoadLibraryExA("C:\Program Files\Common Files\MSSoap\Binaries\Resources\1033\MSSOAPR3.DLL", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).

LoadLibraryExA("C:\Program Files\Common Files\MSSoap\Binaries\MSSOAPR3.DLL", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).


How to register DLLs from within Dependency Walker?

Open the RegSvr32.exe (found in WINDOWS\System32 folder) in DW and then run the profiler by selecting the corresponding main-menu option. It will prompt you to browse and enter the particular DLL, which you want to install.


If you have corrected the error i.e., in this case if you have placed the missing DLL in any of the three directories where it is expected to be (you can easily identify the directories in the DW error messages pasted above) and assuming that everything else is fine, like the DLL is not a corrupted one, etc. then you would see the below alert showing that the registration of the DLL has completed successfully.


DLL registered successfully
This alert marks the end of a successful DLL registration as is quite evident from the message displayed in the alert box.

Liked the article? Subscribe to this blog for regular updates. You may like to follow the blog to manage the bookmark easily and to tell the world that you enjoy GeekExplains. Interested? Find the 'Followers' widget in the rightmost sidebar.



Share/Save/Bookmark


3 comments:

Tomás Orin de la Fuente said...

Great work! thanks, you solved my problem!!! regards!

Mikael said...

Great tip about running depends.exe on regsvr32.exe, found my issue very quick

Anonymous said...

fantastico, grazie!!!!