ReactOS 0.4.16-dev-92-g0c2cdca
ATL::CAtlModule Class Referenceabstract

#include <atlbase.h>

Inheritance diagram for ATL::CAtlModule:
Collaboration diagram for ATL::CAtlModule:

Public Member Functions

 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)
 

Static Public Attributes

static GUID m_libid
 

Private Member Functions

HRESULT CommonInitRegistrar (CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
 

Additional Inherited Members

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

Detailed Description

Definition at line 459 of file atlbase.h.

Constructor & Destructor Documentation

◆ CAtlModule()

ATL::CAtlModule::CAtlModule ( )
inline

Definition at line 464 of file atlbase.h.

465 {
466 ATLASSERT(_pAtlModule == NULL);
467 _pAtlModule = this;
468 cbSize = sizeof(_ATL_MODULE);
469 m_nLockCnt = 0;
470 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define NULL
Definition: types.h:112
_ATL_MODULE70 _ATL_MODULE
Definition: atlbase.h:144

Member Function Documentation

◆ AddCommonRGSReplacements()

virtual HRESULT ATL::CAtlModule::AddCommonRGSReplacements ( IRegistrarBase )
pure virtual

◆ CommonInitRegistrar()

HRESULT ATL::CAtlModule::CommonInitRegistrar ( CRegObject registrar,
WCHAR modulePath,
DWORD  modulePathCount,
struct _ATL_REGMAP_ENTRY pMapEntries 
)
inlineprivate

Definition at line 534 of file atlbase.h.

535 {
537 DWORD dwFLen;
538 HRESULT hResult;
539
540 hInstance = _AtlBaseModule.GetModuleInstance();
541 dwFLen = GetModuleFileNameW(hInstance, modulePath, modulePathCount);
542 if (dwFLen == modulePathCount)
544 else if (dwFLen == 0)
546
547 if (pMapEntries != NULL)
548 {
549 while (pMapEntries->szKey != NULL)
550 {
551 ATLASSERT(pMapEntries->szData != NULL);
552 hResult = registrar.AddReplacement(pMapEntries->szKey, pMapEntries->szData);
553 if (FAILED(hResult))
554 return hResult;
555 pMapEntries++;
556 }
557 }
558
559 hResult = AddCommonRGSReplacements(&registrar);
560 if (FAILED(hResult))
561 return hResult;
562
563 hResult = registrar.AddReplacement(L"Module", modulePath);
564 if (FAILED(hResult))
565 return hResult;
566
567 hResult = registrar.AddReplacement(L"Module_Raw", modulePath);
568 if (FAILED(hResult))
569 return hResult;
570
571 return S_OK;
572 }
HINSTANCE hInstance
Definition: charmap.c:19
virtual HRESULT AddCommonRGSReplacements(IRegistrarBase *)=0
HRESULT STDMETHODCALLTYPE AddReplacement(LPCOLESTR key, LPCOLESTR item)
Definition: statreg.h:87
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
LPCOLESTR szKey
Definition: atlbase.h:243
LPCOLESTR szData
Definition: atlbase.h:244
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by UpdateRegistryFromResource().

◆ GetLockCount()

virtual LONG ATL::CAtlModule::GetLockCount ( )
inlinevirtual

Definition at line 472 of file atlbase.h.

473 {
474 return m_nLockCnt;
475 }

Referenced by ATL::CComModule::DllCanUnloadNow().

◆ Lock()

virtual LONG ATL::CAtlModule::Lock ( )
inlinevirtual

Reimplemented in ATL::CAtlExeModuleT< T >, and ATL::CAtlExeModuleT< CAtlObjMapModule >.

Definition at line 477 of file atlbase.h.

478 {
480 }
static ULONG WINAPI Increment(LPLONG p)
Definition: atlbase.h:410

◆ Unlock()

virtual LONG ATL::CAtlModule::Unlock ( )
inlinevirtual

Reimplemented in ATL::CAtlExeModuleT< T >, and ATL::CAtlExeModuleT< CAtlObjMapModule >.

Definition at line 482 of file atlbase.h.

483 {
485 }
static ULONG WINAPI Decrement(LPLONG p)
Definition: atlbase.h:415

◆ UpdateRegistryFromResource() [1/2]

HRESULT WINAPI ATL::CAtlModule::UpdateRegistryFromResource ( LPCTSTR  lpszRes,
BOOL  bRegister,
struct _ATL_REGMAP_ENTRY pMapEntries = NULL 
)
inline

Definition at line 489 of file atlbase.h.

490 {
491 CRegObject registrar;
492 WCHAR modulePath[MAX_PATH];
493 HRESULT hResult;
494 PCWSTR lpwszRes;
495
496 hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
497 if (FAILED(hResult))
498 return hResult;
499#ifdef UNICODE
500 lpwszRes = lpszRes;
501#else
502 /* FIXME: this is a bit of a hack, need to re-evaluate */
503 WCHAR resid[MAX_PATH];
504 MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, resid, MAX_PATH);
505 lpwszRes = resid;
506#endif
507 if (bRegister != FALSE)
508 hResult = registrar.ResourceRegisterSz(modulePath, lpwszRes, L"REGISTRY");
509 else
510 hResult = registrar.ResourceUnregisterSz(modulePath, lpwszRes, L"REGISTRY");
511
512 return hResult;
513 }
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:534
HRESULT STDMETHODCALLTYPE ResourceUnregisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:145
HRESULT STDMETHODCALLTYPE ResourceRegisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:140
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
const uint16_t * PCWSTR
Definition: typedefs.h:57
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DllRegisterServer(), and DllUnregisterServer().

◆ UpdateRegistryFromResource() [2/2]

HRESULT WINAPI ATL::CAtlModule::UpdateRegistryFromResource ( UINT  nResID,
BOOL  bRegister,
struct _ATL_REGMAP_ENTRY pMapEntries = NULL 
)
inline

Definition at line 515 of file atlbase.h.

516 {
517 CRegObject registrar;
518 WCHAR modulePath[MAX_PATH];
519 HRESULT hResult;
520
521 hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
522 if (FAILED(hResult))
523 return hResult;
524
525 if (bRegister != FALSE)
526 hResult = registrar.ResourceRegister(modulePath, nResID, L"REGISTRY");
527 else
528 hResult = registrar.ResourceUnregister(modulePath, nResID, L"REGISTRY");
529
530 return hResult;
531 }
HRESULT STDMETHODCALLTYPE ResourceUnregister(LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
Definition: statreg.h:175
HRESULT STDMETHODCALLTYPE ResourceRegister(LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
Definition: statreg.h:170

Member Data Documentation

◆ m_libid

GUID ATL::CAtlModule::m_libid
static

Definition at line 462 of file atlbase.h.

Referenced by ATL::CComModule::Init().


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