MCPcopy Create free account
hub / github.com/JHRobotics/softgpu / registryWrite

Function registryWrite

winreg.c:187–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187BOOL registryWrite(const char *path, const char *str, int type)
188{
189 HKEY rootkey;
190 const char *key;
191 const char *subkey;
192 BOOL rc = FALSE;
193
194 if(registrySplitPath(path, &rootkey, &key, &subkey))
195 {
196 HKEY hKey;
197 LSTATUS lResult = -1;
198
199 lResult = RegCreateKeyA(rootkey, key, &hKey);
200 //lResult = RegOpenKeyEx(rootkey, key, 0, KEY_READ, &hKey);
201 if(lResult == ERROR_SUCCESS)
202 {
203 if(type == WINREG_DWORD)
204 {
205 DWORD tmp = strtoul(str, NULL, 0);
206 lResult = RegSetValueExA(hKey, subkey, 0, REG_DWORD, (LPBYTE)&tmp, sizeof(DWORD));
207 }
208 else if(type == WINREG_STR)
209 {
210 lResult = RegSetValueExA(hKey, subkey, 0, REG_SZ, (LPBYTE)str, strlen(str)+1);
211 }
212
213 if(lResult == ERROR_SUCCESS)
214 {
215 rc = TRUE;
216 }
217 RegCloseKey(hKey);
218 }
219 else
220 {
221 REPORT("RegCreateKeyA: %ld", lResult);
222 }
223 }
224
225 return rc;
226}
227
228BOOL registryWriteDWORD(const char *path, DWORD dw)
229{

Callers 2

registryWriteDWORDFunction · 0.85
writeSettingsFunction · 0.85

Calls 1

registrySplitPathFunction · 0.85

Tested by

no test coverage detected