// GetDriveType.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "Windows.h"

int _tmain(int argc, _TCHAR* argv[])
{
    // Get logical drive strings— a:\b:\c:\... etc.
    // and show it <TAB>-seperated with the drivetype
    // e.g.: A:\  2  C:\  3  D:\  3  E:\  2  F:\  5  G:\  5  H:\  3
    TCHAR buf[100];
    DWORD len = GetLogicalDriveStrings(sizeof(buf)/sizeof(TCHAR),buf);
   
    unsigned int k=0;
    while (k < len)
    {
        char drive[4] ;
        for(int i=0; i < 3; i++)
        {
            drive[i] = buf[k+i] ;
        }
        drive[3] = '\0' ;
        UINT type = GetDriveType(drive);
        printf ("%s\t%d\t", drive, type) ;
        k=k+4 ;
    }
    return 0;
}
