Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
add dummy devicepath
Browse files Browse the repository at this point in the history
  • Loading branch information
CatxFish committed Dec 23, 2017
1 parent b207989 commit 5fa7172
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/virtual-source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,37 @@ CFactoryTemplate g_Templates[] =

int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);

void RegisterDummyDevicePath()
{
HKEY hKey;
std::string str_video_capture_device_key(
"SOFTWARE\\Classes\\CLSID\\{860BB310-5D01-11d0-BD3B-00A0C911CE86}\\Instance\\");

LPOLESTR olestr_CLSID;
StringFromCLSID(CLSID_OBS_VirtualV, &olestr_CLSID);

std::wstring wstr_CLSID(olestr_CLSID);

int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr_CLSID[0],
(int)wstr_CLSID.size(), NULL, 0, NULL, NULL);
std::string str2(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr_CLSID[0], (int)wstr_CLSID.size(),
&str2[0], size_needed, NULL, NULL);

str_video_capture_device_key.append(str2);

RegOpenKeyEx(HKEY_LOCAL_MACHINE, str_video_capture_device_key.c_str(), 0,
KEY_ALL_ACCESS, &hKey);


LPCTSTR value = TEXT("DevicePath");
LPCTSTR data = "obs:virtualcam";
if (ERROR_SUCCESS == RegSetValueEx(hKey, value, 0, REG_SZ, (LPBYTE)data, strlen(data) + 1))
::MessageBoxA(0, "ok", "ok", MB_OK);

RegCloseKey(hKey);
}

STDAPI RegisterFilters(BOOL bRegister)
{
HRESULT hr = NOERROR;
Expand Down Expand Up @@ -145,6 +176,9 @@ STDAPI RegisterFilters(BOOL bRegister)
}
}

if (SUCCEEDED(hr) && bRegister)
RegisterDummyDevicePath();

if (fm)
fm->Release();
}
Expand Down

0 comments on commit 5fa7172

Please sign in to comment.