[KMTEST]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 12 May 2014 23:36:05 +0000 (23:36 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 12 May 2014 23:36:05 +0000 (23:36 +0000)
Revert the DDK compatibility hack and apply a real fix. I kept the hack for NDK exports, we should consider changing them as well for consistency reasons.

svn path=/trunk/; revision=63268

rostests/kmtests/npfs/NpfsHelpers.c
rostests/kmtests/ntos_ex/ExFastMutex.c
rostests/kmtests/ntos_ex/ExResource.c
rostests/kmtests/ntos_io/IoCreateFile.c
rostests/kmtests/ntos_ke/KeEvent.c
rostests/kmtests/ntos_ke/KeGuardedMutex.c
rostests/kmtests/ntos_mm/MmSection.c
rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c
rostests/kmtests/ntos_mm/ZwCreateSection.c
rostests/kmtests/ntos_mm/ZwMapViewOfSection.c
rostests/kmtests/ntos_ob/ObTypes.c

index a06aec7..f4cd46e 100644 (file)
@@ -742,11 +742,7 @@ KmtStartThread(
     {
         Status = ObReferenceObjectByHandle(ThreadHandle,
                                            SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
                                            *PsThreadType,
-#else
-                                           PsThreadType,
-#endif
                                            KernelMode,
                                            &ThreadObject,
                                            NULL);
index 6ac87b6..db5cf14 100644 (file)
@@ -196,13 +196,7 @@ StartThread(
     InitializeObjectAttributes(&Attributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     Status = PsCreateSystemThread(&ThreadData->Handle, GENERIC_ALL, &Attributes, NULL, NULL, AcquireMutexThread, ThreadData);
     ok_eq_hex(Status, STATUS_SUCCESS);
-    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
-                                       *PsThreadType,
-#else
-                                       PsThreadType,
-#endif
-                                        KernelMode, (PVOID *)&ThreadData->Thread, NULL);
+    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE, *PsThreadType, KernelMode, (PVOID *)&ThreadData->Thread, NULL);
     ok_eq_hex(Status, STATUS_SUCCESS);
 
     return KeWaitForSingleObject(&ThreadData->OutEvent, Executive, KernelMode, FALSE, Timeout);
index 2463c3c..5ace01a 100644 (file)
@@ -268,14 +268,7 @@ StartThread(
     InitializeObjectAttributes(&Attributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     Status = PsCreateSystemThread(&ThreadData->Handle, GENERIC_ALL, &Attributes, NULL, NULL, AcquireResourceThread, ThreadData);
     ok_eq_hex(Status, STATUS_SUCCESS);
-    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
-                                       *PsThreadType,
-#else
-                                       PsThreadType,
-#endif
-
-                                       KernelMode, (PVOID *)&ThreadData->Thread, NULL);
+    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE, *PsThreadType, KernelMode, (PVOID *)&ThreadData->Thread, NULL);
     ok_eq_hex(Status, STATUS_SUCCESS);
 
     return KeWaitForSingleObject(&ThreadData->OutEvent, Executive, KernelMode, FALSE, Timeout);
index f970e4d..8362745 100644 (file)
@@ -57,11 +57,7 @@ KernelModeTest(IN PVOID Context)
     {
         Status = ObReferenceObjectByHandle(TargetHandle,
                                            FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                            *IoFileObjectType,
-#else
-                                           IoFileObjectType,
-#endif
                                            KernelMode,
                                            (PVOID *)&TargetFileObject,
                                            NULL);
@@ -107,11 +103,7 @@ KernelModeTest(IN PVOID Context)
     {
         Status = ObReferenceObjectByHandle(ParentHandle,
                                            FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                            *IoFileObjectType,
-#else
-                                           IoFileObjectType,
-#endif
                                            KernelMode,
                                            (PVOID *)&ParentFileObject,
                                            NULL);
@@ -181,11 +173,7 @@ KernelModeTest(IN PVOID Context)
         {
             Status = ObReferenceObjectByHandle(ParentHandle,
                                                FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                                *IoFileObjectType,
-#else
-                                               IoFileObjectType,
-#endif
                                                KernelMode,
                                                (PVOID *)&ParentFileObject,
                                                NULL);
@@ -199,11 +187,7 @@ KernelModeTest(IN PVOID Context)
                 ok_eq_long(RtlCompareUnicodeString(&ParentFileObject->FileName, &TargetFileObject->FileName, FALSE), 0);
                 Status = ObReferenceObjectByHandle(SystemRootHandle,
                                                    FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                                    *IoFileObjectType,
-#else
-                                                   IoFileObjectType,
-#endif
                                                    KernelMode,
                                                    (PVOID *)&SystemRootFileObject,
                                                    NULL);
@@ -256,12 +240,7 @@ KernelModeTest(IN PVOID Context)
     {
         Status = ObReferenceObjectByHandle(ParentHandle,
                                            FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                            *IoFileObjectType,
-#else
-                                           IoFileObjectType,
-#endif
-
                                            KernelMode,
                                            (PVOID *)&ParentFileObject,
                                            NULL);
@@ -323,12 +302,7 @@ KernelModeTest(IN PVOID Context)
         {
             Status = ObReferenceObjectByHandle(ParentHandle,
                                                FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                                *IoFileObjectType,
-#else
-                                               IoFileObjectType,
-#endif
-
                                                KernelMode,
                                                (PVOID *)&ParentFileObject,
                                                NULL);
@@ -342,12 +316,7 @@ KernelModeTest(IN PVOID Context)
                 ok_eq_long(RtlCompareUnicodeString(&ParentFileObject->FileName, &TargetFileObject->FileName, FALSE), 0);
                 Status = ObReferenceObjectByHandle(SystemRootHandle,
                                                    FILE_READ_DATA,
-#ifdef _PROPER_NT_EXPORTS
                                                    *IoFileObjectType,
-#else
-                                                   IoFileObjectType,
-#endif
-
                                                    KernelMode,
                                                    (PVOID *)&SystemRootFileObject,
                                                    NULL);
@@ -565,11 +534,7 @@ START_TEST(IoCreateFile)
         /* Then, just wait on our thread to finish */
         Status = ObReferenceObjectByHandle(ThreadHandle,
                                            SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
                                            *PsThreadType,
-#else
-                                           PsThreadType,
-#endif
                                            KernelMode,
                                            &ThreadObject,
                                            NULL);
index 95feb12..e6d45db 100644 (file)
@@ -169,13 +169,7 @@ TestEventConcurrent(
         Threads[i].Signal = FALSE;
         Status = PsCreateSystemThread(&Threads[i].Handle, GENERIC_ALL, NULL, NULL, NULL, WaitForEventThread, &Threads[i]);
         ok_eq_hex(Status, STATUS_SUCCESS);
-        Status = ObReferenceObjectByHandle(Threads[i].Handle, SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
-                                           *PsThreadType,
-#else
-                                           PsThreadType,
-#endif
-                                           KernelMode, (PVOID *)&Threads[i].Thread, NULL);
+        Status = ObReferenceObjectByHandle(Threads[i].Handle, SYNCHRONIZE, *PsThreadType, KernelMode, (PVOID *)&Threads[i].Thread, NULL);
         ok_eq_hex(Status, STATUS_SUCCESS);
         ThreadObjects[i] = Threads[i].Thread;
         Priority = KeQueryPriorityThread(Threads[i].Thread);
index 3acbec1..317ca11 100644 (file)
@@ -204,13 +204,7 @@ StartThread(
     InitializeObjectAttributes(&Attributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     Status = PsCreateSystemThread(&ThreadData->Handle, GENERIC_ALL, &Attributes, NULL, NULL, AcquireMutexThread, ThreadData);
     ok_eq_hex(Status, STATUS_SUCCESS);
-    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE,
-#ifdef _PROPER_NT_EXPORTS
-                                       *PsThreadType,
-#else
-                                       PsThreadType,
-#endif
-                                       KernelMode, (PVOID *)&ThreadData->Thread, NULL);
+    Status = ObReferenceObjectByHandle(ThreadData->Handle, SYNCHRONIZE, *PsThreadType, KernelMode, (PVOID *)&ThreadData->Thread, NULL);
     ok_eq_hex(Status, STATUS_SUCCESS);
 
     return KeWaitForSingleObject(&ThreadData->OutEvent, Executive, KernelMode, FALSE, Timeout);
index e465721..393dba9 100644 (file)
@@ -428,13 +428,7 @@ START_TEST(MmSection)
 
     if (!skip(Status == STATUS_SUCCESS && FileHandle1 != NULL, "Failed to open file 1\n"))
     {
-        Status = ObReferenceObjectByHandle(FileHandle1, FILE_READ_DATA | FILE_WRITE_DATA,
-#ifdef _PROPER_NT_EXPORTS
-                                           *IoFileObjectType,
-#else
-                                           IoFileObjectType,
-#endif
-                                           KernelMode, (PVOID *)&FileObject1, NULL);
+        Status = ObReferenceObjectByHandle(FileHandle1, FILE_READ_DATA | FILE_WRITE_DATA, *IoFileObjectType, KernelMode, (PVOID *)&FileObject1, NULL);
         ok_eq_hex(Status, STATUS_SUCCESS);
         ok(FileObject1 != NULL, "FileObject1 is NULL\n");
         CheckObject(FileHandle1, 3L, 1L);
@@ -442,13 +436,7 @@ START_TEST(MmSection)
 
     if (!skip(Status == STATUS_SUCCESS && FileHandle2 != NULL, "Failed to open file 2\n"))
     {
-        Status = ObReferenceObjectByHandle(FileHandle2, FILE_READ_DATA | FILE_WRITE_DATA,
-#ifdef _PROPER_NT_EXPORTS
-                                           *IoFileObjectType,
-#else
-                                           IoFileObjectType,
-#endif
-                                           KernelMode, (PVOID *)&FileObject2, NULL);
+        Status = ObReferenceObjectByHandle(FileHandle2, FILE_READ_DATA | FILE_WRITE_DATA, *IoFileObjectType, KernelMode, (PVOID *)&FileObject2, NULL);
         ok_eq_hex(Status, STATUS_SUCCESS);
         ok(FileObject2 != NULL, "FileObject2 is NULL\n");
     }
index 2d7b7b7..785cb51 100644 (file)
@@ -437,13 +437,7 @@ SystemProcessTest(VOID)
         goto cleanup;
     }
 
-    Status = ObReferenceObjectByHandle(Thread1, THREAD_ALL_ACCESS,
-#ifdef _PROPER_NT_EXPORTS
-                                       *PsThreadType,
-#else
-                                       PsThreadType,
-#endif
-                                       KernelMode, &ThreadObjects[0], NULL);
+    Status = ObReferenceObjectByHandle(Thread1, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObjects[0], NULL);
     if (!NT_SUCCESS(Status))
     {
         trace("error referencing thread1\n");
@@ -457,13 +451,7 @@ SystemProcessTest(VOID)
         goto cleanup;
     }
 
-    Status = ObReferenceObjectByHandle(Thread2, THREAD_ALL_ACCESS,
-#ifdef _PROPER_NT_EXPORTS
-                                       *PsThreadType,
-#else
-                                       PsThreadType,
-#endif
-                                       KernelMode, &ThreadObjects[1], NULL);
+    Status = ObReferenceObjectByHandle(Thread2, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObjects[1], NULL);
     if (!NT_SUCCESS(Status))
     {
         trace("error referencing thread2\n");
index 55720da..1e9ccdb 100644 (file)
@@ -464,13 +464,7 @@ BasicBehaviorChecks(HANDLE FileHandle)
 /* FIXME: Null pointer dereference. See ROSTESTS-108 */
 #ifdef ROSTESTS_108_FIXED
     //mimic lack of section support for a particular file as well.
-    Status = ObReferenceObjectByHandle(FileHandle, STANDARD_RIGHTS_ALL,
-#ifdef _PROPER_NT_EXPORTS
-                                       *IoFileObjectType,
-#else
-                                       IoFileObjectType,
-#endif
-                                        KernelMode, (PVOID *)&FileObject, NULL);
+    Status = ObReferenceObjectByHandle(FileHandle, STANDARD_RIGHTS_ALL, *IoFileObjectType, KernelMode, (PVOID *)&FileObject, NULL);
     if (!skip(NT_SUCCESS(Status), "Cannot reference object by handle\n"))
     {
         PSECTION_OBJECT_POINTERS Pointers = FileObject->SectionObjectPointer;
index 3a4bcad..09083ed 100644 (file)
@@ -390,13 +390,7 @@ BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
         Status = PsCreateSystemThread(&SysThreadHandle, STANDARD_RIGHTS_ALL, &ObjectAttributes, NULL, NULL, SystemProcessWorker, NULL);
         if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
         {
-            Status = ObReferenceObjectByHandle(SysThreadHandle, THREAD_ALL_ACCESS,
-#ifdef _PROPER_NT_EXPORTS
-                                               *PsThreadType,
-#else
-                                               PsThreadType,
-#endif
-                                               KernelMode, &ThreadObject, NULL);
+            Status = ObReferenceObjectByHandle(SysThreadHandle, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObject, NULL);
             if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing file-backed section\n"))
             {
                 //wait until the system thread actually terminates
@@ -521,13 +515,7 @@ PageFileBehaviorChecks()
 
             if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
             {
-                Status = ObReferenceObjectByHandle(SysThreadHandle, THREAD_ALL_ACCESS,
-#ifdef _PROPER_NT_EXPORTS
-                                                   *PsThreadType,
-#else
-                                                   PsThreadType,
-#endif
-                                                   KernelMode, &ThreadObject, NULL);
+                Status = ObReferenceObjectByHandle(SysThreadHandle, THREAD_ALL_ACCESS, *PsThreadType, KernelMode, &ThreadObject, NULL);
                 if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing pagefile-backed section\n"))
                 {
                     //wait until the system thread actually terminates
index 5f2e14f..70d6e8e 100644 (file)
@@ -164,14 +164,6 @@ TestObjectTypes(VOID)
     SeDefaultObjectMethod = ObpTypeObjectType->TypeInfo.SecurityProcedure;
     ok(SeDefaultObjectMethod != NULL, "No SeDefaultObjectMethod\n");
 
-#ifdef _PROPER_NT_EXPORTS
-#define ExSemaphoreObjectType *ExSemaphoreObjectType
-#define SeTokenObjectType *SeTokenObjectType
-#define PsProcessType *PsProcessType
-#define PsThreadType *PsThreadType
-#define ExEventObjectType *ExEventObjectType
-#define IoFileObjectType *IoFileObjectType
-#endif
 #ifdef _PROPER_NT_NDK_EXPORTS
 #define ObpTypeObjectType *ObpTypeObjectType
 #define ObpDirectoryObjectType *ObpDirectoryObjectType
@@ -203,16 +195,16 @@ TestObjectTypes(VOID)
         ok_eq_hex(ObpTypeObjectType->Key, TAG('ObjT'));
     CheckObjectType(Directory, ObpDirectoryObjectType,          OBT_CASE_INSENSITIVE | OBT_PAGED_POOL,      0x100,  0x020003, 0x02000c, 0x020003, 0x0f000f, 0x0f000f);
     CheckObjectType(SymbolicLink, ObpSymbolicLinkObjectType,    OBT_CASE_INSENSITIVE | OBT_PAGED_POOL,      0x100,  0x020001, 0x020000, 0x020001, 0x0f0001, 0x0f0001);
-    CheckObjectType(Token, SeTokenObjectType,                   OBT_SECURITY_REQUIRED | OBT_PAGED_POOL,     0x100,  0x020008, 0x0200e0, 0x020000, 0x0f01ff, 0x1f01ff);
-    CheckObjectType(Process, PsProcessType,                     OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x0b0,  0x020410, 0x020beb, 0x120000, 0x1f0fff, 0x1f0fff);
-    CheckObjectType(Thread, PsThreadType,                       OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x0b0,  0x020048, 0x020037, 0x120000, 0x1f03ff, 0x1f03ff);
+    CheckObjectType(Token, *SeTokenObjectType,                   OBT_SECURITY_REQUIRED | OBT_PAGED_POOL,     0x100,  0x020008, 0x0200e0, 0x020000, 0x0f01ff, 0x1f01ff);
+    CheckObjectType(Process, *PsProcessType,                     OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x0b0,  0x020410, 0x020beb, 0x120000, 0x1f0fff, 0x1f0fff);
+    CheckObjectType(Thread, *PsThreadType,                       OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x0b0,  0x020048, 0x020037, 0x120000, 0x1f03ff, 0x1f03ff);
     CheckObjectType(Job, PsJobType,                             OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x000,  0x020004, 0x02000b, 0x120000, 0x1f03ff, 0x1f001f);
     CheckObjectType(DebugObject, DbgkDebugObjectType,           OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED,     0x000,  0x020001, 0x020002, 0x120000, 0x1f000f, 0x1f000f);
-    CheckObjectType(Event, ExEventObjectType,                   OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
+    CheckObjectType(Event, *ExEventObjectType,                   OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
     CheckObjectType(EventPair, ExEventPairObjectType,           0,                                          0x100,  0x120000, 0x120000, 0x120000, 0x1f0000, 0x1f0000);
     CheckObjectType(Mutant, ExMutantObjectType,                 OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020000, 0x120000, 0x1f0001, 0x1f0001);
     CheckObjectType(Callback, ExCallbackObjectType,             OBT_NO_DEFAULT,                             0x100,  0x020000, 0x020001, 0x120000, 0x1f0001, 0x1f0001);
-    CheckObjectType(Semaphore, ExSemaphoreObjectType,           OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
+    CheckObjectType(Semaphore, *ExSemaphoreObjectType,           OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
     CheckObjectType(Timer, ExTimerObjectType,                   OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
     CheckObjectType(Profile, ExProfileObjectType,               OBT_NO_DEFAULT,                             0x100,  0x020001, 0x020001, 0x020001, 0x0f0001, 0x0f0001);
     CheckObjectType(KeyedEvent, ExpKeyedEventObjectType,        OBT_PAGED_POOL,                             0x000,  0x020001, 0x020002, 0x020000, 0x0f0003, 0x1f0003);
@@ -231,7 +223,7 @@ TestObjectTypes(VOID)
                                                                                                             0x100,  0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
     CheckObjectType(Driver, IoDriverObjectType,                 OBT_CASE_INSENSITIVE,                       0x100,  0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
     CheckObjectType(IoCompletion, IoCompletionObjectType,       OBT_CASE_INSENSITIVE,                       0x110,  0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
-    CheckObjectType(File, IoFileObjectType,                     OBT_NO_DEFAULT | OBT_CUSTOM_SECURITY_PROC | OBT_CASE_INSENSITIVE | OBT_MAINTAIN_HANDLE_COUNT,
+    CheckObjectType(File, *IoFileObjectType,                     OBT_NO_DEFAULT | OBT_CUSTOM_SECURITY_PROC | OBT_CASE_INSENSITIVE | OBT_MAINTAIN_HANDLE_COUNT,
                                                                                                             0x130,  0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
     CheckObjectType(WmiGuid, WmipGuidObjectType,                OBT_NO_DEFAULT | OBT_CUSTOM_SECURITY_PROC | OBT_SECURITY_REQUIRED,
                                                                                                             0x100,  0x000001, 0x000002, 0x000010, 0x120fff, 0x1f0fff);