ReactOS  0.4.12-dev-51-ge94618b
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 789 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComModule()

ATL::CComModule::CComModule ( )
inline

Definition at line 794 of file atlbase.h.

795  {
796  ATLASSERT(_pModule == NULL);
797  _pModule = this;
798  _pModule->m_pObjMap = NULL;
799  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416

◆ ~CComModule()

ATL::CComModule::~CComModule ( )
inline

Definition at line 801 of file atlbase.h.

802  {
803  _pModule = NULL;
804  }
smooth NULL
Definition: ftsmooth.c:416

Member Function Documentation

◆ DllCanUnloadNow()

HRESULT ATL::CComModule::DllCanUnloadNow ( )
inline

Definition at line 937 of file atlbase.h.

Referenced by DllCanUnloadNow().

938  {
939  if (GetLockCount() == 0)
940  return S_OK;
941  return S_FALSE;
942  }
virtual LONG GetLockCount()
Definition: atlbase.h:434
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ DllGetClassObject()

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

Definition at line 944 of file atlbase.h.

Referenced by DllGetClassObject().

945  {
946  return GetClassObject(rclsid, riid, ppv);
947  }
REFIID riid
Definition: precomp.h:44
HRESULT GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:847

◆ DllRegisterServer()

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

Definition at line 949 of file atlbase.h.

Referenced by DllRegisterServer().

950  {
951  return RegisterServer(bRegTypeLib);
952  }
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:886

◆ DllUnregisterServer()

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

Definition at line 954 of file atlbase.h.

Referenced by DllUnregisterServer().

955  {
956  return UnregisterServer(bUnRegTypeLib);
957  }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:911

◆ GetClassObject()

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

Definition at line 847 of file atlbase.h.

848  {
849  _ATL_OBJMAP_ENTRY *objectMapEntry;
850  HRESULT hResult;
851 
852  ATLASSERT(ppv != NULL);
853  if (ppv == NULL)
854  return E_POINTER;
855  *ppv = NULL;
856  hResult = S_OK;
857  if (m_pObjMap != NULL)
858  {
859  objectMapEntry = m_pObjMap;
860  while (objectMapEntry->pclsid != NULL)
861  {
862  if (objectMapEntry->pfnGetClassObject != NULL && InlineIsEqualGUID(rclsid, *objectMapEntry->pclsid) != FALSE)
863  {
864  if (objectMapEntry->pCF == NULL)
865  {
867 
868  if (objectMapEntry->pCF == NULL)
869  hResult = objectMapEntry->pfnGetClassObject(reinterpret_cast<void *>(objectMapEntry->pfnCreateInstance), IID_IUnknown, reinterpret_cast<LPVOID *>(&objectMapEntry->pCF));
870  }
871  if (objectMapEntry->pCF != NULL)
872  hResult = objectMapEntry->pCF->QueryInterface(riid, ppv);
873  break;
874  }
875  objectMapEntry++;
876  }
877  }
878  if (hResult == S_OK && *ppv == NULL)
879  {
880  // FIXME: call AtlComModuleGetClassObject
881  hResult = CLASS_E_CLASSNOTAVAILABLE;
882  }
883  return hResult;
884  }
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:792
_ATL_CREATORFUNC * pfnCreateInstance
Definition: atlbase.h:89
#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)
CAtlComModule _AtlComModule
Definition: atlbase.cpp:28
#define E_POINTER
Definition: winerror.h:2365
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:137
CComCriticalSection m_csObjMap
Definition: atlbase.h:172

◆ Init()

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

Definition at line 806 of file atlbase.h.

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

807  {
808  _ATL_OBJMAP_ENTRY *objectMapEntry;
809 
810  if (plibid != NULL)
811  m_libid = *plibid;
812 
813  if (p != reinterpret_cast<_ATL_OBJMAP_ENTRY *>(-1))
814  {
815  m_pObjMap = p;
816  if (p != NULL)
817  {
818  objectMapEntry = p;
819  while (objectMapEntry->pclsid != NULL)
820  {
821  objectMapEntry->pfnObjectMain(true);
822  objectMapEntry++;
823  }
824  }
825  }
826  return S_OK;
827  }
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:792
smooth NULL
Definition: ftsmooth.c:416
const CLSID * pclsid
Definition: atlbase.h:86
static GUID m_libid
Definition: atlbase.h:424
#define S_OK
Definition: intsafe.h:59
GLfloat GLfloat p
Definition: glext.h:8902

◆ RegisterServer()

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

Definition at line 886 of file atlbase.h.

887  {
888  _ATL_OBJMAP_ENTRY *objectMapEntry;
889  HRESULT hResult;
890 
891  hResult = S_OK;
892  objectMapEntry = m_pObjMap;
893  if (objectMapEntry != NULL)
894  {
895  while (objectMapEntry->pclsid != NULL)
896  {
897  if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
898  {
899  hResult = objectMapEntry->pfnUpdateRegistry(TRUE);
900  if (FAILED(hResult))
901  break;
902  }
903  objectMapEntry++;
904  }
905  }
906  if (SUCCEEDED(hResult))
907  hResult = CAtlModuleT<CComModule>::RegisterServer(bRegTypeLib, pCLSID);
908  return hResult;
909  }
#define TRUE
Definition: types.h:120
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:792
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:605
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:4024
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ Term()

void ATL::CComModule::Term ( )
inline

Definition at line 829 of file atlbase.h.

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

830  {
831  _ATL_OBJMAP_ENTRY *objectMapEntry;
832 
833  if (m_pObjMap != NULL)
834  {
835  objectMapEntry = m_pObjMap;
836  while (objectMapEntry->pclsid != NULL)
837  {
838  if (objectMapEntry->pCF != NULL)
839  objectMapEntry->pCF->Release();
840  objectMapEntry->pCF = NULL;
841  objectMapEntry->pfnObjectMain(false);
842  objectMapEntry++;
843  }
844  }
845  }
IUnknown * pCF
Definition: atlbase.h:90
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:792
ULONG Release()
smooth NULL
Definition: ftsmooth.c:416
const CLSID * pclsid
Definition: atlbase.h:86

◆ UnregisterServer()

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

Definition at line 911 of file atlbase.h.

912  {
913  _ATL_OBJMAP_ENTRY *objectMapEntry;
914  HRESULT hResult;
915 
916  hResult = S_OK;
917  objectMapEntry = m_pObjMap;
918  if (objectMapEntry != NULL)
919  {
920  while (objectMapEntry->pclsid != NULL)
921  {
922  if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
923  {
924  hResult = objectMapEntry->pfnUpdateRegistry(FALSE); //unregister
925  if (FAILED(hResult))
926  break;
927  }
928  objectMapEntry++;
929  }
930  }
931  if (SUCCEEDED(hResult))
932  hResult = CAtlModuleT<CComModule>::UnregisterServer(bUnRegTypeLib, pCLSID);
933 
934  return hResult;
935  }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:611
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:792
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:4024
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Member Data Documentation

◆ m_pObjMap

_ATL_OBJMAP_ENTRY* ATL::CComModule::m_pObjMap

Definition at line 792 of file atlbase.h.

Referenced by CComModule().


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