Replacing driver without rebooting the system

Hi,
Is it possible to replace an existing driver with another driver
(unload the old driver, load new driver) without rebooting the system?

How to do that in Windows XP and in windows 7? Is it possible for boot drivers also? (i guess not possible for boot drivers) but let me know is there any work around to do the same for boot drivers

There are a couple of different ways.

  1. If you have a debugger attached you can use the .kdfiles command (
    http://msdn.microsoft.com/en-us/library/ff563848(VS.85).aspx)
  2. For plug and play drivers you can disable the device node (via devcon.exe
    or device manager) replace the binary in “%WINDIR%/system32/drivers” and
    then enable the device again. If you have multiple devices make sure all of
    them are unplugged or disabled so that the image is unloaded and then
    reloaded.

I am not sure about boot drivers

On Wed, Sep 8, 2010 at 8:25 PM, Prasanna Kumar T S M <
xxxxx@gmail.com> wrote:

Hi,
Is it possible to replace an existing driver with another driver (unload
the old driver, load new driver) without rebooting the system?


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

On Wed, 8 Sep 2010 21:44:36 +1200
Daniel Newton wrote:

> There are a couple of different ways.
>
> 1) If you have a debugger attached you can use the .kdfiles command (
> http://msdn.microsoft.com/en-us/library/ff563848(VS.85).aspx)
> 2) For plug and play drivers you can disable the device node (via
> devcon.exe or device manager) replace the binary in
> “%WINDIR%/system32/drivers” and then enable the device again. If you
> have multiple devices make sure all of them are unplugged or disabled
> so that the image is unloaded and then reloaded.

If you’re frequently disabling/swapping/re-enabling the driver you can
also do so via the command line: run “net stop ” and “net
start ”.


Bruce Cran

“Bruce Cran” wrote in message news:xxxxx@ntdev…
> If you’re frequently disabling/swapping/re-enabling the driver you can
> also do so via the command line: run “net stop ” and “net
> start ”.

Net stop/start should only be used for NT4 style legacy drivers. PnP drivers
need to be stopped/started by having their devices disabled/enabled via
Device Manager or devcon.

Daniel Newton wrote:
>I am not sure about boot drivers

Older O/S releases required the mythical checked version of the boot loader
to make .kdfiles work with boot start drivers. I never managed to see this
work, so I can’t speak to the legend. Win7 is supposed to have this support
built in, it just needs to be enabled in the BCD. I haven’t tried this
either yet to verify.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Bruce Cran” wrote in message news:xxxxx@ntdev…
> On Wed, 8 Sep 2010 21:44:36 +1200
> Daniel Newton wrote:
>
>> There are a couple of different ways.
>>
>> 1) If you have a debugger attached you can use the .kdfiles command (
>> http://msdn.microsoft.com/en-us/library/ff563848(VS.85).aspx)
>> 2) For plug and play drivers you can disable the device node (via
>> devcon.exe or device manager) replace the binary in
>> “%WINDIR%/system32/drivers” and then enable the device again. If you
>> have multiple devices make sure all of them are unplugged or disabled
>> so that the image is unloaded and then reloaded.
>
> If you’re frequently disabling/swapping/re-enabling the driver you can
> also do so via the command line: run “net stop ” and “net
> start ”.
>
> –
> Bruce Cran
>

It isn’t possible for any driver that won’t unload. In general boot devices
are in that category. PnP non boot devices should generally be unloadable if
you can disable/remove all of their devices, but as we just discussed, a pnp
driver that includes a control device is very likely to not be unloadable
even after your disable or remove all of the associated devices.

.kdfiles and windbg are only applicable to test/debug scenarios. Are you
talking about a test environment issue or a production issue?

Mark Roddy

On Wed, Sep 8, 2010 at 4:40 AM, wrote:

> How to do that in Windows XP and in windows 7? Is it possible for boot
> drivers also? (i guess not possible for boot drivers) but let me know is
> there any work around to do the same for boot drivers
>
> —
> 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
>

