| 180 | } |
| 181 | |
| 182 | static int check_memory(printInfoStruct& printInfo) |
| 183 | { |
| 184 | if (l_Debug) |
| 185 | std::wcout << L"Accessing memory statistics via MemoryStatus" << '\n'; |
| 186 | |
| 187 | MEMORYSTATUSEX memBuf; |
| 188 | memBuf.dwLength = sizeof(memBuf); |
| 189 | GlobalMemoryStatusEx(&memBuf); |
| 190 | |
| 191 | printInfo.tRam = round((memBuf.ullTotalPhys / pow(1024.0, printInfo.unit) * pow(10.0, printInfo.unit))) / pow(10.0, printInfo.unit); |
| 192 | printInfo.aRam = round((memBuf.ullAvailPhys / pow(1024.0, printInfo.unit) * pow(10.0, printInfo.unit))) / pow(10.0, printInfo.unit); |
| 193 | printInfo.percentFree = 100.0 * memBuf.ullAvailPhys / memBuf.ullTotalPhys; |
| 194 | |
| 195 | if (l_Debug) |
| 196 | std::wcout << L"Found memBuf.dwTotalPhys: " << memBuf.ullTotalPhys << '\n' |
| 197 | << L"Found memBuf.dwAvailPhys: " << memBuf.ullAvailPhys << '\n'; |
| 198 | |
| 199 | return -1; |
| 200 | } |
| 201 | |
| 202 | int wmain(int argc, WCHAR **argv) |
| 203 | { |