mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
asio: fix XP build; remove call to RegGetValueA (#788)
## Link to GitHub Issue or related Pull Request, if one exists Fixes #787 ## Description of change Remove the call to `RegGetValueA` as it is Vista and up. Replace with `RegOpenKeyExA` + `RegQueryValueExA` ## Testing
This commit is contained in:
@@ -32,18 +32,28 @@ namespace hooks::audio {
|
|||||||
RegEnumKeyA(hkEnum, index, key_name, sizeof(key_name)) == ERROR_SUCCESS;
|
RegEnumKeyA(hkEnum, index, key_name, sizeof(key_name)) == ERROR_SUCCESS;
|
||||||
index++) {
|
index++) {
|
||||||
|
|
||||||
// read description (display name), fall back to the key name
|
// read description (display name), fall back to the key name.
|
||||||
|
// RegOpenKeyExA + RegQueryValueExA is used instead of RegGetValueA
|
||||||
|
// because the latter is unavailable on Windows XP.
|
||||||
char desc[256] = { 0 };
|
char desc[256] = { 0 };
|
||||||
DWORD size = sizeof(desc);
|
DWORD size = sizeof(desc);
|
||||||
std::string name = key_name;
|
std::string name = key_name;
|
||||||
if (RegGetValueA(hkEnum,
|
HKEY hkDriver = nullptr;
|
||||||
key_name,
|
if (RegOpenKeyExA(hkEnum, key_name, 0,
|
||||||
ASIO_REG_DESC,
|
KEY_QUERY_VALUE | wow64_flag, &hkDriver) == ERROR_SUCCESS) {
|
||||||
RRF_RT_REG_SZ | wow64_flag,
|
DWORD type = 0;
|
||||||
nullptr,
|
if (RegQueryValueExA(hkDriver,
|
||||||
desc,
|
ASIO_REG_DESC,
|
||||||
&size) == ERROR_SUCCESS && desc[0]) {
|
nullptr,
|
||||||
name = desc;
|
&type,
|
||||||
|
reinterpret_cast<LPBYTE>(desc),
|
||||||
|
&size) == ERROR_SUCCESS
|
||||||
|
&& type == REG_SZ && desc[0]) {
|
||||||
|
// ensure null termination
|
||||||
|
desc[sizeof(desc) - 1] = '\0';
|
||||||
|
name = desc;
|
||||||
|
}
|
||||||
|
RegCloseKey(hkDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge with an existing entry from the other view (match by name)
|
// merge with an existing entry from the other view (match by name)
|
||||||
|
|||||||
Reference in New Issue
Block a user