Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v3: Reorder patches to fix test failures.
There might be a better way of deriving a serial from a UUID, but by my understanding, Linux uses version 4 UUIDs, and taking the last 4 bytes is as random as it can be. I don't know about Mac.
For folders such as drive_c which are not separate host systems, this returns a serial with the high byte containing the DOS drive letter, and the other three bytes zero, so it would seem to be exactly as unique and stable as the volume GUID itself.
dlls/mountmgr.sys/device.c | 3 +++ dlls/ntdll/tests/file.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 8fb984579e3..f68ab4de9b4 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1123,6 +1123,9 @@ static NTSTATUS set_volume_info( struct volume *volume, struct dos_drive *drive, } }
+ if (!volume->serial) + memcpy(&volume->serial, &volume->guid.Data4[4], sizeof(DWORD)); + if (!volume->mount) volume->mount = add_volume_mount_point( disk_device->dev_obj, &disk_device->name, &volume->guid ); if (drive && !drive->mount) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 33b8ead5528..68c6a79e795 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3908,7 +3908,7 @@ static void test_query_volume_information_file(void) io.Information);
todo_wine ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n"); - todo_wine ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n"); + ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n"); ok(ffvi->SupportsObjects == 1,"expected 1, got %d\n", ffvi->SupportsObjects); ok(ffvi->VolumeLabelLength == lstrlenW(ffvi->VolumeLabel) * sizeof(WCHAR), "got %d\n", ffvi->VolumeLabelLength);