Detecting PC peculiarity (vol of disk C ecc..)
-
I need a C/C++ program able to detect some peculiarity of the PC (as the number of the partitions of the hard disk, the number and the label of the disk C, ecc.) if it is possible without calling the "system" statement (calling the "system" statement I see alwais the DOS window). Can you help me ????? - I work with Visual C++ compiler. Many thanks - Giovanni
-
I need a C/C++ program able to detect some peculiarity of the PC (as the number of the partitions of the hard disk, the number and the label of the disk C, ecc.) if it is possible without calling the "system" statement (calling the "system" statement I see alwais the DOS window). Can you help me ????? - I work with Visual C++ compiler. Many thanks - Giovanni
This depends on your target OS. For both Win9x and NT-kernel based Win32 implementations you can: To get the drive letters mapped: GetLogicalDrives() and/or GetLogicalDriveStrings(). To get the label of a volume (note: there is no label for a disk) you can use GetVolumeInformation(). For NT only you can get disk information (partitions and so on) using DeviceIoControl() with e.g. IOCTL_DISK_GET_DRIVE_LAYOUT. To get the same info from Win9x I believe you have to resort to BCB (DOS, anno 1982) and 16-bit code, but I might be wrong. If you want to get the GUID's of volumes (introduced in NT5) you can get to them using NT5+ only API's such as FindFirstVolume. Also, there is no C or C++ "statement" called "system". system() is a C library function. ++luck;