On 8/27/22 04:29, jhol (@jhol) wrote:
Maybe we could at least test that GetDiskFreeSpaceA() of the C drive works, since I imagine that should never fail. As it is the test seems pretty much useless...
Ok, so we can have
ok(GetDiskFreeSpaceA("C:", ...) == TRUE);
and
ok(GetDiskFreeSpaceA("\\\\?\\Volume{00000000-0000-0000-0000-000000000043}\\", ...) == TRUE);
Wine implements a pseudo-volume-GUID scheme whereby the last two digits are the ASCII code of the DOS drive letter in hexadecimal. It uses real GUIDs for other volumes on my machine, though I'm not sure what these devices are.
Should we be hard-coding these pseudo-GUIDs into the test cases?, or do we need to treat it as an opaque token which must first be retrieved from `FindFirstVolume` and friends? I guess we could take the DOS device letter and convert it into a volume GUID somehow? - need to figure out how.
It can be converted with GetVolumeNameForVolumeMountPointW(). That would probably be better than using a Wine-specific scheme (which may not remain stable anyway.)
My other question is, can we really always guaruantee that the C-drive is a conventional disk on Windows machines? I've never seen it in the wild, but is it theoretically possible for the whole system to be running with a different drive letter as the main system drive, and C be one of these weird virtual/network drive examples you found? Or is it possible for someone to have a system running on a weird drive?
I guess we could enumerate the drives and find the first one that is not weird, but I'm not sure what APIs are available to make such a determination.
I'd like to have a good test case, I'm just unsure how we can test an API which works great - until it doesn't.
I don't know if it's possible to have a misbehaving C drive, but on the other hand, I expect that if programs try to call GetDiskFreeSpaceA("C:") and it fails, they will not handle that well. Which is to say, anyone with a misbehaving C drive is already asking for trouble.
It's a lot more reasonable to expect there to be misbehaving network drives on the machine (especially since it's often the easiest way to get a winetest executable onto a machine.)
So I think (and this is my personal opinion) it's reasonable to assume that querying the C drive always works. Or, at least, it's better to have a test case that is useful and works almost-always, than no test case at all. (Depending in general on what's being tested, of course.)
I don't think any of that should block this patch, since it's a preƫxisting problem with the test, but it'd certainly be appreciated if you have the time for it.