IProcessDebugManager


The below code snip is self-explanatory.

 

#ifdef _WIN64

#define IProcessDebugManager IProcessDebugManager64

#define IID_IProcessDebugManager IID_IProcessDebugManager64

#else

#define IProcessDebugManager IProcessDebugManager32

#define IID_IProcessDebugManager IID_IProcessDebugManager32

#endif

 

If you write a native COM client that references IProcessDebugManager say using the code below, it runs fine; both the 32 bit as well as the 64 bit build.

 

    IProcessDebugManager *pdm = NULL;

 

    // Initialize COM

    CoInitialize(NULL);

 

    HRESULT hr = CoCreateInstance(CLSID_ProcessDebugManager, NULL,

              CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER

              | CLSCTX_LOCAL_SERVER,

              IID_IProcessDebugManager, (void **)&pdm);

 

It is to be noted that with 32 bit build IID_IProcessDebugManager32 is used and with 64 bit build IID_IProcessDebugManager64 is used. These are defined in the header file activdbg.h. These IID’s are defined as:

 

EXTERN_C const IID IID_IProcessDebugManager32;

 

#if defined(__cplusplus) && !defined(CINTERFACE)

   

    MIDL_INTERFACE("51973C2f-CB0C-11d0-B5C9-00A0244A0E7A")

    IProcessDebugManager32 : public IUnknown

    {

    public:

        virtual HRESULT STDMETHODCALLTYPE CreateApplication(

            /* [out] */ IDebugApplication32 **ppda) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE GetDefaultApplication(

            /* [out] */ IDebugApplication32 **ppda) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE AddApplication(

            /* [in] */ IDebugApplication32 *pda,

            /* [out] */ DWORD *pdwAppCookie) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE RemoveApplication(

            /* [in] */ DWORD dwAppCookie) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE CreateDebugDocumentHelper(

            /* [in] */ IUnknown *punkOuter,

            /* [out] */ IDebugDocumentHelper32 **pddh) = 0;

       

    };

 

And

 

EXTERN_C const IID IID_IProcessDebugManager64;

 

#if defined(__cplusplus) && !defined(CINTERFACE)

   

    MIDL_INTERFACE("56b9fc1c-63a9-4cc1-ac21-087d69a17fab")

    IProcessDebugManager64 : public IUnknown

    {

    public:

        virtual HRESULT STDMETHODCALLTYPE CreateApplication(

            /* [out] */ IDebugApplication64 **ppda) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE GetDefaultApplication(

            /* [out] */ IDebugApplication64 **ppda) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE AddApplication(

            /* [in] */ IDebugApplication64 *pda,

            /* [out] */ DWORD *pdwAppCookie) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE RemoveApplication(

            /* [in] */ DWORD dwAppCookie) = 0;

       

        virtual HRESULT STDMETHODCALLTYPE CreateDebugDocumentHelper(

            /* [in] */ IUnknown *punkOuter,

            /* [out] */ IDebugDocumentHelper64 **pddh) = 0;

       

    };

 

Please notice that both IID’s have different GUID’s even if the interface they define have the same methods. This information might be handy while developing managed COM clients.

Say if we write a 64 bit COM client referencing IID_IProcessDebugManager32 it will obviously fail with an exception saying “No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))”. To resolve this you might have to detect the process bit-ness and use the appropriate IID and the interface.

 

Written By
Shamik Misra
Support Escalation Engineer, Microsoft Developer Support


Comments (0)

Skip to main content