22{
27 PFILE_OBJECT ParentFileObject, TargetFileObject, SystemRootFileObject;
28
30
31
33
34
35
36
37
38
39
40 TargetFileObject =
NULL;
57 {
62 (
PVOID *)&TargetFileObject,
65 }
66
67 ok(TargetFileObject !=
NULL,
"Not target to continue!\n");
68 if (TargetFileObject ==
NULL)
69 {
71 {
73 }
74 return;
75 }
76
77
78
79
91 0,
96 0,
103 {
108 (
PVOID *)&ParentFileObject,
112 {
113
114
115
116
117
118
119 ok(ParentFileObject != TargetFileObject,
"Diverted file object must be different\n");
121 ok_eq_pointer(ParentFileObject->FsContext, TargetFileObject->FsContext);
122 ok(ParentFileObject->FsContext2 != 0x0,
"Parent must be open!\n");
123 ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
126 }
127
130 }
131
132
148 {
154 SystemRootHandle,
161 0,
166 0,
173 {
178 (
PVOID *)&ParentFileObject,
182 {
183 ok(ParentFileObject != TargetFileObject,
"Diverted file object must be different\n");
184 ok_eq_pointer(ParentFileObject->FsContext, TargetFileObject->FsContext);
185 ok(ParentFileObject->FsContext2 != 0x0,
"Parent must be open!\n");
186 ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
192 (
PVOID *)&SystemRootFileObject,
196 {
197 ok_eq_pointer(ParentFileObject->RelatedFileObject, SystemRootFileObject);
198 ok(ParentFileObject->RelatedFileObject != TargetFileObject,
"File objects must be different\n");
199 ok(SystemRootFileObject != TargetFileObject,
"File objects must be different\n");
201 }
203 }
206 }
208 }
209
210
211
212
213
214
215
216
228 0,
233 0,
240 {
245 (
PVOID *)&ParentFileObject,
249 {
250 ok(ParentFileObject != TargetFileObject,
"Diverted file object must be different\n");
252 ok_eq_pointer(ParentFileObject->FsContext, TargetFileObject->FsContext);
253 ok(ParentFileObject->FsContext2 != 0x0,
"Parent must be open!\n");
254 ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
257 }
260 }
261
277 {
283 SystemRootHandle,
290 0,
295 0,
302 {
307 (
PVOID *)&ParentFileObject,
311 {
312 ok(ParentFileObject != TargetFileObject,
"Diverted file object must be different\n");
313 ok_eq_pointer(ParentFileObject->FsContext, TargetFileObject->FsContext);
314 ok(ParentFileObject->FsContext2 != 0x0,
"Parent must be open!\n");
315 ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
321 (
PVOID *)&SystemRootFileObject,
325 {
326 ok_eq_pointer(ParentFileObject->RelatedFileObject, SystemRootFileObject);
327 ok(ParentFileObject->RelatedFileObject != TargetFileObject,
"File objects must be different\n");
328 ok(SystemRootFileObject != TargetFileObject,
"File objects must be different\n");
330 }
332 }
335 }
337 }
338
341
342
343
344
356 0,
361 0,
368 {
370 }
371
372
388 {
394 SystemRootHandle,
401 0,
406 0,
413 {
415 }
417 }
418}
static UNICODE_STRING Regedit
static UNICODE_STRING Foobar
static UNICODE_STRING SystemRootRegedit
static UNICODE_STRING SystemRootFoobar
static UNICODE_STRING SystemRoot
static UNICODE_STRING SystemRootFoobarFoobar
static UNICODE_STRING FoobarFoobar
#define ok_eq_pointer(value, expected)
#define ok_eq_hex(value, expected)
#define ok_eq_long(value, expected)
#define FILE_DIRECTORY_FILE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define INVALID_HANDLE_VALUE
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define ExGetPreviousMode
#define FILE_SYNCHRONOUS_IO_NONALERT
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
POBJECT_TYPE IoFileObjectType
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE TargetHandle
#define FILE_DOES_NOT_EXIST
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG Disposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength, IN CREATE_FILE_TYPE CreateFileType, IN PVOID ExtraCreateParameters OPTIONAL, IN ULONG Options)
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
#define STATUS_OBJECT_PATH_NOT_FOUND
#define IO_OPEN_TARGET_DIRECTORY
#define ObDereferenceObject