I have code to get the drive letter. This code in my system is good, but it isn't working in virtual machine(VMWare) :
std::vector<TCHAR*> DrivesName = { _T("A:\\"), _T("B:\\"), _T("C:\\"), _T("D:\\"), _T("E:\\"),
_T("F:\\"), _T("G:\\"), _T("H:\\"), _T("I:\\"), _T("J:\\"),
_T("K:\\"), _T("L:\\"), _T("M:\\"), _T("N:\\"), _T("O:\\"),
_T("P:\\"), _T("Q:\\"), _T("R:\\"), _T("S:\\"), _T("T:\\"),
_T("U:\\"), _T("V:\\"), _T("W:\\"), _T("X:\\"), _T("Y:\\"), _T("Z:\\") };
DWORD drivesBitmask = GetLogicalDrives();
if (drivesBitmask == 0)
{
std::cout << "ERROR";
}
for (int i = 0; i < 26; i++)
{
if ((drivesBitmask & 1) == 0)
{
if (typeDriver != DRIVE_NO_ROOT_DIR)
{
std::cout << "Drive: " << DrivesName[i] << std::endl;
}
}
}
I changed (drivesBitmask & 1) == 0 condition to (drivesBitmask & 2) == 0 it work, but i don't understand....
what is different?