fa21d67d3a50c0bf05b18c45d9ee347fdf2037a6
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
;
20 DWORD cbData
= sizeof(DWORD
);
22 /* Set the structure members to TRUE */
23 Globals
.bShowWarning
= TRUE
;
24 Globals
.bIsEnhancedKeyboard
= TRUE
;
26 /* Open the key, so that we can query it */
27 lResult
= RegOpenKeyExW(HKEY_CURRENT_USER
,
28 L
"Software\\Microsoft\\osk",
33 if (lResult
!= ERROR_SUCCESS
)
35 /* Bail out and return FALSE if we fail */
40 lResult
= RegQueryValueExW(hKey
,
44 (BYTE
*)&dwShowWarningData
,
47 if (lResult
!= ERROR_SUCCESS
)
49 /* Bail out and return FALSE if we fail */
54 /* Load the data value (it can be either FALSE or TRUE depending on the data itself) */
55 Globals
.bShowWarning
= (dwShowWarningData
!= 0);
58 lResult
= RegQueryValueExW(hKey
,
59 L
"IsEnhancedKeyboard",
65 if (lResult
!= ERROR_SUCCESS
)
67 /* Bail out and return FALSE if we fail */
72 /* Load the dialog layout value */
73 Globals
.bIsEnhancedKeyboard
= (dwLayout
!= 0);
75 /* If we're here then we succeed, close the key and return TRUE */
80 BOOL
SaveDataToRegistry()
84 DWORD dwShowWarningData
, dwLayout
;
86 /* If no key has been made, create one */
87 lResult
= RegCreateKeyExW(HKEY_CURRENT_USER
,
88 L
"Software\\Microsoft\\osk",
97 if (lResult
!= ERROR_SUCCESS
)
99 /* Bail out and return FALSE if we fail */
103 /* The data value of the subkey will be appended to the warning dialog switch */
104 dwShowWarningData
= Globals
.bShowWarning
;
106 lResult
= RegSetValueExW(hKey
,
110 (BYTE
*)&dwShowWarningData
,
111 sizeof(dwShowWarningData
));
113 if (lResult
!= ERROR_SUCCESS
)
115 /* Bail out and return FALSE if we fail */
120 /* The value will be appended to the layout dialog */
121 dwLayout
= Globals
.bIsEnhancedKeyboard
;
123 lResult
= RegSetValueExW(hKey
,
124 L
"IsEnhancedKeyboard",
130 if (lResult
!= ERROR_SUCCESS
)
132 /* Bail out and return FALSE if we fail */
137 /* If we're here then we succeed, close the key and return TRUE */