ReactOS  0.4.12-dev-102-g4b7f1e0
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 421 of file atlbase.h.

Constructor & Destructor Documentation

◆ CAtlModule()

ATL::CAtlModule::CAtlModule ( )
inline

Definition at line 426 of file atlbase.h.

427  {
428  ATLASSERT(_pAtlModule == NULL);
429  _pAtlModule = this;
430  cbSize = sizeof(_ATL_MODULE);
431  m_nLockCnt = 0;
432  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
_ATL_MODULE70 _ATL_MODULE
Definition: atlbase.h:146
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 496 of file atlbase.h.

497  {
499  DWORD dwFLen;
500  HRESULT hResult;
501 
502  hInstance = _AtlBaseModule.GetModuleInstance();
503  dwFLen = GetModuleFileNameW(hInstance, modulePath, modulePathCount);
504  if (dwFLen == modulePathCount)
506  else if (dwFLen == 0)
508 
509  if (pMapEntries != NULL)
510  {
511  while (pMapEntries->szKey != NULL)
512  {
513  ATLASSERT(pMapEntries->szData != NULL);
514  hResult = registrar.AddReplacement(pMapEntries->szKey, pMapEntries->szData);
515  if (FAILED(hResult))
516  return hResult;
517  pMapEntries++;
518  }
519  }
520 
521  hResult = AddCommonRGSReplacements(&registrar);
522  if (FAILED(hResult))
523  return hResult;
524 
525  hResult = registrar.AddReplacement(L"Module", modulePath);
526  if (FAILED(hResult))
527  return hResult;
528 
529  hResult = registrar.AddReplacement(L"Module_Raw", modulePath);
530  if (FAILED(hResult))
531  return hResult;
532 
533  return S_OK;
534  }
HINSTANCE GetModuleInstance()
Definition: atlcore.h:198
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:189
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:190
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:1087
HRESULT STDMETHODCALLTYPE AddReplacement(LPCOLESTR key, LPCOLESTR item)
Definition: statreg.h:87
#define S_OK
Definition: intsafe.h:59
CAtlBaseModule _AtlBaseModule
Definition: atlbase.cpp:26
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ GetLockCount()

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

Definition at line 434 of file atlbase.h.

435  {
436  return m_nLockCnt;
437  }

◆ Lock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 439 of file atlbase.h.

440  {
442  }
static ULONG WINAPI Increment(LPLONG p)
Definition: atlbase.h:372

◆ Unlock()

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

Reimplemented in ATL::CAtlExeModuleT< T >.

Definition at line 444 of file atlbase.h.

445  {
447  }
static ULONG WINAPI Decrement(LPLONG p)
Definition: atlbase.h:377

◆ UpdateRegistryFromResource() [1/2]

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

Definition at line 451 of file atlbase.h.

Referenced by DllRegisterServer(), and DllUnregisterServer().

452  {
453  CRegObject registrar;
454  WCHAR modulePath[MAX_PATH];
455  HRESULT hResult;
456  PCWSTR lpwszRes;
457 
458  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
459  if (FAILED(hResult))
460  return hResult;
461 #ifdef UNICODE
462  lpwszRes = lpszRes;
463 #else
464  /* FIXME: this is a bit of a hack, need to re-evaluate */
465  WCHAR resid[MAX_PATH];
466  MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, resid, MAX_PATH);
467  lpwszRes = resid;
468 #endif
469  if (bRegister != FALSE)
470  hResult = registrar.ResourceRegisterSz(modulePath, lpwszRes, L"REGISTRY");
471  else
472  hResult = registrar.ResourceUnregisterSz(modulePath, lpwszRes, L"REGISTRY");
473 
474  return hResult;
475  }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:496
HRESULT STDMETHODCALLTYPE ResourceRegisterSz(LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: statreg.h:140
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:1087
#define MultiByteToWideChar
Definition: compat.h:100
const uint16_t * PCWSTR
Definition: typedefs.h:55

◆ UpdateRegistryFromResource() [2/2]

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

Definition at line 477 of file atlbase.h.

478  {
479  CRegObject registrar;
480  WCHAR modulePath[MAX_PATH];
481  HRESULT hResult;
482 
483  hResult = CommonInitRegistrar(registrar, modulePath, sizeof(modulePath) / sizeof(modulePath[0]), pMapEntries);
484  if (FAILED(hResult))
485  return hResult;
486 
487  if (bRegister != FALSE)
488  hResult = registrar.ResourceRegister(modulePath, nResID, L"REGISTRY");
489  else
490  hResult = registrar.ResourceUnregister(modulePath, nResID, L"REGISTRY");
491 
492  return hResult;
493  }
__wchar_t WCHAR
Definition: xmlstorage.h:180
HRESULT CommonInitRegistrar(CRegObject &registrar, WCHAR *modulePath, DWORD modulePathCount, struct _ATL_REGMAP_ENTRY *pMapEntries)
Definition: atlbase.h:496
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1087
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 424 of file atlbase.h.


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