2 * PROJECT: ReactOS On-Screen Keyboard
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Settings file for warning dialog on startup
5 * COPYRIGHT: Copyright 2018 Bișoc George (fraizeraust99 at gmail dot com)
8 /* INCLUDES *******************************************************************/
13 /* FUNCTIONS *******************************************************************/
15 BOOL
LoadDataFromRegistry()
19 DWORD dwShowWarningData
, dwLayout
, dwSoundOnClick
;
20 DWORD cbData
= sizeof(DWORD
);
22 /* Set the structure members to TRUE (and the bSoundClick member to FALSE) */
23 Globals
.bShowWarning
= TRUE
;
24 Globals
.bIsEnhancedKeyboard
= TRUE
;
25 Globals
.bSoundClick
= FALSE
;
27 /* Open the key, so that we can query it */
28 lResult
= RegOpenKeyExW(HKEY_CURRENT_USER
,
29 L
"Software\\Microsoft\\osk",
34 if (lResult
!= ERROR_SUCCESS
)
36 /* Bail out and return FALSE if we fail */
41 lResult
= RegQueryValueExW(hKey
,
45 (BYTE
*)&dwShowWarningData
,
48 if (lResult
!= ERROR_SUCCESS
)
50 /* Bail out and return FALSE if we fail */
55 /* Load the data value (it can be either FALSE or TRUE depending on the data itself) */
56 Globals
.bShowWarning
= (dwShowWarningData
!= 0);
59 lResult
= RegQueryValueExW(hKey
,
60 L
"IsEnhancedKeyboard",
66 if (lResult
!= ERROR_SUCCESS
)
68 /* Bail out and return FALSE if we fail */
73 /* Load the dialog layout value */
74 Globals
.bIsEnhancedKeyboard
= (dwLayout
!= 0);
77 lResult
= RegQueryValueExW(hKey
,
81 (BYTE
*)&dwSoundOnClick
,
84 if (lResult
!= ERROR_SUCCESS
)
86 /* Bail out and return FALSE if we fail */
91 /* Load the sound on click value event */
92 Globals
.bSoundClick
= (dwSoundOnClick
!= 0);
94 /* If we're here then we succeed, close the key and return TRUE */
99 BOOL
SaveDataToRegistry()
103 DWORD dwShowWarningData
, dwLayout
, dwSoundOnClick
;
105 /* If no key has been made, create one */
106 lResult
= RegCreateKeyExW(HKEY_CURRENT_USER
,
107 L
"Software\\Microsoft\\osk",
116 if (lResult
!= ERROR_SUCCESS
)
118 /* Bail out and return FALSE if we fail */
122 /* The data value of the subkey will be appended to the warning dialog switch */
123 dwShowWarningData
= Globals
.bShowWarning
;
125 lResult
= RegSetValueExW(hKey
,
129 (BYTE
*)&dwShowWarningData
,
130 sizeof(dwShowWarningData
));
132 if (lResult
!= ERROR_SUCCESS
)
134 /* Bail out and return FALSE if we fail */
139 /* The value will be appended to the layout dialog */
140 dwLayout
= Globals
.bIsEnhancedKeyboard
;
142 lResult
= RegSetValueExW(hKey
,
143 L
"IsEnhancedKeyboard",
149 if (lResult
!= ERROR_SUCCESS
)
151 /* Bail out and return FALSE if we fail */
156 /* The value will be appended to the sound on click event */
157 dwSoundOnClick
= Globals
.bSoundClick
;
159 lResult
= RegSetValueExW(hKey
,
163 (BYTE
*)&dwSoundOnClick
,
164 sizeof(dwSoundOnClick
));
166 if (lResult
!= ERROR_SUCCESS
)
168 /* Bail out and return FALSE if we fail */
173 /* If we're here then we succeed, close the key and return TRUE */