ReactOS  0.4.15-dev-4871-g4471ee4
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 410 of file atlbase.h.

Constructor & Destructor Documentation

◆ CAtlModule()

ATL::CAtlModule::CAtlModule ( )
inline

Definition at line 415 of file atlbase.h.

416  {
417  ATLASSERT(_pAtlModule == NULL);
418  _pAtlModule = this;
419  cbSize = sizeof(_ATL_MODULE);
420  m_nLockCnt = 0;
421  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
_ATL_MODULE70 _ATL_MODULE
Definition: atlbase.h:135
#define NULL
Definition: types.h:112

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 485 of file atlbase.h.

486  {
488  DWORD dwFLen;
489  HRESULT hResult;
490 
491  hInstance = _AtlBaseModule.GetModuleInstance();
492  dwFLen = GetModuleFileNameW(hInstance, modulePath, modulePathCount);
493  if (dwFLen == modulePathCount)
495  else if (dwFLen == 0)
497 
498  if (pMapEntries != NULL)
499  {
500  while (pMapEntries->szKey != NULL)
501  {
502  ATLASSERT(pMapEntries->szData != NULL);
503  hResult = registrar.AddReplacement(pMapEntries->szKey, pMapEntries->szData);
504  if (FAILED(hResult))
505  return hResult;
506  pMapEntries++;
507  }
508  }
509 
510  hResult = AddCommonRGSReplacements(&registrar);
511  if (FAILED(hResult))
512  return hResult;
513 
514  hResult = registrar.AddReplacement(L"Module", modulePath);
515  if (FAILED(hResult))
516  return hResult;
517 
518  hResult = registrar.AddReplacement(L"Module_Raw", modulePath);
519  if (FAILED(hResult))
520  return hResult;
521 
522  return S_OK;
523  }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
LPCOLESTR szKey
Definition: atlbase.h:178
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
HINSTANCE hInstance
Definition: charmap.c:20
#define L(x)
Definition: ntvdm.h:50
LPCOLESTR szData
Definition: atlbase.h:179
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual HRESULT AddCommonRGSReplacements(IRegistrarBase *)=0
HRESULT STDMETHODCALLTYPE AddReplacement(LPCOLESTR key, LPCOLESTR item)
Definition: statreg.h:87
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by UpdateRegistryFromResource().

◆ GetLockCount()

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

Definition at line 423 of file atlbase.h.

424  {
425  return m_nLockCnt;
426  }

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

◆ Lock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 428 of file atlbase.h.

429  {
431  }
static ULONG WINAPI Increment(LPLONG p)
Definition: atlbase.h:361

◆ Unlock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 433 of file atlbase.h.

434  {
436  }
static ULONG WINAPI Decrement(LPLONG p)
Definition: atlbase.h:366

◆ UpdateRegistryFromResource() [1/2]

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

Definition at line 440 of file atlbase.h.

441  {
442  CRegObject registrar;
443  WCHAR modulePath[MAX_PATH];
444  HRESULT hResult;
445  PCWSTR lpwszRes;
446 
447  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
448  if (FAILED(hResult))
449  return hResult;
450 #ifdef UNICODE
451  lpwszRes = lpszRes;
452 #else
453  /* FIXME: this is a bit of a hack, need to re-evaluate */
454  WCHAR resid[MAX_PATH];
455  MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, resid, MAX_PATH);
456  lpwszRes = resid;
457 #endif
458  if (bRegister != FALSE)
459  hResult = registrar.ResourceRegisterSz(modulePath, lpwszRes, L"REGISTRY");
460  else
461  hResult = registrar.ResourceUnregisterSz(modulePath, lpwszRes, L"REGISTRY");
462 
463  return hResult;
464  }
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define CP_ACP
Definition: compat.h:109
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:485
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
HRESULT STDMETHODCALLTYPE ResourceRegisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:140
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
HRESULT STDMETHODCALLTYPE ResourceUnregisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:145
#define MultiByteToWideChar
Definition: compat.h:110

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 466 of file atlbase.h.

467  {
468  CRegObject registrar;
469  WCHAR modulePath[MAX_PATH];
470  HRESULT hResult;
471 
472  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
473  if (FAILED(hResult))
474  return hResult;
475 
476  if (bRegister != FALSE)
477  hResult = registrar.ResourceRegister(modulePath, nResID, L"REGISTRY");
478  else
479  hResult = registrar.ResourceUnregister(modulePath, nResID, L"REGISTRY");
480 
481  return hResult;
482  }
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:485
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
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 413 of file atlbase.h.

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


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