1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Block the VMR-9 DirectShow filter

See issue #299.
This commit is contained in:
narzoul 2024-05-04 21:35:22 +02:00
parent c47902457e
commit 0f63ebef9f

View File

@ -315,6 +315,37 @@ namespace
return LOG_RESULT(result);
}
LSTATUS WINAPI regEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpValueName, LPDWORD lpcchValueName,
LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
LOG_FUNC("RegEnumValueW", hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData);
if (lpValueName && lpcchValueName && !lpReserved && !lpType && !lpData && !lpcbData)
{
auto keyName(getKeyName(hKey));
if (L"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\DirectShow\\DoNotUse" == keyName)
{
if (0 == dwIndex)
{
const std::wstring CLSID_VMR9(L"{51B4ABF3-748F-4E3B-A276-C828330E926A}");
if (*lpcchValueName < CLSID_VMR9.length() + 1)
{
return LOG_RESULT(ERROR_MORE_DATA);
}
memcpy(lpValueName, CLSID_VMR9.c_str(), 2 * (CLSID_VMR9.length() + 1));
*lpcchValueName = CLSID_VMR9.length();
return LOG_RESULT(ERROR_SUCCESS);
}
else
{
dwIndex--;
}
}
}
return LOG_RESULT(CALL_ORIG_FUNC(RegEnumValueW)(hKey, dwIndex, lpValueName, lpcchValueName,
lpReserved, lpType, lpData, lpcbData));
}
template <typename Char, typename OrigFunc>
LONG regGetValue(HKEY hkey, const Char* lpSubKey, const Char* lpValue,
DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData, OrigFunc origFunc, const char* funcName)
@ -442,6 +473,7 @@ namespace Win32
HOOK_REGISTRY_OPEN_FUNCTION(RegOpenKeyTransactedW);
HOOK_REGISTRY_FUNCTION(RegCloseKey, regCloseKey);
HOOK_REGISTRY_FUNCTION(RegEnumValueW, regEnumValueW);
HOOK_REGISTRY_FUNCTION(RegGetValueA, regGetValueA);
HOOK_REGISTRY_FUNCTION(RegGetValueW, regGetValueW);
HOOK_REGISTRY_FUNCTION(RegQueryValueExA, regQueryValueExA);