You can open the volume and issue IOCTL_STORAGE_QUERY_PROPERTY; this returns a STORAGE_DEVICE_DESCRIPTOR which has a RemovableMedia property. I believe this is the same as CM_DEVCAP_REMOVABLE (not 100% sure). At least it reports "fixed" USB flash drives as removable.
HANDLE hFile = CreateFile("\\\\.\\Z:", FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
STORAGE_PROPERTY_QUERY StoragePropertyQuery;
StoragePropertyQuery.PropertyId = StorageDeviceProperty;
StoragePropertyQuery.QueryType = PropertyStandardQuery;
BYTE Buffer[1024];
if(DeviceIoControl(hFile, IOCTL_STORAGE_QUERY_PROPERTY, &SotragePropertyQuery, sizeof(STORAGE_PROPERTY_QUERY), Buffer, 1024, &BytesReturned, NULL))
{
PSTORAGE_DEVICE_DESCRIPTOR StorageDeviceDescriptor = (PSTORAGE_DEVICE_DESCRIPTOR)Buffer;
if(StorageDeviceDescriptor->RemovableMedia)
{
printf("Z: IS removable\n");
}
else
{
printf("Z: is NOT removable\n");
}
}
CloseHandle(hFile);
hFile = INVALID_HANDLE_VALUE;
}