wine: suppress admin privilege popup warning in wine environment

This commit is contained in:
RadWolfie 2020-12-10 05:11:39 -06:00
parent e42c39e9ba
commit 1ceb0b424f
2 changed files with 10 additions and 1 deletions

View File

@ -664,8 +664,10 @@ bool HandleFirstLaunch()
return false;
}
// Wine will always run programs as administrator by default, it can be safely disregard.
// Since Wine doesn't use root permission. Unless user is running Wine as root.
bool bElevated = CxbxIsElevated();
if (bElevated && !g_Settings->m_core.allowAdminPrivilege) {
if (bElevated && !isWineEnv() && !g_Settings->m_core.allowAdminPrivilege) {
PopupReturn ret = PopupWarningEx(nullptr, PopupButtons::YesNo, PopupReturn::No,
"Cxbx-Reloaded has detected that it has been launched with Administrator rights.\n"
"\nThis is dangerous, as a maliciously modified Xbox titles could take control of your system.\n"

View File

@ -44,6 +44,7 @@
#include "core\hle\D3D8\XbConvert.h" // For EmuPC2XB_D3DFormat
#include "common\Settings.hpp"
#include "common/util/cliConfig.hpp"
#include "common/win32/WineEnv.h"
#include "core\kernel\init\CxbxKrnl.h" // For CxbxExec
#include "resource/ResCxbx.h"
@ -273,6 +274,12 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
ReleaseDC(hwnd, hDC);
}
// Check if running in Wine environment. If it is, then we don't need admin warning message popup on startup.
if (isWineEnv()) {
BOOL bAdminCheckRemoveRet = RemoveMenu(GetMenu(hwnd), ID_SETTINGS_ALLOWADMINPRIVILEGE, MF_GRAYED);
assert(bAdminCheckRemoveRet != -1);
}
SetClassLong(hwnd, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_CXBX)));
DragAcceptFiles(hwnd, TRUE);