Commit 50903a15 authored by Erich E. Hoover's avatar Erich E. Hoover Committed by Alexandre Julliard

kernelbase: Reimplement GetVolumeInformation on top of GetVolumeInformationByHandle.

parent 86333a20
......@@ -1522,6 +1522,7 @@ static void test_GetVolumeInformationByHandle(void)
FILE_FS_VOLUME_INFORMATION *volume_info = (void *)buffer;
DWORD serial, filename_len, flags;
WCHAR label[20], fsname[20];
char volume[MAX_PATH+1];
IO_STATUS_BLOCK io;
HANDLE file;
NTSTATUS status;
......@@ -1578,6 +1579,44 @@ static void test_GetVolumeInformationByHandle(void)
"expected label length %u, got %u\n", volume_info->VolumeLabelLength / sizeof(WCHAR), wcslen( label ));
CloseHandle( file );
/* get the unique volume name for the windows drive */
ret = GetVolumeNameForVolumeMountPointA("C:\\", volume, MAX_PATH);
ok(ret == TRUE, "GetVolumeNameForVolumeMountPointA failed\n");
/* try again with unique volume name */
file = CreateFileA( volume, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL );
ok(file != INVALID_HANDLE_VALUE, "failed to open file, error %u\n", GetLastError());
ret = pGetVolumeInformationByHandleW( file, label, ARRAY_SIZE(label), &serial,
&filename_len, &flags, fsname, ARRAY_SIZE(fsname) );
ok(ret, "got error %u\n", GetLastError());
memset(buffer, 0, sizeof(buffer));
status = NtQueryVolumeInformationFile( file, &io, buffer, sizeof(buffer), FileFsVolumeInformation );
ok(!status, "got status %#x\n", status);
ok(serial == volume_info->VolumeSerialNumber, "expected serial %08x, got %08x\n",
volume_info->VolumeSerialNumber, serial);
ok(!wcscmp( label, volume_info->VolumeLabel ), "expected label %s, got %s\n",
debugstr_w( volume_info->VolumeLabel ), debugstr_w( label ));
ok(wcslen( label ) == volume_info->VolumeLabelLength / sizeof(WCHAR),
"expected label length %u, got %u\n", volume_info->VolumeLabelLength / sizeof(WCHAR), wcslen( label ));
memset(buffer, 0, sizeof(buffer));
status = NtQueryVolumeInformationFile( file, &io, buffer, sizeof(buffer), FileFsAttributeInformation );
ok(!status, "got status %#x\n", status);
ok(flags == attr_info->FileSystemAttributes, "expected flags %#x, got %#x\n",
attr_info->FileSystemAttributes, flags);
ok(filename_len == attr_info->MaximumComponentNameLength, "expected filename_len %u, got %u\n",
attr_info->MaximumComponentNameLength, filename_len);
ok(!wcscmp( fsname, attr_info->FileSystemName ), "expected fsname %s, got %s\n",
debugstr_w( attr_info->FileSystemName ), debugstr_w( fsname ));
ok(wcslen( fsname ) == attr_info->FileSystemNameLength / sizeof(WCHAR),
"expected fsname length %u, got %u\n", attr_info->FileSystemNameLength / sizeof(WCHAR), wcslen( fsname ));
CloseHandle( file );
}
START_TEST(volume)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment