IMallocSpy::PreGetSize  1QVX3VX

Called by OLE just prior to any call to IMalloc::GetSize65AX.OK.

void * PreGetSize(

    void * pRequest,

//Pointer the caller is passing to IMalloc::GetSize

    BOOL fSpyed

//TRUE if allocation was done while this spy was active

   );

 

 

Parameters

pRequest

[in] Pointer the caller is passing to IMalloc::GetSize65AX.OK.

fSpyed

[in] TRUE if the allocation was done while the spy was active.

 

Return Value

Pointer to the actual allocation for which the size is to be determined.

Remarks

The PreGetSize method receives as its pRequest parameter the pointer the caller is passing to IMalloc::GetSize65AX.OK. It must then return a pointer to the actual allocation, which may have altered pRequest in the implementation of either the PreAlloc or PreRealloc methods of IMallocSpy. The pointer to the true allocation is then passed to IMalloc::GetSize as its pv parameter.

IMalloc::GetSize then returns the size determined, and OLE passes this value to IMallocSpy::PostGetSize7BOOAT in cbActual.

 

Note  The size determined by IMalloc::GetSize65AX.OK is the value returned by the Win32 function HeapSize. On Windows NT, this is the size originally requested. On Windows 95, memory allocations are done on eight-byte boundaries. For example, a memory allocation request of 27 bytes on Windows NT would return an allocation of 32 bytes and GetSize would return 27. On Windows 95, the same request would return an allocation of 28 bytes and GetSize would return 28. Implementers of IMallocSpy::PostGetSize cannot assume, for example, that if cbActual is sizeof(debug_header), that the value is the actual size of the user s allocation.

 

See Also

IMalloc::GetSize, IMallocSpy::PostGetSize, CoRegisterMallocSpy, CoRevokeMallocSpy