diff --git a/2.x/trunk/phlib/bintree.c b/2.x/trunk/phlib/bintree.c index 78c30db35..fccd1643c 100644 --- a/2.x/trunk/phlib/bintree.c +++ b/2.x/trunk/phlib/bintree.c @@ -30,6 +30,7 @@ VOID PhInitializeBinaryTree( Tree->Root.Parent = NULL; Tree->Root.Left = NULL; Tree->Root.Right = NULL; + Tree->Count = 0; Tree->CompareFunction = CompareFunction; } @@ -113,6 +114,8 @@ PPH_BINARY_LINKS PhBinaryTreeAdd( Subject->Left = NULL; Subject->Right = NULL; + Tree->Count++; + return NULL; } @@ -170,6 +173,8 @@ VOID PhBinaryTreeRemove( if (child->Right) child->Right->Parent = child; } + + Tree->Count--; } PPH_BINARY_LINKS PhBinaryTreeSearch( @@ -197,6 +202,8 @@ VOID PhInitializeAvlTree( Tree->Root.Left = NULL; Tree->Root.Right = NULL; Tree->Root.Balance = 0; + Tree->Count = 0; + Tree->CompareFunction = CompareFunction; } @@ -709,6 +716,8 @@ PPH_AVL_LINKS PhAvlTreeAdd( } } + Tree->Count++; + return NULL; } @@ -829,6 +838,8 @@ VOID PhAvlTreeRemove( if (newSubject->Right) newSubject->Right->Parent = newSubject; } + + Tree->Count--; } PPH_AVL_LINKS PhAvlTreeSearch( diff --git a/2.x/trunk/phlib/include/phbase.h b/2.x/trunk/phlib/include/phbase.h index 6fe34783b..5fc22a009 100644 --- a/2.x/trunk/phlib/include/phbase.h +++ b/2.x/trunk/phlib/include/phbase.h @@ -1810,6 +1810,8 @@ typedef INT (NTAPI *PPH_BINARY_TREE_COMPARE_FUNCTION)( typedef struct _PH_BINARY_TREE { PH_BINARY_LINKS Root; // Right contains real root + ULONG Count; + PPH_BINARY_TREE_COMPARE_FUNCTION CompareFunction; } PH_BINARY_TREE, *PPH_BINARY_TREE; @@ -1851,6 +1853,8 @@ typedef INT (NTAPI *PPH_AVL_TREE_COMPARE_FUNCTION)( typedef struct _PH_AVL_TREE { PH_AVL_LINKS Root; // Right contains real root + ULONG Count; + PPH_AVL_TREE_COMPARE_FUNCTION CompareFunction; } PH_AVL_TREE, *PPH_AVL_TREE;