Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Register for optical drive insert remove in service

1 view
Skip to first unread message

pacchij

unread,
Jul 29, 2009, 4:11:02 PM7/29/09
to
HI,

I have a service that needs to get notified when Cd/DVD drives are
inserted/removed.
I used REgisterDeviceNotification to get notifications.

DWORD dwFlags = DEVICE_NOTIFY_SERVICE_HANDLE |
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES;
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter = {0};
ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
//memcpy( &(NotificationFilter.dbcc_classguid), &(GUID_DEVINTERFACE_CDROM),
sizeof(struct _GUID) );
HANDLE han = (HANDLE)RegisterDeviceNotification( hStatus,
&NotificationFilter, dwFlags );

also tried by removing all flags and gave speicific GUID_DEVINTERFACE_CDROM
id.
I am not able to get
SERVICE_CONTROL_DEVICEEVENT for any CD/DVD add/remove.

My requirement is extended to identify any volume added/removed tosystem.
this could be Cd/DVD/USB/Network Drive.
I am getting only USB drive notification by altering to
GUID_DEVINTERFACE_VOLUME

Is there anyway to receive volume notifications in service by giving certain
INTERFACE ID. I can not realy open handle to each device and register
separately.

Thanks in advance.


0 new messages