Problem Installing toaster function driver

Hello.

As the title may have suggested, I am a windows noob trying to learn the ins and outs of windows device drivers. Coming from the Linux world, I am initially finding the learning curve a little steeper than I expected, especially driver installation.

Now I am using the toaster driver provided within the DDK v7600.16385.1 as a sample. I was able to build the drivers using x64 checked build environment. My target machine is a VM running Windows server 2008 R2. I boot with the ‘disable driver checking for signature’ switch on so I am able to load unsigned drivers as well.

By doing this I was able to install the bus driver (busenum.sys), although it did tell me that the driver is unsigned (despite placing the toaster.cat catalog file in the same directory). Anyhow, as suggested by the toaster documentation (http://msdn.microsoft.com/en-us/library/windows/hardware/ff558716(v=vs.85).aspx), I am supposed to ‘simulate’ the plugging of a toaster using the enumerate exe (enum.exe -p 1).

In the words of the documentation 'these applications(enum.exe and devcon.exe) send an I/O control (IOCTL) to the bus driver with the user-provided globally unique serial number and hardware ID of the device and trigger the entire enumeration process. The PnP manager takes the ID information that the bus driver provides and searches the system INF directory to find a matching INF file. If the PnP manager does not find a suitable INF file (for example, when you install for the first time), it prompts the user to specify an INF file. At this point, you can pick one of the three INF files (Toaster.inf, Toastco.inf, or Toasterf.inf) to be the device INF file. If you are testing this sample for the first time, you should choose Toastco.inf. '. Regarding the above lines, I was NOT prompted to specify the inf file for the toaster function driver. It started searching for the driver. And since it couldn’t find the driver file and the inf for the toaster function driver, it merely said it failed to install the device. I had to manually open the device manager. There in the others category, I saw a device named “microsoft_eliyas_toaster_01”. I tried to update the driver software for this new device by pointing it to the toaster.inf file to which the installer says that ‘windows found driver software for your device but encountered an error while attempting to install it’. And it further added ‘the system cannot find the file specified’.

These two seem mutually exclusive to my untrained eye. Ive searched on this all I could on google and ive mostly found threads helping people resolve their driver installation issues for printers, scanners and its mostly written with en end user perspective. Ive yet to find something written from a developer perspective…

Now luckily Ive found this as one of the few active forums where like minded windows developers gather…so pls folks…Id be grateful if I could get started somewhere…

Regards
Aijaz

i just tried building and installing it on win7 vm seems to work
without problems

here is an output of the trial

C:\WinDDK\7600.16385.1\src\general\toaster>winmergeu /r %cd% …\toasterorig

C:\WinDDK\7600.16385.1\src\general\toaster>type toasterdiff.txt

Compare C:\WinDDK\7600.16385.1\src\general\toaster with
C:\WinDDK\7600.16385.1\src\general\toasterorig
16/04/2012 03:47:17
Filename, Short Result
remdir.bat, Left Only
showosandbuild.bat, Left Only
toasterdiff.txt, Left Only

C:\WinDDK\7600.16385.1\src\general\toaster>makedirs %cd%
Starting dirs creation…Completed.

C:\WinDDK\7600.16385.1\src\general\toaster>build -ceZg

BUILD: Compile and Link for x86
BUILD: Start time: Mon Apr 16 03:48:03 2012

BUILD: Finish time: Mon Apr 16 03:49:08 2012
BUILD: Done

154 files compiled - 3 Warnings
5 libraries built
30 executables built

C:\WinDDK\7600.16385.1\src\general\toaster> dir /s /b *.exe *sys *.dll
*.lib >> binaries.txt

cutoff the toastcd directory from the list it is duplicate

use sed on binaries.txt to make it binaries.bat

sed commands are

  1. prepend copy before path

  2. append %cd%\Binaries. after path

C:\WinDDK\7600.16385.1\src\general\toaster\binaries>sed
s/$/\x20%cd%\binaries\./g binaries.txt >binaries.bat

everyline in binaries.bat will look like this

copy C:\WinDDK\7600.16385.1\src\general\toaster\wdm\toastmon\objchk_win7_x86\i386\toastmon.sys
%cd%\binaries.

make the binaries directory copy wont make directory

md binaries

run binaries.bat it will copy all 35 built components to that folder

copy bus.inf , toastco,inf toaster.cat to binaries folder

run buildiso.bat (uses imgburn to build an iso)

C:\WinDDK\7600.16385.1\src\general\toaster\binaries>type BuildIso.bat
“c:\Program Files\ImgBurn\ImgBurn.exe” /mode build /buildoutputmode imagefile /s
rc %CD% /dest %1.iso /FILESYSTEM “UDF” /UDFREVISION “2.01” /VOLUMELABEL %1 /roo
tfolder yes /noimagedetails /start /close
C:\WinDDK\7600.16385.1\src\general\toaster\binaries>BuildIso.bat ToasterCD

mount the iso in vm using capture iso feature

use devcon install :\bus.inf “root\busenum”

a warning will popup do you want to blah blah click yes if you are on
x64 you probably also need to boot in test signing mode

and devcon suceeded and i can do

enum -p 1

here is an output

C:>devcon install d:\bus.inf “root\busenum”
Device node created. Install is complete when drivers are installed…
Updating drivers for root\busenum from d:\bus.inf.
Drivers installed successfully.

C:>d:\Enum.exe -p 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
SerialNo. of the device to be enumerated: 1
Success!!!

C:>d:\Enum.exe -p 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
SerialNo. of the device to be enumerated: 1
PlugIn failed:0x57

C:>d:\Enum.exe -u 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
Unplugging device(s)…
Success!!!

C:>d:\Enum.exe -p 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
SerialNo. of the device to be enumerated: 1
Success!!!

C:>d:\Enum.exe -e 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
Ejecting Device(s)
Success!!!

C:>d:\Enum.exe -p 1
Opening \?\root#system#0001#{d35f7840-6a0c-11d2-b841-00c04fad5171}
Bus interface opened!!!
SerialNo. of the device to be enumerated: 1
Success!!!

C:>

On 4/15/12, xxxxx@gmail.com wrote:
> Hello.
>
> As the title may have suggested, I am a windows noob trying to learn the ins
> and outs of windows device drivers. Coming from the Linux world, I am
> initially finding the learning curve a little steeper than I expected,
> especially driver installation.
>
> Now I am using the toaster driver provided within the DDK v7600.16385.1 as a
> sample. I was able to build the drivers using x64 checked build environment.
> My target machine is a VM running Windows server 2008 R2. I boot with the
> ‘disable driver checking for signature’ switch on so I am able to load
> unsigned drivers as well.
>
> By doing this I was able to install the bus driver (busenum.sys), although
> it did tell me that the driver is unsigned (despite placing the toaster.cat
> catalog file in the same directory). Anyhow, as suggested by the toaster
> documentation
> (http://msdn.microsoft.com/en-us/library/windows/hardware/ff558716(v=vs.85).aspx),
> I am supposed to ‘simulate’ the plugging of a toaster using the enumerate
> exe (enum.exe -p 1).
>
> In the words of the documentation 'these applications(enum.exe and
> devcon.exe) send an I/O control (IOCTL) to the bus driver with the
> user-provided globally unique serial number and hardware ID of the device
> and trigger the entire enumeration process. The PnP manager takes the ID
> information that the bus driver provides and searches the system INF
> directory to find a matching INF file. If the PnP manager does not find a
> suitable INF file (for example, when you install for the first time), it
> prompts the user to specify an INF file. At this point, you can pick one of
> the three INF files (Toaster.inf, Toastco.inf, or Toasterf.inf) to be the
> device INF file. If you are testing this sample for the first time, you
> should choose Toastco.inf. '. Regarding the above lines, I was NOT prompted
> to specify the inf file for the toaster function driver. It started
> searching for the driver. And since it couldn’t find the driver file and the
> inf for the toaster function driver, it merely said it failed to install the
> device. I had to manually open the device manager. There in the others
> category, I saw a device named “microsoft_eliyas_toaster_01”. I tried to
> update the driver software for this new device by pointing it to the
> toaster.inf file to which the installer says that ‘windows found driver
> software for your device but encountered an error while attempting to
> install it’. And it further added ‘the system cannot find the file
> specified’.
>
> These two seem mutually exclusive to my untrained eye. Ive searched on this
> all I could on google and ive mostly found threads helping people resolve
> their driver installation issues for printers, scanners and its mostly
> written with en end user perspective. Ive yet to find something written from
> a developer perspective…
>
> Now luckily Ive found this as one of the few active forums where like minded
> windows developers gather…so pls folks…Id be grateful if I could get
> started somewhere…
>
> Regards
> Aijaz
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Hello.

I followed your instructions and I was able to ‘root enumerate’ the toaster bus (install the toaster bus driver) and was then able to add the toaster function driver (the one which goes with the co-installer) by using devcon on the CD that I created from the various INF, sys and the toaster.cat files.

What intrigues me is that why was I not able to install the same via the device manager GUI. It looked as if it was not able to find the correct file for installing the function driver. To confirm if it has to do with all the setup and driver files being on the CD, I copied all the files in the CD over to a folder in C:\toasterdriver and then installed the bus driver using the same ‘devcon.exe install root\busenum’ and it worked. And later I used the enum.exe to simulate the plug in of a ‘toaster device’ and that worked fine too. Windows was able to install the driver using the toasterco.inf file smoothly.

Having established that it has got nothing to do with the presence of these files on the CD, I replaced the toasterco.inf (in C:\toasterdriver) with toaster.inf and repeated the steps. As expected the bus driver installed smoothly bus the installation of the function driver failed with the exact same error as I described in my earlier post. A device called ‘Microsoft_Eliyas_toaster_01’ was found and windows was not able to find the driver for this new device. Heres what the debugger has to say about it (includes the logs showing the installation of the bus driver as well):

0: kd> g
BusEnum.SYS: Driver Entry
BusEnum.SYS: Add Device: 0xFFFFFA8002110BD0
BusEnum.SYS: AddDevice: FFFFFA80021063B0 to FFFFFA8002110BD0->FFFFFA8002110BD0 (\Device\00000062)
BusEnum.SYS: FDO IRP_MN_QUERY_LEGACY_BUS_INFORMATION IRP:0xFFFFFA800221CAE0
BusEnum.SYS: FDO IRP_MN_FILTER_RESOURCE_REQUIREMENTS IRP:0xFFFFFA800221CAE0
BusEnum.SYS: FDO IRP_MN_START_DEVICE IRP:0xFFFFFA800221CAE0
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA800221CAE0
BusEnum.SYS: FDO IRP_MN_QUERY_PNP_DEVICE_STATE IRP:0xFFFFFA800221CAE0
BusEnum.SYS: FDO IRP_MN_QUERY_DEVICE_RELATIONS IRP:0xFFFFFA800221CAE0
QueryDeviceRelation Type: BusRelations
#PDOS present = 0
#PDOs reported = 0
BusEnum.SYS: FDO: unknown_syscontrol_irp
/*This marks the end of the bus driver installation. What I do not understand in it is why does the PnP manager call the AddDevice routing for the Bus driver? As far as my humble knowledge about Windows drivers goes, I used to think (and Ive read it in texts) that the PnP manager calls the adddevice to add a ‘device instance’ for a device which appears on a given bus. But here we are installting the bus itself. So what does the AddDevice for the bus driver being called for??*/

/*This marks the beginning of the procedure to find/install the driver for the toaster device*/
BusEnum.SYS: Create
BusEnum.SYS: PlugIn called
BusEnum.SYS: Exposing PDO
======SerialNo: 1
======HardwareId: {B85B7C50-6A01-11d2-B841-00C04FAD5171}\MsToaster
======Length: 50
BusEnum.SYS: FdoData->NextLowerDriver = 0xFFFFFA8002110BD0
BusEnum.SYS: FDO IRP_MN_QUERY_DEVICE_RELATIONS IRP:0xFFFFFA800221CAE0
QueryDeviceRelation Type: BusRelations
#PDOS present = 1
#PDOs reported = 1
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryDeviceID
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA800221CAE0
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_TEXT IRP: 0xFFFFFA800202D2C0
DeviceTextDescription :Microsoft_Eliyas_Toaster_01
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_TEXT IRP: 0xFFFFFA800202D2C0
DeviceTextLocationInformation: Unknown
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryInstanceID
InstanceID: 01
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA8001D85EE0
QueryId Type: BusQueryHardwareIDs
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA8001D85EE0
QueryId Type: BusQueryCompatibleIDs
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA8001D85EE0
QueryId Type: UnKnown ID
BusEnum.SYS: PDO IRP_MN_QUERY_RESOURCE_REQUIREMENTS IRP: 0xFFFFFA8001D85EE0
BusEnum.SYS: PDO IRP_MN_QUERY_BUS_INFORMATION IRP: 0xFFFFFA8001D85EE0
BusEnum.SYS: PDO IRP_MN_QUERY_RESOURCES IRP: 0xFFFFFA8001D85EE0
BusEnum.SYS: PDO unknown_pnp_irp IRP: 0xFFFFFA8001D85EE0
BusEnum.SYS: Close
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA80020CC6B0
BusEnum.SYS: PDO IRP_MN_QUERY_INTERFACE IRP: 0xFFFFFA800203D950
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: EjectionRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: RemovalRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA80020CC6B0
BusEnum.SYS: PDO IRP_MN_QUERY_INTERFACE IRP: 0xFFFFFA800203D950
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: EjectionRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: RemovalRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryDeviceID
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA800213D010
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_TEXT IRP: 0xFFFFFA800202D2C0
DeviceTextDescription :Microsoft_Eliyas_Toaster_01
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_TEXT IRP: 0xFFFFFA800202D2C0
DeviceTextLocationInformation: Unknown
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryInstanceID
InstanceID: 01
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryHardwareIDs
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: BusQueryCompatibleIDs
BusEnum.SYS: PDO IRP_MN_QUERY_ID IRP: 0xFFFFFA800202D2C0
QueryId Type: UnKnown ID
BusEnum.SYS: PDO IRP_MN_QUERY_RESOURCE_REQUIREMENTS IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: PDO IRP_MN_QUERY_BUS_INFORMATION IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: PDO IRP_MN_QUERY_RESOURCES IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: PDO unknown_pnp_irp IRP: 0xFFFFFA800202D2C0
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA8001F58CF0
BusEnum.SYS: PDO IRP_MN_QUERY_INTERFACE IRP: 0xFFFFFA800203D950
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: EjectionRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: RemovalRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA8001F58CF0
BusEnum.SYS: PDO IRP_MN_QUERY_INTERFACE IRP: 0xFFFFFA800203D950
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: EjectionRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: RemovalRelations
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_DEVICE_RELATIONS IRP: 0xFFFFFA800203D950
QueryDeviceRelation Type: UnKnown Relation
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA80020B3700
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA80020B3700
BusEnum.SYS: PDO IRP_MN_QUERY_CAPABILITIES IRP: 0xFFFFFA800203D950
BusEnum.SYS: FDO IRP_MN_QUERY_CAPABILITIES IRP:0xFFFFFA80020B3700
/*This marks the end of the failure of MS to find the driver for this device*/

Whats interesting to note is that the driver gets installed when I have the toasterco.inf instead of the toaster.inf file as the setup file for the toaster device. I am still learning about the control flow(PnP callback function invocation order by the PnP manager) as well as the data flow (IRPs) to understand what might have gone wrong (I need to know what is the ‘right’ sequence in the first place which I intend to study by comparing how a successful device installation log looks like. Nonetheless, if you folks out here have it figured out what has gone please do let me know.

Keen to hear from you folks.

Aijaz

Sorry have to say that I was wrong when I said ‘it always works with all the files being on CD’. I honestly do not know what I did the very first time that caused the function driver to get installed (how the PnP was able to find the driver and the setup file for it)

I again tried running the enum utility directly from the CD (like D:\enum.exe -p 1) but it failed again with the same error like before. I am quite confused as to what is preventing that driver from being installed. Keen to hear your comments

Regards,
Aijaz Baig