HEAP *heapPtr = (HEAP *)heap;
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;
}
if (TRACE_ON(heap) && !HEAP_IsRealArena( heapPtr, 0, NULL, NOISY ))
int i;
NTSTATUS Status;
-#if 0
- if (ZwAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
+#if 1
+ if (address==NULL && ZwAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
&commitSize, MEM_COMMIT, PAGE_READWRITE ))
{
WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
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;
}
/* make sure that we have a big enough size *committed* to fit another
RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE HeapEnumerationRoutine,
PVOID lParam)
{
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DbgBreakPoint();
- return STATUS_SUCCESS;
-#if 0
+
+#if 1
NTSTATUS Status = STATUS_SUCCESS;
- HEAP** pptr;
- RtlEnterHeapLock(&RtlpProcessHeapsListLock);
+ struct list *ptr=NULL;
+ RtlEnterHeapLock(&processHeap->critSection);
+ Status=HeapEnumerationRoutine(processHeap,lParam);
+ LIST_FOR_EACH( ptr, &processHeap->entry )
+ {
+ if (!NT_SUCCESS(Status))
+ break;
+ Status = HeapEnumerationRoutine(ptr,lParam);
- for (pptr = (HEAP**)&NtCurrentPeb()->ProcessHeaps; *pptr; pptr = &(*pptr)->next)
- {
- Status = HeapEnumerationRoutine(*pptr,lParam);
- if (!NT_SUCCESS(Status))
- break;
- }
+ }
- RtlLeaveHeapLock(&RtlpProcessHeapsListLock);
+
+ RtlLeaveHeapLock(&processHeap->critSection);
return Status;
#endif
{
ULONG total = 1; /* main heap */
struct list *ptr;
-
+ ULONG i=0;
RtlEnterHeapLock( &processHeap->critSection );
LIST_FOR_EACH( ptr, &processHeap->entry ) total++;
- if (total <= count)
+ //if (total <= count)
{
- *heaps++ = processHeap;
+ *(heaps++) = processHeap;
+ i++;
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 );
- return total;
+ return i;
}
BOOLEAN NTAPI
RtlValidateProcessHeaps(VOID)
{
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DPRINT1("UNIMPLEMENTED\n");
- DbgBreakPoint();
- return STATUS_SUCCESS;
-#if 0
+
+#if 1
BOOLEAN Result = TRUE;
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))
{
}
}
- RtlLeaveHeapLock (&RtlpProcessHeapsListLock);
+ RtlLeaveHeapLock( &processHeap->critSection );
return Result;
#endif
}