ReactOS 0.4.15-dev-7674-gc0b4db1
Settings.cpp
Go to the documentation of this file.
1/*
2 * regexpl - Console Registry Explorer
3 *
4 * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22// Settings.cpp : implemetation of CSettings class - user customizable settings for Registry Explorer
23
24#include "ph.h"
25#include "RegistryExplorer.h"
26#include "Settings.h"
27#include "Prompt.h"
28
29#define DEFAULT_NORMAL_TEXT_ATTRIBUTES FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED
30#define DEFAULT_COMMAND_TEXT_ATTRIBUTES FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED
31
33{
35
38}
39
41{
43}
44
46{
47 if (m_pszPrompt)
48 {
49 delete[] m_pszPrompt;
51 }
52
53 return S_OK;
54}
55
57{
58 HKEY hKey = NULL;
59 HRESULT hr;
60 DWORD dwType;
62 DWORD w;
63
64 hr = Clean();
65 if (FAILED(hr))
66 return hr;
67
68 hr = S_OK;
69
71 if (nError != ERROR_SUCCESS)
72 return S_FALSE;
73
75 if (nError == ERROR_SUCCESS && dwType == REG_SZ)
76 {
77 m_pszPrompt = (TCHAR *) new (std::nothrow) BYTE[dwSize];
78 if (!m_pszPrompt)
79 {
81 goto Exit;
82 }
83
85 if (nError != ERROR_SUCCESS || dwType != REG_SZ)
86 {
87 delete m_pszPrompt;
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
119Exit:
120
121 if (hKey)
123
124 return hr;
125}
126
128{
129 return S_OK;
130}
131
133{
135}
136
138{
140}
141
143{
145}
#define NORMAL_TEXT_ATTRIBUTES_VALUE_NAME
#define COMMAND_TEXT_ATTRIBUTES_VALUE_NAME
#define PROMPT_VALUE_NAME
#define DEFAULT_COMMAND_TEXT_ATTRIBUTES
Definition: Settings.cpp:30
#define DEFAULT_NORMAL_TEXT_ATTRIBUTES
Definition: Settings.cpp:29
#define RegCloseKey(hKey)
Definition: registry.h:49
static LPCTSTR GetDefaultPrompt()
Definition: Prompt.cpp:90
HRESULT Load(LPCTSTR pszLoadKey)
Definition: Settings.cpp:56
~CSettings()
Definition: Settings.cpp:40
LPCTSTR GetPrompt()
Definition: Settings.cpp:132
WORD m_wCommandTextAttributes
Definition: Settings.h:19
HRESULT Clean()
Definition: Settings.cpp:45
LPTSTR m_pszPrompt
Definition: Settings.h:17
WORD GetCommandTextAttributes()
Definition: Settings.cpp:142
WORD GetNormalTextAttributes()
Definition: Settings.cpp:137
HRESULT Store(LPCTSTR pszStoreKey)
Definition: Settings.cpp:127
WORD m_wNormalTextAttributes
Definition: Settings.h:18
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define REG_SZ
Definition: layer.c:22
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
HRESULT hr
Definition: shlfolder.c:183
static void Exit(void)
Definition: sock.c:1330
#define VERIFY(e)
Definition: ph.h:34
#define S_FALSE
Definition: winerror.h:2357
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
char TCHAR
Definition: xmlstorage.h:189
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
unsigned char BYTE
Definition: xxhash.c:193