ReactOS 0.4.15-dev-7660-g0086d05
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 179 of file settings.cpp.

180{
181 CStringW szDownloadDir;
182 ZeroMemory(pSettingsInfo, sizeof(SETTINGS_INFO));
183
184 pSettingsInfo->bSaveWndPos = TRUE;
185 pSettingsInfo->bUpdateAtStart = FALSE;
186 pSettingsInfo->bLogEnabled = TRUE;
187 pSettingsInfo->bUseSource = FALSE;
188
190 {
191 szDownloadDir.ReleaseBuffer();
192 if (!szDownloadDir.GetEnvironmentVariableW(L"SystemDrive"))
193 {
194 szDownloadDir = L"C:";
195 }
196 }
197 else
198 {
199 szDownloadDir.ReleaseBuffer();
200 }
201
202 PathAppendW(szDownloadDir.GetBuffer(MAX_PATH), L"\\RAPPS Downloads");
203 szDownloadDir.ReleaseBuffer();
204
206 pSettingsInfo->szDownloadDir, _countof(pSettingsInfo->szDownloadDir), szDownloadDir.GetString(),
207 szDownloadDir.GetLength() + 1);
208
209 pSettingsInfo->bDelInstaller = FALSE;
210 pSettingsInfo->Maximized = FALSE;
211 pSettingsInfo->Left = CW_USEDEFAULT;
212 pSettingsInfo->Top = CW_USEDEFAULT;
213 pSettingsInfo->Width = 680;
214 pSettingsInfo->Height = 450;
215}
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars) noexcept
Definition: atlsimpstr.h:433
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:382
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
int GetLength() const noexcept
Definition: atlsimpstr.h:362
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2558
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
#define PathAppendW
Definition: pathcch.h:309
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2067
#define CSIDL_PERSONAL
Definition: shlobj.h:2096
#define _countof(array)
Definition: sndvol32.h:68
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
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:1712
#define CW_USEDEFAULT
Definition: winuser.h:225

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

◆ LoadSettings()

BOOL LoadSettings ( PSETTINGS_INFO  pSettingsInfo)

Definition at line 218 of file settings.cpp.

219{
220 ATL::CRegKey RegKey;
221 if (RegKey.Open(HKEY_CURRENT_USER, L"Software\\ReactOS\\" RAPPS_NAME, KEY_READ) != ERROR_SUCCESS)
222 {
223 return FALSE;
224 }
225
226 return LoadAllSettings(RegKey, *pSettingsInfo);
227}
#define RAPPS_NAME
Definition: defines.h:34
BOOL LoadAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:157
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11

◆ SaveSettings()

BOOL SaveSettings ( HWND  hwnd,
PSETTINGS_INFO  pSettingsInfo 
)

Definition at line 230 of file settings.cpp.

231{
233 ATL::CRegKey RegKey;
234
235 if (pSettingsInfo->bSaveWndPos)
236 {
237 wp.length = sizeof(wp);
239
240 pSettingsInfo->Left = wp.rcNormalPosition.left;
241 pSettingsInfo->Top = wp.rcNormalPosition.top;
242 pSettingsInfo->Width = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
243 pSettingsInfo->Height = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
244 pSettingsInfo->Maximized =
246 }
247
248 if (RegKey.Create(HKEY_CURRENT_USER, L"Software\\ReactOS\\" RAPPS_NAME, NULL,
250 {
251 return FALSE;
252 }
253
254 return SaveAllSettings(RegKey, *pSettingsInfo);
255}
BOOL SaveAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:135
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 REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
RECT rcNormalPosition
Definition: winuser.h:3294
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:770
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2531
#define SW_MAXIMIZE
Definition: winuser.h:771

Variable Documentation

◆ SettingsInfo