   Determining the kind of removable drive
  Hi!I'm having a little trouble, and there's strangely little information about this on the net. I am trying to determine the type of a removeable drive.Why? Because it doesn't make sense to tell the user to change the floppy if he's in fact using a USB stick. Furthermore I think using generic terms such as "storage device" and "storage media" sounds too unspecific.GetDriveType() will return DRIVE_REMOVEABLE for all devices that are removable, but it won't tell me if it's a floppy, USB stick zipdisk or even removeable hard disk. The web page at:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getdrivetype.aspQuote:says the following: To determine whether a drive is a USB-type drive, call SetupDiGetDeviceRegistryProperty and specify the SPDRP_REMOVAL_POLICY property.And that's linked to SetupDiGetDeviceRegistryProperty. There it says:Quote:"The current removal policy (see CM_REMOVAL_POLICY_* in Cfgmgr32.h.)"Ok, It all ends here. I don't have that file, and as far as I can understand, that file is part of the DDK.Any suggestions? I'm using plain C om MSVC 6.   
  Nobody?Does anybody just have this Cfgmgr32.h from the DDK, and can tell me the different CM_REMOVAL_POLICY_* constants and their values maybe? It is present in mingw32, but these constants seem to be missing in that implementation.I guess maybe if someone told me the constants, I might be able to make it work somehow.   ;  Not sure if this will help but a few second google search came up with these:http://www.codeproject.com/system/EnumDeviceProperties.aspPM me your email and I will zip and email you the .h file, I found it.  Here is part of mine://// Removal policies (retrievable via CM_Get_DevInst_Registry_Property with// the CM_DRP_REMOVAL_POLICY, CM_DRP_REMOVAL_POLICY_OVERRIDE, or// CM_DRP_REMOVAL_POLICY_HW_DEFAULT properties)//#define CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL   1#define CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL   2#define CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL  3//// Device install states (retrievable via CM_Get_DevInst_Registry_Property with// the CM_DRP_INSTALL_STATE properties)//#define CM_INSTALL_STATE_INSTALLED  0#define CM_INSTALL_STATE_NEEDS_REINSTALL 1#define CM_INSTALL_STATE_FAILED_INSTALL  2#define CM_INSTALL_STATE_FINISH_INSTALL  3Hope this helps, it's a long file otherwise I'd have copy and pasted the full thing here.Mike   ;  Thank you for your reply, rating++.Unfortunately, it looks like I have no idea how I would actually go about using this. A google search for each of the CM_REMOVAL_POLICY constants returns 0 results. They don't appear to be documented anywhere. Talk about terrible documentation!I guess I will just have to do without said feature. But thanks anyways for clearing things up!   ;  Maybe a different approach? You can find out if a device is removable already, so how about perhaps trying to find the available disk space on the drive and the free space, this should give you some idea what the device is, and clearly if theres hundreds of MBs free you don't need to change the floppy :)so 1.44MB is obviously floppy?32-1024MB USB sticks?1024MB+ HDDs?Not perfect i know.   ;  Just found this, i have no idea how you would make use of it tho, looks like supporting code is needed to use WMIhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_physicalmedia.asp   ;Quote:Original post by MarvinMaybe a different approach? You can find out if a device is removable already, so how about perhaps trying to find the available disk space on the drive and the free space, this should give you some idea what the device is, and clearly if theres hundreds of MBs free you don't need to change the floppy :)so 1.44MB is obviously floppy?32-1024MB USB sticks?1024MB+ HDDs?Not perfect i know.Sure isn't. While I was shopping for USB sticks a while back I saw 2GB models [wink]. Can't be long before 4GB+ models are available (if they aren't already).Using free space isn't a good idea anyway, I currently have < 250 MB free on one of my HDs (non-removable though), and 880 MB free space on my USB stick [grin].If you still want to use this approach (which I don't recommend), try to find the physical capacity of the disk.Quote:Original post by mr BiCEPSWhy? Because it doesn't make sense to tell the user to change the floppy if he's in fact using a USB stick. Furthermore I think using generic terms such as "storage device" and "storage media" sounds too unspecific.How about "disk"? "Please change the disk in drive X" doesn't sound so bad to me... (assuming it's removable of course, otherwise it sounds pretty stupid [wink])   