Update driver requires restart

I’m creating a KMDF driver for a PCI device and whenever I update the driver it says that my hardware settings have changed and that I have to restart. Is there any way to cleanly update the driver without needing a restart? (And if I remember correctly the old driver for the device, written in DriverWorks, didn’t require the restart on driver update.)

Thanks in advance,
Josh

By default, a KMDF will allow for a driver update w/out a reboot. This
is seen as a query remove -> remove by the driver. Do you call
WdfDeviceSetStaticStopRemove or return failure from
EvtDeviceQueryRemove/Stop? If so, these will fail a graceful remove.
Do you have an app with an open handle to the PCI device when you try to
update the driver? Does the app listen for notifications and close its
handle appropriately? What does setupapi.log say about the failure (and
did you crank up the logging levels to make sure everything is logged?)?

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
Sent: Tuesday, May 01, 2007 12:52 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Update driver requires restart

I’m creating a KMDF driver for a PCI device and whenever I update the
driver it says that my hardware settings have changed and that I have to
restart. Is there any way to cleanly update the driver without needing a
restart? (And if I remember correctly the old driver for the device,
written in DriverWorks, didn’t require the restart on driver update.)

Thanks in advance,
Josh


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I don’t call WdfDeviceSetStaticStopRemove so thats not the problem. I don’t believe I’m handling EvtDeviceQueryRemove/Stop events, maybe thats my problem.
For the other questions: I doubt its an app issue because this will also happen right after I boot up. And I looked in setupapi.log (after maxing the log levels) and the only thing I found was:
“@ 16:26:54.149 : File “C:\WINNT\system32\SETA.tmp” marked to be moved to “C:\WINNT\system32\wdfcoinstaller01001.dll” on next reboot.
@ 16:26:54.159 : Device required reboot: files in use, or treated as in use.”

I’ll try handling those stop/remove events and see if that fixes things.

Thanks,
Josh

By default if you do not implement these functions, you get the right
behavior. You do not need to implement these functions to get the right
behavior. I think that on update, the install package is trying to
update the coinstaller which is already in use in the stack, so to
resolve the in use conflict, a reboot is required. I don’t remember
seeing this problem for other KMDF drivers that I have updated, so
perhaps posting your INF might help

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
Sent: Tuesday, May 01, 2007 1:48 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Update driver requires restart

I don’t call WdfDeviceSetStaticStopRemove so thats not the problem. I
don’t believe I’m handling EvtDeviceQueryRemove/Stop events, maybe thats
my problem.
For the other questions: I doubt its an app issue because this will also
happen right after I boot up. And I looked in setupapi.log (after maxing
the log levels) and the only thing I found was:
“@ 16:26:54.149 : File “C:\WINNT\system32\SETA.tmp” marked to be moved
to “C:\WINNT\system32\wdfcoinstaller01001.dll” on next reboot.
@ 16:26:54.159 : Device required reboot: files in use, or treated as in
use.”

I’ll try handling those stop/remove events and see if that fixes things.

Thanks,
Josh


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hmmm, it sounds like not handling the stop/remove events should be fine then.

Here’s my inf file in its entirety:

; ‘RTDGPD.inf’ file for the RTD RTDGPD driver

[Version]
Signature=“$WINDOWS NT$”
Class=RTD dataModules
ClassGUID={A2CB91F8-D73C-406D-89E1-410F905F97BB}
Provider=%Provider%
DriverVer=05/01/2007,1.0.0.17584

[DestinationDirs]
DefaultDestDir = 12
RTDGPD_Device_CoInstaller_CopyFiles = 11

; ================= Class section =====================

[ClassInstall32]
Addreg=RTDGPD_ClassReg

[RTDGPD_ClassReg]
HKR,0,%ClassName%
HKR,Icon,-5
HKR,DeviceCharacteristics,0x10001,0x100 ;Use same security checks on relative opens
HKR,Security,“D:P(A;;GA;;;SY)(A;;GA;;;BA)” ;Allow generic all access to system and built-in Admin.
;This one overrides the security set by the driver

;*****************************************
; RTDGPD Device Install Section
;*****************************************

[Manufacturer]
%MfgName%=Standard,NT$ARCH$

; For Win2K
[Standard]
; DisplayName Section DeviceId
; ----------- ------- --------
%RTDGPDDevice.DeviceDesc%=RTDGPD_Device, PCI\VEN_1435&DEV_7820

; For XP and later
[Standard.NT$ARCH$]
%RTDGPDDevice.DeviceDesc%=RTDGPD_Device, PCI\VEN_1435&DEV_7820

[RTDGPD_Device.NT]
CopyFiles=RTDGPD_Device.NT.Copy

[RTDGPD_Device.NT.Copy]
RTDGPD.sys

;-------------- Service installation

