Page 1 of 1
[0.12.11] [kovarex] Game is running in administrator mode after update
Posted: Sat Oct 03, 2015 12:27 pm
by Archetim
Hi,
on Win7(in my case, probably in all versions) it seems that after an update for which it required administrator privileges the game keeps running in this mode.
I think it should switch back normal user privileges to avoid security risks.
Regards
Archetim
Re: Game is running in administrator mode after update
Posted: Mon Oct 05, 2015 10:46 am
by kovarex
Well, we run the updated game with the "open" command. While the updater is ran with the "runas" (administrator).
I have no idea why would the game be ran in admin mode. Couldn't it be because the parent process is already administrator?
Re: Game is running in administrator mode after update
Posted: Sat Oct 10, 2015 4:09 pm
by Archetim
Hi,
sorry for my late response. I had not much time this week.
I see no parent process for Factorio after updating.
My assumption was that the updater starts factorio after updating and because of this factorio runs with the same permissions as the updater.
When I close it and start factorio again as usual with the link on the desktop then it runs in normal user mode.
Re: Game is running in administrator mode after update
Posted: Sat Oct 10, 2015 4:51 pm
by _aD
Archetim, thanks for bringing this to light. I wish the likes of Adobe, Mozilla, and other big software developers also fixed this security flaw. The last thing a Windows computer needs is Acrobat, Flash or any web browser running with administrator priviledges.
How can I launch an unelevated process from my elevated process and vice versa?
Re: Game is running in administrator mode after update
Posted: Fri Oct 16, 2015 12:11 pm
by kovarex
Code: Select all
void GetDesktopAutomationObject(REFIID riid, void **ppv)
{
CComPtr<IShellView> spsv;
FindDesktopFolderView(IID_PPV_ARGS(&spsv));
CComPtr<IDispatch> spdispView;
spsv->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&spdispView));
spdispView->QueryInterface(riid, ppv);
}
void ShellExecuteFromExplorer(
PCWSTR pszFile,
PCWSTR pszParameters = nullptr,
PCWSTR pszDirectory = nullptr,
PCWSTR pszOperation = nullptr,
int nShowCmd = SW_SHOWNORMAL)
{
CComPtr<IShellFolderViewDual> spFolderView;
GetDesktopAutomationObject(IID_PPV_ARGS(&spFolderView));
CComPtr<IDispatch> spdispShell;
spFolderView->get_Application(&spdispShell);
CComQIPtr<IShellDispatch2>(spdispShell)
->ShellExecute(CComBSTR(pszFile),
CComVariant(pszParameters ? pszParameters : L""),
CComVariant(pszDirectory ? pszDirectory : L""),
CComVariant(pszOperation ? pszOperation : L""),
CComVariant(nShowCmd));
}
Using this horribleness without knowing what it is? I prefer not solving the issue.
Re: [0.12.11] [kovarex] Game is running in administrator mode after update
Posted: Sun Nov 01, 2015 10:32 pm
by voyta
You should really start a bootstrapper of your own non-elevated, then run the installer and elevate that, keeping the bootsrapper running non-elevated to relaunch Factorio of new version after the installer is done.
But why bother, there's like one in thousand programs that does UAC right, Factorio does other things right, right?
PS: What's horrible and not understandable on asking Explorer to open something for you? (other than the fact Explorer might not be there and might not have the privileges you expect, and generally being unreliable for this purpose)?