MCPcopy Create free account
hub / github.com/ZDoom/Raze / I_QueryPathKey

Function I_QueryPathKey

source/platform/win32/i_steam.cpp:17–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15//==========================================================================
16
17bool 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

Callers 1

G_AddExternalSearchPathsFunction · 0.85

Calls 3

IsNotEmptyMethod · 0.80
FStringClass · 0.50
DataMethod · 0.45

Tested by

no test coverage detected