[RTDGPD_Device.NT.Services]
AddService = RTDGPD, %SPSVCINST_ASSOCSERVICE%, RTDGPD_Service_Inst

[RTDGPD_Service_Inst]
DisplayName = %RTDGPD.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\RTDGPD.sys
LoadOrderGroup = Extended Base

[SourceDisksNames]
1 = %DiskId1%,“”

[SourceDisksFiles]
RTDGPD.sys = 1,

;
;— WDF Coinstaller installation ------
;
[RTDGPD_Device.NT.CoInstallers]
AddReg=RTDGPD_Device_CoInstaller_AddReg
CopyFiles=RTDGPD_Device_CoInstaller_CopyFiles

[RTDGPD_Device_CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “wdfcoinstaller01001.dll,WdfCoInstaller”

[RTDGPD_Device_CoInstaller_CopyFiles]
wdfcoinstaller01001.dll

[SourceDisksFiles]
wdfcoinstaller01001.dll=1 ; make sure the number matches with SourceDisksNames

[RTDGPD_Device.NT.Wdf]
KmdfService = RTDGPD, RTDGPD_wdfsect

[RTDGPD_wdfsect]
KmdfLibraryVersion = 1.1

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
Provider = “RTD Embedded Technologies, Inc.”
MfgName = “RTD Embedded Technologies, Inc.”
ClassName = “RTD dataModules”
DiskId1 = “RTDGPD Device Installation Disk #1
RTDGPDDevice.DeviceDesc = “RTD RTDGPD Device”
RTDGPD.SVCDESC = “RTDGPD Device Driver”

Thanks,
Josh

Actually, the setupapi log says the problem is the coinstaller, so don’t worry about the driver code (I was wondering about that to begin with).

This sounds naggingly familiar- I’ll see if I can get to why, unless someone else resolves this for you first.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
Sent: Tuesday, May 01, 2007 1:48 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Update driver requires restart

I don’t call WdfDeviceSetStaticStopRemove so thats not the problem. I don’t believe I’m handling EvtDeviceQueryRemove/Stop events, maybe thats my problem.
For the other questions: I doubt its an app issue because this will also happen right after I boot up. And I looked in setupapi.log (after maxing the log levels) and the only thing I found was:
“@ 16:26:54.149 : File “C:\WINNT\system32\SETA.tmp” marked to be moved to “C:\WINNT\system32\wdfcoinstaller01001.dll” on next reboot.
@ 16:26:54.159 : Device required reboot: files in use, or treated as in use.”

I’ll try handling those stop/remove events and see if that fixes things.

Thanks,
Josh

Josh-

What OS is this happening on?

Josh-

If you’ve got the WDK handy, could you update your INF to use the 1.5 coinstaller and see if that fixes the issue? No need to recompile the driver.

Also, I’d like to know if this happens to be Windows 2000 [to see if it’s the problem I was recalling or not].

Thanks,
Bob Kjelgaard

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Tuesday, May 01, 2007 2:46 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Update driver requires restart

Josh-

What OS is this happening on?


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Bob,

This is on Windows 2000. (With version 1.1 of the kmdf as you can tell from the inf.)
I’ll try using version 1.5 and see if that makes any difference.

Thanks,
Josh

Actually, we don’t have v1.5 of the KMDF and our MSDN subscription ran out so I can’t get it from the WDK. So it looks like I won’t be trying the new version. Any other ideas?

Thanks,
Josh

This is probably a problem reported in the KMDF 1.1 Release Notes then. One of my colleagues came through after I left work yesterday on my inquiries, and emailed me the text, so here it is:

>
On Windows 2000 systems only, if you install multiple instances of the same driver or multiple KMDF drivers, you will see a dialogue box prompting you to reboot the system. You can ignore this message.
The reason for the message is that on Windows 2000 systems, SetupAPI tries to overwrite the already-installed KMDF coinstaller but it can’t ignore the file-copy failure if the coinstaller is already present. The reboot message appears if you install multiple instances of the same driver or multiple drivers that use KMDF, and when you right-click on the properties in Device Manager for any of the individual device instances. You do not need to reboot your computer – the message can be ignored.

To prevent the message from appearing, set the COPYFLG_NO_OVERWRITE flag (0x00000010) in the .CoInstallers section of the driver’s INF file, under the CopyFiles directive, as follows:

[driver.CoInstallers]
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_CopyFiles]
wdfcoinstaller01001.dll,0x00000010
<<

We fixed the coinstaller to avoid this in 1.5, and there are the usual benefits of picking up fixed bugs, etc. So I believe using it is a preferred solution. But if you must use 1.1, then using this workaround is approved.

Sorry I couldn’t get this to you sooner- left work before the responses came back and forgot I had a 1.1 CD (although who knows if I could find it ;).

