Skip to content

Latest commit

 

History

History
115 lines (90 loc) · 4.33 KB

nf-objbase-coregistermallocspy.md

File metadata and controls

115 lines (90 loc) · 4.33 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:objbase.CoRegisterMallocSpy
CoRegisterMallocSpy function (objbase.h)
Registers an implementation of the IMallocSpy interface, thereafter requiring OLE to call its wrapper methods around every call to the corresponding IMalloc method.
CoRegisterMallocSpy
CoRegisterMallocSpy function [COM]
_com_CoRegisterMallocSpy
com.coregistermallocspy
objbase/CoRegisterMallocSpy
com\coregistermallocspy.htm
com
28623c1f-e158-4cc5-8c7f-c13d7a65aa76
12/05/2018
CoRegisterMallocSpy, CoRegisterMallocSpy function [COM], _com_CoRegisterMallocSpy, com.coregistermallocspy, objbase/CoRegisterMallocSpy
objbase.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Ole32.lib
Ole32.dll
Windows
19H1
CoRegisterMallocSpy
objbase/CoRegisterMallocSpy
c++
APIRef
kbSyntax
DllExport
Ole32.dll
API-MS-Win-Core-Com-private-l1-1-0.dll
ComBase.dll
API-MS-Win-Core-COM-Private-l1-1-1.dll
CoRegisterMallocSpy

CoRegisterMallocSpy function

-description

Registers an implementation of the IMallocSpy interface, thereafter requiring OLE to call its wrapper methods around every call to the corresponding IMalloc method.

-parameters

-param pMallocSpy [in]

A pointer to an instance of the IMallocSpy implementation.

-returns

This function can return the standard return value E_INVALIDARG, as well as the following values.

Return code Description
S_OK
The object was successfully registered.
CO_E_OBJISREG
The object is already registered.

-remarks

The CoRegisterMallocSpy function registers the IMallocSpy object, which is used to debug calls to IMalloc methods. The function calls QueryInterface on the pointer pMallocSpy for the interface IID_IMallocSpy. This is to ensure that pMallocSpy really points to an implementation of IMallocSpy. By the rules of OLE, it is expected that a successful call to QueryInterface has added a reference (through the AddRef method) to the IMallocSpy object. That is, CoRegisterMallocSpy does not directly call AddRef on pMallocSpy, but fully expects that the QueryInterface call will.

When the IMallocSpy object is registered, whenever there is a call to one of the IMalloc methods, OLE first calls the corresponding IMallocSpy pre-method. Then, after executing the IMalloc method, OLE calls the corresponding IMallocSpy post-method. For example, whenever there is a call to IMalloc::Alloc, from whatever source, OLE calls IMallocSpy::PreAlloc, calls Alloc, and after that allocation is completed, calls IMallocSpy::PostAlloc.

-see-also

CoGetMalloc

CoRevokeMallocSpy

IMallocSpy