ntdll/tests: Test NtQueryVolumeInformationFile calls on named pipe object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-09-25 16:38:13 +02:00 committed by Alexandre Julliard
parent 1b2554c2c3
commit 4df0162caf
2 changed files with 56 additions and 9 deletions

View File

@ -73,6 +73,7 @@ static NTSTATUS (WINAPI *pNtCreateNamedPipeFile) (PHANDLE handle, ULONG access,
ULONG inbound_quota, ULONG outbound_quota,
PLARGE_INTEGER timeout);
static NTSTATUS (WINAPI *pNtQueryInformationFile) (IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass);
static NTSTATUS (WINAPI *pNtQueryVolumeInformationFile)(HANDLE handle, PIO_STATUS_BLOCK io, void *buffer, ULONG length, FS_INFORMATION_CLASS info_class);
static NTSTATUS (WINAPI *pNtSetInformationFile) (HANDLE handle, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS class);
static NTSTATUS (WINAPI *pNtCancelIoFile) (HANDLE hFile, PIO_STATUS_BLOCK io_status);
static NTSTATUS (WINAPI *pNtCancelIoFileEx) (HANDLE hFile, IO_STATUS_BLOCK *iosb, IO_STATUS_BLOCK *io_status);
@ -94,6 +95,7 @@ static BOOL init_func_ptrs(void)
loadfunc(NtFsControlFile)
loadfunc(NtCreateNamedPipeFile)
loadfunc(NtQueryInformationFile)
loadfunc(NtQueryVolumeInformationFile)
loadfunc(NtSetInformationFile)
loadfunc(NtCancelIoFile)
loadfunc(NtCancelIoFileEx)
@ -1100,6 +1102,43 @@ static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
CloseHandle(event);
}
static void test_volume_info(void)
{
FILE_FS_DEVICE_INFORMATION *device_info;
IO_STATUS_BLOCK iosb;
HANDLE read, write;
char buffer[128];
NTSTATUS status;
if (!create_pipe_pair( &read, &write, FILE_FLAG_OVERLAPPED | PIPE_ACCESS_INBOUND,
PIPE_TYPE_MESSAGE, 4096 )) return;
memset( buffer, 0xaa, sizeof(buffer) );
status = pNtQueryVolumeInformationFile( read, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation );
todo_wine {
ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status );
ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information );
device_info = (FILE_FS_DEVICE_INFORMATION*)buffer;
ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType );
ok( !(device_info->Characteristics & ~FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL),
"Characteristics = %x\n", device_info->Characteristics );
}
memset( buffer, 0xaa, sizeof(buffer) );
status = pNtQueryVolumeInformationFile( write, &iosb, buffer, sizeof(buffer), FileFsDeviceInformation );
todo_wine {
ok( status == STATUS_SUCCESS, "NtQueryVolumeInformationFile failed: %x\n", status );
ok( iosb.Information == sizeof(*device_info), "Information = %lu\n", iosb.Information );
device_info = (FILE_FS_DEVICE_INFORMATION*)buffer;
ok( device_info->DeviceType == FILE_DEVICE_NAMED_PIPE, "DeviceType = %u\n", device_info->DeviceType );
ok( !(device_info->Characteristics & ~FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL),
"Characteristics = %x\n", device_info->Characteristics );
}
CloseHandle( read );
CloseHandle( write );
}
START_TEST(pipe)
{
if (!init_func_ptrs())
@ -1141,4 +1180,6 @@ START_TEST(pipe)
read_pipe_test(PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE);
trace("starting message read in message mode server -> client\n");
read_pipe_test(PIPE_ACCESS_OUTBOUND, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE);
test_volume_info();
}

View File

@ -1715,15 +1715,21 @@ typedef struct _RTL_HANDLE_TABLE
#define FILE_MAXIMUM_DISPOSITION 5
/* Characteristics of a File System */
#define FILE_REMOVABLE_MEDIA 0x00000001
#define FILE_READ_ONLY_DEVICE 0x00000002
#define FILE_FLOPPY_DISKETTE 0x00000004
#define FILE_WRITE_ONE_MEDIA 0x00000008
#define FILE_REMOTE_DEVICE 0x00000010
#define FILE_DEVICE_IS_MOUNTED 0x00000020
#define FILE_VIRTUAL_VOLUME 0x00000040
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
#define FILE_DEVICE_SECURE_OPEN 0x00000100
#define FILE_REMOVABLE_MEDIA 0x00000001
#define FILE_READ_ONLY_DEVICE 0x00000002
#define FILE_FLOPPY_DISKETTE 0x00000004
#define FILE_WRITE_ONE_MEDIA 0x00000008
#define FILE_REMOTE_DEVICE 0x00000010
#define FILE_DEVICE_IS_MOUNTED 0x00000020
#define FILE_VIRTUAL_VOLUME 0x00000040
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
#define FILE_DEVICE_SECURE_OPEN 0x00000100
#define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
#define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
#define FILE_CHARACTERISTIC_CSV 0x00010000
#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
#define FILE_PORTABLE_DEVICE 0x00040000
/* options for NtCreateNamedPipeFile */
#define FILE_PIPE_INBOUND 0x00000000