Force an existing application to always run with UAC virtualization on

前端 未结 5 798
花落未央
花落未央 2020-12-18 01:13

I\'ve seen several questions that are the opposite of this; \"How do I disable virtualization?\" That is not my question. I want to force an application to run with virtuali

5条回答
  •  不思量自难忘°
    2020-12-18 01:46

    this may come way too late now, but I am the author of the suggestion you found to activate UAC virtualization, and there was a mistake in my post. The registry keys to modify are the following:

    HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\ 
    HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\
    

    (notice the "Layers" appended)

    so a full example would be:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
    "C:\\Program Files (x86)\\Some Company\\someprogram.exe"="RUNASINVOKER"
    

    note that multiple parameters must be separated with space character.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
    "C:\\Program Files (x86)\\Some Company\\someprogram.exe"="WINXPSP3 RUNASINVOKER"
    

    --

    I'm sincerely sorry that you lost a fair amount of time because of my mistake.

    And by the way, let me express my disagreement with Ian Boyd's post. There are places where write privileges should not be granted to everyone, such as this one, since it breaks the base security rule of "System-wide writes should be authorised to privileged principals only". Program Files is a system-wide place, not a per-user one.

    All rules have exceptions of course, but in the present case, one could imagine a maliciously crafted configuration file making the program exec an arbitrary command as the user running it. On a lighter side, one could imagine a "mistake delete" by another user, which would make the app fail. Back on the heavier side, application executables in Program Files are often run by the admin, sooner or later. Even if you don't want to, uninstalling programs very often run uninstall executables that are in Program Files. Maybe the uninstall procedure will use that config file which could have consequences if it's maliciously crafted.

    Of course you may say, this sounds paranoid somehow, agreed. I did modify some NTFS ACLs in Program Files at the times of Win XP and was able to sleep after that, but why take the slightest risk when the tools are available ?

提交回复
热议问题