| 163 | } |
| 164 | |
| 165 | static bool getDriveSpaceValues(drive& drive, const Bunit& unit) |
| 166 | { |
| 167 | if (l_Debug) |
| 168 | std::wcout << "Getting free and used disk space for drive " << drive.name << '\n'; |
| 169 | |
| 170 | ULARGE_INTEGER tempFree, tempTotal; |
| 171 | if (!GetDiskFreeSpaceEx(drive.name.c_str(), NULL, &tempTotal, &tempFree)) |
| 172 | return false; |
| 173 | |
| 174 | ULARGE_INTEGER tempUsed; |
| 175 | tempUsed.QuadPart = tempTotal.QuadPart - tempFree.QuadPart; |
| 176 | |
| 177 | if (l_Debug) |
| 178 | std::wcout << "\tcap: " << tempFree.QuadPart << '\n'; |
| 179 | |
| 180 | drive.cap = round((tempTotal.QuadPart / pow(1024.0, unit))); |
| 181 | |
| 182 | if (l_Debug) |
| 183 | std::wcout << "\tAfter conversion: " << drive.cap << '\n' |
| 184 | << "\tfree: " << tempFree.QuadPart << '\n'; |
| 185 | |
| 186 | drive.free = round((tempFree.QuadPart / pow(1024.0, unit))); |
| 187 | |
| 188 | if (l_Debug) |
| 189 | std::wcout << "\tAfter conversion: " << drive.free << '\n' |
| 190 | << "\tused: " << tempUsed.QuadPart << '\n'; |
| 191 | |
| 192 | drive.used = round((tempUsed.QuadPart / pow(1024.0, unit))); |
| 193 | |
| 194 | if (l_Debug) |
| 195 | std::wcout << "\tAfter conversion: " << drive.used << '\n' << '\n'; |
| 196 | |
| 197 | return true; |
| 198 | } |
| 199 | |
| 200 | static int parseArguments(int ac, WCHAR **av, po::variables_map& vm, printInfoStruct& printInfo) |
| 201 | { |