ReactOS  0.4.15-dev-1377-ga59cecd
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 }
int GetLength() const
Definition: atlsimpstr.h:356
BOOL bUpdateAtStart
Definition: settings.h:8
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1648
BOOL Maximized
Definition: settings.h:13
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
WCHAR szDownloadDir[MAX_PATH]
Definition: settings.h:10
BOOL bUseSource
Definition: settings.h:23
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#define FALSE
Definition: types.h:117
#define CW_USEDEFAULT
Definition: winuser.h:225
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
PCXSTR GetString() const
Definition: atlsimpstr.h:361
static const WCHAR L[]
Definition: oid.c:1250
BOOL bLogEnabled
Definition: settings.h:9
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
#define NULL
Definition: types.h:112
BOOL bDelInstaller
Definition: settings.h:11
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2208
BOOL bSaveWndPos
Definition: settings.h:7

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define FALSE
Definition: types.h:117
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE)
Definition: atlbase.h:1070
BOOL LoadAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:146
static const WCHAR L[]
Definition: oid.c:1250

◆ SaveSettings()

BOOL SaveSettings ( HWND  hwnd,
PSETTINGS_INFO  pSettingsInfo 
)

Definition at line 217 of file settings.cpp.

218 {
219  WINDOWPLACEMENT wp;
220  ATL::CRegKey RegKey;
221 
222  if (pSettingsInfo->bSaveWndPos)
223  {
224  wp.length = sizeof(wp);
225  GetWindowPlacement(hwnd, &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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL SaveAllSettings(CRegKey &key, SETTINGS_INFO &settings)
Definition: settings.cpp:125
LONG top
Definition: windef.h:307
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2507
LONG left
Definition: windef.h:306
#define SW_SHOWMINIMIZED
Definition: winuser.h:765
LONG right
Definition: windef.h:308
BOOL Maximized
Definition: settings.h:13
#define FALSE
Definition: types.h:117
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
static const WCHAR L[]
Definition: oid.c:1250
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:1091
#define NULL
Definition: types.h:112
RECT rcNormalPosition
Definition: winuser.h:3270
BOOL bSaveWndPos
Definition: settings.h:7
LONG bottom
Definition: windef.h:309
#define SW_MAXIMIZE
Definition: winuser.h:766

Variable Documentation

◆ SettingsInfo