ReactOS  0.4.13-dev-235-g7373cb3
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 409 of file atlbase.h.

Constructor & Destructor Documentation

◆ CAtlModule()

ATL::CAtlModule::CAtlModule ( )
inline

Definition at line 414 of file atlbase.h.

415  {
416  ATLASSERT(_pAtlModule == NULL);
417  _pAtlModule = this;
418  cbSize = sizeof(_ATL_MODULE);
419  m_nLockCnt = 0;
420  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
_ATL_MODULE70 _ATL_MODULE
Definition: atlbase.h:134
smooth NULL
Definition: ftsmooth.c:416

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

485  {
487  DWORD dwFLen;
488  HRESULT hResult;
489 
490  hInstance = _AtlBaseModule.GetModuleInstance();
491  dwFLen = GetModuleFileNameW(hInstance, modulePath, modulePathCount);
492  if (dwFLen == modulePathCount)
494  else if (dwFLen == 0)
496 
497  if (pMapEntries != NULL)
498  {
499  while (pMapEntries->szKey != NULL)
500  {
501  ATLASSERT(pMapEntries->szData != NULL);
502  hResult = registrar.AddReplacement(pMapEntries->szKey, pMapEntries->szData);
503  if (FAILED(hResult))
504  return hResult;
505  pMapEntries++;
506  }
507  }
508 
509  hResult = AddCommonRGSReplacements(&registrar);
510  if (FAILED(hResult))
511  return hResult;
512 
513  hResult = registrar.AddReplacement(L"Module", modulePath);
514  if (FAILED(hResult))
515  return hResult;
516 
517  hResult = registrar.AddReplacement(L"Module_Raw", modulePath);
518  if (FAILED(hResult))
519  return hResult;
520 
521  return S_OK;
522  }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
LPCOLESTR szKey
Definition: atlbase.h:177
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
LPCOLESTR szData
Definition: atlbase.h:178
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual HRESULT AddCommonRGSReplacements(IRegistrarBase *)=0
static const WCHAR L[]
Definition: oid.c:1250
HRESULT STDMETHODCALLTYPE AddReplacement(LPCOLESTR key, LPCOLESTR item)
Definition: statreg.h:87
#define S_OK
Definition: intsafe.h:59
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by UpdateRegistryFromResource().

◆ GetLockCount()

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

Definition at line 422 of file atlbase.h.

423  {
424  return m_nLockCnt;
425  }

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

◆ Lock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 427 of file atlbase.h.

428  {
430  }
static ULONG WINAPI Increment(LPLONG p)
Definition: atlbase.h:360

◆ Unlock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 432 of file atlbase.h.

433  {
435  }
static ULONG WINAPI Decrement(LPLONG p)
Definition: atlbase.h:365

◆ UpdateRegistryFromResource() [1/2]

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

Definition at line 439 of file atlbase.h.

440  {
441  CRegObject registrar;
442  WCHAR modulePath[MAX_PATH];
443  HRESULT hResult;
444  PCWSTR lpwszRes;
445 
446  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
447  if (FAILED(hResult))
448  return hResult;
449 #ifdef UNICODE
450  lpwszRes = lpszRes;
451 #else
452  /* FIXME: this is a bit of a hack, need to re-evaluate */
453  WCHAR resid[MAX_PATH];
454  MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, resid, MAX_PATH);
455  lpwszRes = resid;
456 #endif
457  if (bRegister != FALSE)
458  hResult = registrar.ResourceRegisterSz(modulePath, lpwszRes, L"REGISTRY");
459  else
460  hResult = registrar.ResourceUnregisterSz(modulePath, lpwszRes, L"REGISTRY");
461 
462  return hResult;
463  }
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define CP_ACP
Definition: compat.h:99
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:484
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:77
#define MAX_PATH
Definition: compat.h:26
HRESULT STDMETHODCALLTYPE ResourceUnregisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:145
static const WCHAR L[]
Definition: oid.c:1250
#define MultiByteToWideChar
Definition: compat.h:100

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

466  {
467  CRegObject registrar;
468  WCHAR modulePath[MAX_PATH];
469  HRESULT hResult;
470 
471  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
472  if (FAILED(hResult))
473  return hResult;
474 
475  if (bRegister != FALSE)
476  hResult = registrar.ResourceRegister(modulePath, nResID, L"REGISTRY");
477  else
478  hResult = registrar.ResourceUnregister(modulePath, nResID, L"REGISTRY");
479 
480  return hResult;
481  }
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
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 412 of file atlbase.h.

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


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