This method is called just before invoking the IMalloc::Alloc method.
ULONG PreRealloc( void* pRequest, ULONG cbRequest, void** ppNewRequest, BOOL fSpyed );
- [in] Pointer specified in the original call to the IMalloc::Realloc method, indicating the memory block to be reallocated.
- [in] Memory block's byte count as specified in the original call to IMalloc::Realloc.
- [out] Address of pointer variable that receives a pointer to the actual memory block to be reallocated. This may be different from the pointer in pRequest if the implementation of IMallocSpy::PreRealloc extends or modifies the reallocation. This is an out pointer and should always be stored by PreRealloc.
- [in] TRUE if the original allocation was done while the spy was active, otherwise FALSE.
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 zero, 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 zero.
To determine whether the platform supports this interface, see Determining Supported COM APIs.
OS Versions: Windows CE 3.0 and later.
Header: Objidl.h, Objidl.idl.
Link Library: Ole32.lib
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.