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
This commit is contained in:
parent
7a63f75f00
commit
f26941b566
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user