Oh my, the messes I get myself into.
I’ve been assigned to write an INF file to install an existing driver under NT4.
Background:
The driver is the communication interface between a windows program
and a custom ISA board. The driver does work and has not been touched
in several years.
Up until now, the driver has been loaded on the fly by the application
via the service manager APIs. (yes, that’s right, we’re loading the
driver for an actual piece of hardware on the fly.).
New security requirements demand that we run the application as a
non-administrative user. This, of course, means that we no longer have
the option of loading the driver on the fly - we’re going to have to
properly install it.
Now, I’ve done driver development before, including the creation of an
INF file, but I did it under Windows XP, and on a previous job.
The driver install consits of a single .sys file and a couple of
registry entries.
Things I’ve done:
I’ve verified (using the OSR DriverLoader) that I can in fact register
and run the driver correctly, when I place the driver file in
c:\winnt\system32\drivers.
My problems:
Is C:\winnt\system32\drivers the correct location for a non-PNP driver to live?
I’ve hacked up an INF file (below) that I’m trying to use, based on a
reading of the INF docs in the current WDK documentation, and a
working XP INF file. I can’t get it to load, either by right-clicking
on the inf file (I don’t get an error, just nothing happens), nor by
using the Multimedia control panel (I figured since I used class
‘Media’, that would be the one to use).
Can anyone point me the direction of what I’m doing wrong here?
Obviously the problem is that I don’t know enough about NT4 INF files,
but I may simply be going about the installation incorrectly.
Any help would be appreciated. Thanks!
The prototype INF file:
;Copyright 2007 Gilbarco Veeder-Root
;
; Install information file for sc3.sys driver
; This driver is NT4 ONLY!
;
; This inf was written LONG after the driver.
;
;--------- Version Section ---------------------------------------------------
[Version]
Signature=“$WINDOWS NT$”
; TODO: which class should this driver be?
Class=Media
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%Provider%
; TODO: find out ver # of actual driver.
DriverVer=11/7/2007,0.0.0.1
;--------- DestinationDirs Section -------------------------------------------
; I think on NT, drivers go in %windir%/system32/drivers. that’s dirid 12
[DestinationDirs]
DefaultDestDir = 12
;--------- SourceDiskNames and SourceDiskFiles Section -----------------------
; These sections identify source disks and files for installation.
[SourceDisksNames]
; one source disk only, driver in \i386 directory
1 = %DiskId1%,\i386
[SourceDisksFiles]
SC3.sys = 1,
;--------- Manufacturer and Models Sections ----------------------------------
[Manufacturer]
%Provider%=DeviceList
; Models section - NT4
[DeviceList]
%SC3Desc%=DriverInstall
;---------- DDInstall Sections -----------------------------------------------
; --------- Windows NT -----------------
[DriverInstall]
CopyFiles=DriverFiles
AddReg = SC3HW_Registry
[DriverInstall.Services]
Addservice = SC3, 0x2, DriverService, EventLogging
;---------- End DDInstall Sections
; --------- Service ----------------------
[DriverService]
DisplayName = %ServiceDescription%
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_DEMAND_START%
ErrorControl = %SERVICE_ERROR_NORMAL%
ServiceBinary = %12%\SC3.sys
LoadOrderGroup = Extended Base
; --------- Event Logging ----------------------
; add registry entries so that event logger can translate
; our messages. Reference iologmsg.dll (standard system messages)
[EventLogging]
AddReg=EventLogAddReg
[EventLogAddReg]
HKR,EventMessageFile,0x00020000,“%11%\iologmsg.dll”
HKR,TypesSupported,0x00010001,7
; --------- Hardware Specific Registry entries ----------------------
[SC3HW_Registry]
; two DWORDs - segement and irq
HKLM,“hardware\devicemap\gasboysc3”,segment,0x00010001,0xD0000
HKLM,“hardware\devicemap\gasboysc3”,irq,0x00010001,0xA
; --------- Files ----------------------
[DriverFiles]
SC3.sys,2
;--------- Strings Section ---------------------------------------------------
[Strings]
Provider = “Gilbarco Veedeer-Root”
SC3Desc = “SC3 Device”
ServiceDescription = “SC3 Device Driver”
DiskId1 = “SC3 Device Installation Disk #1”
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
REG_NONE = 0x00020001
SERVICE_KERNEL_DRIVER = 0x00000001
SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
SERVICE_ADAPTER = 0x00000004
SERVICE_RECOGNIZER_DRIVER = 0x00000008
SERVICE_BOOT_START = 0x0
SERVICE_SYSTEM_START = 0x1
SERVICE_AUTO_START = 0x2
SERVICE_DEMAND_START = 0x3
SERVICE_DISABLED = 0x4
SERVICE_ERROR_IGNORE = 0x00000000
SERVICE_ERROR_NORMAL = 0x00000001
SERVICE_ERROR_SEVERE = 0x00000002
SERVICE_ERROR_CRITICAL = 0x00000003
–
Michael Kohne
xxxxx@kohne.org