ReactOS 0.4.15-dev-7906-g1b85a5f
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 ()
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *)=0
 
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 869 of file atlbase.h.

Constructor & Destructor Documentation

◆ CComModule()

ATL::CComModule::CComModule ( )
inline

Definition at line 874 of file atlbase.h.

875 {
876 ATLASSERT(_pModule == NULL);
877 _pModule = this;
878 _pModule->m_pObjMap = NULL;
879 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define NULL
Definition: types.h:112

◆ ~CComModule()

ATL::CComModule::~CComModule ( )
inline

Definition at line 881 of file atlbase.h.

882 {
883 _pModule = NULL;
884 }

Member Function Documentation

◆ DllCanUnloadNow()

HRESULT ATL::CComModule::DllCanUnloadNow ( )
inline

Definition at line 1030 of file atlbase.h.

1031 {
1032 if (GetLockCount() == 0)
1033 return S_OK;
1034 return S_FALSE;
1035 }
virtual LONG GetLockCount()
Definition: atlbase.h:472
#define S_OK
Definition: intsafe.h:52
#define S_FALSE
Definition: winerror.h:2357

Referenced by DllCanUnloadNow().

◆ DllGetClassObject()

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

Definition at line 1037 of file atlbase.h.

1038 {
1039 return GetClassObject(rclsid, riid, ppv);
1040 }
HRESULT GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: atlbase.h:941
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by DllGetClassObject().

◆ DllRegisterServer()

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

Definition at line 1042 of file atlbase.h.

1043 {
1044 return RegisterServer(bRegTypeLib);
1045 }
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:979

Referenced by DllRegisterServer().

◆ DllUnregisterServer()

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

Definition at line 1047 of file atlbase.h.

1048 {
1049 return UnregisterServer(bUnRegTypeLib);
1050 }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:1004

Referenced by DllUnregisterServer().

◆ GetClassObject()

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

Definition at line 941 of file atlbase.h.

942 {
943 _ATL_OBJMAP_ENTRY *objectMapEntry;
944 HRESULT hResult;
945
946 ATLASSERT(ppv != NULL);
947 if (ppv == NULL)
948 return E_POINTER;
949 *ppv = NULL;
950 hResult = S_OK;
951 if (m_pObjMap != NULL)
952 {
953 objectMapEntry = m_pObjMap;
954 while (objectMapEntry->pclsid != NULL)
955 {
956 if (objectMapEntry->pfnGetClassObject != NULL && InlineIsEqualGUID(rclsid, *objectMapEntry->pclsid) != FALSE)
957 {
958 if (objectMapEntry->pCF == NULL)
959 {
960 CComCritSecLock<CComCriticalSection> lock(_AtlComModule.m_csObjMap, true);
961
962 if (objectMapEntry->pCF == NULL)
963 hResult = objectMapEntry->pfnGetClassObject(reinterpret_cast<void *>(objectMapEntry->pfnCreateInstance), IID_IUnknown, reinterpret_cast<LPVOID *>(&objectMapEntry->pCF));
964 }
965 if (objectMapEntry->pCF != NULL)
966 hResult = objectMapEntry->pCF->QueryInterface(riid, ppv);
967 break;
968 }
969 objectMapEntry++;
970 }
971 }
972 if (hResult == S_OK && *ppv == NULL)
973 {
974 hResult = AtlComModuleGetClassObject(&_AtlComModule, rclsid, riid, ppv);
975 }
976 return hResult;
977 }
const GUID IID_IUnknown
_ATL_OBJMAP_ENTRY * m_pObjMap
Definition: atlbase.h:872
#define FALSE
Definition: types.h:117
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pComModule, REFCLSID rclsid, REFIID riid, LPVOID *ppv)
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:142
_ATL_CREATORFUNC * pfnCreateInstance
Definition: atlbase.h:89
IUnknown * pCF
Definition: atlbase.h:90
const CLSID * pclsid
Definition: atlbase.h:86
_ATL_CREATORFUNC * pfnGetClassObject
Definition: atlbase.h:88
rwlock_t lock
Definition: tcpcore.h:0
#define E_POINTER
Definition: winerror.h:2365

Referenced by DllGetClassObject().

◆ Init()

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

Definition at line 886 of file atlbase.h.

