[USP10_WINETEST] Sync with Wine Staging 2.9. CORE-13362
[reactos.git] / rostests / kmtests / rtl / RtlRegistry.c
index 9d2dd51..a6fbd5f 100644 (file)
@@ -2,18 +2,12 @@
  * PROJECT:         ReactOS kernel-mode tests
  * LICENSE:         GPLv2+ - See COPYING in the top level directory
  * PURPOSE:         Test for RtlQueryRegistryValues
- * PROGRAMMER:      Thomas Faber <thfabba@gmx.de>
+ * PROGRAMMER:      Thomas Faber <thomas.faber@reactos.org>
  */
 
 #define KMT_EMULATE_KERNEL
 #include <kmt_test.h>
 
-#ifdef KMT_KERNEL_MODE
-#define KMT_KERNEL_HANDLE OBJ_KERNEL_HANDLE
-#else
-#define KMT_KERNEL_HANDLE 0
-#endif
-
 #ifndef RTL_NUMBER_OF
 #define RTL_NUMBER_OF(x) (sizeof(x) / sizeof(x[0]))
 #endif
@@ -122,7 +116,8 @@ TestRtlQueryRegistryValues(
 #define DO_QUERY(ExpectedArray, ExpectedCount) do                       \
     {                                                                   \
         ULONG _i;                                                       \
-        for (_i = 0; _i < (ExpectedCount); _i++)                        \
+        ULONG _ExpectedCount = (ExpectedCount);                         \
+        for (_i = 0; _i < _ExpectedCount; _i++)                         \
         {                                                               \
             Expected.Values[_i].ValueName = ValueName.Buffer;           \
             Expected.Values[_i].ValueType = REG_SZ;                     \
@@ -130,8 +125,8 @@ TestRtlQueryRegistryValues(
             Expected.Values[_i].ValueLength = (ExpectedArray)[_i].Len;  \
         }                                                               \
         Expected.CurrentIndex = 0;                                      \
-        Expected.Count = (ExpectedCount);                               \
-        if ((ExpectedCount) == 1)                                       \
+        Expected.Count = _ExpectedCount;                                \
+        if (_ExpectedCount == 1)                                        \
             QueryTable[0].EntryContext = &Expected.Values[0];           \
         else                                                            \
             QueryTable[0].EntryContext = NULL;                          \
@@ -211,7 +206,7 @@ START_TEST(RtlRegistry)
     RtlInitUnicodeString(&KeyName, L"\\Registry\\MACHINE\\Software");
     InitializeObjectAttributes(&ObjectAttributes,
                                &KeyName,
-                               OBJ_CASE_INSENSITIVE | KMT_KERNEL_HANDLE,
+                               OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
                                NULL,
                                NULL);
     Status = ZwOpenKey(&SoftwareHandle,
@@ -224,7 +219,7 @@ START_TEST(RtlRegistry)
     RtlInitUnicodeString(&KeyName, L"RtlRegistryKmtestKey");
     InitializeObjectAttributes(&ObjectAttributes,
                                &KeyName,
-                               OBJ_CASE_INSENSITIVE | KMT_KERNEL_HANDLE,
+                               OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
                                SoftwareHandle,
                                NULL);
     Status = ZwCreateKey(&KeyHandle,