// This is the way to retrieve info of a logical drive. void GetRootInfo(char *root) { DWORD LongFNameLen = 0, flags = 0; char volume[32], FATName[32]; DWORD serialnum = 0; FillMemory(volume, 32, 0); FillMemory(FATName, 32, 0); UINT oldErrMode = SetErrorMode(SEM_FAILCRITICALERRORS); // Disables the system from telling the user to insert a CD or a floppy disc if needed. BOOL res = GetVolumeInformation(root, volume, 32, &serialnum, &LongFNameLen, &flags, FATName, 32); if (res != 0) { // Convert serial number to a display form char tmp[256]; FillMemory(tmp, 256, '0'); char serial[16]; FillMemory(serial, 16, 0); ltoa(serialnum, serial, 16); CopyMemory(&tmp[8 - strlen(serial)], serial, strlen(serial)); for (int i = 0; i < 4; i++) serial[i] = toupper(tmp[i]); serial[i++] = '-'; for (; i < 9; i++) serial[i] = toupper(tmp[i-1]); FillMemory(tmp, 256, 0); sprintf(tmp, "FAT Name:%s, Root:%s, RootVolume:%s, RootSerial:%s", FATName, root, volume, serial); MessageBox(NULL, tmp, "Volume Information", MB_OK); } SetErrorMode(oldErrMode); } // Usage: GetRootInfo("C:\\"); // Voila :)