[ros-dev] heap.c

Aleksey Bragin aleksey at reactos.org
Sun Jan 13 18:43:29 CET 2008


Hi,
please provide a patch in a unified diff format (preferably submit it  
to www.reactos.org/bugzilla for faster reviewing/commit process).

WBR,
Aleksey Bragin.

On Jan 13, 2008, at 6:11 PM, Oriol wrote:

> here's the implementation and some corrections of some unimplemented
> functions at lib/rtl/heap.c
>
> NTSTATUS NTAPI
> RtlEnumProcessHeaps(PHEAP_ENUMERATION_ROUTINE HeapEnumerationRoutine,
>                     PVOID lParam)
> {
>
> #if 1
>    NTSTATUS Status = STATUS_SUCCESS;
>
>    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);
>
>       }
>
>
>    RtlLeaveHeapLock(&processHeap->critSection);
>
>    return Status;
> #endif
> }
>
>
> /*
>  * @implemented
>  */
> ULONG NTAPI
> RtlGetProcessHeaps(ULONG count,
>                    HANDLE *heaps )
> {
>     ULONG total = 1;  /* main heap */
>     struct list *ptr;
>     ULONG i=0;
>     RtlEnterHeapLock( &processHeap->critSection );
>     LIST_FOR_EACH( ptr, &processHeap->entry ) total++;
>     //if (total <= count)
>     {
>         *(heaps++) = processHeap;
>         i++;
>         LIST_FOR_EACH( ptr, &processHeap->entry )
>         {
>             if(i>=count)
>             {
>                 break;
>             }
>             i++;
>             *(heaps++) = LIST_ENTRY( ptr, HEAP, entry );
>
>         }
>     }
>     RtlLeaveHeapLock( &processHeap->critSection );
>     return i;
> }
>
>
> /*
>  * @implemented
>  */
> BOOLEAN NTAPI
> RtlValidateProcessHeaps(VOID)
> {
>
> #if 1
>    BOOLEAN Result = TRUE;
>    HEAP ** pptr;
>
>
>    RtlEnterHeapLock( &processHeap->critSection );
>
>    for (pptr = (HEAP**)&NtCurrentPeb()->ProcessHeaps; *pptr; pptr++)
>    {
>       if (!RtlValidateHeap(*pptr, 0, NULL))
>       {
>          Result = FALSE;
>          break;
>       }
>    }
>
>
>     RtlLeaveHeapLock( &processHeap->critSection );
>    return Result;
> #endif
> }
>
> is it correct?
>
>
> 		
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev




More information about the Ros-dev mailing list