mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
added free list support to PH_LIST and PH_HASHTABLE
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3201 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -103,6 +103,8 @@ static ULONG PhpPrimeNumbers[] =
|
||||
*/
|
||||
BOOLEAN PhInitializeBase()
|
||||
{
|
||||
PH_OBJECT_TYPE_PARAMETERS parameters;
|
||||
|
||||
if (!NT_SUCCESS(PhCreateObjectType(
|
||||
&PhStringType,
|
||||
L"String",
|
||||
@@ -119,11 +121,15 @@ BOOLEAN PhInitializeBase()
|
||||
)))
|
||||
return FALSE;
|
||||
|
||||
if (!NT_SUCCESS(PhCreateObjectType(
|
||||
parameters.FreeListSize = sizeof(PH_LIST);
|
||||
parameters.FreeListCount = 128;
|
||||
|
||||
if (!NT_SUCCESS(PhCreateObjectTypeEx(
|
||||
&PhListType,
|
||||
L"List",
|
||||
0,
|
||||
PhpListDeleteProcedure
|
||||
PHOBJTYPE_USE_FREE_LIST,
|
||||
PhpListDeleteProcedure,
|
||||
¶meters
|
||||
)))
|
||||
return FALSE;
|
||||
|
||||
@@ -143,11 +149,15 @@ BOOLEAN PhInitializeBase()
|
||||
)))
|
||||
return FALSE;
|
||||
|
||||
if (!NT_SUCCESS(PhCreateObjectType(
|
||||
parameters.FreeListSize = sizeof(PH_HASHTABLE);
|
||||
parameters.FreeListCount = 64;
|
||||
|
||||
if (!NT_SUCCESS(PhCreateObjectTypeEx(
|
||||
&PhHashtableType,
|
||||
L"Hashtable",
|
||||
0,
|
||||
PhpHashtableDeleteProcedure
|
||||
PHOBJTYPE_USE_FREE_LIST,
|
||||
PhpHashtableDeleteProcedure,
|
||||
¶meters
|
||||
)))
|
||||
return FALSE;
|
||||
|
||||
|
||||
@@ -575,10 +575,10 @@ PPH_OBJECT_HEADER PhpAllocateObject(
|
||||
if (ObjectType->Flags & PHOBJTYPE_USE_FREE_LIST)
|
||||
{
|
||||
#ifdef PHOBJ_STRICT_CHECKS
|
||||
if (ObjectType->FreeList.Size != ObjectSize)
|
||||
if (ObjectType->FreeList.Size != PhpAddObjectHeaderSize(ObjectSize))
|
||||
PhRaiseStatus(STATUS_INVALID_PARAMETER);
|
||||
#else
|
||||
assert(ObjectType->FreeList.Size == ObjectSize);
|
||||
assert(ObjectType->FreeList.Size == PhpAddObjectHeaderSize(ObjectSize));
|
||||
#endif
|
||||
|
||||
objectHeader = PhAllocateFromFreeList(&ObjectType->FreeList);
|
||||
|
||||
Reference in New Issue
Block a user