Solved (Was: [Slightly OT] Can't load my WDM driver under 98.)

From: “Matt A.”
Sent: Tuesday, April 25, 2000 9:43 PM

> I have a WDM driver that loads and works fine under Windows 2000. Under
> Windows 98, however, I get an error 192 from the Add Hardware Wizard
during
> Plug and Play installation which, intepreted as a Win32 error code, means
> ERROR_EXE_MARKED_INVALID.

[snip]

Well, it turns out error 192 displayed by the Wizard is not
ERROR_EXE_MARKED_INVALID – it not a Win32 error at all. Neither does it
appear to be a Configuration Manager or Device Installer error. I don’t
know what kind of error code it is, but apparently it means the Windows
cannot locate a file specified in the .inf. How as a developer you’re
supposed to know this, I can’t figure out.

In anycase, I tracked the 192 problem down to having a [SourceDisksNames]
section that looked like this:

[SourceDisksNames]
1=%DISK_NAME%,DISK1

When I changed it to the following, error 192 went away and Windows starting
loading my driver.

[SourceDisksNames]
1=%DISK_NAME%,

[snip]

> That is, I have created a registry key
> “HKLM\System\CurrentControlSet\Services\MyDriver” containing an
“ImagePath”
> string value (all modelled after some existing entries I found there) and
am
> passing the string “MyDriver” to NtKernLoadDriver() as a UNICODE_STRING.
My
> driver file is at the location specified by “ImagePath” (the same place,
in
> fact, that PELDR_LoadModule() is able to load it from). Am I missing
> something else?

I finally got NtKernLoadDriver() to work too – verifying that my driver was
indeed a valid WDM driver as far as Win98 is concerned. I had been somewhat
misled by documentation which described the parameter to NtKernLoadDriver()
as being the “name of the driver’s service key under
\HKLM\System\CurrentControlSet\Services”. The problem was that I was
specifying only the “leaf” name of my service key (that is, literally just
“MyDriver”) and not the whole branch. If the docs had said “path of the
driver’s service key” I probably wouldn’t have wasted any time on this.

Of course, you’re also supposed to pass an NT Object Manager-style path like
“\Registry\Machine\System\CurrentControlSet\Services\MyDriver”, not
“\HKLM\System\CurrentControlSet\Services” like the docs suggest. Thanks to
NuMega for an example of this at their Web site
(http://www.numega.com/drivercentral/tech_tips/ntloaddriver.shtml).

- Matt