Actually, as I understand it, the WDK is available as a free download. MSDN subscription includes WDK in the CD/DVD set (been a while since I let mine lapse- those were the choices when I did), but the download is still available.

If I’m wrong about that, SOMEONE on this list is bound to point it out…

I’ll keep looking for the WDK download. Our subscription should be back soon, so I can get it then if nothing else. In the meantime, I’ll use the workaround from a previous post. Thanks for all the help everyone. Maybe next time I’ll bother reading the release notes. :stuck_out_tongue:

Thanks,
Josh

Follow the instructions in this link to get the WDK ISO

http://blogs.msdn.com/doronh/archive/2007/04/11/the-wdk-iso-download-lin
k-has-been-moved-off-of-whdc.aspx

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
Sent: Wednesday, May 02, 2007 6:27 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Update driver requires restart

I’ll keep looking for the WDK download. Our subscription should be back
soon, so I can get it then if nothing else. In the meantime, I’ll use
the workaround from a previous post. Thanks for all the help everyone.
Maybe next time I’ll bother reading the release notes. :stuck_out_tongue:

Thanks,
Josh


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I used the link, and tried to follow the instructions but the “Windows Driver Kit RTM” doesn’t show in my list of ‘connections’ or ‘programs’ on the Connect website. Did I miss it? Is it gone?

Thanks,
Josh

Hmm, I can’t find it in the list anymore, but after you sign in to the
connect site, try this link

https://connect.microsoft.com/site/sitehome.aspx?SiteID=148

does that work? The new name of the program is “Windows Logo Kit (WLK),
Windows Driver Kit (WDK) and Windows Driver Framework (WDF)”

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
Sent: Wednesday, May 02, 2007 10:23 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Update driver requires restart

I used the link, and tried to follow the instructions but the “Windows
Driver Kit RTM” doesn’t show in my list of ‘connections’ or ‘programs’
on the Connect website. Did I miss it? Is it gone?

Thanks,
Josh


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I tried the link and got:

Page Not Found

The content that you requested cannot be found or you do not have permission to view it.

If you believe you have reached this page in error, click the Contact Us link at the bottom of the page to report the issue and include this ID in your e-mail: e1e2c05f-f47a-4336-8e4d-c64f2f5bcf12

Thanks,
Josh

well i could not find that in list yesterday but its there in the list today

magic maybe

Microsoft Windows Driver Kit (WDK) and Windows Logo Kit (WLK)
Program Information

WDK, WLK and WDF beta customers

Apply for Participation in this Program

Program Start Date 4/20/2006
Program End Date 9/27/2007
Nomination Start Date 4/20/2006
Nomination End Date 9/27/2007

On 5/3/07, Doron Holan wrote:
> Hmm, I can’t find it in the list anymore, but after you sign in to the
> connect site, try this link
>
> https://connect.microsoft.com/site/sitehome.aspx?SiteID=148
>
> does that work? The new name of the program is “Windows Logo Kit (WLK),
> Windows Driver Kit (WDK) and Windows Driver Framework (WDF)”
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@rtd.com
> Sent: Wednesday, May 02, 2007 10:23 AM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Update driver requires restart
>
> I used the link, and tried to follow the instructions but the “Windows
> Driver Kit RTM” doesn’t show in my list of ‘connections’ or ‘programs’
> on the Connect website. Did I miss it? Is it gone?
>
> Thanks,
> Josh
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

No magic, some things had to be fixed on the connect site (partially
based on the feedback in this group as well as the public newsgroups).
Hopefully everything goes smoothly moving fwd.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of raj_r
Sent: Thursday, May 03, 2007 10:35 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Update driver requires restart

well i could not find that in list yesterday but its there in the list
today

magic maybe

Microsoft Windows Driver Kit (WDK) and Windows Logo Kit (WLK)
Program Information

WDK, WLK and WDF beta customers

Apply for Participation in this Program

Program Start Date 4/20/2006
Program End Date 9/27/2007
Nomination Start Date 4/20/2006
Nomination End Date 9/27/2007

On 5/3/07, Doron Holan wrote:
> Hmm, I can’t find it in the list anymore, but after you sign in to the
> connect site, try this link
>
> https://connect.microsoft.com/site/sitehome.aspx?SiteID=148
>
> does that work? The new name of the program is “Windows Logo Kit
(WLK),
> Windows Driver Kit (WDK) and Windows Driver Framework (WDF)”
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@rtd.com
> Sent: Wednesday, May 02, 2007 10:23 AM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Update driver requires restart
>
> I used the link, and tried to follow the instructions but the “Windows
> Driver Kit RTM” doesn’t show in my list of ‘connections’ or ‘programs’
> on the Connect website. Did I miss it? Is it gone?
>
> Thanks,
> Josh
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

After a little trial and error I was able to get the download started. Thanks for help.

Josh