ReactOS 0.4.16-dev-297-gc569aee
settings.h File Reference
#include <wininet.h>
Include dependency graph for settings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SETTINGS_INFO
 

Typedefs

typedef SETTINGS_INFOPSETTINGS_INFO
 

Functions

BOOL LoadSettings (PSETTINGS_INFO pSettingsInfo)
 
BOOL SaveSettings (HWND hwnd, PSETTINGS_INFO pSettingsInfo)
 
VOID FillDefaultSettings (PSETTINGS_INFO pSettingsInfo)
 

Variables

SETTINGS_INFO SettingsInfo
 

Typedef Documentation

◆ PSETTINGS_INFO

Definition at line 27 of file settings.h.

Function Documentation

◆ FillDefaultSettings()

VOID FillDefaultSettings ( PSETTINGS_INFO  pSettingsInfo)

Definition at line 210 of file settings.cpp.

211{
212 ZeroMemory(pSettingsInfo, sizeof(*pSettingsInfo));
213
214 pSettingsInfo->bSaveWndPos = TRUE;
215 pSettingsInfo->bUpdateAtStart = FALSE;
216 pSettingsInfo->bLogEnabled = TRUE;
217 pSettingsInfo->bUseSource = FALSE;
218 pSettingsInfo->bDelInstaller = FALSE;
219 pSettingsInfo->Maximized = FALSE;
220 pSettingsInfo->Left = CW_USEDEFAULT;
221 pSettingsInfo->Top = CW_USEDEFAULT;
222 pSettingsInfo->Width = 680;
223 pSettingsInfo->Height = 450;
224
225 ValidateStringSettings(pSettingsInfo);
226}
static VOID ValidateStringSettings(PSETTINGS_INFO pSettingsInfo)
Definition: settings.cpp:197
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL bUseSource
Definition: settings.h:23
BOOL bLogEnabled
Definition: settings.h:9
BOOL bDelInstaller
Definition: settings.h:11
BOOL Maximized
Definition: settings.h:13
BOOL bUpdateAtStart
Definition: settings.h:8
BOOL bSaveWndPos
Definition: settings.h:7
#define ZeroMemory
Definition: winbase.h:1737
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by LoadSettings(), and anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc().

◆ LoadSettings()

BOOL LoadSettings ( PSETTINGS_INFO  pSettingsInfo)

Definition at line 229 of file settings.cpp.

230{
231 BOOL bLoadedAny = FALSE;
232
233 FillDefaultSettings(pSettingsInfo);
234
235 ATL::CRegKey RegKey;
237 {
238 bLoadedAny = LoadAllSettings(RegKey, *pSettingsInfo);
239 }
240
241 ValidateStringSettings(pSettingsInfo); // Handles the case where a REG_SZ is present but empty
242
243 if (!bLoadedAny)
244 {
245 // This the first launch, write at least one item so ParseCmdAndExecute() does not
246 // trigger another DB update in another process instance between now and SaveSettings().
247 ATL::CRegKey RegKey;
250 {
251 SettingsFieldBool field(&(pSettingsInfo->bUpdateAtStart), L"bUpdateAtStart");
252 field.Save(RegKey);
253 }
254 }
255 return bLoadedAny;
256}
static BOOL LoadAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:156
#define SETTINGSSUBKEY
Definition: settings.cpp:11
VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
Definition: settings.cpp:210
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL) noexcept
Definition: atlbase.h:1189
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_READ
Definition: nt_native.h:1023
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define L(x)
Definition: ntvdm.h:50
Definition: parser.c:44
#define HKEY_CURRENT_USER
Definition: winreg.h:11

◆ SaveSettings()

BOOL SaveSettings ( HWND  hwnd,
PSETTINGS_INFO  pSettingsInfo 
)

Definition at line 259 of file settings.cpp.

260{
262 ATL::CRegKey RegKey;
263
264 if (pSettingsInfo->bSaveWndPos)
265 {
266 wp.length = sizeof(wp);
268
269 pSettingsInfo->Left = wp.rcNormalPosition.left;
270 pSettingsInfo->Top = wp.rcNormalPosition.top;
271 pSettingsInfo->Width = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
272 pSettingsInfo->Height = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
273 pSettingsInfo->Maximized =
275 }
276
279 {
280 return FALSE;
281 }
282
283 return SaveAllSettings(RegKey, *pSettingsInfo);
284}
static BOOL SaveAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:134
RECT rcNormalPosition
Definition: winuser.h:3298
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define SW_SHOWMINIMIZED
Definition: winuser.h:774
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2535
#define SW_MAXIMIZE
Definition: winuser.h:775

Variable Documentation

◆ SettingsInfo