Drive removal notifications via RegisterDeviceNotification

Hi,

I am trying to use RegisterDeviceNotification to detect hot-swappable
sata drive surprise removals/insertions in a box of disks (service
context on xp and 2003). The only notifications I can get are usb
related, in the case where I specify
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES. The disks in question are raw
disks that we manage ourselves.

I am aware of the distinction between class and interface GUIDs as
discussed on Doran’s blog post at:
http://blogs.msdn.com/doronh/archive/2006/02/15/532679.aspx.

(Isn’t the usb example at
http://msdn.microsoft.com/en-us/library/aa363432.aspx broken since it
uses GUID_DEVCLASS_WCEUSB? That example doesn’t work for me.)

The sata card vendor suggested I should be able to get drive remove/add
notifications, when using the scsi adapter guid specified in their .inf
file, but I believe that is also a class GUID.

Should I be able to do this? Would it require special driver support?
My vendor suggested it shouldn’t, that it was all handled by an upper
level. Maybe I should try DBT_DEVTYP_HANDLE and specify a disk handle
instead of a guid?

Any hint would be greatly appreciated.

Thanks,

John M. Adams

Have you tried registering for GUID_DEVINTERFACE_DISK or GUID_DEVINTERFACE_VOLUME and seeing what you get notified on? certainly registering for interface notification arrivals will work that way. You should get removals as well, but you might need to open a handle on arrival and then register for notificatiosn on the handle to be told of surprise removal.

d (with 2 o’s)

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of John Adams
Sent: Wednesday, January 21, 2009 1:11 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Drive removal notifications via RegisterDeviceNotification

Hi,

I am trying to use RegisterDeviceNotification to detect hot-swappable sata drive surprise removals/insertions in a box of disks (service context on xp and 2003). The only notifications I can get are usb related, in the case where I specify DEVICE_NOTIFY_ALL_INTERFACE_CLASSES. The disks in question are raw disks that we manage ourselves.

I am aware of the distinction between class and interface GUIDs as discussed on Doran’s blog post at: http://blogs.msdn.com/doronh/archive/2006/02/15/532679.aspx.
(Isn’t the usb example at http://msdn.microsoft.com/en-us/library/aa363432.aspx broken since it uses GUID_DEVCLASS_WCEUSB? That example doesn’t work for me.)

The sata card vendor suggested I should be able to get drive remove/add notifications, when using the scsi adapter guid specified in their .inf file, but I believe that is also a class GUID.

Should I be able to do this? Would it require special driver support? My vendor suggested it shouldn’t, that it was all handled by an upper level. Maybe I should try DBT_DEVTYP_HANDLE and specify a disk handle instead of a guid?

Any hint would be greatly appreciated.

Thanks,


John M. Adams


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

If your “raw disks” show up in Device Manager as disks, you should be
able to use GUID_DEVINTERFACE_DISK. Yes, you will get notified of any
other hot-pluggable disks showing up as well, and you’ll need to figure
out if the notification you got is for a disk you are interested in.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of “John Adams”

Sent: Wednesday, January 21, 2009 2:11 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Drive removal notifications via
RegisterDeviceNotification

Hi,

I am trying to use RegisterDeviceNotification to detect hot-swappable
sata drive surprise removals/insertions in a box of disks (service
context on xp and 2003). The only notifications I can get are usb
related, in the case where I specify
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES. The disks in question are raw
disks that we manage ourselves.

I am aware of the distinction between class and interface GUIDs as
discussed on Doran’s blog post at:
http://blogs.msdn.com/doronh/archive/2006/02/15/532679.aspx.

(Isn’t the usb example at
http://msdn.microsoft.com/en-us/library/aa363432.aspx broken since it
uses GUID_DEVCLASS_WCEUSB? That example doesn’t work for me.)

The sata card vendor suggested I should be able to get drive remove/add
notifications, when using the scsi adapter guid specified in their .inf
file, but I believe that is also a class GUID.

Should I be able to do this? Would it require special driver support?
My vendor suggested it shouldn’t, that it was all handled by an upper
level. Maybe I should try DBT_DEVTYP_HANDLE and specify a disk handle
instead of a guid?

Any hint would be greatly appreciated.

Thanks,



John M. Adams


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