Can I unload and reload a filesystem driver without rebooting my PC?

Hi All,

I am involved in a filesystem driver development. I want to update my driver to the new version that we have updated recently. Currently I replace the .sys file with the new .sys file and reboot the PC to get the new driver loaded. But I want to do this without rebooting my PC. Can I do this by issuing unload and then load the driver again using the new .sys file?

Thanks in advance…
Girish.

may using sc command

sc stop

sc start

Yes you can, but it is not the safe way to do this. To avoid crashing of the system you have close all programs that were started after your driver was loaded into the system.

Using ‘sc’ is not unsafe. If there are any outstanding references/handles
to a driver, it won’t unload.

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Wednesday, March 09, 2011 4:23 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Can I unload and reload a filesystem driver without
rebooting my PC?

Yes you can, but it is not the safe way to do this. To avoid crashing of the
system you have close all programs that were started after your driver was
loaded into the system.


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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

Thank you all for the responses. I tried using SC STOP , but I am getting the following error message: “The requested control is not valid for this service”. Do I need to do anything in my driver or is it not supported for a filesystem driver?

Thanks,
Girish

Apparently it’s not valid, which kind of surprises me, not that I really
know much about filesystems.

mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@rediffmail.com
Sent: Wednesday, March 09, 2011 6:47 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Can I unload and reload a filesystem driver without
rebooting my PC?

Thank you all for the responses. I tried using SC STOP , but I
am getting the following error message: “The requested control is not valid
for this service”. Do I need to do anything in my driver or is it not
supported for a filesystem driver?

Thanks,
Girish


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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

Is the Unload routine even registered via DriverObject->DriverUnload?

Regards,
Ayush Gupta
Software Consultant & Owner,
AI Consulting

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Wednesday, March 09, 2011 5:22 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Can I unload and reload a filesystem driver without
rebooting my PC?

Apparently it’s not valid, which kind of surprises me, not that I really
know much about filesystems.

mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@rediffmail.com
Sent: Wednesday, March 09, 2011 6:47 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Can I unload and reload a filesystem driver without
rebooting my PC?

Thank you all for the responses. I tried using SC STOP , but I
am getting the following error message: “The requested control is not valid
for this service”. Do I need to do anything in my driver or is it not
supported for a filesystem driver?

Thanks,
Girish


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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’ll echo what has already been asked: “Did you register the Unload function during DriverEntry?” As far as starting/stopping the driver, you can also use Device Manager to Disable the driver, refresh the SYS file, and then use Enable to reload and start the driver binary. Powershell’s start/stop-service also works. If you are using “.kdfiles” in WinDbg, the new binary will be loaded for you any time the driver is loaded, or enabled, or started. Unless you have a bug in your code there is nothing unsafe in using any of these to START/STOP the driver. However, given you have ANY handles or references to the driver, it will not unload and you will have to reboot. There is no getting around that.

Gary G. Little

----- Original Message -----
From: xxxxx@rediffmail.com
To: “Windows File Systems Devs Interest List”
Sent: Wednesday, March 9, 2011 5:47:18 AM
Subject: RE:[ntfsd] Can I unload and reload a filesystem driver without rebooting my PC?

Thank you all for the responses. I tried using SC STOP , but I am getting the following error message: “The requested control is not valid for this service”. Do I need to do anything in my driver or is it not supported for a filesystem driver?

Thanks,
Girish


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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

Hi!

I recently started development on a filesystem driver, and i planned to test like this:
I formatted a pendrive to ext2 (I’m planning to do an ext4 implementation).
Wrote a small tool, which loads/unloads/starts/stops a driver, and can send ioctls to it.
So:
load driver
start driver
plug in pendrive
test functionality
unplug pendrive
call ioctl (closes/deletes everything)
stop driver
unload driver

But after the volume is mounted and i delete the volume’s device object, i get a bluescreen…
(despite the pendrive being unplugged…)

Oh, btw this was only a sort-of FYI…

Sounds like you have a bug. If you are getting a blue screen, it must be due to some logic issue in your driver.

What does !analyze -v indicate?

Tony
OSR

I don’t have 2 pcs, so i don’t use a kernel debugger…

Sorry, but that has to be the most LAME excuse I’ve heard in quite some time. Virtually everyone I know does their development on a single PC these days… go get VirtualBox (which is free) and run it in there. Or take the crash dump file (c:\Windows\memory.dmp if you have properly configured your machine) and load it up under WinDBG.

Tony
OSR

You don’t use a kernel debugger. Now that explains a lot about why you haven’t already found and fixed your problem.

By the way, you can always take your dump file to OsrOnline to get the analyze dump.

Gary G. Little

----- Original Message -----
From: xxxxx@gmail.com
To: “Windows File Systems Devs Interest List”
Sent: Wednesday, March 9, 2011 10:46:53 AM
Subject: RE:[ntfsd] Can I unload and reload a filesystem driver without rebooting my PC?

I don’t have 2 pcs, so i don’t use a kernel debugger…


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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