DefaultInstall + reboot expectation

Hi all,

I’m attempting to install a non-pnp driver (WFP Callout driver) with the following inf file.

;
; MYDriver.inf
;

[Version]
Signature=“$WINDOWS NT$”
Class=MyClass
ClassGuid={39BC59C1-433F-4935-A12B-982A17811125}
Provider=%ManufacturerName%
CatalogFile=MYDriver.cat
DriverVer= ; set by DriverVer in stampinf property pages
DriverPackageType=KernelService

[SourceDisksNames]
1 = %DiskName%

[SourceDisksFiles]
MYDriver.sys = 1

[DestinationDirs]
DefaultDestDir = 12
MYDriver.DriverFiles = 12

[DefaultInstall]
OptionDesc = %Description%
CopyFiles=MYDriver.DriverFiles

[DefaultInstall.Services]
AddService = %ServiceName%,0x00000800,MYDriver.Service

[DefaultUninstall]
DelFiles = MYDriver.DriverFiles

[DefaultUninstall.Services]
DelService = %ServiceName%,0x200 ; SPSVCINST_STOPSERVICE

[MYDriver.DriverFiles]
MYDriver.sys,0x00000040 ; COPYFLG_OVERWRITE_OLDER_ONLY

[MYDriver.Service]
DisplayName = %ServiceName%
Description = %ServiceDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\MYDriver.sys
LoadOrderGroup = NDIS ;/// Load immediately after TCPIP.sys
Dependencies = TCPIP

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName = “Mynufacturer”
DiskName = “MYDriver Installation Disk”
Description = “MyDesc”
ServiceDesc = “MyDesc”
ServiceName = “MY Driver”

I have a *firm* requirement that no restart should occur on install, removal, or upgrade.

On initial install this is easy. Install the driver service as SERVICE_DEMAND_START and add it as a dependency of the usermode service (also required by my product), windows does the rest.
During testing of an upgrade, using these steps:

  1. right click 1.0.33 inf file -> install
  2. sc start “MY driver”
  3. right click 1.0.34 inf file -> install

I’m being prompted to reboot on Windows 10 (not windows 7). The relevant parts of setupapi log file are:

flq: Source Media: SPFQOPERATION_DOIT
flq: {FILE_QUEUE_COMMIT_COPY_FILE}
flq: {FILE_QUEUE_BACKUP_FILE}
flq: CopyFile: ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ to ‘C:\Windows\Temp\OLD6135.tmp’
flq: {FILE_QUEUE_BACKUP_FILE exit OK}
flq: {SPFILENOTIFY_STARTCOPY}
flq: {SPFILENOTIFY_STARTCOPY - exit(0x00000001)}
flq: Copying ‘C:\Users\WDKRemoteUser\Desktop\deploy\MYDriver\MYDriver.sys’ to ‘C:\Windows\system32\DRIVERS\MYDriver.sys’.
flq: CopyFile: ‘C:\Users\WDKRemoteUser\Desktop\deploy\MYDriver\MYDriver.sys’ to ‘C:\Windows\system32\DRIVERS\SET6164.tmp’
cpy: CopyFile Drp is NOT active
! flq: MoveFile: ‘C:\Windows\system32\DRIVERS\SET6164.tmp’ to ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ FAILED!
! flq: Error 5: Access is denied.
flq: {SPFQNOTIFY_FILEOPDELAYED}
flq: {SPFILENOTIFY_FILEOPDELAYED}
flq: {SPFILENOTIFY_FILEOPDELAYED - exit(0x00000000)}
flq: {SPFQNOTIFY_FILEOPDELAYED - returned 0x00000005}
! flq: Targetfile ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ marked to be moved from ‘C:\Windows\system32\DRIVERS\SET6164.tmp’ on next reboot.
flq: {SPFILENOTIFY_ENDCOPY}
flq: {SPFILENOTIFY_ENDCOPY - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT_COPY_FILE exit OK}

It looks like MYDriver.sys in the driver directory is still being used by my driver service? Is the DefaultUninstall.Services section not executed at any point in this process?

It’s worth stating, this isn’t actually representitive of how customers will install my software, they will use an installer. However I’m seeing the exact same behavior with the installer and suspect the two cases are related.

If it’s relevant I’m using Wix + their difx:Driver extension.

I’d also be interested how others have handled the “no reboot” requirement.
Many thanks
J

I don’t think del services are processed at all. You can’t copy the file because starting in win10, the driver’s pages are backed by the image itself, not the pagefile. This leads to the standard file is locked problems like you have with DLLs loaded by a process. If you can’t deal with the reboot, your install will need to manually stop the service through the SCM first before copying over the new install

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@live.co.uk
Sent: Wednesday, July 13, 2016 7:20 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DefaultInstall + reboot expectation

