27
27
// #include <node.h>
28
28
#include < sstream>
29
29
#include < string>
30
+ #include < filesystem>
30
31
#include < fstream>
31
32
#include " shared.hpp"
32
33
#include " utility.hpp"
@@ -440,12 +441,6 @@ Napi::Value service::OBS_service_installVirtualCamPlugin(const Napi::CallbackInf
440
441
WaitForSingleObject (ShExecInfo.hProcess , INFINITE);
441
442
CloseHandle (ShExecInfo.hProcess );
442
443
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 );
449
444
#elif __APPLE__
450
445
isInstalled = g_util_osx->installPlugin ();
451
446
#endif
@@ -472,12 +467,18 @@ Napi::Value service::OBS_service_uninstallVirtualCamPlugin(const Napi::CallbackI
472
467
WaitForSingleObject (ShExecInfo.hProcess , INFINITE);
473
468
CloseHandle (ShExecInfo.hProcess );
474
469
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
+ }
481
482
#elif __APPLE__
482
483
g_util_osx->uninstallPlugin ();
483
484
#endif
@@ -520,11 +521,6 @@ Napi::Value service::OBS_service_isVirtualCamPluginInstalled(const Napi::Callbac
520
521
return Napi::Number::New (info.Env (), VcamInstalledStatus::NotInstalled);
521
522
}
522
523
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
-
528
524
DWORD dwRet = 0 ;
529
525
TCHAR buf[TOTALBYTES] = {0 };
530
526
DWORD dwBufSize = sizeof (buf);
0 commit comments