Author: pschweitzer
Date: Thu Apr 24 20:50:32 2014
New Revision: 62960
URL:
http://svn.reactos.org/svn/reactos?rev=62960&view=rev
Log:
[KMTESTS:IO]
Complete a bit more IoCreateFile tests, taking into account relatives.
A side note (related to first commit - actually to these test as a whole):
It's pretty unfortunate that they work (on my Windows 2K3). They just expose
a totally different behavior than expected reading R. Nagar (pp 478 - 479).
The experimental behavior also being different from behavior expected from IFS
samples provided by MS.
Perhaps some magic in the callpath between IopParseDevice return and IoCreateFile return?
Modified:
trunk/rostests/kmtests/ntos_io/IoCreateFile.c
Modified: trunk/rostests/kmtests/ntos_io/IoCreateFile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_io/IoCreateF…
==============================================================================
--- trunk/rostests/kmtests/ntos_io/IoCreateFile.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_io/IoCreateFile.c [iso-8859-1] Thu Apr 24 20:50:32 2014
@@ -23,8 +23,8 @@
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
OBJECT_ATTRIBUTES ObjectAttributes;
- PFILE_OBJECT ParentFileObject, TargetFileObject;
HANDLE ParentHandle, SystemRootHandle, TargetHandle;
+ PFILE_OBJECT ParentFileObject, TargetFileObject, SystemRootFileObject;
UNREFERENCED_PARAMETER(Context);
@@ -117,6 +117,7 @@
* CCB must be != NULL, otherwise it means open failed
*/
ok(ParentFileObject != TargetFileObject, "Diverted file object must be
different\n");
+ ok_eq_pointer(ParentFileObject->RelatedFileObject, NULL);
ok_eq_pointer(ParentFileObject->FsContext,
TargetFileObject->FsContext);
ok(ParentFileObject->FsContext2 != 0x0, "Parent must be
open!\n");
ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
@@ -184,6 +185,20 @@
ok(ParentFileObject->FsContext2 != 0x0, "Parent must be
open!\n");
ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
ok_eq_long(RtlCompareUnicodeString(&ParentFileObject->FileName,
&TargetFileObject->FileName, FALSE), 0);
+ Status = ObReferenceObjectByHandle(SystemRootHandle,
+ FILE_READ_DATA,
+ IoFileObjectType,
+ KernelMode,
+ (PVOID *)&SystemRootFileObject,
+ NULL);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ if (Status == STATUS_SUCCESS)
+ {
+ ok_eq_pointer(ParentFileObject->RelatedFileObject,
SystemRootFileObject);
+ ok(ParentFileObject->RelatedFileObject != TargetFileObject,
"File objects must be different\n");
+ ok(SystemRootFileObject != TargetFileObject, "File objects must
be different\n");
+ ObDereferenceObject(SystemRootFileObject);
+ }
ObDereferenceObject(ParentFileObject);
}
ok_eq_long(IoStatusBlock.Information, FILE_EXISTS);
@@ -233,6 +248,7 @@
if (Status == STATUS_SUCCESS)
{
ok(ParentFileObject != TargetFileObject, "Diverted file object must be
different\n");
+ ok_eq_pointer(ParentFileObject->RelatedFileObject, NULL);
ok_eq_pointer(ParentFileObject->FsContext,
TargetFileObject->FsContext);
ok(ParentFileObject->FsContext2 != 0x0, "Parent must be
open!\n");
ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
@@ -298,6 +314,20 @@
ok(ParentFileObject->FsContext2 != 0x0, "Parent must be
open!\n");
ok(ParentFileObject->FsContext2 != TargetFileObject->FsContext2,
"Parent open must have its own context!\n");
ok_eq_long(RtlCompareUnicodeString(&ParentFileObject->FileName,
&TargetFileObject->FileName, FALSE), 0);
+ Status = ObReferenceObjectByHandle(SystemRootHandle,
+ FILE_READ_DATA,
+ IoFileObjectType,
+ KernelMode,
+ (PVOID *)&SystemRootFileObject,
+ NULL);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ if (Status == STATUS_SUCCESS)
+ {
+ ok_eq_pointer(ParentFileObject->RelatedFileObject,
SystemRootFileObject);
+ ok(ParentFileObject->RelatedFileObject != TargetFileObject,
"File objects must be different\n");
+ ok(SystemRootFileObject != TargetFileObject, "File objects must
be different\n");
+ ObDereferenceObject(SystemRootFileObject);
+ }
ObDereferenceObject(ParentFileObject);
}
ok_eq_long(IoStatusBlock.Information, FILE_DOES_NOT_EXIST);