Skip to content

Commit 45ed986

Browse files
committed
disable 32bit virtual camera installation
* do not attempt to install 32 bit vcam DLL because that does not exist * before attempting to remove DLL via regsvr32, make sure the file exists (prevent regsvr32 from showing error message).
1 parent 1d2e50d commit 45ed986

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

obs-studio-client/source/nodeobs_service.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
//#include <node.h>
2828
#include <sstream>
2929
#include <string>
30+
#include <filesystem>
3031
#include <fstream>
3132
#include "shared.hpp"
3233
#include "utility.hpp"
@@ -440,12 +441,6 @@ Napi::Value service::OBS_service_installVirtualCamPlugin(const Napi::CallbackInf
440441
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
441442
CloseHandle(ShExecInfo.hProcess);
442443

443-
std::wstring pathToRegFile32 = L"/s /n /i:\"1\" \"" + utfWorkingDir;
444-
pathToRegFile32 += L"\\data\\obs-plugins\\win-dshow\\obs-virtualcam-module32.dll\"";
445-
ShExecInfo.lpParameters = pathToRegFile32.c_str();
446-
ShellExecuteEx(&ShExecInfo);
447-
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
448-
CloseHandle(ShExecInfo.hProcess);
449444
#elif __APPLE__
450445
isInstalled = g_util_osx->installPlugin();
451446
#endif
@@ -472,12 +467,18 @@ Napi::Value service::OBS_service_uninstallVirtualCamPlugin(const Napi::CallbackI
472467
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
473468
CloseHandle(ShExecInfo.hProcess);
474469

475-
std::wstring pathToRegFile32 = L"/u \"" + utfWorkingDir;
476-
pathToRegFile32 += L"\\data\\obs-plugins\\win-dshow\\obs-virtualcam-module32.dll\"";
477-
ShExecInfo.lpParameters = pathToRegFile32.c_str();
478-
ShellExecuteEx(&ShExecInfo);
479-
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
480-
CloseHandle(ShExecInfo.hProcess);
470+
// Check if the 32-bit module exists and uninstall it if it does. This way user does not see an error message from regsvr32
471+
std::wstring pathToDLL(L"\\data\\obs-plugins\\win-dshow\\obs-virtualcam-module32.dll");
472+
std::wstring module32path(utfWorkingDir);
473+
module32path += pathToDLL;
474+
if (std::filesystem::exists(module32path)) {
475+
std::wstring pathToRegFile32 = L"/u \"" + utfWorkingDir;
476+
pathToRegFile32 += pathToDLL + L"\"";
477+
ShExecInfo.lpParameters = pathToRegFile32.c_str();
478+
ShellExecuteEx(&ShExecInfo);
479+
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
480+
CloseHandle(ShExecInfo.hProcess);
481+
}
481482
#elif __APPLE__
482483
g_util_osx->uninstallPlugin();
483484
#endif
@@ -520,11 +521,6 @@ Napi::Value service::OBS_service_isVirtualCamPluginInstalled(const Napi::Callbac
520521
return Napi::Number::New(info.Env(), VcamInstalledStatus::NotInstalled);
521522
}
522523

523-
error = RegOpenKeyEx(HKEY_CLASSES_ROOT, wideGUID.c_str(), 0, KEY_READ | KEY_WOW64_32KEY, &OpenResult);
524-
if (error != ERROR_SUCCESS) {
525-
return Napi::Number::New(info.Env(), VcamInstalledStatus::NotInstalled);
526-
}
527-
528524
DWORD dwRet = 0;
529525
TCHAR buf[TOTALBYTES] = {0};
530526
DWORD dwBufSize = sizeof(buf);

0 commit comments

Comments
 (0)