ReactOS  0.4.13-dev-257-gfabbd7c
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 780 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComModule()

ATL::CComModule::CComModule ( )
inline

Definition at line 785 of file atlbase.h.

786  {
787  ATLASSERT(_pModule == NULL);
788  _pModule = this;
789  _pModule->m_pObjMap = NULL;
790  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416

◆ ~CComModule()

ATL::CComModule::~CComModule ( )
inline

Definition at line 792 of file atlbase.h.

793  {
794  _pModule = NULL;
795  }
smooth NULL
Definition: ftsmooth.c:416

Member Function Documentation

◆ DllCanUnloadNow()

HRESULT ATL::CComModule::DllCanUnloadNow ( )
inline

Definition at line 928 of file atlbase.h.

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

Referenced by DllCanUnloadNow().

◆ DllGetClassObject()

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

Definition at line 935 of file atlbase.h.

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

Referenced by DllGetClassObject().

◆ DllRegisterServer()

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

Definition at line 940 of file atlbase.h.

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

Referenced by DllRegisterServer().

◆ DllUnregisterServer()

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

Definition at line 945 of file atlbase.h.

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

Referenced by DllUnregisterServer().

◆ GetClassObject()

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

Definition at line 838 of file atlbase.h.

839  {
840  _ATL_OBJMAP_ENTRY *objectMapEntry;
841  HRESULT hResult;
842 
843  ATLASSERT(ppv != NULL);
844  if (ppv == NULL)
845  return E_POINTER;
846  *ppv = NULL;
847  hResult = S_OK;
848  if (m_pObjMap != NULL)
849  {
850  objectMapEntry = m_pObjMap;
851  while (objectMapEntry->pclsid != NULL)
852  {
853  if (objectMapEntry->pfnGetClassObject != NULL && InlineIsEqualGUID(rclsid, *objectMapEntry->pclsid) != FALSE)
854  {
855  if (objectMapEntry->pCF == NULL)
856  {
857  CComCritSecLock<CComCriticalSection> lock(_AtlComModule.m_csObjMap, true);
858 
859  if (objectMapEntry->pCF == NULL)
860  hResult = objectMapEntry->pfnGetClassObject(reinterpret_cast<void *>(objectMapEntry->pfnCreateInstance), IID_IUnknown, reinterpret_cast<LPVOID *>(&objectMapEntry->pCF));
861  }
862  if (objectMapEntry->pCF != NULL)
863  hResult = objectMapEntry->pCF->QueryInterface(riid, ppv);
864  break;
865  }
866  objectMapEntry++;
867  }
868  }
869  if (hResult == S_OK && *ppv == NULL)
870  {
871  // FIXME: call AtlComModuleGetClassObject
872  hResult = CLASS_E_CLASSNOTAVAILABLE;
873  }
874  return hResult;
875  }
IUnknown * pCF
Definition: atlbase.h:90
rwlock_t lock
Definition: tcpcore.h:1163
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
REFIID riid
Definition: precomp.h:44
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:783
_ATL_CREATORFUNC * pfnCreateInstance
Definition: atlbase.h:89
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
smooth NULL
Definition: ftsmooth.c:416
const CLSID * pclsid
Definition: atlbase.h:86
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
_ATL_CREATORFUNC * pfnGetClassObject
Definition: atlbase.h:88
#define S_OK
Definition: intsafe.h:59
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:137

Referenced by DllGetClassObject().

◆ Init()

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

Definition at line 797 of file atlbase.h.

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

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

◆ RegisterServer()

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

Definition at line 877 of file atlbase.h.

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

Referenced by DllRegisterServer().

◆ Term()

void ATL::CComModule::Term ( )
inline

Definition at line 820 of file atlbase.h.

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

Referenced by DllMain(), and InitializeAtlModule().

◆ UnregisterServer()

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

Definition at line 902 of file atlbase.h.

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

Referenced by DllUnregisterServer().

Member Data Documentation

◆ m_pObjMap

_ATL_OBJMAP_ENTRY* ATL::CComModule::m_pObjMap

Definition at line 783 of file atlbase.h.

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


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