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 function revokes a registered IMallocSpyobject.

Syntax

HRESULT CoRevokeMallocSpy( );

Parameters

None.

Return Value

S_OK

The IMallocSpyobject is successfully revoked.

CO_E_OBJNOTREG

No spy is currently registered.

E_ACCESSDENIED

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

Remarks

The IMallocSpyobject is released when it is revoked. This release corresponds to the call to IUnknown::AddRefin the implementation of the QueryInterfacefunction by the CoRegisterMallocSpyfunction. The implementation of the IMallocSpyinterface 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, CoRevokeMallocSpynotes internally that a revoke is pending.

When the outstanding allocations have been freed, the revoke proceeds automatically, releasing the IMallocSpyobject. Thus, it is necessary to call CoRevokeMallocSpyonly once for each call to CoRegisterMallocSpy, even if E_ACCESSDENIED is returned.

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

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also