*. Yup Wlk 8319:
*. I have register for both interface guid for device arrival and after that register with file handle as below:
-
My service handle is register for dwControlsAccepted |= (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT.
-
When service starts, I have register for inteface GUID, for device arrival as
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = InterfaceClassGuid;
hInterfaceNotify = RegisterDeviceNotification(
hWnd, // events recipient this is service handle
&NotificationFilter, // type of device
DEVICE_NOTIFY_SERVICE_HANDLE|
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES // type of recipient handle
);
- In Device Arrival: I am registering the file handle for device remove events as:
memset (&filter, 0, sizeof(filter)); //zero the structure
filter.dbch_size = sizeof(filter);
filter.dbch_devicetype = DBT_DEVTYP_HANDLE;
filter.dbch_handle = *p_handle;
hDeviceNotify = RegisterDeviceNotification(g_serviceStatusHandle, &filter, DEVICE_NOTIFY_SERVICE_HANDLE|
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
One thing I forgot to unregister for the GUID interface at the end of the service. It might be the problem.
~ Ravi
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, May 17, 2012 7:37 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Plug and Play Surprise Removal Failed :- User Mode Open handle Problem: (DBT_DEVICEREMOVECOMPLETE is not getting called)
Whql, and i think you mean the wlk, doesn’t make the notification system work differently. It just makes sure you are doing the right thing. Registering pnpPowerCallbacks.EvtDeviceSurpriseRemoval and notifying the app out of band is NOT the right fix. Are you registering for notifications on the file handle you open or just the device interface guid?
d
debt from my phone
From: Rathore, Ravi
Sent: 5/17/2012 4:53 AM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Plug and Play Surprise Removal Failed :- User Mode Open handle Problem: (DBT_DEVICEREMOVECOMPLETE is not getting called)
IT works well if I run the plug and play surprise removal with WDK supplied exe, but when I did run with WHQL , I didn’t get any events only for this Test.
Is it possible that during WHQL - surprise removal test, Windows service will not be notified to close handle even I have register for RegisterDeviceNotificaion in service ? It could be WHQL issue also for windows 8.
Other way could be register pnpPowerCallbacks.EvtDeviceSurpriseRemoval in driver and then notify the user mode app to close handle.
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, May 16, 2012 7:13 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Plug and Play Surprise Removal Failed :- User Mode Open handle Problem: (DBT_DEVICEREMOVECOMPLETE is not getting called)
Yed, although iirc surprise remove come directly as remove complete, not a graceful remove. You can easily ser what happens by a quick experiment though
d
debt from my phone
From: Rathore, Ravi
Sent: 5/16/2012 6:23 AM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Plug and Play Surprise Removal Failed :- User Mode Open handle Problem: (DBT_DEVICEREMOVECOMPLETE is not getting called)
Is it good to close user mode handle there DBT_DEVICEREMOVEPENDING ?
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@broadcom.com
Sent: Wednesday, May 16, 2012 6:44 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Plug and Play Surprise Removal Failed :- User Mode Open handle Problem: (DBT_DEVICEREMOVECOMPLETE is not getting called)
I think you’ll get DBT_DEVICEREMOVEPENDING
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
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
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
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
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