2

My program needs to find out SD Cards among all local drives. One can easily identify removable drives (using GetLogicalDrivesStrings() and GetDriveType() ) but knowing which ones are truly SD cards seems harder.

There are quite a few questions (including here, here, here and here) but no complete answer (many focus on USB). Some say it is impossible to distinguish SD Cards from USB, however Windows Explorer displays different drive icons for SD cards (at least in Windows 7) hence it does distinguish which is which.

Extra bonus for code NOT based on WMI since my program is still using native Win32/MFC! Can some DeviceIoControl() properties help? Now, if someone has a C#/.NET solution, I'd still happily read it!

Community
  • 1
  • 1
Serge Wautier
  • 21,494
  • 13
  • 69
  • 110
  • 2
    Easy cheat; since the shell knows the type, ask the shell. Use `SHGetFileInfo` to get the icon index for the drive. – Jonathan Potter Nov 12 '15 at 08:57
  • Haha! You've earned the Gold Badge _Dirty-yet-funny-and-even-maybe-effective solution_. Let me just check the icon index on all versions of Windows! I might end up using your solution, which would show how desperate I am :-D – Serge Wautier Nov 12 '15 at 10:06

1 Answers1

0

Should be possible with DevicePowerEnumDevices

A USB Flash Drive should have PDCAP_D2_SUPPORTED under "Power data" in Device Manager, but not a memory card.

See discussion here

xMRi
  • 14,982
  • 3
  • 26
  • 59