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:
bicarus
2026-07-10 00:26:03 -07:00
committed by GitHub
parent 829503568e
commit 8d42c0ce77
+16 -6
View File
@@ -32,19 +32,29 @@ 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,
KEY_QUERY_VALUE | wow64_flag, &hkDriver) == ERROR_SUCCESS) {
DWORD type = 0;
if (RegQueryValueExA(hkDriver,
ASIO_REG_DESC, ASIO_REG_DESC,
RRF_RT_REG_SZ | wow64_flag,
nullptr, nullptr,
desc, &type,
&size) == ERROR_SUCCESS && desc[0]) { reinterpret_cast<LPBYTE>(desc),
&size) == ERROR_SUCCESS
&& type == REG_SZ && desc[0]) {
// ensure null termination
desc[sizeof(desc) - 1] = '\0';
name = desc; 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)
const std::string name_lower = strtolower(name); const std::string name_lower = strtolower(name);