我需要识别每张SD卡并阻止或允许单独使用MFC应用程序。我尝试使用PNP ID但它无法正常工作。是否有办法找到Sd卡的CID?
iRetValDeviceType = SetupDiGetDeviceRegistryProperty(hDevInfo, &DevInfoData, SPDRP_COMPATIBLEIDS, &dwDataTypeDeviceType, (PBYTE)pszBufferDeviceType, dwBuffSizeDeviceType, &dwBuffSizeDeviceType);
CM_Get_Device_ID(DevInfoData.DevInst,pzsBufferPnpId,MAX_PATH,0);
csPnpId = (CString)pzsBufferPnpId;
auto itSearch = NonStorageMap.find(csPnpId);
if(itSearch != NonStorageMap.end())
{
//pnp id found in map -->allow the device
}
else
{
if( (StrStrI(pszBufferDeviceType,"PCISTOR")) || (StrStrI(pszBufferDeviceType,"SD"))
{
//pnp id not found in map -->block the device
lRetVal = DisableDevice(&hDevInfo,&DevInfoData, DICS_STOP, bRebootRequired);//DICS_DISABLE
}
}