how to findout which drive is a cool disk?
-
Hi, I know three ways to get some information on physical devices: 1. using the DriveInfo class 2. using WMI, have a look at the WMI classes Win32_DiskDrive, Win32_LogicalDiskToPartition, Win32_PhysicalMedia, Win32_CDROMDrive; which ones you want depends on the information you need. warning: not everything may be available to regular users under Vista/Win7 without going trough the UAC dialog. 3. using Win32 functions (from kernel32.dll), which requires P/Invoke. Here is an example prototype:
/// /// Gets the drive type /// /// drive name (letter colon backslash) /// /// 0 (DRIVE\_UNKNOWN) The drive type cannot be determined. /// 1 (DRIVE\_NO\_ROOT\_DIR) The root path is invalid. (no volume is mounted at the path). /// 2 (DRIVE\_REMOVABLE) The disk can be removed from the drive. /// 3 (DRIVE\_FIXED) The disk cannot be removed from the drive. /// 4 (DRIVE\_REMOTE) The drive is a remote (network) drive. /// 5 (DRIVE\_CDROM) The drive is a CD-ROM drive. /// 6 (DRIVE\_RAMDISK) The drive is a RAM disk. /// \[DllImport("kernel32.dll")\] public static extern int GetDriveType(string rootPathName);
For each of these, I refer to the MSDN documentation, Google, and some experimentation. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.