MCPcopy Create free account
hub / github.com/LibreVR/Revive / GetLibraryPath

Function GetLibraryPath

ReviveOverlay/revivemanifestcontroller.cpp:34–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34bool GetLibraryPath(PWCHAR path, DWORD length, PWCHAR guid)
35{
36 LONG error = ERROR_SUCCESS;
37
38 // Open the libraries key
39 WCHAR keyPath[MAX_PATH] = { L"Software\\Oculus VR, LLC\\Oculus\\Libraries\\" };
40 HKEY oculusKey;
41
42 // Open the library key
43 wcsncat(keyPath, guid, MAX_PATH);
44 error = RegOpenKeyExW(HKEY_CURRENT_USER, keyPath, 0, KEY_READ, &oculusKey);
45 if (error != ERROR_SUCCESS)
46 {
47 qDebug("Unable to open Library path key.");
48 return false;
49 }
50
51 // Get the volume path to this library
52 DWORD pathSize;
53 error = RegQueryValueExW(oculusKey, L"Path", NULL, NULL, NULL, &pathSize);
54 PWCHAR volumePath = (PWCHAR)malloc(pathSize);
55 error = RegQueryValueExW(oculusKey, L"Path", NULL, NULL, (PBYTE)volumePath, &pathSize);
56 RegCloseKey(oculusKey);
57 if (error != ERROR_SUCCESS)
58 {
59 free(volumePath);
60 qDebug("Unable to read Library path.");
61 return false;
62 }
63
64 // Resolve the volume path to a mount point
65 DWORD total;
66 WCHAR volume[50] = { L'\0' };
67 wcsncpy(volume, volumePath, 49);
68 GetVolumePathNamesForVolumeNameW(volume, path, length, &total);
69 wcsncat(path, volumePath + 49, MAX_PATH);
70 free(volumePath);
71
72 return true;
73}
74
75void QueryKey(HKEY hKey, QStringList &id_array, QStringList &path_array)
76{

Callers 1

QueryKeyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected