I’m trying to write a little tool to simplify inventorying my removable media. Getting and storing a list of files on the media is simple enough, but I want to be able to catalog them according to what type of drive they are.
There is an API function to get the drive type, but it is old and limited to floppy, CD, fixed, removable, network, and RAM. it does not give fine-grained information to determine whether a drive is a flash-drive or a memory-card (let alone even more detailed like what kind of memory-card). Even a newer function meant for USB drives doesn’t seem to specifically differentiate between types of USB media.
Is there a reasonably easy and reliable way (preferably C++) to determine that? (Yes, I know that some media can be modified to present as different types, but it only needs to work well enough for normal, standard media.) There is definitely some way to do this because Windows contains different icons for all kinds of media in shell32.dll
, and Explorer usually uses the correct one when you plug them in.