[PATCH 2/2] include: Add RTL_GENERIC_TABLE

Alex Henrie alexhenrie24 at gmail.com
Mon Jun 22 02:16:06 CDT 2020


And fix RtlInitializeGenericTable's return type while updating the ntdll
functions to use the newly added typedefs.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ntdll/rtl.c    | 15 ++++++++-------
 include/ddk/ntddk.h | 40 ++++++++++++++++++++++++++++++++++------
 2 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index bf91423eba..4a4a7b31de 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -429,30 +429,31 @@ RtlDeleteSecurityObject( PSECURITY_DESCRIPTOR *ObjectDescriptor )
 /******************************************************************************
  *  RtlInitializeGenericTable           [NTDLL.@]
  */
-PVOID WINAPI RtlInitializeGenericTable(PVOID pTable, PVOID arg2, PVOID arg3, PVOID arg4, PVOID arg5)
+void WINAPI RtlInitializeGenericTable(RTL_GENERIC_TABLE *table, PRTL_GENERIC_COMPARE_ROUTINE compare,
+                                      PRTL_GENERIC_ALLOCATE_ROUTINE allocate, PRTL_GENERIC_FREE_ROUTINE free,
+                                      void *context)
 {
-  FIXME("(%p,%p,%p,%p,%p) stub!\n", pTable, arg2, arg3, arg4, arg5);
-  return NULL;
+    FIXME("(%p, %p, %p, %p, %p) stub!\n", table, compare, allocate, free, context);
 }
 
 /******************************************************************************
  *  RtlEnumerateGenericTableWithoutSplaying           [NTDLL.@]
  */
-PVOID RtlEnumerateGenericTableWithoutSplaying(PVOID pTable, PVOID *RestartKey)
+void * RtlEnumerateGenericTableWithoutSplaying(RTL_GENERIC_TABLE *table, void *previous)
 {
     static int warn_once;
 
     if (!warn_once++)
-        FIXME("(%p,%p) stub!\n", pTable, RestartKey);
+        FIXME("(%p, %p) stub!\n", table, previous);
     return NULL;
 }
 
 /******************************************************************************
  *  RtlNumberGenericTableElements           [NTDLL.@]
  */
-ULONG RtlNumberGenericTableElements(PVOID pTable)
+ULONG RtlNumberGenericTableElements(RTL_GENERIC_TABLE *table)
 {
-    FIXME("(%p) stub!\n", pTable);
+    FIXME("(%p) stub!\n", table);
     return 0;
 }
 
diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h
index 497d42da39..7feacce84c 100644
--- a/include/ddk/ntddk.h
+++ b/include/ddk/ntddk.h
@@ -146,6 +146,40 @@ typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION
   LARGE_INTEGER ValidDataLength;
 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
 
+typedef enum _RTL_GENERIC_COMPARE_RESULTS {
+    GenericLessThan,
+    GenericGreaterThan,
+    GenericEqual
+} RTL_GENERIC_COMPARE_RESULTS;
+
+typedef struct _RTL_SPLAY_LINKS {
+    struct _RTL_SPLAY_LINKS *Parent;
+    struct _RTL_SPLAY_LINKS *LeftChild;
+    struct _RTL_SPLAY_LINKS *RightChild;
+} RTL_SPLAY_LINKS;
+typedef RTL_SPLAY_LINKS *PRTL_SPLAY_LINKS;
+
+struct _RTL_GENERIC_TABLE;
+
+typedef RTL_GENERIC_COMPARE_RESULTS (WINAPI *PRTL_GENERIC_COMPARE_ROUTINE)(struct _RTL_GENERIC_TABLE *, void *, void *);
+
+typedef void * (WINAPI *PRTL_GENERIC_ALLOCATE_ROUTINE)(struct _RTL_GENERIC_TABLE *, LONG);
+
+typedef void (WINAPI *PRTL_GENERIC_FREE_ROUTINE)(struct _RTL_GENERIC_TABLE *Table, void *);
+
+typedef struct _RTL_GENERIC_TABLE {
+    PRTL_SPLAY_LINKS TableRoot;
+    LIST_ENTRY InsertOrderList;
+    LIST_ENTRY *OrderedPointer;
+    ULONG WhichOrderedElement;
+    ULONG NumberGenericTableElements;
+    PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
+    PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
+    PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
+    void *TableContext;
+} RTL_GENERIC_TABLE;
+typedef RTL_GENERIC_TABLE *PRTL_GENERIC_TABLE;
+
 typedef struct _RTL_BALANCED_LINKS {
     struct _RTL_BALANCED_LINKS *Parent;
     struct _RTL_BALANCED_LINKS *LeftChild;
@@ -157,12 +191,6 @@ typedef RTL_BALANCED_LINKS *PRTL_BALANCED_LINKS;
 
 struct _RTL_AVL_TABLE;
 
-typedef enum _RTL_GENERIC_COMPARE_RESULTS {
-    GenericLessThan,
-    GenericGreaterThan,
-    GenericEqual
-} RTL_GENERIC_COMPARE_RESULTS;
-
 typedef RTL_GENERIC_COMPARE_RESULTS (WINAPI *PRTL_AVL_COMPARE_ROUTINE)(struct _RTL_AVL_TABLE *, void *, void *);
 
 typedef void * (WINAPI *PRTL_AVL_ALLOCATE_ROUTINE)(struct _RTL_AVL_TABLE *, LONG);
-- 
2.27.0




More information about the wine-devel mailing list