I feel somewhat noob yet with this of getting the Information of Hardware of the CPU, so i come with this request: Hard Drive, CD/DVD/Bluray reader, Floppy and if it\'s poss
If you want to determine that a device is USB device, you can open its handle and send IOCTL queries using DeviceIoControl() to get bus type a device is connected to.
EnumUsbDrivesLetters - the post is in Russian but it contains C++ source code, so the matter could be understood easily.
Cheers, Andriy
The only all-in-one API I know of for Windows with that information is WMI, but it's not terribly simple to use. On the other hand, many programs communicate with devices directly, using pass-through control codes, or I/O control codes like SMART_RCV_DRIVE_DATA.
(I don't know how Speccy works, but I'm guessing it uses a combination of these methods to get the system info needed.)
I'm not sure what you didn't understand about the documentation you linked to...
The sole argument accepted by the function is the root directory of the drive you want to get information about (including a trailing backslash). The function returns a value indicating which type of drive that is. A chart is shown that gives the possible return values and what each of them mean.
For example:
GetDriveType(_T("C:\\")) // returns DRIVE_FIXED if C:\ is my hard drive
GetDriveType(_T("A:\\")) // returns DRIVE_REMOVABLE if A:\ is my floppy drive
GetDriveType(_T("D:\\")) // returns DRIVE_CDROM if D:\ is a CD-ROM drive
GetDriveType(_T("N:\\")) // returns DRIVE_REMOTE if N:\ is a network drive
It also says that if you want to determine whether a drive is a USB-type drive, you need to call the SetupDiGetDeviceRegistryProperty function and specify the SPDRP_REMOVAL_POLICY
property.