[KMTESTS]
authorThomas Faber <thomas.faber@reactos.org>
Fri, 19 Aug 2011 19:03:46 +0000 (19:03 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 19 Aug 2011 19:03:46 +0000 (19:03 +0000)
- ExResource: Fix a TODO
- Fix warnings. All of them.

svn path=/branches/GSoC_2011/KMTestSuite/; revision=53322

kmtests/include/kmt_platform.h
kmtests/include/kmt_test.h
kmtests/ntos_ex/ExInterlocked.c
kmtests/ntos_ex/ExResource.c
kmtests/ntos_ke/KeSpinLock.c
kmtests/ntos_ob/ObType.c

index e407da9..580a098 100644 (file)
 
 #ifdef KMT_EMULATE_KERNEL
 #define ok_irql(i)
-#ifdef __GNUC__
-#define KIRQL __attribute__((__unused__)) int
-#elif !defined __GNUC__
 #define KIRQL int
-#endif /* !defined __GNUC__ */
 typedef const UCHAR CUCHAR, *PCUCHAR;
 typedef ULONG LOGICAL, *PLOGICAL;
 
 #undef KeRaiseIrql
-#define KeRaiseIrql(new, old)
+#define KeRaiseIrql(new, old) *(old) = 123
 #undef KeLowerIrql
-#define KeLowerIrql(i)
+#define KeLowerIrql(i) (void)(i)
 #define ExAllocatePool(type, size)              HeapAlloc(GetProcessHeap(), 0, size)
 #define ExAllocatePoolWithTag(type, size, tag)  HeapAlloc(GetProcessHeap(), 0, size)
 #define ExFreePool(p)                           HeapFree(GetProcessHeap(), 0, p)
index 86f8664..73ea959 100644 (file)
@@ -104,7 +104,8 @@ DWORD KmtSendBufferToDriver(IN DWORD ControlCode, IN OUT PVOID Buffer OPTIONAL,
 extern PKMT_RESULTBUFFER ResultBuffer;
 
 #ifdef __GNUC__
-#define KMT_FORMAT(type, fmt, first) __attribute__((__format__(type, fmt, first)))
+/* TODO: GCC doesn't understand %wZ :( */
+#define KMT_FORMAT(type, fmt, first) /*__attribute__((__format__(type, fmt, first)))*/
 #elif !defined __GNUC__
 #define KMT_FORMAT(type, fmt, first)
 #endif /* !defined __GNUC__ */
index ee266e2..6131f03 100644 (file)
@@ -136,14 +136,14 @@ Large(
 }
 
 #define CheckInterlockedCmpXchg(Function, Type, Print, Val, Cmp, Xchg,      \
-                                ExpectedValue, ExpectedRet, ...) do         \
+                                ExpectedValue, ExpectedRet) do              \
 {                                                                           \
     Type Ret##Type = 0;                                                     \
     Type Value##Type = Val;                                                 \
     Status = STATUS_SUCCESS;                                                \
     _SEH2_TRY {                                                             \
         SaveState(OldState);                                                \
-        Ret##Type = Function(&Value##Type, Xchg, Cmp, ##__VA_ARGS__);       \
+        Ret##Type = Function(&Value##Type, Xchg, Cmp);                      \
         SaveState(NewState);                                                \
         CheckState(&OldState, &NewState);                                   \
     } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {                             \
@@ -236,13 +236,13 @@ Large(
 } while (0)
 
 #define CheckInterlockedOpLargeNoRet(Function, Type, Print, Val, Op,        \
-                                ExpectedValue, ...) do                      \
+                                ExpectedValue) do                           \
 {                                                                           \
     Type Value##Type = Val;                                                 \
     Status = STATUS_SUCCESS;                                                \
     _SEH2_TRY {                                                             \
         SaveState(OldState);                                                \
-        Function(&Value##Type, Op, ##__VA_ARGS__);                          \
+        Function(&Value##Type, Op);                                         \
         SaveState(NewState);                                                \
         CheckState(&OldState, &NewState);                                   \
     } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {                             \
@@ -305,7 +305,7 @@ TestInterlockedFunctional(VOID)
 
     /* Exchange */
     CheckInterlockedOp(InterlockedExchange, LONG, "%ld", 5, 8, 8L, 5L);
-    CheckInterlockedOp(InterlockedExchangePointer, PVOID, "%p", (PVOID)700, (PVOID)93, (PVOID)93, (PVOID)700);
+    CheckInterlockedOpNoArg(InterlockedExchangePointer, PVOID, "%p", (PVOID)700, (PVOID)93, (PVOID)700, (PVOID)93);
 #undef InterlockedExchange
 #ifdef _M_IX86
     CheckInterlockedOp(InterlockedExchange, LONG, "%ld", 5, 8, 8L, 5L);
index b8b7147..28122d3 100644 (file)
@@ -25,9 +25,6 @@ typedef struct _ERESOURCE_2K3 {
   ULONG ContentionCount;
   USHORT NumberOfSharedWaiters;
   USHORT NumberOfExclusiveWaiters;
-#if defined(_WIN64)
-  PVOID Reserved2; /* TODO: not sure if this should be in here for 2k3 */
-#endif
   _ANONYMOUS_UNION union {
     PVOID Address;
     ULONG_PTR CreatorBackTraceIndex;
@@ -51,7 +48,6 @@ typedef struct _ERESOURCE_2K3 {
     ok_eq_ulong((Res)->ContentionCount, 0LU);                                                                   \
     ok_eq_uint((Res)->NumberOfSharedWaiters, 0);                                                                \
     ok_eq_uint((Res)->NumberOfExclusiveWaiters, 0);                                                             \
-    /* ok_eq_pointer((Res)->Reserved2, NULL); */                                                                \
     ok_eq_pointer((Res)->Address, NULL);                                                                        \
     ok_eq_ulongptr((Res)->SpinLock, 0);                                                                         \
 } while (0)
index b03e0ea..79e799b 100644 (file)
@@ -108,8 +108,11 @@ DEFINE_RELEASE(ReleaseExpNoLower,     FALSE, (KeReleaseSpinLockFromDpcLevel)(Spi
 DEFINE_ACQUIRE(AcquireInStackNoRaise, FALSE, KeAcquireInStackQueuedSpinLockAtDpcLevel(SpinLock, &CheckData->QueueHandle))
 DEFINE_RELEASE(ReleaseInStackNoRaise, FALSE, KeReleaseInStackQueuedSpinLockFromDpcLevel(&CheckData->QueueHandle))
 
+/* TODO: test these functions. They behave weirdly, though */
+#if 0
 DEFINE_ACQUIRE(AcquireForDpc,         TRUE,  CheckData->Irql = KeAcquireSpinLockForDpc(SpinLock))
 DEFINE_RELEASE(ReleaseForDpc,         TRUE,  KeReleaseSpinLockForDpc(SpinLock, CheckData->Irql))
+#endif
 
 DEFINE_ACQUIRE(AcquireInStackForDpc,  FALSE, KeAcquireInStackQueuedSpinLockForDpc(SpinLock, &CheckData->QueueHandle))
 DEFINE_RELEASE(ReleaseInStackForDpc,  FALSE, KeReleaseInStackQueuedSpinLockForDpc(&CheckData->QueueHandle))
index 4c0d33b..e428aa0 100644 (file)
@@ -178,11 +178,13 @@ ObtCreateObjectTypes(VOID)
     {
         WCHAR DirectoryName[sizeof "\\ObjectTypes\\" - 1];
         WCHAR TypeName[15];
-    } Name = { L"\\ObjectTypes\\" };
+    } Name;
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE ObjectTypeHandle;
     UNICODE_STRING ObjectPath;
 
+    RtlCopyMemory(&Name.DirectoryName, L"\\ObjectTypes\\", sizeof Name.DirectoryName);
+
     for (i = 0; i < NUM_OBTYPES; ++i)
     {
         Status = RtlStringCbPrintfW(Name.TypeName, sizeof Name.TypeName, L"MyObjectType%x", i);