ReactOS  0.4.12-dev-102-g4b7f1e0
settings.c File Reference
#include "magnifier.h"
#include <tchar.h>
#include <winreg.h>
Include dependency graph for settings.c:

Go to the source code of this file.

Functions

void LoadSettings ()
 
void SaveSettings ()
 

Variables

int iZoom = 3
 
BOOL bShowWarning = TRUE
 
BOOL bFollowMouse = TRUE
 
BOOL bFollowFocus = TRUE
 
BOOL bFollowCaret = TRUE
 
BOOL bInvertColors = FALSE
 
BOOL bStartMinimized = FALSE
 
BOOL bShowMagnifier = TRUE
 
struct _AppBarConfig_t AppBarConfig
 

Function Documentation

◆ LoadSettings()

void LoadSettings ( void  )

Definition at line 35 of file settings.c.

36 {
37  HKEY hkey;
38  LONG value;
39  ULONG len;
40  struct _AppBarConfig_t config_temp;
41 
42  if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, KEY_READ, &hkey) == ERROR_SUCCESS)
43  {
44  len = sizeof(AppBarConfig);
45  if (RegQueryValueEx(hkey, _T("AppBar"), 0, 0, (BYTE *)&config_temp, &len) == ERROR_SUCCESS)
46  {
47  if(config_temp.cbSize == sizeof(AppBarConfig))
48  {
49  AppBarConfig = config_temp;
50  }
51  }
52 
53  len = 4;
54  if (RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
55  {
56  if (value >= 0 && value <= 9)
57  iZoom = value;
58  }
59 
60  len = 4;
61  if (RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
62  bShowWarning = (value == 0 ? FALSE : TRUE);
63 
64  len = 4;
65  if (RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
66  bInvertColors = (value == 0 ? FALSE : TRUE);
67 
68  len = 4;
69  if (RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
70  bStartMinimized = (value == 0 ? FALSE : TRUE);
71 
72  len = 4;
73  if (RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
74  bFollowMouse = (value == 0 ? FALSE : TRUE);
75 
76  len = 4;
77  if (RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
78  bFollowFocus = (value == 0 ? FALSE : TRUE);
79 
80  len = 4;
81  if (RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
82  bFollowFocus = (value == 0 ? FALSE : TRUE);
83 
84  len = 4;
85  if (RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len) == ERROR_SUCCESS)
86  bFollowCaret = (value == 0 ? FALSE : TRUE);
87 
88  RegCloseKey(hkey);
89  }
90 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
int iZoom
Definition: settings.c:15
#define HKEY_CURRENT_USER
Definition: winreg.h:11
struct _AppBarConfig_t AppBarConfig
Definition: settings.c:27
BOOL bShowWarning
Definition: settings.c:17
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
BOOL bInvertColors
Definition: settings.c:23
#define _T(x)
Definition: vfdio.h:22
BOOL bFollowCaret
Definition: settings.c:21
BOOL bFollowFocus
Definition: settings.c:20
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
BOOL bStartMinimized
Definition: settings.c:24
GLsizei const GLfloat * value
Definition: glext.h:6069
#define RegOpenKeyEx
Definition: winreg.h:520
BOOL bFollowMouse
Definition: settings.c:19
unsigned int ULONG
Definition: retypes.h:1

◆ SaveSettings()

void SaveSettings ( void  )

Definition at line 92 of file settings.c.

93 {
94  HKEY hkey;
95  LONG value;
96 
97  if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, _T(""), 0, KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS)
98  {
99  RegSetValueEx(hkey, _T("AppBar"), 0, REG_BINARY, (BYTE *)&AppBarConfig, sizeof(AppBarConfig));
100 
101  value = iZoom;
102  RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
103 
104  value = bShowWarning;
105  RegSetValueEx(hkey, _T("ShowWarning"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
106 
107  value = bInvertColors;
108  RegSetValueEx(hkey, _T("StationaryInvertColors"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
109 
110  value = bStartMinimized;
111  RegSetValueEx(hkey, _T("StationaryStartMinimized"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
112 
113  value = bFollowMouse;
114  RegSetValueEx(hkey, _T("StationaryTrackCursor"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
115 
116  value = bFollowFocus;
117  RegSetValueEx(hkey, _T("StationaryTrackFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
118 
119  value = bFollowFocus;
120  RegSetValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
121 
122  value = bFollowCaret;
123  RegSetValueEx(hkey, _T("StationaryTrackText"), 0, REG_DWORD, (BYTE *)&value, sizeof(value));
124 
125  RegCloseKey(hkey);
126  }
127 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
int iZoom
Definition: settings.c:15
#define HKEY_CURRENT_USER
Definition: winreg.h:11
struct _AppBarConfig_t AppBarConfig
Definition: settings.c:27
BOOL bShowWarning
Definition: settings.c:17
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
BOOL bInvertColors
Definition: settings.c:23
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
#define _T(x)
Definition: vfdio.h:22
BOOL bFollowCaret
Definition: settings.c:21
BOOL bFollowFocus
Definition: settings.c:20
unsigned char BYTE
Definition: mem.h:68
BOOL bStartMinimized
Definition: settings.c:24
GLsizei const GLfloat * value
Definition: glext.h:6069
BOOL bFollowMouse
Definition: settings.c:19
#define REG_DWORD
Definition: sdbapi.c:539
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501

Variable Documentation

◆ AppBarConfig

struct _AppBarConfig_t AppBarConfig
Initial value:
= {
sizeof(struct _AppBarConfig_t),
-2 ,
0, 1,
{ 101,101,101,101 },
{ 20, 20, 600, 200 },
}

Definition at line 27 of file settings.c.

Referenced by AttachAppBar(), DoAppBarStuff(), InitInstance(), LoadSettings(), and WndProc().

◆ bFollowCaret

BOOL bFollowCaret = TRUE

Definition at line 21 of file settings.c.

Referenced by LoadSettings(), OptionsProc(), SaveSettings(), and WndProc().

◆ bFollowFocus

BOOL bFollowFocus = TRUE

Definition at line 20 of file settings.c.

Referenced by LoadSettings(), OptionsProc(), SaveSettings(), and WndProc().

◆ bFollowMouse

BOOL bFollowMouse = TRUE

Definition at line 19 of file settings.c.

Referenced by LoadSettings(), OptionsProc(), SaveSettings(), and WndProc().

◆ bInvertColors

BOOL bInvertColors = FALSE

Definition at line 23 of file settings.c.

Referenced by Draw(), LoadSettings(), OptionsProc(), and SaveSettings().

◆ bShowMagnifier

BOOL bShowMagnifier = TRUE

Definition at line 25 of file settings.c.

Referenced by OptionsProc().

◆ bShowWarning

BOOL bShowWarning = TRUE

Definition at line 17 of file settings.c.

Referenced by InitInstance(), LoadSettings(), SaveSettings(), and WarningProc().

◆ bStartMinimized

BOOL bStartMinimized = FALSE

Definition at line 24 of file settings.c.

Referenced by InitInstance(), LoadSettings(), OptionsProc(), and SaveSettings().

◆ iZoom

int iZoom = 3

Definition at line 15 of file settings.c.

Referenced by Draw(), LoadSettings(), OptionsProc(), and SaveSettings().