Hi all,

I’m attempting to install a non-pnp driver (WFP Callout driver) with the following inf file.

;
; MYDriver.inf
;

[Version]
Signature=“$WINDOWS NT$”
Class=MyClass
ClassGuid={39BC59C1-433F-4935-A12B-982A17811125}
Provider=%ManufacturerName%
CatalogFile=MYDriver.cat
DriverVer= ; set by DriverVer in stampinf property pages DriverPackageType=KernelService

[SourceDisksNames]
1 = %DiskName%

[SourceDisksFiles]
MYDriver.sys = 1

[DestinationDirs]
DefaultDestDir = 12
MYDriver.DriverFiles = 12

[DefaultInstall]
OptionDesc = %Description%
CopyFiles=MYDriver.DriverFiles

[DefaultInstall.Services]
AddService = %ServiceName%,0x00000800,MYDriver.Service

[DefaultUninstall]
DelFiles = MYDriver.DriverFiles

[DefaultUninstall.Services]
DelService = %ServiceName%,0x200 ; SPSVCINST_STOPSERVICE

[MYDriver.DriverFiles]
MYDriver.sys,0x00000040 ; COPYFLG_OVERWRITE_OLDER_ONLY

[MYDriver.Service]
DisplayName = %ServiceName%
Description = %ServiceDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\MYDriver.sys
LoadOrderGroup = NDIS ;/// Load immediately after TCPIP.sys
Dependencies = TCPIP

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName = “Mynufacturer”
DiskName = “MYDriver Installation Disk”
Description = “MyDesc”
ServiceDesc = “MyDesc”
ServiceName = “MY Driver”

I have a firm requirement that no restart should occur on install, removal, or upgrade.

On initial install this is easy. Install the driver service as SERVICE_DEMAND_START and add it as a dependency of the usermode service (also required by my product), windows does the rest.
During testing of an upgrade, using these steps:
1. right click 1.0.33 inf file -> install 2. sc start “MY driver”
3. right click 1.0.34 inf file -> install

I’m being prompted to reboot on Windows 10 (not windows 7). The relevant parts of setupapi log file are:

flq: Source Media: SPFQOPERATION_DOIT
flq: {FILE_QUEUE_COMMIT_COPY_FILE}
flq: {FILE_QUEUE_BACKUP_FILE}
flq: CopyFile: ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ to ‘C:\Windows\Temp\OLD6135.tmp’
flq: {FILE_QUEUE_BACKUP_FILE exit OK}
flq: {SPFILENOTIFY_STARTCOPY}
flq: {SPFILENOTIFY_STARTCOPY - exit(0x00000001)}
flq: Copying ‘C:\Users\WDKRemoteUser\Desktop\deploy\MYDriver\MYDriver.sys’ to ‘C:\Windows\system32\DRIVERS\MYDriver.sys’.
flq: CopyFile: ‘C:\Users\WDKRemoteUser\Desktop\deploy\MYDriver\MYDriver.sys’ to ‘C:\Windows\system32\DRIVERS\SET6164.tmp’
cpy: CopyFile Drp is NOT active
! flq: MoveFile: ‘C:\Windows\system32\DRIVERS\SET6164.tmp’ to ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ FAILED!
! flq: Error 5: Access is denied.
flq: {SPFQNOTIFY_FILEOPDELAYED}
flq: {SPFILENOTIFY_FILEOPDELAYED}
flq: {SPFILENOTIFY_FILEOPDELAYED - exit(0x00000000)}
flq: {SPFQNOTIFY_FILEOPDELAYED - returned 0x00000005}
! flq: Targetfile ‘C:\Windows\system32\DRIVERS\MYDriver.sys’ marked to be moved from ‘C:\Windows\system32\DRIVERS\SET6164.tmp’ on next reboot.
flq: {SPFILENOTIFY_ENDCOPY}
flq: {SPFILENOTIFY_ENDCOPY - exit(0x00000001)}
flq: {FILE_QUEUE_COMMIT_COPY_FILE exit OK}

It looks like MYDriver.sys in the driver directory is still being used by my driver service? Is the DefaultUninstall.Services section not executed at any point in this process?

It’s worth stating, this isn’t actually representitive of how customers will install my software, they will use an installer. However I’m seeing the exact same behavior with the installer and suspect the two cases are related.

If it’s relevant I’m using Wix + their difx:Driver extension.

I’d also be interested how others have handled the “no reboot” requirement.
Many thanks
J


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>