Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Source/UnityCaptureFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,14 @@ __inline static GUID GetCLSIDUnityCaptureServiceNum(int i)
return NumCLSID;
}

struct AStringHolder { char str[256]; };
__inline static AStringHolder GetDevicePathNum(int i)
{
AStringHolder res;
StringCchPrintf(res.str, sizeof(res.str)/sizeof(*res.str), "foo:bar%d", i + 1);
return res;
}

extern "C" int CustomGetFactoryType(const IID &rClsID)
{
if (IsEqualCLSID(rClsID, CLSID_UnityCaptureProperties)) return 1;
Expand Down Expand Up @@ -1178,7 +1186,8 @@ static HRESULT RegisterFilters(BOOL bRegister)
StringFromCLSID(GetCLSIDUnityCaptureServiceNum(i), &CLSID_Filter_Str);
StringCchPrintfW(strKey, 256, L"SOFTWARE\\Classes\\CLSID\\%s\\Instance\\%s", CLSID_Category_Str, CLSID_Filter_Str);
RegOpenKeyExW(HKEY_LOCAL_MACHINE, strKey, 0, KEY_ALL_ACCESS, &hKey);
RegSetValueExA(hKey, "DevicePath", 0, REG_SZ, (LPBYTE)"foo:bar", (DWORD)sizeof("foo:bar"));
const char* path = GetDevicePathNum(i).str;
RegSetValueExA(hKey, "DevicePath", 0, REG_SZ, (LPBYTE)path, (DWORD)sizeof(path));
RegCloseKey(hKey);
}
if (FAILED(hr)) MessageBoxA(0, "Service RegisterFilter of IFilterMapper2 failed", "RegisterFilters setup", NULL);
Expand Down