Export (0) Print
Expand All
COM
Expand Minimize

CoRevokeMallocSpy function

Revokes a registered IMallocSpy object.

Syntax


HRESULT CoRevokeMallocSpy(void);

Parameters

This function has no parameters.

Return value

This function can return the following values.

Return codeDescription
S_OK

The object was revoked successfully.

CO_E_OBJNOTREG

No spy is currently registered.

E_ACCESSDENIED

A spy is registered but there are outstanding allocations (not yet freed) made while this spy was active.

 

Remarks

The IMallocSpy object is released when it is revoked. This release corresponds to the call to IUnknown::AddRef in the implementation of the QueryInterface function by the CoRegisterMallocSpy function. The implementation of the IMallocSpy interface should then do any appropriate cleanup.

If the return code is E_ACCESSDENIED, there are still outstanding allocations that were made while the spy was active. In this case, the registered spy cannot be revoked at this time because it may have attached arbitrary headers and/or trailers to these allocations that only the spy knows about. Only the spy's PreFree (or PreRealloc) method knows how to account for these headers and trailers. Before returning E_ACCESSDENIED, CoRevokeMallocSpy notes internally that a revoke is pending. When the outstanding allocations have been freed, the revoke proceeds automatically, releasing the IMallocSpy object. Thus, it is necessary to call CoRevokeMallocSpy only once for each call to CoRegisterMallocSpy, even if E_ACCESSDENIED is returned.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CoRegisterMallocSpy
IMallocSpy

 

 

Community Additions

ADD
Show:
© 2014 Microsoft