Následující jednoduchý kód vypisuje za pomoci API funkcí GetLogicalDrives a GetDriveType všechny připojené disky a jejich druh/typ.

#include <windows.h>
#include <stdio.h>
 
int main(){
  int i;
  DWORD dwMask = GetLogicalDrives();
  char szDrive[] = "X:\\";
 
  for(i = 0; i <= 'Z' - 'A'; i++){
    if(!(dwMask & (1 << i)))
      continue;
 
    szDrive[0] = i + 'A';
    switch(GetDriveType(szDrive)){
      case DRIVE_UNKNOWN:
        printf("%s Unknown drive\n", szDrive);
        break;
      case DRIVE_NO_ROOT_DIR:
        printf("%s No Root Dir Drive\n", szDrive);
        break;
      case DRIVE_REMOVABLE:
        printf("%s Removable Drive\n", szDrive);
        break;
      case DRIVE_FIXED:
        printf("%s Fixed Drive\n", szDrive);
        break;
      case DRIVE_REMOTE:
        printf("%s Remote Drive\n", szDrive);
        break;
      case DRIVE_CDROM:
        printf("%s CD-ROM Drive\n", szDrive);
        break;
      case DRIVE_RAMDISK:
        printf("%s Ramdisk\n", szDrive);
        break;
      default:
        printf("%s Err. Unknown value\n", szDrive);
        break;
    }
  }
 
  return 0;
}