0

While Getting the message WM_DEVICECHANGE ( either device arrival/romal (DBT_DEVICEARRIVAL/DBT_DEVICEREMOVEPENDING....), how we may able to get the device name

like KingstonDataTraveler_2.01

PDEV_BROADCAST_HANDLE pDBHandle  =(PDEV_BROADCAST_HANDLE) lParam;
if(pDBHandle->dbch_handle !=INVALID_HANDLE_VALUE)
{
STORAGE_PROPERTY_QUERY query;
DWORD cbBytesReturned = 0;
char buffer [10000];
memset ((void *) & query, 0, sizeof (query));
query.PropertyId = StorageDeviceProperty;
query.QueryType = PropertyStandardQuery;
 memset (buffer, 0, sizeof (buffer));
 BOOL b =DeviceIoControl (pDBHandle->dbch_handle, IOCTL_STORAGE_QUERY_PROPERTY,
                   & query,
                   sizeof (query),
                   & buffer,
                   sizeof (buffer),
                   & cbBytesReturned, NULL);

But is b false and getlast error is INVALID_HANDLE_VALUE

can you suggest some method to get device name at device arrival & device removal

Thanks in Advance
Dileep Subramanian

Edited by pyTony: fm

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by 5ophie2012
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.