ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

static LPVOID WINAPI IMalloc_fnRealloc ( LPMALLOC  iface,
LPVOID  pv,
DWORD  cb 
) [static]

Definition at line 201 of file ifs.c.

                                                                          {

    LPVOID pNewMemory;

    TRACE("(%p,%d)\n",pv,cb);

    if(Malloc32.pSpy) {
        LPVOID pRealMemory;
        BOOL fSpyed;

        EnterCriticalSection(&IMalloc32_SpyCS);
            fSpyed = RemoveMemoryLocation(pv);
            cb = IMallocSpy_PreRealloc(Malloc32.pSpy, pv, cb, &pRealMemory, fSpyed);

        /* check if can release the spy */
        if(Malloc32.SpyReleasePending && !Malloc32.SpyedAllocationsLeft) {
            IMallocSpy_Release(Malloc32.pSpy);
        Malloc32.SpyReleasePending = FALSE;
        Malloc32.pSpy = NULL;
        }

        if (0==cb) {
            /* PreRealloc can force Realloc to fail */
                LeaveCriticalSection(&IMalloc32_SpyCS);
        return NULL;
        }
        pv = pRealMemory;
    }

        if (!pv) pNewMemory = HeapAlloc(GetProcessHeap(),0,cb);
    else if (cb) pNewMemory = HeapReAlloc(GetProcessHeap(),0,pv,cb);
    else {
        HeapFree(GetProcessHeap(),0,pv);
        pNewMemory = NULL;
    }

    if(Malloc32.pSpy) {
        pNewMemory = IMallocSpy_PostRealloc(Malloc32.pSpy, pNewMemory, TRUE);
        if (pNewMemory) AddMemoryLocation(pNewMemory);
            LeaveCriticalSection(&IMalloc32_SpyCS);
    }

    TRACE("--(%p)\n",pNewMemory);
    return pNewMemory;
}

Generated on Sun May 27 2012 05:15:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.