Tech Support > Microsoft Windows > Drivers > capture shutdown event from lower filter driver of disk driver
capture shutdown event from lower filter driver of disk driver
Posted by Paris on February 10th, 2005


I am writing a driver which is a lower filter of disk class driver. My
driver needs to save its state to the physical disk when the shutdown occurs.
How do I capture the shutdown event in a driver at such a level? I actually
tried the IoRegisterShutdownNotification() and tried to handle the
IRP_MJ_SHUTDOWN. Although I can successfully registered for this event, I
couldn't receive the IRP_MJ_SHUTDOWN irp. I also tried the
SRB_FUNCTION_SHUTDOWN. although I can capture it I don't know what's the
difference between this command and IRP_MJ_SHUTDOWN irp and whether it is
save for my drive to conduct some block level write when handling
SRB_FUNCTION_SHUTDOWN.

thanks for any coming help

Paris

Posted by Maxim S. Shatskih on February 10th, 2005


FSDs always send MJ_SHUTDOWN to disks, no need to register.
At this point, FSs are yet accessible.

The second notification is a MJ_POWER IRP, which is sent later and the FS's
are already dead there.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Paris" <Paris@discussions.microsoft.com> wrote in message
news:544A0EF6-C23E-4A1D-97B3-34296E0687E6@microsoft.com...


Posted by Paris on February 10th, 2005


As described in DDK, the IRP_MJ_SHUTDOWN will be sent both before and after
flushing file system cache. it seems that the disk.sys consumes the
IRP_MJ_SHUTDOWN request and issue the SRB_FUNCTION_SHUTDOWN request to the
lower level driver as is my driver. My question is when my driver handling
this SRB, can it assume that this is a last notification of shutdown and all
the file system cache and what ever cahce above this driver has been flushed?
meanwhile, I found that although there are only two disk devices in the
disk stack, my driver received the SRB_FUNCTION_SHUTDOWN request from
disk.sys for four times. why the number of srb requests is more than the
number of devices?

Moreover, when handling SRB_FUCTION_SHUTDOWN request , can the driver access
the Registry?

thanks,

Paris

"Maxim S. Shatskih" wrote: