提交 f26941b5 编写于 作者: R Richard Stanway

UI/updater: Exit with error if elevation failed

In rare cases, "runas" would somehow launch the updater as a non-admin user
again, resulting in a loop where the updater constantly spawns processes.
Fixes https://github.com/obsproject/obs-studio/issues/2984
上级 7a63f75f
......@@ -1629,6 +1629,17 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
is32bit = wcsstr(cwd, L"bin\\32bit") != nullptr;
if (!HasElevation()) {
WinHandle hMutex = OpenMutex(
SYNCHRONIZE, false, L"OBSUpdaterRunningAsNonAdminUser");
if (hMutex) {
MessageBox(
nullptr, L"Updater Error",
L"OBS Studio Updater must be run as an administrator.",
MB_ICONWARNING);
return 2;
}
HANDLE hLowMutex = CreateMutexW(
nullptr, true, L"OBSUpdaterRunningAsNonAdminUser");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册