ReactOS 0.4.15-dev-5672-gf73ac17
settings.h File Reference
#include <windef.h>
#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 167 of file settings.cpp.

168{
169 ATL::CStringW szDownloadDir;
170 ZeroMemory(pSettingsInfo, sizeof(SETTINGS_INFO));
171
172 pSettingsInfo->bSaveWndPos = TRUE;
173 pSettingsInfo->bUpdateAtStart = FALSE;
174 pSettingsInfo->bLogEnabled = TRUE;
175 pSettingsInfo->bUseSource = FALSE;
176
178 {
179 szDownloadDir.ReleaseBuffer();
180 if (!szDownloadDir.GetEnvironmentVariableW(L"SystemDrive"))
181 {
182 szDownloadDir = L"C:";
183 }
184 }
185 else
186 {
187 szDownloadDir.ReleaseBuffer();
188 }
189
190 PathAppendW(szDownloadDir.GetBuffer(MAX_PATH), L"\\RAPPS Downloads");
191 szDownloadDir.ReleaseBuffer();
192
194 _countof(pSettingsInfo->szDownloadDir),
195 szDownloadDir.GetString(),
196 szDownloadDir.GetLength() + 1);
197
198 pSettingsInfo->bDelInstaller = FALSE;
199 pSettingsInfo->Maximized = FALSE;
200 pSettingsInfo->Left = CW_USEDEFAULT;
201 pSettingsInfo->Top = CW_USEDEFAULT;
202 pSettingsInfo->Width = 680;
203 pSettingsInfo->Height = 450;
204}
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)
Definition: atlsimpstr.h:423
int GetLength() const
Definition: atlsimpstr.h:356
PCXSTR GetString() const
Definition: atlsimpstr.h:361
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#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
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2001
#define CSIDL_PERSONAL
Definition: shlobj.h:2030
#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:1670
#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 206 of file settings.cpp.

207{
208 ATL::CRegKey RegKey;
209 if (RegKey.Open(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", KEY_READ) != ERROR_SUCCESS)
210 {
211 return FALSE;
212 }
213
214 return LoadAllSettings(RegKey, *pSettingsInfo);
215}
BOOL LoadAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:146
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE)
Definition: atlbase.h:1072
#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 217 of file settings.cpp.

218{
220 ATL::CRegKey RegKey;
221
222 if (pSettingsInfo->bSaveWndPos)
223 {
224 wp.length = sizeof(wp);
226
227 pSettingsInfo->Left = wp.rcNormalPosition.left;
228 pSettingsInfo->Top = wp.rcNormalPosition.top;
229 pSettingsInfo->Width = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
230 pSettingsInfo->Height = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
231 pSettingsInfo->Maximized = (wp.showCmd == SW_MAXIMIZE
232 || (wp.showCmd == SW_SHOWMINIMIZED
233 && (wp.flags & WPF_RESTORETOMAXIMIZED)));
234 }
235
236 if (RegKey.Create(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", NULL,
238 {
239 return FALSE;
240 }
241
242 return SaveAllSettings(RegKey, *pSettingsInfo);
243}
BOOL SaveAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:125
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)
Definition: atlbase.h:1093
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
RECT rcNormalPosition
Definition: winuser.h:3285
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:765
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2522
#define SW_MAXIMIZE
Definition: winuser.h:766

Variable Documentation

◆ SettingsInfo