ntdll/tests: Add tests for NtQueryVolumeInformationFile with FileFsVolumeInformation class.
This commit is contained in:
parent
d360b6f913
commit
5eac14f11c
|
@ -35,6 +35,7 @@
|
|||
#include "wine/test.h"
|
||||
#include "winternl.h"
|
||||
#include "winuser.h"
|
||||
#include "winioctl.h"
|
||||
|
||||
#ifndef IO_COMPLETION_ALL_ACCESS
|
||||
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
|
||||
|
@ -75,6 +76,7 @@ static NTSTATUS (WINAPI *pNtSetInformationFile)(HANDLE, PIO_STATUS_BLOCK, PVOID,
|
|||
static NTSTATUS (WINAPI *pNtQueryInformationFile)(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FILE_INFORMATION_CLASS);
|
||||
static NTSTATUS (WINAPI *pNtQueryDirectoryFile)(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,
|
||||
PVOID,ULONG,FILE_INFORMATION_CLASS,BOOLEAN,PUNICODE_STRING,BOOLEAN);
|
||||
static NTSTATUS (WINAPI *pNtQueryVolumeInformationFile)(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG,FS_INFORMATION_CLASS);
|
||||
|
||||
static inline BOOL is_signaled( HANDLE obj )
|
||||
{
|
||||
|
@ -1458,6 +1460,61 @@ static void test_file_all_name_information(void)
|
|||
HeapFree( GetProcessHeap(), 0, file_name );
|
||||
}
|
||||
|
||||
static void test_query_volume_information_file(void)
|
||||
{
|
||||
NTSTATUS status;
|
||||
HANDLE dir;
|
||||
WCHAR path[MAX_PATH];
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
UNICODE_STRING nameW;
|
||||
UINT len;
|
||||
FILE_FS_VOLUME_INFORMATION *ffvi;
|
||||
BYTE buf[sizeof(FILE_FS_VOLUME_INFORMATION) + MAX_PATH * sizeof(WCHAR)];
|
||||
|
||||
len = GetWindowsDirectoryW( path, MAX_PATH );
|
||||
pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL );
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
status = pNtOpenFile( &dir, SYNCHRONIZE|FILE_LIST_DIRECTORY, &attr, &io,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT );
|
||||
ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
|
||||
pRtlFreeUnicodeString( &nameW );
|
||||
|
||||
ZeroMemory( buf, sizeof(buf) );
|
||||
U(io).Status = 0xdadadada;
|
||||
io.Information = 0xcacacaca;
|
||||
|
||||
status = pNtQueryVolumeInformationFile( dir, &io, buf, sizeof(buf), FileFsVolumeInformation );
|
||||
|
||||
ffvi = (FILE_FS_VOLUME_INFORMATION *)buf;
|
||||
|
||||
todo_wine
|
||||
{
|
||||
ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", status);
|
||||
ok(U(io).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", U(io).Status);
|
||||
|
||||
ok(io.Information == (FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel) + ffvi->VolumeLabelLength),
|
||||
"expected %d, got %lu\n", (FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel) + ffvi->VolumeLabelLength),
|
||||
io.Information);
|
||||
|
||||
ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\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), "expected %d, got %d",
|
||||
lstrlenW(ffvi->VolumeLabel) * sizeof(WCHAR), ffvi->VolumeLabelLength);
|
||||
|
||||
trace("VolumeSerialNumber: %x VolumeLabelName: %s\n", ffvi->VolumeSerialNumber, wine_dbgstr_w(ffvi->VolumeLabel));
|
||||
|
||||
CloseHandle( dir );
|
||||
}
|
||||
|
||||
START_TEST(file)
|
||||
{
|
||||
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
||||
|
@ -1492,6 +1549,7 @@ START_TEST(file)
|
|||
pNtSetInformationFile = (void *)GetProcAddress(hntdll, "NtSetInformationFile");
|
||||
pNtQueryInformationFile = (void *)GetProcAddress(hntdll, "NtQueryInformationFile");
|
||||
pNtQueryDirectoryFile = (void *)GetProcAddress(hntdll, "NtQueryDirectoryFile");
|
||||
pNtQueryVolumeInformationFile = (void *)GetProcAddress(hntdll, "NtQueryVolumeInformationFile");
|
||||
|
||||
create_file_test();
|
||||
open_file_test();
|
||||
|
@ -1504,4 +1562,5 @@ START_TEST(file)
|
|||
test_file_both_information();
|
||||
test_file_name_information();
|
||||
test_file_all_name_information();
|
||||
test_query_volume_information_file();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue