ReactOS 0.4.15-dev-8339-g4028de8
NpfsVolumeInfo.c File Reference
#include <kmt_test.h>
#include "npfs.h"
Include dependency graph for NpfsVolumeInfo.c:

Go to the source code of this file.

Macros

#define MAX_INSTANCES   1
 
#define IN_QUOTA   4096
 
#define OUT_QUOTA   4096
 

Functions

static VOID TestVolumeInfo (IN HANDLE ServerHandle)
 
static VOID NTAPI RunTest (IN PVOID Context)
 
 START_TEST (NpfsVolumeInfo)
 

Variables

static KSTART_ROUTINE RunTest
 

Macro Definition Documentation

◆ IN_QUOTA

#define IN_QUOTA   4096

Definition at line 12 of file NpfsVolumeInfo.c.

◆ MAX_INSTANCES

#define MAX_INSTANCES   1

Definition at line 11 of file NpfsVolumeInfo.c.

◆ OUT_QUOTA

#define OUT_QUOTA   4096

Definition at line 13 of file NpfsVolumeInfo.c.

Function Documentation

◆ RunTest()

static VOID NTAPI RunTest ( IN PVOID  Context)
static

Definition at line 146 of file NpfsVolumeInfo.c.

148{
150 HANDLE ServerHandle;
151
153
154 ServerHandle = INVALID_HANDLE_VALUE;
155 Status = NpCreatePipe(&ServerHandle,
156 DEVICE_NAMED_PIPE L"\\KmtestNpfsVolumeInfoTestPipe",
159 IN_QUOTA,
160 OUT_QUOTA);
162 ok(ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "ServerHandle = %p\n", ServerHandle);
163 if (!skip(NT_SUCCESS(Status) && ServerHandle != NULL && ServerHandle != INVALID_HANDLE_VALUE, "No pipe\n"))
164 {
165 TestVolumeInfo(ServerHandle);
166 ObCloseHandle(ServerHandle, KernelMode);
167 }
168}
#define OUT_QUOTA
static VOID TestVolumeInfo(IN HANDLE ServerHandle)
#define IN_QUOTA
#define MAX_INSTANCES
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
Status
Definition: gdiplustypes.h:25
#define BYTE_STREAM
Definition: npfs.h:13
#define DUPLEX
Definition: npfs.h:21
#define DEVICE_NAMED_PIPE
Definition: npfs.h:11
NTSTATUS NpCreatePipe(OUT PHANDLE ServerHandle, IN PCWSTR PipePath, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG NamedPipeType, IN ULONG NamedPipeConfiguration, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota)
#define QUEUE
Definition: npfs.h:17
#define KernelMode
Definition: asm.h:34
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ START_TEST()

START_TEST ( NpfsVolumeInfo  )

Definition at line 170 of file NpfsVolumeInfo.c.

171{
173
176}
static KSTART_ROUTINE RunTest
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)

◆ TestVolumeInfo()

static VOID TestVolumeInfo ( IN HANDLE  ServerHandle)
static

Definition at line 17 of file NpfsVolumeInfo.c.

19{
22 FILE_FS_SIZE_INFORMATION FileFsSizeInfo;
23 FILE_FS_DEVICE_INFORMATION FileFsDeviceInfo;
24 FILE_FS_FULL_SIZE_INFORMATION FileFsFullSizeInfo;
25
26 struct {
28 WCHAR PartialName[10];
29 } VolumeInfo;
30
31 struct {
33 WCHAR PartialName[6];
34 } AttributeInfo;
35
36 RtlFillMemory(&VolumeInfo, sizeof(VolumeInfo), 0xFF);
40 sizeof(VolumeInfo),
44 ok_eq_long(VolumeInfo.VolumeCreationTime.LowPart, 0);
45 ok_eq_long(VolumeInfo.VolumeCreationTime.HighPart, 0);
46 ok_eq_ulong(VolumeInfo.VolumeSerialNumber, 0);
47 ok_bool_false(VolumeInfo.SupportsObjects, "VolumeInfo.SupportsObjects");
48 ok_eq_ulong(VolumeInfo.VolumeLabelLength, 18);
49 ok_eq_size(RtlCompareMemory(VolumeInfo.VolumeLabel, L"NamedPipe", 18), 18);
50 ok_eq_wchar(VolumeInfo.VolumeLabel[9], 0xFFFF);
52
53 RtlFillMemory(&VolumeInfo, sizeof(VolumeInfo), 0xFF);
57 sizeof(FILE_FS_VOLUME_INFORMATION) + 2 * sizeof(WCHAR),
61 ok_eq_long(VolumeInfo.VolumeCreationTime.LowPart, 0);
62 ok_eq_long(VolumeInfo.VolumeCreationTime.HighPart, 0);
63 ok_eq_ulong(VolumeInfo.VolumeSerialNumber, 0);
64 ok_bool_false(VolumeInfo.SupportsObjects, "VolumeInfo.SupportsObjects");
65 ok_eq_ulong(VolumeInfo.VolumeLabelLength, 18);
66 ok_eq_size(RtlCompareMemory(VolumeInfo.VolumeLabel, L"NamedP", 10), 10);
67 ok_eq_wchar(VolumeInfo.VolumeLabel[5], 0xFFFF);
69
70 RtlFillMemory(&FileFsSizeInfo, sizeof(FileFsSizeInfo), 0xFF);
73 &FileFsSizeInfo,
74 sizeof(FileFsSizeInfo),
80 ok_eq_ulong(FileFsSizeInfo.SectorsPerAllocationUnit, 1);
81 ok_eq_ulong(FileFsSizeInfo.BytesPerSector, 1);
82 ok_eq_ulong(IoStatusBlock.Information, sizeof(FileFsSizeInfo));
83
84 RtlFillMemory(&FileFsDeviceInfo, sizeof(FileFsDeviceInfo), 0xFF);
87 &FileFsDeviceInfo,
88 sizeof(FileFsDeviceInfo),
92 ok_eq_ulong(FileFsDeviceInfo.Characteristics, 0);
94 ok_eq_ulong(IoStatusBlock.Information, sizeof(FileFsDeviceInfo));
95
96 RtlFillMemory(&AttributeInfo, sizeof(AttributeInfo), 0xFF);
99 &AttributeInfo,
100 sizeof(AttributeInfo),
104 ok_eq_ulong(AttributeInfo.FileSystemAttributes, FILE_CASE_PRESERVED_NAMES);
105 ok_eq_long(AttributeInfo.MaximumComponentNameLength, 0xFFFFFFFF);
106 ok_eq_ulong(AttributeInfo.FileSystemNameLength, 8);
107 ok_eq_size(RtlCompareMemory(AttributeInfo.FileSystemName, L"NPFS", 8), 8);
108 ok_eq_wchar(AttributeInfo.FileSystemName[4], 0xFFFF);
110
111 RtlFillMemory(&AttributeInfo, sizeof(AttributeInfo), 0xFF);
114 &AttributeInfo,
115 sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 2 * sizeof(WCHAR),
119 ok_eq_ulong(AttributeInfo.FileSystemAttributes, FILE_CASE_PRESERVED_NAMES);
120 ok_eq_long(AttributeInfo.MaximumComponentNameLength, 0xFFFFFFFF);
121 ok_eq_ulong(AttributeInfo.FileSystemNameLength, 8);
122 ok_eq_size(RtlCompareMemory(AttributeInfo.FileSystemName, L"NPFS", 8), 8);
123 ok_eq_wchar(AttributeInfo.FileSystemName[4], 0xFFFF);
125
126 RtlFillMemory(&FileFsFullSizeInfo, sizeof(FileFsFullSizeInfo), 0xFF);
129 &FileFsFullSizeInfo,
130 sizeof(FileFsFullSizeInfo),
134 ok_eq_longlong(FileFsFullSizeInfo.TotalAllocationUnits.QuadPart, 0);
137 ok_eq_ulong(FileFsFullSizeInfo.SectorsPerAllocationUnit, 0);
138 ok_eq_ulong(FileFsFullSizeInfo.BytesPerSector, 0);
139 ok_eq_ulong(IoStatusBlock.Information, sizeof(FileFsFullSizeInfo));
140}
#define ok_eq_ulong(value, expected)
Definition: apitest.h:63
#define ok_eq_longlong(value, expected)
Definition: apitest.h:64
#define ok_eq_long(value, expected)
Definition: apitest.h:62
#define ok_bool_false(value, desc)
Definition: apitest.h:79
#define ok_eq_size(value, expected)
Definition: apitest.h:69
#define ok_eq_wchar(value, expected)
Definition: apitest.h:67
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
struct _FILE_FS_ATTRIBUTE_INFORMATION FILE_FS_ATTRIBUTE_INFORMATION
@ FileFsDeviceInformation
Definition: from_kernel.h:222
@ FileFsAttributeInformation
Definition: from_kernel.h:223
@ FileFsVolumeInformation
Definition: from_kernel.h:219
@ FileFsSizeInformation
Definition: from_kernel.h:221
#define FILE_CASE_PRESERVED_NAMES
Definition: from_kernel.h:234
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FileFsFullSizeInformation
Definition: ntifs_ex.h:389
NTSYSAPI NTSTATUS NTAPI ZwQueryVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FsInformation, IN ULONG Length, IN FS_INFORMATION_CLASS FsInformationClass)
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:62
struct _FILE_FS_VOLUME_INFORMATION FILE_FS_VOLUME_INFORMATION
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
LARGE_INTEGER ActualAvailableAllocationUnits
Definition: from_kernel.h:272
LARGE_INTEGER CallerAvailableAllocationUnits
Definition: from_kernel.h:271
LARGE_INTEGER TotalAllocationUnits
Definition: from_kernel.h:270
LARGE_INTEGER TotalAllocationUnits
Definition: from_kernel.h:263
LARGE_INTEGER AvailableAllocationUnits
Definition: from_kernel.h:264
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
LONGLONG QuadPart
Definition: typedefs.h:114
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by RunTest().

Variable Documentation

◆ RunTest

KSTART_ROUTINE RunTest
static

Definition at line 142 of file NpfsVolumeInfo.c.

Referenced by START_TEST().