I’ve seen the legend work once or twice, though not by the way described in
the windbg docs. I definitely needed the CHK version of ntldr, not the one
from the setup directory.

The Win7 support also worked for me, as I recall.

Good luck,

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Scott Noone
Sent: Wednesday, September 08, 2010 8:22 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Replacing driver without rebooting the system

“Bruce Cran” wrote in message news:xxxxx@ntdev…
> If you’re frequently disabling/swapping/re-enabling the driver you can
> also do so via the command line: run “net stop ” and “net
> start ”.

Net stop/start should only be used for NT4 style legacy drivers. PnP drivers
need to be stopped/started by having their devices disabled/enabled via
Device Manager or devcon.

Daniel Newton wrote:
>I am not sure about boot drivers

Older O/S releases required the mythical checked version of the boot loader
to make .kdfiles work with boot start drivers. I never managed to see this
work, so I can’t speak to the legend. Win7 is supposed to have this support
built in, it just needs to be enabled in the BCD. I haven’t tried this
either yet to verify.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Bruce Cran” wrote in message news:xxxxx@ntdev…
> On Wed, 8 Sep 2010 21:44:36 +1200
> Daniel Newton wrote:
>
>> There are a couple of different ways.
>>
>> 1) If you have a debugger attached you can use the .kdfiles command (
>> http://msdn.microsoft.com/en-us/library/ff563848(VS.85).aspx)
>> 2) For plug and play drivers you can disable the device node (via
>> devcon.exe or device manager) replace the binary in
>> “%WINDIR%/system32/drivers” and then enable the device again. If you
>> have multiple devices make sure all of them are unplugged or disabled
>> so that the image is unloaded and then reloaded.
>
> If you’re frequently disabling/swapping/re-enabling the driver you can
> also do so via the command line: run “net stop ” and “net
> start ”.
>
> –
> Bruce Cran
>


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

I want to create an installer for a kernel driver (pnp driver). After installation of the driver the device should start working without reboot. At present the device works only after rebooting the machine.

> Is it possible to replace an existing driver with another driver

(unload the old driver, load new driver) without rebooting the system?

If the driver is unloadable - then usually yes, with the exception of the boot disk/volume stacks (or any stack with a pagefile, or a stack for a disk from which the app is running).


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

What kind of driver is this? You need to be more specific here.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
> I want to create an installer for a kernel driver (pnp driver). After
> installation of the driver the device should start working without reboot.
> At present the device works only after rebooting the machine.
>

Sure, given you’ve registered an unload function and have no outstanding
references. Simply use Device Manager and disable it, or use a command line
and “net stop drivername” or an elevated Powershell session and
“stop-service drivername”.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Prasanna Kumar T S M
Sent: Wednesday, September 08, 2010 3:26 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Replacing driver without rebooting the system

Hi,
Is it possible to replace an existing driver with another driver
(unload the old driver, load new driver) without rebooting the system?


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

What is the value the you set for Start in the INF file?

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, September 08, 2010 7:57 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Replacing driver without rebooting the system

I want to create an installer for a kernel driver (pnp driver). After
installation of the driver the device should start working without reboot.
At present the device works only after rebooting the machine.


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

It is a display driver. What other info do you need?

It is system start (SERVICE_SYSTEM_START).

Perhaps you need to restart the device stack (SetupDiCallClassInstaller with
DIF_PROPERTYCHANGE).

After that you can check if it really needs a reboot
(SetupDiGetDeviceInstallParams with “DI_NEEDRESTART | DI_NEEDREBOOT”), which
shouldnt be the case as long as it is pnp and no app is stubbornly holding a
handle open.

On Thu, Sep 9, 2010 at 12:56 AM, wrote:

> I want to create an installer for a kernel driver (pnp driver). After
> installation of the driver the device should start working without reboot.
> At present the device works only after rebooting the machine.
>
> —
> 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
>