Howto initialize a private (not registred) interface?
Hello all,
My application is a plugin module (DLL) which loads a PDB file and
analyze it with the help of interfaces in Visual Studio DIA SDK
(msdia.dll). The plugin is implemented in ATL but is not a COM server
and it must not be (at least not registred). Using the DIA SDK
interfaces with smart pointers is no problem, but there is one
interface which is just a stub - IDiaLoadCallback2. So, this interface
must be implemented by the plugin. IDiaLoadCallback2 allows you to
control where to find the debug database. I did it as an ATL simple
object like this:
class ATL_NO_VTABLE CCallback :
public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
public ATL::CComCoClass<CCallback, &__uuidof(IDiaLoadCallback2)>,
public ISupportErrorInfo,
public IDiaLoadCallback2
{
...
BEGIN_COM_MAP(CCallback)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IDiaLoadCallback2)
END_COM_MAP()
...
};
OBJECT_ENTRY_AUTO(__uuidof(IDiaLoadCallback2), CCallback)
The plugin start routine initialize the DIA SDK interfaces like this:
ATL::CComPtr<IDiaDataSource> m_pDiaDataSource;
hr = m_pDiaDataSource.CoCreateInstance(__uuidof(DiaSource), NULL,
CLSCTX_INPROC_SERVER);
=> hr = S_OK
CCallback* m_pCallback;
hr = m_pDiaDataSource->QueryInterface(__uuidof(IDiaLoadCallback2),
(void**)&m_pCallback);
=> error: hr = E_NOINTERFACE
How to do this?
I don't want to register CCallback, just use it as a private
interface.
Thanks
Jerker B=E4ck