Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Logical Drives
Author:Arkon
Category:Win32API
File Size:722 Bytes
Uploaded at:27-Nov-02 07:41:53 pm
Description:
  Retrieves logical drives and their type...
  
#include <windows.h>
#include <stdio.h>

void main()
{
 char tmp[256];
 FillMemory(tmp, 256, 0);
 char j = 'A';
 DWORD drives = GetLogicalDrives();
 for (DWORD i = 1; i; i <<= 1)
 {
  strcpy(tmp, "$:\\");
  tmp[0] = j;
  switch(GetDriveType(tmp))
  {
   case DRIVE_UNKNOWN: strcpy(tmp, "DRIVE_UNKNOWN"); break;
   case DRIVE_REMOVABLE: strcpy(tmp, "DRIVE_REMOVABLE"); break;
   case DRIVE_FIXED: strcpy(tmp, "DRIVE_FIXED"); break;
   case DRIVE_REMOTE: strcpy(tmp, "DRIVE_REMOTE"); break;
   case DRIVE_CDROM: strcpy(tmp, "DRIVE_CDROM"); break;
   case DRIVE_RAMDISK: strcpy(tmp, "DRIVE_RAMDISK"); break;
   default: strcpy(tmp, "ERR");
  }
  if (drives & i) printf("\r\n%c: - %s", j++, tmp);
 }
}
User Contributed Comments(None)
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[117058]
2D Rotated Rectangles Collision Detection[88983]
Keyboard Hook[77323]
UDP[65877]
HTTP Proxy[41214]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11561]
PS2 Mouse Driver[6958]
Wave Format Player[5792]
Reading FAT12[5620]
CodeGuru[5359]


All rights reserved to RageStorm © 2009