mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 21:56:40 +00:00
Oriol Pique <oripipa@yahoo.es>
- Minor patch to HEAP_GetPtr to include magic value in debug output. - Fixing the parameters checking in HEAP_InitSubHeap (it is currently not used - put between #if 0 / #endif ). - Correcting HEAP_FindFreeBlock which was logging error message as warning (while still returning NULL to caller) by changing severity of logged message. - Implementing RtlEnumProcessHeaps (previously stubbed out). - Fixing sanity checks in and implementation of RtlGetProcessHeaps (previously the function was not checking for the counter value, and also was not assigning anything to the returned value; now this seems to be corrected. - Fixing RtlValidateProcessHeaps implementation (the function was stubbed out because (most probably, I wasn't able to find a bug mentioning this) it was previously using a global lock for all heaps (which probably could cause some problems in the kernel), now it only locks heaps belonging to the given process - and this is the correct behaviour. Aleksey Bragin <aleksey@reactos.org> - Fix typo in ntuser.c, and low severity of debug message. See issue #2964 for more details. svn path=/trunk/; revision=33945
This commit is contained in:
parent
fd13a6484a
commit
3da8a2640d
|
@ -335,7 +335,8 @@ static HEAP *HEAP_GetPtr(
|
||||||
HEAP *heapPtr = (HEAP *)heap;
|
HEAP *heapPtr = (HEAP *)heap;
|
||||||
if (!heapPtr || (heapPtr->magic != HEAP_MAGIC))
|
if (!heapPtr || (heapPtr->magic != HEAP_MAGIC))
|
||||||
{
|
{
|
||||||
ERR("Invalid heap %p!\n", heap );
|
ERR("Invalid heap %p, magic:%4s!\n", heap,heapPtr->magic );
|
||||||
|
//KeDumpStackFrames(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (TRACE_ON(heap) && !HEAP_IsRealArena( heapPtr, 0, NULL, NOISY ))
|
if (TRACE_ON(heap) && !HEAP_IsRealArena( heapPtr, 0, NULL, NOISY ))
|
||||||
|
@ -595,8 +596,8 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
|
||||||
int i;
|
int i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
if (ZwAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
|
if (address==NULL && ZwAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
|
||||||
&commitSize, MEM_COMMIT, PAGE_READWRITE ))
|
&commitSize, MEM_COMMIT, PAGE_READWRITE ))
|
||||||
{
|
{
|
||||||
WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
|
WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
|
||||||
|
@ -775,7 +776,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
|
||||||
|
|
||||||
if (!(heap->flags & HEAP_GROWABLE))
|
if (!(heap->flags & HEAP_GROWABLE))
|
||||||
{
|
{
|
||||||
WARN("Not enough space in heap %p for %08lx bytes\n", heap, size );
|
ERR("Not enough space in heap %p for %08lx bytes\n", heap, size );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* make sure that we have a big enough size *committed* to fit another
|
/* make sure that we have a big enough size *committed* to fit another
|
||||||
|
@ -1595,26 +1596,23 @@ NTSTATUS NTAPI
|
||||||
RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE HeapEnumerationRoutine,
|
RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE HeapEnumerationRoutine,
|
||||||
PVOID lParam)
|
PVOID lParam)
|
||||||
{
|
{
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
#if 1
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DbgBreakPoint();
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
#if 0
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
HEAP** pptr;
|
|
||||||
|
|
||||||
RtlEnterHeapLock(&RtlpProcessHeapsListLock);
|
struct list *ptr=NULL;
|
||||||
|
RtlEnterHeapLock(&processHeap->critSection);
|
||||||
for (pptr = (HEAP**)&NtCurrentPeb()->ProcessHeaps; *pptr; pptr = &(*pptr)->next)
|
Status=HeapEnumerationRoutine(processHeap,lParam);
|
||||||
|
LIST_FOR_EACH( ptr, &processHeap->entry )
|
||||||
{
|
{
|
||||||
Status = HeapEnumerationRoutine(*pptr,lParam);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
Status = HeapEnumerationRoutine(ptr,lParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlLeaveHeapLock(&RtlpProcessHeapsListLock);
|
|
||||||
|
RtlLeaveHeapLock(&processHeap->critSection);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1630,17 +1628,26 @@ RtlGetProcessHeaps(ULONG count,
|
||||||
{
|
{
|
||||||
ULONG total = 1; /* main heap */
|
ULONG total = 1; /* main heap */
|
||||||
struct list *ptr;
|
struct list *ptr;
|
||||||
|
ULONG i=0;
|
||||||
RtlEnterHeapLock( &processHeap->critSection );
|
RtlEnterHeapLock( &processHeap->critSection );
|
||||||
LIST_FOR_EACH( ptr, &processHeap->entry ) total++;
|
LIST_FOR_EACH( ptr, &processHeap->entry ) total++;
|
||||||
if (total <= count)
|
//if (total <= count)
|
||||||
{
|
{
|
||||||
*heaps++ = processHeap;
|
*(heaps++) = processHeap;
|
||||||
|
i++;
|
||||||
LIST_FOR_EACH( ptr, &processHeap->entry )
|
LIST_FOR_EACH( ptr, &processHeap->entry )
|
||||||
*heaps++ = LIST_ENTRY( ptr, HEAP, entry );
|
{
|
||||||
|
if(i>=count)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
*(heaps++) = LIST_ENTRY( ptr, HEAP, entry );
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RtlLeaveHeapLock( &processHeap->critSection );
|
RtlLeaveHeapLock( &processHeap->critSection );
|
||||||
return total;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1650,19 +1657,15 @@ RtlGetProcessHeaps(ULONG count,
|
||||||
BOOLEAN NTAPI
|
BOOLEAN NTAPI
|
||||||
RtlValidateProcessHeaps(VOID)
|
RtlValidateProcessHeaps(VOID)
|
||||||
{
|
{
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
#if 1
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DPRINT1("UNIMPLEMENTED\n");
|
|
||||||
DbgBreakPoint();
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
#if 0
|
|
||||||
BOOLEAN Result = TRUE;
|
BOOLEAN Result = TRUE;
|
||||||
HEAP ** pptr;
|
HEAP ** pptr;
|
||||||
|
|
||||||
RtlEnterHeapLock(&RtlpProcessHeapsListLock);
|
|
||||||
|
|
||||||
for (pptr = (HEAP**)&NtCurrentPeb()->ProcessHeaps; *pptr; pptr = &(*pptr)->next)
|
RtlEnterHeapLock( &processHeap->critSection );
|
||||||
|
|
||||||
|
for (pptr = (HEAP**)&NtCurrentPeb()->ProcessHeaps; *pptr; pptr++)
|
||||||
{
|
{
|
||||||
if (!RtlValidateHeap(*pptr, 0, NULL))
|
if (!RtlValidateHeap(*pptr, 0, NULL))
|
||||||
{
|
{
|
||||||
|
@ -1671,8 +1674,8 @@ RtlValidateProcessHeaps(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlLeaveHeapLock (&RtlpProcessHeapsListLock);
|
|
||||||
|
|
||||||
|
RtlLeaveHeapLock( &processHeap->critSection );
|
||||||
return Result;
|
return Result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ NTSTATUS FASTCALL InitUserImpl(VOID)
|
||||||
if (gpsi)
|
if (gpsi)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(gpsi, sizeof(SERVERINFO));
|
RtlZeroMemory(gpsi, sizeof(SERVERINFO));
|
||||||
DPRINT1("Gloabal Server Data -> %x\n", gpsi);
|
DPRINT("Global Server Data -> %x\n", gpsi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue