I need to create a WDM driver that emulates a device that is not present. The driver needs to be loaded when the O/S boots, opened and closed via SetupDiXXX and CreateFile, needs to respond to DeviceIoControl, etc.
I have the driver coded, but XP refuses to load it. The system event viewer says:
The MyDevice service failed to start due to the following error: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
Given that, I think the problem is in the INF file (reference below). Is it? How should I go about fixing it?
;; MyDevice.inf
[Version]
Signature="$Windows 95$"
Class=MyDeviceDeviceClass
ClassGUID={ff646f80-8def-11d2-9449-00105a075f6b}
Provider=%ProviderName%
DriverVer= 12/21/2009,1.0.0.1
[ClassInstall32]
Addreg=Class_AddReg
[Class_AddReg]
HKR,,,,%DeviceClassName%
HKR,,Icon,,"-18"
[DestinationDirs]
MyDevice_Files_Driver = 10,System32\Drivers
[Manufacturer]
%MfgName%=Mfg0
[Mfg0]
%DeviceDesc%=MyDevice_DDI, *MyDevice
[MyDevice_DDI]
CopyFiles=MyDevice_Files_Driver
AddReg=MyDevice_9X_AddReg
[MyDevice_DDI.NT]
CopyFiles=MyDevice_Files_Driver
AddReg=MyDevice_NT_AddReg
[MyDevice_DDI.NT.Services]
Addservice = MyDevice, 0x00000002, MyDevice_AddService
[MyDevice_AddService]
DisplayName = %SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %10%\System32\Drivers\MyDevice.sys
[MyDevice_NT_AddReg]
HKLM, "System\CurrentControlSet\Services\MyDevice\Parameters","BreakOnEntry", 0x00010001, 0
[MyDevice_Files_Driver]
MyDevice.sys
[Strings]
ProviderName="Acme"
MfgName="Acme"
DeviceDesc="Acme"
DeviceClassName="Device class for MyDevice"
SvcDesc="MyDevice NT service"