i get device insertion and removal notification from WM_DEVICECHANGE
i get the dbcc_name from the DBT_DEVTYP_DEVICEINTERFACE
i get the corresponding drive letter from the DBT_DEVTYP_VOLUME
if i insert the device one by one it works correctly
but if i insert two device at a time i get duplication in drive letters
how can i solve it
kindly provide me some ideas
my code snippet
if ( DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam )
{
PDEV_BROADCAST_HDR pHdr = ( PDEV_BROADCAST_HDR )lParam;
PDEV_BROADCAST_DEVICEINTERFACE pDevInf;
PDEV_BROADCAST_VOLUME pDevVolume = reinterpret_cast<PDEV_BROADCAST_VOLUME>(lParam);
switch( pHdr->dbch_devicetype )
{
case DBT_DEVTYP_DEVICEINTERFACE:
pDevInf = ( PDEV_BROADCAST_DEVICEINTERFACE )pHdr;
updateDevice( pDevInf, wParam , pDevVolume );
break;
case DBT_DEVTYP_VOLUME:
pDevVolume = ( PDEV_BROADCAST_VOLUME )pHdr;
QString aDrive = FirstDriveFromMask( pDevVolume->dbcv_unitmask );
break;
}
}