Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method is called just before invoking the IMalloc::Allocmethod.

Syntax

ULONG PreRealloc(
  void* 
pRequest, 
  ULONG 
cbRequest, 
  void** 
ppNewRequest, 
  BOOL 
fSpyed 
);

Parameters

pRequest

[in] Pointer specified in the original call to the IMalloc::Reallocmethod, indicating the memory block to be reallocated.

cbRequest

[in] Memory block's byte count as specified in the original call to IMalloc::Realloc.

ppNewRequest

[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 pRequestif the implementation of IMallocSpy::PreReallocextends or modifies the reallocation. This is an out pointer and should always be stored by PreRealloc.

fSpyed

[in] TRUE if the original allocation was done while the spy was active, otherwise FALSE.

Return Value

The actual byte count to be passed to IMalloc::Realloc.

Remarks

The IMallocSpy::PreReallocimplementation may extend and/or modify the allocation to store debug-specific information with the allocation. Thus, the ppNewRequestparameter may differ from pRequest, a pointer to the request specified in the original call to IMalloc::Realloc.

PreRealloccan force memory allocation failure by returning zero, allowing testing to ensure that the application handles allocation failure gracefully in all cases.

In this case, PostReallocis not called and Reallocreturns NULL. However, if IMalloc::Reallocencounters a real memory failure and returns NULL, PostReallocis called.

Forcing allocation failure is effective only if cbRequestis not equal to zero.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also