ReactOS 0.4.15-dev-6068-g8061a6f
registry.c File Reference
#include "umandlg.h"
Include dependency graph for registry.c:

Go to the source code of this file.


#define ACCESS_UTILMAN_KEY   L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility\\Utility Manager"
#define UTILMAN_KEY   L"SOFTWARE\\Microsoft\\Utility Manager"
#define OSK_KEY   L"On-Screen Keyboard"
#define MAGNIFIER_KEY   L"Magnifier"


BOOL InitAppRegKey (IN HKEY hPredefinedKey, IN LPCWSTR lpszSubKey, OUT PHKEY phKey, OUT LPDWORD lpdwDisposition)
BOOL QueryAppSettings (IN HKEY hKey, IN LPCWSTR lpszSubKey, IN LPCWSTR lpszRegValue, OUT PVOID ReturnedData, IN OUT LPDWORD lpdwSizeData)
BOOL SaveAppSettings (IN HKEY hKey, IN LPCWSTR lpszRegValue, IN DWORD dwRegType, IN PVOID Data, IN DWORD cbSize)



Macro Definition Documentation


#define ACCESS_UTILMAN_KEY   L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Accessibility\\Utility Manager"

Definition at line 19 of file registry.c.


#define MAGNIFIER_KEY   L"Magnifier"

Definition at line 22 of file registry.c.


#define OSK_KEY   L"On-Screen Keyboard"

Definition at line 21 of file registry.c.


#define UTILMAN_KEY   L"SOFTWARE\\Microsoft\\Utility Manager"

Definition at line 20 of file registry.c.

Function Documentation

◆ InitAppRegKey()

BOOL InitAppRegKey ( IN HKEY  hPredefinedKey,
IN LPCWSTR  lpszSubKey,
OUT LPDWORD  lpdwDisposition 


Initialize a key. The function may not necessarily create it but open the key if it already exists. The disposition pointed lpdwDisposition determines that. This is a function helper.

[in]hPredefinedKeyThe predefined key (e.g. HKEY_CLASSES_ROOT).
[in]lpszSubKeyThe path to the sub key to be created.
[out]phKeyA pointer that receives a handle to the key given by the function.
[out]lpdwDispositionA pointer that receives the disposition given by the function.
Returns TRUE if the function successfully created a key (or opened it), FALSE otherwise for failure.

Definition at line 50 of file registry.c.

55 LONG lResult;
57 lResult = RegCreateKeyExW(hPredefinedKey,
58 lpszSubKey,
59 0,
60 NULL,
61 0,
63 NULL,
64 phKey,
65 lpdwDisposition);
66 if (lResult != ERROR_SUCCESS)
67 {
68 DPRINT("InitAppRegKey(): Failed to create the following key (or open the key) of path \"%S\". The error code is \"%li\".\n", lpszSubKey, lResult);
69 return FALSE;
70 }
72 return TRUE;
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define KEY_WRITE
Definition: nt_native.h:1031
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:71

◆ QueryAppSettings()

BOOL QueryAppSettings ( IN HKEY  hKey,
IN LPCWSTR  lpszSubKey,
IN LPCWSTR  lpszRegValue,
OUT PVOID  ReturnedData,
IN OUT LPDWORD  lpdwSizeData 


Query the setting from the application's key. This is a function helper.

[in]hKeyA handle to a key.
[in]lpszSubKeyThe path to a sub-key.
[in]lpszRegValueThe registry value where we need to get the data from.
[out]ReturnedDataAn arbitrary pointer that receives the returned data. Being arbitrary, the data can be of any type.
[in,out]lpdwSizeDataA pointer to the returned data pointed by ReturnedData parameter that retrieves the size of the aforementioned data, in bytes.
Returns TRUE if the function successfully loaded the value we wanted, FALSE otherwise for failure.

Definition at line 102 of file registry.c.

108 LONG lResult;
109 HKEY hKeyQueryValue;
111 lResult = RegOpenKeyExW(hKey,
112 lpszSubKey,
113 0,
115 &hKeyQueryValue);
116 if (lResult != ERROR_SUCCESS)
117 {
118 DPRINT("QueryAppSettings(): Failed to open the key of path \"%S\". The error code is \"%li\".\n", lpszSubKey, lResult);
119 return FALSE;
120 }
122 lResult = RegQueryValueExW(hKeyQueryValue,
123 lpszRegValue,
124 NULL,
125 NULL,
126 (LPBYTE)&ReturnedData,
127 lpdwSizeData);
128 if (lResult != ERROR_SUCCESS)
129 {
130 DPRINT("QueryAppSettings(): Failed to query the data from value \"%S\". The error code is \"%li\".\n", lpszRegValue, lResult);
131 RegCloseKey(hKeyQueryValue);
132 return FALSE;
133 }
135 RegCloseKey(hKeyQueryValue);
136 return TRUE;
#define RegCloseKey(hKey)
Definition: registry.h:47
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3353
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4118
FxAutoRegKey hKey
#define KEY_READ
Definition: nt_native.h:1023
unsigned char * LPBYTE
Definition: typedefs.h:53

◆ SaveAppSettings()

BOOL SaveAppSettings ( IN HKEY  hKey,
IN LPCWSTR  lpszRegValue,
IN DWORD  dwRegType,
IN DWORD  cbSize 


Save an application's setting data to the Registry. This is a function helper.

[in]hKeyA handle to a key.
[in]lpszRegValueThe path to the sub key where the value needs to be created.
[out]dwRegTypeThe type of registry value to be created (e.g. a REG_DWORD).
[in]DataA pointer to an arbitrary data for the value to be set. Being arbitrary, the data can be of any type (in conformity with the registry type pointed by dwRegType) otherwise the function might lead to a undefined behaviour.
[in]cbSizeThe size of the buffer data pointed by Data parameter, in bytes.
Returns TRUE if the function successfully saved the application's setting, FALSE otherwise for failure.

Definition at line 166 of file registry.c.

172 LONG lResult;
173 HKEY hKeySetValue;
175 lResult = RegOpenKeyExW(hKey,
176 NULL,
177 0,
179 &hKeySetValue);
180 if (lResult != ERROR_SUCCESS)
181 {
182 DPRINT("SaveAppSettings(): Failed to open the key, the error code is \"%li\"!\n", lResult);
183 return FALSE;
184 }
186 lResult = RegSetValueExW(hKeySetValue,
187 lpszRegValue,
188 0,
189 dwRegType,
190 (LPBYTE)&Data,
191 cbSize);
192 if (lResult != ERROR_SUCCESS)
193 {
194 DPRINT("SaveAppSettings(): Failed to set the \"%S\" value with data, the error code is \"%li\"!\n", lpszRegValue, lResult);
195 RegCloseKey(hKeySetValue);
196 return FALSE;
197 }
199 RegCloseKey(hKeySetValue);
200 return TRUE;
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4897
Definition: nt_native.h:1017

Variable Documentation

◆ RegData


Definition at line 14 of file registry.c.

◆ Settings

Definition at line 15 of file registry.c.