ReactOS  0.4.14-dev-77-gd9e7c48
CSettings Class Reference

#include <Settings.h>

Public Member Functions

 CSettings ()
 
 ~CSettings ()
 
HRESULT Load (LPCTSTR pszLoadKey)
 
HRESULT Store (LPCTSTR pszStoreKey)
 
LPCTSTR GetPrompt ()
 
WORD GetNormalTextAttributes ()
 
WORD GetCommandTextAttributes ()
 

Private Member Functions

HRESULT Clean ()
 

Private Attributes

LPTSTR m_pszPrompt
 
WORD m_wNormalTextAttributes
 
WORD m_wCommandTextAttributes
 

Detailed Description

Definition at line 5 of file Settings.h.

Constructor & Destructor Documentation

◆ CSettings()

CSettings::CSettings ( )

Definition at line 32 of file Settings.cpp.

33 {
34  m_pszPrompt = NULL;
35 
38 }
LPTSTR m_pszPrompt
Definition: Settings.h:17
WORD m_wNormalTextAttributes
Definition: Settings.h:18
smooth NULL
Definition: ftsmooth.c:416
WORD m_wCommandTextAttributes
Definition: Settings.h:19
#define DEFAULT_COMMAND_TEXT_ATTRIBUTES
Definition: Settings.cpp:30
#define DEFAULT_NORMAL_TEXT_ATTRIBUTES
Definition: Settings.cpp:29

◆ ~CSettings()

CSettings::~CSettings ( )

Definition at line 40 of file Settings.cpp.

41 {
43 }
HRESULT Clean()
Definition: Settings.cpp:45
#define VERIFY(e)
Definition: ph.h:34
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Member Function Documentation

◆ Clean()

HRESULT CSettings::Clean ( )
private

Definition at line 45 of file Settings.cpp.

46 {
47  if (m_pszPrompt)
48  {
49  delete[] m_pszPrompt;
50  m_pszPrompt = NULL;
51  }
52 
53  return S_OK;
54 }
LPTSTR m_pszPrompt
Definition: Settings.h:17
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Referenced by Load(), and ~CSettings().

◆ GetCommandTextAttributes()

WORD CSettings::GetCommandTextAttributes ( )

Definition at line 142 of file Settings.cpp.

143 {
145 }
WORD m_wCommandTextAttributes
Definition: Settings.h:19

Referenced by main().

◆ GetNormalTextAttributes()

WORD CSettings::GetNormalTextAttributes ( )

Definition at line 137 of file Settings.cpp.

138 {
140 }
WORD m_wNormalTextAttributes
Definition: Settings.h:18

Referenced by main().

◆ GetPrompt()

LPCTSTR CSettings::GetPrompt ( )

Definition at line 132 of file Settings.cpp.

133 {
135 }
LPTSTR m_pszPrompt
Definition: Settings.h:17
static LPCTSTR GetDefaultPrompt()
Definition: Prompt.cpp:90

Referenced by main().

◆ Load()

HRESULT CSettings::Load ( LPCTSTR  pszLoadKey)

Definition at line 56 of file Settings.cpp.

57 {
58  HKEY hKey = NULL;
59  HRESULT hr;
60  DWORD dwType;
61  DWORD dwSize;
62  DWORD w;
63 
64  hr = Clean();
65  if (FAILED(hr))
66  return hr;
67 
68  hr = S_OK;
69 
70  LONG nError = RegOpenKeyEx(HKEY_CURRENT_USER,pszLoadKey,0,KEY_QUERY_VALUE,&hKey);
71  if (nError != ERROR_SUCCESS)
72  return S_FALSE;
73 
74  nError = RegQueryValueEx(hKey,PROMPT_VALUE_NAME,NULL,&dwType,NULL,&dwSize);
75  if (nError == ERROR_SUCCESS && dwType == REG_SZ)
76  {
77  m_pszPrompt = (TCHAR *) new (std::nothrow) BYTE[dwSize];
78  if (!m_pszPrompt)
79  {
80  hr = E_OUTOFMEMORY;
81  goto Exit;
82  }
83 
84  nError = RegQueryValueEx(hKey,PROMPT_VALUE_NAME,NULL,&dwType,(BYTE *)m_pszPrompt,&dwSize);
85  if (nError != ERROR_SUCCESS || dwType != REG_SZ)
86  {
87  delete m_pszPrompt;
88  m_pszPrompt = NULL;
89  hr = S_FALSE;
90  }
91  }
92  else
93  {
94  hr = S_FALSE;
95  }
96 
97  dwSize = sizeof(DWORD);
99  if (nError != ERROR_SUCCESS || dwType != REG_DWORD)
100  {
101  hr = S_FALSE;
102  }
103  else
104  {
106  }
107 
108  dwSize = sizeof(DWORD);
110  if (nError != ERROR_SUCCESS || dwType != REG_DWORD)
111  {
112  hr = S_FALSE;
113  }
114  else
115  {
117  }
118 
119 Exit:
120 
121  if (hKey)
122  VERIFY(RegCloseKey(hKey) == ERROR_SUCCESS);
123 
124  return hr;
125 }
#define RegQueryValueEx
Definition: winreg.h:524
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define DWORD
Definition: nt_native.h:44
HRESULT Clean()
Definition: Settings.cpp:45
#define PROMPT_VALUE_NAME
LPTSTR m_pszPrompt
Definition: Settings.h:17
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
WORD m_wNormalTextAttributes
Definition: Settings.h:18
#define S_FALSE
Definition: winerror.h:2357
#define COMMAND_TEXT_ATTRIBUTES_VALUE_NAME
smooth NULL
Definition: ftsmooth.c:416
WORD m_wCommandTextAttributes
Definition: Settings.h:19
char TCHAR
Definition: xmlstorage.h:189
LONG HRESULT
Definition: typedefs.h:77
static void Exit(void)
Definition: sock.c:1331
unsigned short WORD
Definition: ntddk_ex.h:93
#define VERIFY(e)
Definition: ph.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
#define S_OK
Definition: intsafe.h:59
#define RegOpenKeyEx
Definition: winreg.h:520
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REG_DWORD
Definition: sdbapi.c:596
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define NORMAL_TEXT_ATTRIBUTES_VALUE_NAME
#define REG_SZ
Definition: layer.c:22

Referenced by main().

◆ Store()

HRESULT CSettings::Store ( LPCTSTR  pszStoreKey)

Definition at line 127 of file Settings.cpp.

128 {
129  return S_OK;
130 }
#define S_OK
Definition: intsafe.h:59

Member Data Documentation

◆ m_pszPrompt

LPTSTR CSettings::m_pszPrompt
private

Definition at line 17 of file Settings.h.

Referenced by Clean(), CSettings(), GetPrompt(), and Load().

◆ m_wCommandTextAttributes

WORD CSettings::m_wCommandTextAttributes
private

Definition at line 19 of file Settings.h.

Referenced by CSettings(), GetCommandTextAttributes(), and Load().

◆ m_wNormalTextAttributes

WORD CSettings::m_wNormalTextAttributes
private

Definition at line 18 of file Settings.h.

Referenced by CSettings(), GetNormalTextAttributes(), and Load().


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