| 15 | //========================================================================== |
| 16 | |
| 17 | bool I_QueryPathKey(const wchar_t* keypath, const wchar_t* valname, FString& value) |
| 18 | { |
| 19 | HKEY pathkey; |
| 20 | DWORD pathtype; |
| 21 | DWORD pathlen; |
| 22 | LONG res; |
| 23 | |
| 24 | value = ""; |
| 25 | if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_QUERY_VALUE, &pathkey)) |
| 26 | { |
| 27 | if (ERROR_SUCCESS == RegQueryValueEx(pathkey, valname, 0, &pathtype, NULL, &pathlen) && |
| 28 | pathtype == REG_SZ && pathlen != 0) |
| 29 | { |
| 30 | // Don't include terminating null in count |
| 31 | TArray<wchar_t> chars(pathlen + 1, true); |
| 32 | res = RegQueryValueEx(pathkey, valname, 0, NULL, (LPBYTE)chars.Data(), &pathlen); |
| 33 | if (res == ERROR_SUCCESS) value = FString(chars.Data()); |
| 34 | } |
| 35 | RegCloseKey(pathkey); |
| 36 | } |
| 37 | return value.IsNotEmpty(); |
| 38 | } |
| 39 |
no test coverage detected