On 8/25/22 08:07, Joel Holdsworth wrote:
+ + if (pFindFirstVolumeA) { + handle = pFindFirstVolumeA(volume_guid, MAX_PATH); + ok(handle != INVALID_HANDLE_VALUE, "FindFirstVolumeA error\n"); + do { + ret = GetDiskFreeSpaceA(volume_guid, §ors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters); + if (!ret) + /* GetDiskFreeSpaceA() should succeed, but it can fail with too many + different GetLastError() results to be usable for an ok() */ + trace("GetDiskFreeSpaceA(%s) failed with %ld\n", volume_guid, GetLastError());
If it should succeed, don't we want ok(ret == TRUE, ...); or under what circumstances can this actually fail?
+ } while (pFindNextVolumeA(handle, volume_guid, MAX_PATH)); + pFindVolumeClose(handle); + } }
...
START_TEST(drive) { HANDLE hkernel32 = GetModuleHandleA("kernel32"); pGetDiskFreeSpaceExA = (void *) GetProcAddress(hkernel32, "GetDiskFreeSpaceExA"); + pFindFirstVolumeA = (void *) GetProcAddress(hkernel32, "FindFirstVolumeA"); + pFindFirstVolumeW = (void *) GetProcAddress(hkernel32, "FindFirstVolumeW"); + pFindNextVolumeA = (void *) GetProcAddress(hkernel32, "FindNextVolumeA"); + pFindNextVolumeW = (void *) GetProcAddress(hkernel32, "FindNextVolumeW"); + pFindVolumeClose = (void *) GetProcAddress(hkernel32, "FindVolumeClose");
test_GetDriveTypeA(); test_GetDriveTypeW();
These are available since at least XP; I think we can link to them directly.