|
IMallocSpy::PreRealloc
Called just before invoking IMalloc::Alloc.
ULONG PreRealloc(
void * pRequest,
| //The pointer the caller is passing to IMalloc::Realloc
| ULONG cbRequest,
| //The byte count the caller is passing to IMalloc::Realloc
| void ** ppNewRequest,
| //Points to the actual pointer to be reallocated
| BOOL fSpyed
| //Whether the original allocation was "spyed"
|
Parameters
pRequest
The pointer the caller is passing to IMalloc::Realloc.
cbRequest
The byte count the caller is passing to IMalloc::Realloc.
ppNewRequest
[out] Points to the actual pointer 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.
fSpyed
TRUE if the original allocation was done while the spy was active.
Return Value
The actual byte count to be passed to IMalloc::Realloc.
Comments
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, which the caller is passing 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. Forcing allocation failure is effective only if cbRequest is not equal to 0. Note that if PreRealloc is forcing failure by returning NULL, PostRealloc is not called. However, if IMalloc::Realloc encounters a real memory failure and returns NULL, PostRealloc is called.
See Also
IMalloc::Realloc, IMallocSpy::PostRealloc, CoRegisterMallocSpy, CoRevokeMallocSpy
Related LinksSoftware for Delphi and C++ Builder developers Software for Visual Studio .NET developers Software for Visual Basic 6 developers Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps Win32 Programmer's Reference (win32.hlp) Win32 Multimedia Programmer's Reference (mmedia.hlp) Microsoft Windows Pen API Programmer's Reference (penapi.hlp) Microsoft Windows Sockets 2 Reference (sock2.hlp) Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp) Unix Manual Pages
|