ReactOS  0.4.15-dev-5461-g062a8f2
ATL::CComModule Class Reference

#include <atlbase.h>

Inheritance diagram for ATL::CComModule:
Collaboration diagram for ATL::CComModule:

Public Member Functions

 CComModule ()
 
 ~CComModule ()
 
HRESULT Init (_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
 
void Term ()
 
HRESULT GetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT RegisterServer (BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
 
HRESULT UnregisterServer (BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
 
HRESULT DllCanUnloadNow ()
 
HRESULT DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT DllRegisterServer (BOOL bRegTypeLib=TRUE)
 
HRESULT DllUnregisterServer (BOOL bUnRegTypeLib=TRUE)
 
- Public Member Functions inherited from ATL::CAtlModuleT< CComModule >
HRESULT RegisterServer (BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
 
HRESULT UnregisterServer (BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *pRegistrar)
 
- Public Member Functions inherited from ATL::CAtlModule
 CAtlModule ()
 
virtual LONG GetLockCount ()
 
virtual LONG Lock ()
 
virtual LONG Unlock ()
 
HRESULT WINAPI UpdateRegistryFromResource (LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 
HRESULT WINAPI UpdateRegistryFromResource (UINT nResID, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 

Public Attributes

_ATL_OBJMAP_ENTRYm_pObjMap
 
- Public Attributes inherited from ATL::_ATL_MODULE70
UINT cbSize
 
LONG m_nLockCnt
 
_ATL_TERMFUNC_ELEMm_pTermFuncs
 
CComCriticalSection m_csStaticDataInitAndTypeInfo
 

Additional Inherited Members

- Static Public Member Functions inherited from ATL::CAtlModuleT< CComModule >
static LPCOLESTR GetAppId ()
 
- Static Public Attributes inherited from ATL::CAtlModule
static GUID m_libid
 

Detailed Description

Definition at line 781 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComModule()

ATL::CComModule::CComModule ( )
inline

Definition at line 786 of file atlbase.h.

787  {
788  ATLASSERT(_pModule == NULL);
789  _pModule = this;
790  _pModule->m_pObjMap = NULL;
791  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define NULL
Definition: types.h:112

◆ ~CComModule()

ATL::CComModule::~CComModule ( )
inline

Definition at line 793 of file atlbase.h.

794  {
795  _pModule = NULL;
796  }
#define NULL
Definition: types.h:112

Member Function Documentation

◆ DllCanUnloadNow()

HRESULT ATL::CComModule::DllCanUnloadNow ( )
inline

Definition at line 929 of file atlbase.h.

930  {
931  if (GetLockCount() == 0)
932  return S_OK;
933  return S_FALSE;
934  }
virtual LONG GetLockCount()
Definition: atlbase.h:423
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:52

Referenced by DllCanUnloadNow().

◆ DllGetClassObject()

HRESULT ATL::CComModule::DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)
inline

Definition at line 936 of file atlbase.h.

937  {
938  return GetClassObject(rclsid, riid, ppv);
939  }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:839

Referenced by DllGetClassObject().

◆ DllRegisterServer()

HRESULT ATL::CComModule::DllRegisterServer ( BOOL  bRegTypeLib = TRUE)
inline

Definition at line 941 of file atlbase.h.

942  {
943  return RegisterServer(bRegTypeLib);
944  }
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:878

Referenced by DllRegisterServer().

◆ DllUnregisterServer()

HRESULT ATL::CComModule::DllUnregisterServer ( BOOL  bUnRegTypeLib = TRUE)
inline

Definition at line 946 of file atlbase.h.

947  {
948  return UnregisterServer(bUnRegTypeLib);
949  }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:903

Referenced by DllUnregisterServer().

◆ GetClassObject()

HRESULT ATL::CComModule::GetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)
inline

Definition at line 839 of file atlbase.h.

840  {
841  _ATL_OBJMAP_ENTRY *objectMapEntry;
842  HRESULT hResult;
843 
844  ATLASSERT(ppv != NULL);
845  if (ppv == NULL)
846  return E_POINTER;
847  *ppv = NULL;
848  hResult = S_OK;
849  if (m_pObjMap != NULL)
850  {
851  objectMapEntry = m_pObjMap;
852  while (objectMapEntry->pclsid != NULL)
853  {
854  if (objectMapEntry->pfnGetClassObject != NULL && InlineIsEqualGUID(rclsid, *objectMapEntry->pclsid) != FALSE)
855  {
856  if (objectMapEntry->pCF == NULL)
857  {
858  CComCritSecLock<CComCriticalSection> lock(_AtlComModule.m_csObjMap, true);
859 
860  if (objectMapEntry->pCF == NULL)
861  hResult = objectMapEntry->pfnGetClassObject(reinterpret_cast<void *>(objectMapEntry->pfnCreateInstance), IID_IUnknown, reinterpret_cast<LPVOID *>(&objectMapEntry->pCF));
862  }
863  if (objectMapEntry->pCF != NULL)
864  hResult = objectMapEntry->pCF->QueryInterface(riid, ppv);
865  break;
866  }
867  objectMapEntry++;
868  }
869  }
870  if (hResult == S_OK && *ppv == NULL)
871  {
872  // FIXME: call AtlComModuleGetClassObject
873  hResult = CLASS_E_CLASSNOTAVAILABLE;
874  }
875  return hResult;
876  }
IUnknown * pCF
Definition: atlbase.h:90
rwlock_t lock
Definition: tcpcore.h:1163
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
REFIID riid
Definition: precomp.h:44
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:784
_ATL_CREATORFUNC * pfnCreateInstance
Definition: atlbase.h:89
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
#define FALSE
Definition: types.h:117
const CLSID * pclsid
Definition: atlbase.h:86
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
_ATL_CREATORFUNC * pfnGetClassObject
Definition: atlbase.h:88
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define E_POINTER
Definition: winerror.h:2365
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:142

Referenced by DllGetClassObject().

◆ Init()

HRESULT ATL::CComModule::Init ( _ATL_OBJMAP_ENTRY p,
HINSTANCE  ,
const GUID plibid 
)
inline

Definition at line 798 of file atlbase.h.

799  {
800  _ATL_OBJMAP_ENTRY *objectMapEntry;
801 
802  if (plibid != NULL)
803  m_libid = *plibid;
804 
805  if (p != reinterpret_cast<_ATL_OBJMAP_ENTRY *>(-1))
806  {
807  m_pObjMap = p;
808  if (p != NULL)
809  {
810  objectMapEntry = p;
811  while (objectMapEntry->pclsid != NULL)
812  {
813  objectMapEntry->pfnObjectMain(true);
814  objectMapEntry++;
815  }
816  }
817  }
818  return S_OK;
819  }
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:784
const CLSID * pclsid
Definition: atlbase.h:86
static GUID m_libid
Definition: atlbase.h:413
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by DllMain(), if(), InitializeAtlModule(), and wWinMain().

◆ RegisterServer()

HRESULT ATL::CComModule::RegisterServer ( BOOL  bRegTypeLib = FALSE,
const CLSID pCLSID = NULL 
)
inline

Definition at line 878 of file atlbase.h.

879  {
880  _ATL_OBJMAP_ENTRY *objectMapEntry;
881  HRESULT hResult;
882 
883  hResult = S_OK;
884  objectMapEntry = m_pObjMap;
885  if (objectMapEntry != NULL)
886  {
887  while (objectMapEntry->pclsid != NULL)
888  {
889  if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
890  {
891  hResult = objectMapEntry->pfnUpdateRegistry(TRUE);
892  if (FAILED(hResult))
893  break;
894  }
895  objectMapEntry++;
896  }
897  }
898  if (SUCCEEDED(hResult))
899  hResult = CAtlModuleT<CComModule>::RegisterServer(bRegTypeLib, pCLSID);
900  return hResult;
901  }
#define TRUE
Definition: types.h:120
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:784
#define FALSE
Definition: types.h:117
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:597
if SUCCEEDED(hr)
const CLSID * pclsid
Definition: atlbase.h:86
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by DllRegisterServer().

◆ Term()

void ATL::CComModule::Term ( )
inline

Definition at line 821 of file atlbase.h.

822  {
823  _ATL_OBJMAP_ENTRY *objectMapEntry;
824 
825  if (m_pObjMap != NULL)
826  {
827  objectMapEntry = m_pObjMap;
828  while (objectMapEntry->pclsid != NULL)
829  {
830  if (objectMapEntry->pCF != NULL)
831  objectMapEntry->pCF->Release();
832  objectMapEntry->pCF = NULL;
833  objectMapEntry->pfnObjectMain(false);
834  objectMapEntry++;
835  }
836  }
837  }
IUnknown * pCF
Definition: atlbase.h:90
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:784
ULONG Release()
const CLSID * pclsid
Definition: atlbase.h:86
#define NULL
Definition: types.h:112

Referenced by DllMain(), InitializeAtlModule(), and wWinMain().

◆ UnregisterServer()

HRESULT ATL::CComModule::UnregisterServer ( BOOL  bUnRegTypeLib,
const CLSID pCLSID = NULL 
)
inline

Definition at line 903 of file atlbase.h.

904  {
905  _ATL_OBJMAP_ENTRY *objectMapEntry;
906  HRESULT hResult;
907 
908  hResult = S_OK;
909  objectMapEntry = m_pObjMap;
910  if (objectMapEntry != NULL)
911  {
912  while (objectMapEntry->pclsid != NULL)
913  {
914  if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
915  {
916  hResult = objectMapEntry->pfnUpdateRegistry(FALSE); //unregister
917  if (FAILED(hResult))
918  break;
919  }
920  objectMapEntry++;
921  }
922  }
923  if (SUCCEEDED(hResult))
924  hResult = CAtlModuleT<CComModule>::UnregisterServer(bUnRegTypeLib, pCLSID);
925 
926  return hResult;
927  }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:603
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:784
#define FALSE
Definition: types.h:117
if SUCCEEDED(hr)
const CLSID * pclsid
Definition: atlbase.h:86
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by DllUnregisterServer().

Member Data Documentation

◆ m_pObjMap

_ATL_OBJMAP_ENTRY* ATL::CComModule::m_pObjMap

Definition at line 784 of file atlbase.h.

Referenced by CComModule(), GetClassObject(), Init(), RegisterServer(), Term(), and UnregisterServer().


The documentation for this class was generated from the following file: