4 char *out_string,
int out_string_size) {
8 const char *delimiter = strstr(
path,
"/");
10 strncpy(current_key,
path, delimiter -
path);
11 current_key[delimiter -
path] =
'\0';
13 strcpy(path_tail, delimiter + 1);
16 if (!strcmpi(current_key,
"HKEY_CLASSES_ROOT"))
17 parent_key = HKEY_CLASSES_ROOT;
18 else if (!strcmpi(current_key,
"HKEY_CURRENT_CONFIG"))
19 parent_key = HKEY_CURRENT_CONFIG;
20 else if (!strcmpi(current_key,
"HKEY_CURRENT_USER"))
21 parent_key = HKEY_CURRENT_USER;
22 else if (!strcmpi(current_key,
"HKEY_LOCAL_MACHINE"))
23 parent_key = HKEY_LOCAL_MACHINE;
24 else if (!strcmpi(current_key,
"HKEY_USERS"))
25 parent_key = HKEY_USERS;
29 delimiter = strstr(path_tail,
"/");
31 strncpy(current_key, path_tail, delimiter - path_tail);
32 current_key[delimiter - path_tail] =
'\0';
34 strcpy(path_tail, delimiter + 1);
42 if (!RegOpenKeyExA(parent_key, current_key, 0,
43 KEY_READ | KEY_WOW64_32KEY, &key)) {
60 DWORD data_size = out_string_size;
61 if (RegQueryValueExA(parent_key,
path,
nullptr,
nullptr,
62 (LPBYTE)out_string, &data_size))
89 *(
int *)Data = uDefValue;
91 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE", 0,
92 KEY_READ | KEY_WOW64_32KEY, &hKey)) {
93 if (!RegCreateKeyExA(hKey,
"New World Computing", 0,
"", 0,
94 KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) {
95 if (!RegCreateKeyExA(phkResult,
"Might and Magic VII", 0,
"", 0,
96 KEY_ALL_ACCESS, 0, &v10, &dwDisposition)) {
97 if (!RegCreateKeyExA(v10,
"1.0", 0,
"", 0, KEY_ALL_ACCESS, 0,
98 &v11, &dwDisposition)) {
100 if (status = RegQueryValueExA(v11, lpValueName, 0, 0, Data,
104 RegSetValueExA(v11, lpValueName, 0, 4, Data, 4);
110 RegCloseKey(phkResult);
120 const char *lpValueName;
134 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE", 0,
135 KEY_READ | KEY_WOW64_32KEY, &hKey)) {
136 if (!RegCreateKeyExA(hKey,
"New World Computing", 0,
"", 0,
137 KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) {
138 if (!RegCreateKeyExA(phkResult,
"Might and Magic VII", 0,
"", 0,
139 KEY_ALL_ACCESS, 0, &v8, &dwDisposition)) {
140 if (!RegCreateKeyExA(v8,
"1.0", 0,
"", 0, KEY_ALL_ACCESS, 0,
141 &v9, &dwDisposition)) {
143 RegSetValueExA(v9, lpValueName, 0, 1, (
const BYTE *)Str,
149 RegCloseKey(phkResult);
157 const char *pDefaultValue) {
171 Dest = (LPBYTE)pOutString;
172 lpValueName = pKeyName;
177 result = (LSTATUS)strncpy((
char *)Dest, pDefaultValue, uBufLen);
178 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE", 0,
179 KEY_READ | KEY_WOW64_32KEY, &hKey)) {
180 if (!RegCreateKeyExA(hKey,
"New World Computing", 0,
"", 0,
181 KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) {
182 if (!RegCreateKeyExA(phkResult,
"Might and Magic VII", 0,
"", 0,
183 KEY_ALL_ACCESS, 0, &v13, &dwDisposition)) {
184 if (!RegCreateKeyExA(v13,
"1.0", 0,
"", 0, KEY_ALL_ACCESS, 0,
185 &v14, &dwDisposition)) {
186 if (RegQueryValueExA(v14, lpValueName, 0, &Type, Dest,
195 RegCloseKey(phkResult);
205 const char *lpValueName;
219 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE", 0,
220 KEY_READ | KEY_WOW64_32KEY, &hKey)) {
221 if (!RegCreateKeyExA(hKey,
"New World Computing", 0,
"", 0,
222 KEY_ALL_ACCESS, 0, &phkResult, &dwDisposition)) {
223 if (!RegCreateKeyExA(phkResult,
"Might and Magic VII", 0,
"", 0,
224 KEY_ALL_ACCESS, 0, &v7, &dwDisposition)) {
225 if (!RegCreateKeyExA(v7,
"1.0", 0,
"", 0, KEY_ALL_ACCESS, 0,
226 &v8, &dwDisposition)) {
227 RegSetValueExA(v8, lpValueName, 0, 4, Data, 4);
232 RegCloseKey(phkResult);