887 {
888 _ATL_OBJMAP_ENTRY *objectMapEntry;
889
890 if (plibid != NULL)
891 m_libid = *plibid;
892
893 if (p != reinterpret_cast<_ATL_OBJMAP_ENTRY *>(-1))
894 {
895 m_pObjMap = p;
896 if (p != NULL)
897 {
898 objectMapEntry = p;
899 while (objectMapEntry->pclsid != NULL)
900 {
901 objectMapEntry->pfnObjectMain(true);
902 objectMapEntry++;
903 }
904 }
905 }
906
907 for (_ATL_OBJMAP_ENTRY **iter = _AtlComModule.m_ppAutoObjMapFirst; iter < _AtlComModule.m_ppAutoObjMapLast; iter++)
908 {
909 if (*iter != NULL)
910 (*iter)->pfnObjectMain(true);
911 }
912
913 return S_OK;
914 }
static GUID m_libid
Definition: atlbase.h:462
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by DllMain(), if(), CFontExtModule::Init(), InitializeAtlModule(), and wWinMain().

◆ RegisterServer()

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

Definition at line 979 of file atlbase.h.

980 {
981 _ATL_OBJMAP_ENTRY *objectMapEntry;
982 HRESULT hResult;
983
984 hResult = S_OK;
985 objectMapEntry = m_pObjMap;
986 if (objectMapEntry != NULL)
987 {
988 while (objectMapEntry->pclsid != NULL)
989 {
990 if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
991 {
992 hResult = objectMapEntry->pfnUpdateRegistry(TRUE);
993 if (FAILED(hResult))
994 break;
995 }
996 objectMapEntry++;
997 }
998 }
999 if (SUCCEEDED(hResult))
1000 hResult = CAtlModuleT<CComModule>::RegisterServer(bRegTypeLib, pCLSID);
1001 return hResult;
1002 }
HRESULT RegisterServer(BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
Definition: atlbase.h:667
#define TRUE
Definition: types.h:120
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Referenced by DllRegisterServer().

◆ Term()

void ATL::CComModule::Term ( )
inline

Definition at line 916 of file atlbase.h.

917 {
918 _ATL_OBJMAP_ENTRY *objectMapEntry;
919
920 if (m_pObjMap != NULL)
921 {
922 objectMapEntry = m_pObjMap;
923 while (objectMapEntry->pclsid != NULL)
924 {
925 if (objectMapEntry->pCF != NULL)
926 objectMapEntry->pCF->Release();
927 objectMapEntry->pCF = NULL;
928 objectMapEntry->pfnObjectMain(false);
929 objectMapEntry++;
930 }
931 }
932
933 for (_ATL_OBJMAP_ENTRY **iter = _AtlComModule.m_ppAutoObjMapFirst; iter < _AtlComModule.m_ppAutoObjMapLast; iter++)
934 {
935 if (*iter != NULL)
936 (*iter)->pfnObjectMain(false);
937 }
938
939 }
ULONG Release()

Referenced by DllMain(), InitializeAtlModule(), CFontExtModule::Term(), CShell32Module::Term(), and wWinMain().

◆ UnregisterServer()

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

Definition at line 1004 of file atlbase.h.

1005 {
1006 _ATL_OBJMAP_ENTRY *objectMapEntry;
1007 HRESULT hResult;
1008
1009 hResult = S_OK;
1010 objectMapEntry = m_pObjMap;
1011 if (objectMapEntry != NULL)
1012 {
1013 while (objectMapEntry->pclsid != NULL)
1014 {
1015 if (pCLSID == NULL || IsEqualGUID(*pCLSID, *objectMapEntry->pclsid) != FALSE)
1016 {
1017 hResult = objectMapEntry->pfnUpdateRegistry(FALSE); //unregister
1018 if (FAILED(hResult))
1019 break;
1020 }
1021 objectMapEntry++;
1022 }
1023 }
1024 if (SUCCEEDED(hResult))
1025 hResult = CAtlModuleT<CComModule>::UnregisterServer(bUnRegTypeLib, pCLSID);
1026
1027 return hResult;
1028 }
HRESULT UnregisterServer(BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
Definition: atlbase.h:673

Referenced by DllUnregisterServer().

Member Data Documentation

◆ m_pObjMap

_ATL_OBJMAP_ENTRY* ATL::CComModule::m_pObjMap

Definition at line 872 of file atlbase.h.

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


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