ReactOS  0.4.15-dev-5463-g138eb58
RunOnceExSection Class Reference

#include <registry.h>

Collaboration diagram for RunOnceExSection:

Public Member Functions

 RunOnceExSection (_In_ CRegKeyEx &hParentKey, _In_ const CStringW &lpSubKeyName)
 
 RunOnceExSection (_In_ const RunOnceExSection &Section)
 
BOOL CloseAndDelete (_In_ CRegKeyEx &hParentKey)
 
UINT GetEntryCnt () const
 
BOOL Exec (_Inout_ UINT &iCompleteCnt, _In_ const UINT iTotalCnt)
 

Public Attributes

BOOL m_bSuccess
 
ATL::CStringW m_SectionTitle
 
CSimpleArray< RunOnceExEntrym_EntryList
 

Private Member Functions

BOOL HandleValue (_In_ CRegKeyEx &hKey, _In_ const CStringW &ValueName)
 

Private Attributes

ATL::CStringW m_SectionName
 
CRegKeyEx m_RegKey
 

Friends

class RunOnceExInstance
 
int RunOnceExSectionCmp (_In_ const void *a, _In_ const void *b)
 

Detailed Description

Definition at line 51 of file registry.h.

Constructor & Destructor Documentation

◆ RunOnceExSection() [1/2]

RunOnceExSection::RunOnceExSection ( _In_ CRegKeyEx hParentKey,
_In_ const CStringW lpSubKeyName 
)

◆ RunOnceExSection() [2/2]

RunOnceExSection::RunOnceExSection ( _In_ const RunOnceExSection Section)

Definition at line 180 of file registry.cpp.

180  :
181  m_SectionName(Section.m_SectionName),
182  m_bSuccess(Section.m_bSuccess),
183  m_SectionTitle(Section.m_SectionTitle),
184  m_EntryList(Section.m_EntryList)
185 {
186  m_RegKey.Attach(Section.m_RegKey);
187 }
ATL::CStringW m_SectionName
Definition: registry.h:54
CRegKeyEx m_RegKey
Definition: registry.h:55
ATL::CStringW m_SectionTitle
Definition: registry.h:63
CSimpleArray< RunOnceExEntry > m_EntryList
Definition: registry.h:64
void Attach(HKEY hKey)
Definition: atlbase.h:1050

Member Function Documentation

◆ CloseAndDelete()

BOOL RunOnceExSection::CloseAndDelete ( _In_ CRegKeyEx hParentKey)

Definition at line 189 of file registry.cpp.

191 {
192  m_RegKey.Close();
193  return hParentKey.RecurseDeleteKey(m_SectionName) == ERROR_SUCCESS;
194 }
#define ERROR_SUCCESS
Definition: deptool.c:10
ATL::CStringW m_SectionName
Definition: registry.h:54
CRegKeyEx m_RegKey
Definition: registry.h:55
LONG Close()
Definition: atlbase.h:1055

◆ Exec()

BOOL RunOnceExSection::Exec ( _Inout_ UINT iCompleteCnt,
_In_ const UINT  iTotalCnt 
)

Definition at line 201 of file registry.cpp.

204 {
205  BOOL bSuccess = TRUE;
206 
207  for (int i = 0; i < m_EntryList.GetSize(); i++)
208  {
209  m_EntryList[i].Delete(m_RegKey);
210  bSuccess &= m_EntryList[i].Exec();
211  iCompleteCnt++;
212  // TODO: the meaning of the third param is still unknown, seems it's always 0.
213  if (g_Callback)
214  g_Callback(iCompleteCnt, iTotalCnt, NULL);
215  }
216  return bSuccess;
217 }
#define TRUE
Definition: types.h:120
CRegKeyEx m_RegKey
Definition: registry.h:55
int GetSize() const
Definition: atlsimpcoll.h:104
static BOOLEAN bSuccess
Definition: drive.cpp:433
unsigned int BOOL
Definition: ntddk_ex.h:94
RUNONCEEX_CALLBACK g_Callback
Definition: iernonce.cpp:11
CSimpleArray< RunOnceExEntry > m_EntryList
Definition: registry.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112

