diff options
Diffstat (limited to 'runtime/test/file_system_test.cpp')
| -rw-r--r-- | runtime/test/file_system_test.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp index db8a8f8fb..af37935f6 100644 --- a/runtime/test/file_system_test.cpp +++ b/runtime/test/file_system_test.cpp | |||
| @@ -1395,32 +1395,6 @@ void run_checks(const std::filesystem::path& root) { | |||
| 1395 | if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h); | 1395 | if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h); |
| 1396 | check(attributes_w(L"G:\\data\\sub") != INVALID_FILE_ATTRIBUTES, "GetFileAttributesW stats a G: folder"); | 1396 | check(attributes_w(L"G:\\data\\sub") != INVALID_FILE_ATTRIBUTES, "GetFileAttributesW stats a G: folder"); |
| 1397 | 1397 | ||
| 1398 | // GetDiskFreeSpace(Ex) and SetCurrentDirectory on a console path ask the folder behind it (VIctory files.rs). | ||
| 1399 | using FreeExW = BOOL(WINAPI*)(LPCWSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); | ||
| 1400 | using FreeA = BOOL(WINAPI*)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD); | ||
| 1401 | using SetDirW = BOOL(WINAPI*)(LPCWSTR); | ||
| 1402 | const auto free_ex_w = resolve<FreeExW>("kernel32.dll", "GetDiskFreeSpaceExW"); | ||
| 1403 | const auto free_a = resolve<FreeA>("kernelbase.dll", "GetDiskFreeSpaceA"); | ||
| 1404 | const auto set_dir_w = resolve<SetDirW>("api-ms-win-core-processenvironment-l1-1-0.dll", "SetCurrentDirectoryW"); | ||
| 1405 | ULARGE_INTEGER avail{}, total{}, total_free{}, host_total{}; | ||
| 1406 | ::GetDiskFreeSpaceExW((package.wstring() + L"\\").c_str(), nullptr, &host_total, nullptr); | ||
| 1407 | check(free_ex_w && free_ex_w(L"G:\\", &avail, &total, &total_free) && total.QuadPart == host_total.QuadPart && | ||
| 1408 | total.QuadPart > 0, | ||
| 1409 | "GetDiskFreeSpaceExW(G:\\) answers for the game folder's volume"); | ||
| 1410 | DWORD spc = 0, bps = 0, fc = 0, tc = 0; | ||
| 1411 | check(free_a && free_a("GAME:\\drives\\", &spc, &bps, &fc, &tc) && bps > 0 && tc > 0, | ||
| 1412 | "GetDiskFreeSpaceA on a GAME: folder answers too"); | ||
| 1413 | SetLastError(0); | ||
| 1414 | check(free_ex_w && !free_ex_w(L"G:\\..\\", &avail, nullptr, nullptr) && GetLastError() == ERROR_INVALID_NAME, | ||
| 1415 | "a path that climbs out of the drive is refused"); | ||
| 1416 | wchar_t before[MAX_PATH] = {}; | ||
| 1417 | ::GetCurrentDirectoryW(MAX_PATH, before); | ||
| 1418 | wchar_t now[MAX_PATH] = {}; | ||
| 1419 | check(set_dir_w && set_dir_w(L"G:\\drives\\sub") && ::GetCurrentDirectoryW(MAX_PATH, now) > 0 && | ||
| 1420 | std::filesystem::equivalent(std::filesystem::path(now), package / "drives" / "sub"), | ||
| 1421 | "SetCurrentDirectoryW(G:\\drives\\sub) enters the package folder"); | ||
| 1422 | ::SetCurrentDirectoryW(before); | ||
| 1423 | |||
| 1424 | SetLastError(0); | 1398 | SetLastError(0); |
| 1425 | check(create_w(L"G:\\..\\x.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr) == | 1399 | check(create_w(L"G:\\..\\x.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr) == |
| 1426 | INVALID_HANDLE_VALUE && | 1400 | INVALID_HANDLE_VALUE && |