diff --git a/reactos/ntoskrnl/mm/dbgpool.c b/reactos/ntoskrnl/mm/dbgpool.c index 7eda0c56cdd..eec11bec19e 100644 --- a/reactos/ntoskrnl/mm/dbgpool.c +++ b/reactos/ntoskrnl/mm/dbgpool.c @@ -24,12 +24,23 @@ BOOLEAN NTAPI ExpIsPoolTagDebuggable(ULONG Tag) { +#if 0 if (Tag == TAG('C', 'a', 'l', 'l')) return FALSE; if (Tag == TAG('D', 'r', 'i', 'v')) return FALSE; if (Tag == TAG('D', 'e', 'v', 'i')) return FALSE; if (Tag == TAG('A', 'd', 'a', 'p')) return FALSE; - return FALSE;//TRUE; + if (Tag == TAG('S', 'e', 'S', 'd')) return FALSE; + if (Tag == TAG('O', 'b', 'D', 'i')) return FALSE; + if (Tag == TAG('O', 'b', 'N', 'm')) return FALSE; + if (Tag == TAG('O', 'b', 'N', 'D')) return FALSE; + if (Tag == TAG('O', 'b', 't', 'b')) return FALSE; + if (Tag == TAG('O', 'b', 'S', 'c')) return FALSE; + //if (Tag == TAG('S', 'e', 'S', 'i')) return FALSE; + //if (Tag == TAG('S', 'e', 'A', 'c')) return FALSE; +#endif + + return TRUE; } @@ -37,12 +48,16 @@ PVOID NTAPI ExpAllocateDebugPool(POOL_TYPE Type, ULONG Size, ULONG Tag, PVOID Caller, BOOLEAN EndOfPage) { - ULONG UserSize = Size + sizeof(EI_WHOLE_PAGE_HEADER); - ULONG TotalSize = UserSize + 2*PAGE_SIZE; + ULONG UserSize, TotalSize, AlignedSize; ULONG_PTR UserData, GuardArea; PEI_WHOLE_PAGE_HEADER Header; ULONG_PTR Buffer; + /* Calculate sizes */ + AlignedSize = ROUND_UP(Size, MM_POOL_ALIGNMENT); + UserSize = AlignedSize + sizeof(EI_WHOLE_PAGE_HEADER); + TotalSize = UserSize + 2*PAGE_SIZE; + /* Right now we support only end-of-page allocations */ ASSERT(EndOfPage); @@ -70,13 +85,13 @@ ExpAllocateDebugPool(POOL_TYPE Type, ULONG Size, ULONG Tag, PVOID Caller, BOOLEA GuardArea = PAGE_ROUND_DOWN(Buffer + TotalSize - PAGE_SIZE + 1); /* Calculate user data and header pointers */ - UserData = GuardArea - Size; + UserData = GuardArea - AlignedSize; Header = (PEI_WHOLE_PAGE_HEADER)(UserData - sizeof(EI_WHOLE_PAGE_HEADER)); /* Fill out the header */ Header->ActualAddress = (PVOID)Buffer; Header->Tag = Tag; - Header->Size = Size; + Header->Size = AlignedSize; /* Protect the guard page */ MmSetPageProtect(NULL, (PVOID)GuardArea, PAGE_NOACCESS);