I have a problem related to a WIA minidriver. I'm not
sure which newsgroup is the correct one for this; let me
know if there is a more appropriate group.
I've created a WIA scanner minidriver that loads and
works fine on Windows XP. I also intend for this
minidriver DLL to provide STI functionality in Windows
2000 and Windows 98. My problem is that this WIA/STI DLL
is not getting loaded under Windows 2000 for some reason.
The STI_Trace.log file contains only the following error
line:
e STISVC [stisvc.exe::0x65c] Could not open device
({6BDD1FC6-810F-11D0-BEC7-08002BE2092F}\0001) . Received
from STI: hResult=(80040154). Object not maintained
Win2K does not like my DLL for some reason. My entry
point function never gets called. However, under Windows
XP and Windows 98ME my DLL does get loaded. These are the
only three Windows versions I've tried so far.
I do have two other working minidrivers I can use as
references. One, of course, is the DDK WIA sample scanner
minidriver. The other is an existing scanner product that
currently works under Win2K, although its STI DLL was not
built by me.
I believe that my INF file is correct and the registry
entries all look good to me. Anyway, to rule out those
possibilities, I decided to install the other working
scanner product and then rename and substitute my own WIA
DLL in place of the other DLL. When I did this, my DLL
was still not loaded. But when I substituted the WIA
sample scanner DLL, that DLL is loaded ok---its entry
point gets called. It's only my DLL that will not get
loaded. So there is apparently no problem with the
registry, and the DLL can be found. It just won't get
loaded and get its entry point called for some reason.
I then compared my DLL with the WIA sample minidriver to
see what could be different. I built both using the build
utility and the Windows XP SP1 DDK, build 2600.1106. I
initially had a different entry point than the sample
scanner. I was using _DllMainCRTStartup because my DLL
uses the C runtime library---in fact, it uses STL as
well. So normally I see my DllMain() function get called
by _DllMainCRTStartup . But to make sure this wasn't the
problem, I made my entry point to be "DllEntryPoint" to
match the WIA sample code (remembering to specify
DLLENTRY=DllEntryPoint in the sources file of course).
But this did not help. I checked the exports (using
DUMPBIN) to make sure both DLLs have the same exports.
The only difference is the DliHook export in the sample
minidriver, but that should not matter.
I then compared the "sources" files. Mine is almost the
same as the sample minidriver's. There are only two
differences. Since I'm using STL, I need to set USE_STL=1
and USE_NATIVE_EH=1. Other than that they look the same.
So why does my DLL not get loaded under Win2K??
It should not be a problem with a GUID---the DLL entry
point does not even get called. So Windows doesn't even
know anything about the GUID yet. The only thing I can
imagine is that my entry point looks different in some
way, maybe of because the way it was compiled. But I
cannot see any significant difference between how my DLL
and the sample minidriver are built.