Reputation:
I am trying to load a 3rd party dll (i.e. I have no source code) into my application. On a windows xp 32 bit system, it loads fine, but on a windows 7 system it fails to load, citing error #998 from GetLastError()
I used a dll export viewer to view the imported and exported symbols of the dll, and observed that all but 3 dlls listed in the import table came from this 3rd party vendor. The ones that didn't are:
kernel32.dll
mingwm10.dll
msvcrt.dll
Here is the code I am using to do the import:
SetDllDirectory(L"c:\\dlls");
HMODULE tempDLL = LoadLibrary(L"mydll.dll");
DWORD err = GetLastError();
Any tips on how to go about debugging this, please?
Edit: My thanks to everyone for the answers, and this is what I have discovered so far:
a) The application toolkit package did not prove to be that useful (see below)
b) Colleague A can get the dll to load on his win 7 machine and colleague B cannot, so it something sporadic
c) Running as admin did not change anything
Upvotes: 0
Views: 2870
Reputation: 68053
Have you tried with Data Execution Prevention (DEP) disabled?
This is normally enabled by default on Vista and above, but disabled on XP. If your DLL has a bug causing it to execute data, this could show up during the LoadLibrary call.
Upvotes: 1
Reputation: 99605
Try to use Microsoft Application Compatibility Toolkit (it is a free toolset) to find out why it fails on Windows 7. Hope this will help, it looks like a compatibility issue.
Upvotes: 5