◆ GetEntryCnt()

UINT RunOnceExSection::GetEntryCnt ( ) const

Definition at line 196 of file registry.cpp.

197 {
198  return m_EntryList.GetSize();
199 }
int GetSize() const
Definition: atlsimpcoll.h:104
CSimpleArray< RunOnceExEntry > m_EntryList
Definition: registry.h:64

◆ HandleValue()

BOOL RunOnceExSection::HandleValue ( _In_ CRegKeyEx hKey,
_In_ const CStringW &  ValueName 
)
private

Definition at line 85 of file registry.cpp.

88 {
89  DWORD dwType;
90  DWORD cbData;
91 
92  // Query data size
93  if (hKey.QueryValue(ValueName, &dwType, NULL, &cbData) != ERROR_SUCCESS)
94  return FALSE;
95 
96  // Validate its format and size.
97  if (dwType != REG_SZ)
98  return TRUE;
99 
100  if (cbData % sizeof(WCHAR) != 0)
101  return FALSE;
102 
104  LPWSTR szBuffer = Buffer.GetBuffer((cbData / sizeof(WCHAR)) + 1);
105 
106  if (hKey.QueryValue(ValueName, &dwType, szBuffer, &cbData) != ERROR_SUCCESS)
107  {
108  Buffer.ReleaseBuffer();
109  return FALSE;
110  }
111  szBuffer[cbData / sizeof(WCHAR)] = L'\0';
112  Buffer.ReleaseBuffer();
113 
114  CStringW ExpandStr;
115  DWORD dwcchExpand = ExpandEnvironmentStringsW(Buffer, NULL, 0);
116  ExpandEnvironmentStringsW(Buffer, ExpandStr.GetBuffer(dwcchExpand + 1), dwcchExpand);
117  ExpandStr.ReleaseBuffer();
118 
119  if (ValueName.IsEmpty())
120  {
121  // The default value specifies the section title.
123  }
124  else
125  {
127  }
128 
129  return TRUE;
130 }
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
#define ERROR_SUCCESS
Definition: deptool.c:10
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
ATL::CStringW m_SectionTitle
Definition: registry.h:63
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
CSimpleArray< RunOnceExEntry > m_EntryList
Definition: registry.h:64
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
CAtlStringW CStringW
Definition: atlstr.h:130
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define REG_SZ
Definition: layer.c:22

Friends And Related Function Documentation

◆ RunOnceExInstance

friend class RunOnceExInstance
friend

Definition at line 84 of file registry.h.

◆ RunOnceExSectionCmp

int RunOnceExSectionCmp ( _In_ const void a,
_In_ const void b 
)
friend

Definition at line 219 of file registry.cpp.

222 {
225 }
ATL::CStringW m_SectionName
Definition: registry.h:54
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Member Data Documentation

◆ m_bSuccess

BOOL RunOnceExSection::m_bSuccess

Definition at line 62 of file registry.h.

Referenced by RunOnceExInstance::HandleSubKey().

◆ m_EntryList

CSimpleArray<RunOnceExEntry> RunOnceExSection::m_EntryList

Definition at line 64 of file registry.h.

Referenced by Exec(), GetEntryCnt(), and HandleValue().

◆ m_RegKey

CRegKeyEx RunOnceExSection::m_RegKey
private

Definition at line 55 of file registry.h.

Referenced by CloseAndDelete(), Exec(), RunOnceExInstance::HandleSubKey(), and RunOnceExSection().

◆ m_SectionName

ATL::CStringW RunOnceExSection::m_SectionName
private

Definition at line 54 of file registry.h.

Referenced by CloseAndDelete().

◆ m_SectionTitle

ATL::CStringW RunOnceExSection::m_SectionTitle

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