LoadLibrary File Win32 bit dll
Hi,
I'm working on an old project that was built on VS2013. So I installed VS2013 on my Windows 10 machine (which is 64 bit). The project builds libraries targeting Win32 bits platform. It seems that there are nested library calls from one library to another. The project structure is
Main App ==> Calls a Win32 Lib_A , LoadLibrary ==> Win32 Lib_B
The main issue now is that LoadLibrary in LibA is failing to load Lib_B with error code 126(ERROR_MOD_NOT_FOUND)
I'm relatively new to using dll and loading them so here is what I did to debug the issue:
- I initially got error 126. After using Process Monitor, I found a few missing dependencies on Lib_B. I fixed all of these missing dlls until the Process Monitor couldnot find anymore missing ones.
- I ran the project again and I got error 193 (ERROR_BAD_EXE_FORMAT). From reading, this seems to be related to using 64-bit app to call 32-bit libraries
- Then I changed the MainApp to 0x86 and ran the project. I got error 126 again. I checked Process Monitor and it couldnt find anything wrong with the dependencies
- Now this is where I got stuck, I dont know what's still missing on my machine to load Lib_B from Lib_A. I tried a few things
- Tried to change the target platform on Lib_A and Lib_B from Win32 to 0x86. However, VS2013 doenst show this in the dropdown menu. It only has Win32 and 0x64. The 0x64 is not an option since the app needs to work on old machines
- I used LoadLibraryEx with LOAD_LIBRARY_AS_DATAFILE
Error = GetLastError(); //No error
hrsrc_tmp = FindResource(hLibBExt , L"hLibB", RT_RCDATA);
Error = GetLastError();//Error 1813
The first call to LoadLibraryEx returned something (hLibBExt is not NULL), but FindResource gives me error 1813
I'm not sure what to do next to fix this issue......