| 185 | } |
| 186 | |
| 187 | BOOL 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 | |
| 228 | BOOL registryWriteDWORD(const char *path, DWORD dw) |
| 229 | { |
no test coverage detected