[0.12.11] [kovarex] Game is running in administrator mode after update

Things that we don't consider worth fixing at this moment.
Post Reply
Archetim
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Oct 03, 2015 12:11 pm
Contact:

[0.12.11] [kovarex] Game is running in administrator mode after update

Post 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

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Game is running in administrator mode after update

Post 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?

Archetim
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Oct 03, 2015 12:11 pm
Contact:

Re: Game is running in administrator mode after update

Post 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.

_aD
Fast Inserter
Fast Inserter
Posts: 212
Joined: Sat Apr 12, 2014 12:03 am
Contact:

Re: Game is running in administrator mode after update

Post 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?

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Game is running in administrator mode after update

Post by kovarex »

_aD wrote: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?

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.

voyta
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Thu Jul 23, 2015 10:29 pm
Contact:

Re: [0.12.11] [kovarex] Game is running in administrator mode after update

Post 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)?

Post Reply

Return to “Won't fix.”