Called just before invoking IMalloc::Alloc.
ULONG PreRealloc(
void * pRequest, //Pointer the caller is passing to
//IMalloc::Realloc
ULONG cbRequest, //Byte count the caller is passing to
//IMalloc::Realloc
void ** ppNewRequest,
//Address of output variable that receives a
//pointer to the requested memory block to be
//reallocated
BOOL fSpyed //Whether the original allocation was "spyed"
);
The actual byte count to be passed to IMalloc::Realloc.
The IMallocSpy::PreRealloc implementation may extend and/or modify the allocation to store debug-specific information with the allocation. Thus, the ppNewRequest parameter may differ from pRequest, a pointer to the request specified in the original call to IMalloc::Realloc.
PreRealloc can force memory allocation failure by returning 0, allowing testing to ensure that the application handles allocation failure gracefully in all cases. In this case, PostRealloc is not called and Realloc returns NULL. However, if IMalloc::Realloc encounters a real memory failure and returns NULL, PostRealloc is called. Forcing allocation failure is effective only if cbRequest is not equal to 0.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IMalloc::Realloc, IMallocSpy::PostRealloc, CoRegisterMallocSpy, CoRevokeMallocSpy