Author: ion
Date: Mon Oct 16 07:39:49 2006
New Revision: 24542
URL:
http://svn.reactos.org/svn/reactos?rev=24542&view=rev
Log:
- Implement RtlIsGenericTableEmpty, RtlNumberGenericTableElements.
- Implement RtlLookupElementGenericTable.
- Implement RtlDeleteElementGenericTable
Modified:
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/lib/rtl/generictable.c
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h Mon Oct 16 07:39:49 2006
@@ -2533,6 +2533,15 @@
IN PRTL_GENERIC_TABLE Table
);
+PVOID
+NTAPI
+RtlLookupElementGenericTableFull(
+ IN PRTL_GENERIC_TABLE Table,
+ IN PVOID Buffer,
+ OUT PVOID *NodeOrParent,
+ OUT TABLE_SEARCH_RESULT *SearchResult
+);
+
//
// Handle Table Functions
//
Modified: trunk/reactos/lib/rtl/generictable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/generictable.c?rev…
==============================================================================
--- trunk/reactos/lib/rtl/generictable.c (original)
+++ trunk/reactos/lib/rtl/generictable.c Mon Oct 16 07:39:49 2006
@@ -115,7 +115,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
PVOID
NTAPI
@@ -140,7 +140,7 @@
}
/*
- * @unimplemented
+ * @implemented
*/
PVOID
NTAPI
@@ -218,14 +218,14 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOLEAN
NTAPI
RtlIsGenericTableEmpty(IN PRTL_GENERIC_TABLE Table)
{
- UNIMPLEMENTED;
- return FALSE;
+ /* Check if the table root is empty */
+ return (Table->TableRoot) ? FALSE: TRUE;
}
/*
@@ -235,19 +235,26 @@
NTAPI
RtlNumberGenericTableElements(IN PRTL_GENERIC_TABLE Table)
{
+ /* Return the number of elements */
return Table->NumberGenericTableElements;
}
/*
- * @unimplemented
+ * @implemented
*/
PVOID
NTAPI
RtlLookupElementGenericTable(IN PRTL_GENERIC_TABLE Table,
IN PVOID Buffer)
{
- UNIMPLEMENTED;
- return 0;
+ PRTL_SPLAY_LINKS NodeOrParent;
+ TABLE_SEARCH_RESULT Result;
+
+ /* Call the full version */
+ return RtlLookupElementGenericTableFull(Table,
+ Buffer,
+ &NodeOrParent,
+ &Result);
}
/*
@@ -265,15 +272,36 @@
}
/*
- * @unimplemented
+ * @implemented
*/
BOOLEAN
NTAPI
RtlDeleteElementGenericTable(IN PRTL_GENERIC_TABLE Table,
IN PVOID Buffer)
{
- UNIMPLEMENTED;
- return FALSE;
+ PRTL_SPLAY_LINKS NodeOrParent;
+ TABLE_SEARCH_RESULT Result;
+
+ /* Get the splay links and table search result immediately */
+ Result = RtlpFindGenericTableNodeOrParent(Table, Buffer, &NodeOrParent);
+ if ((Result == TableEmptyTree) || (Result != TableFoundNode))
+ {
+ /* Nothing to delete */
+ return FALSE;
+ }
+
+ /* Delete the entry */
+ Table->TableRoot = RtlDelete(NodeOrParent);
+ RemoveEntryList(&((PTABLE_ENTRY_HEADER)NodeOrParent)->ListEntry);
+
+ /* Update accounting data */
+ Table->NumberGenericTableElements--;
+ Table->WhichOrderedElement = 0;
+ Table->OrderedPointer = &Table->InsertOrderList;
+
+ /* Free the entry */
+ Table->FreeRoutine(Table, NodeOrParent);
+ return TRUE;
}
/*