uac

Elevating privileges doesn't work with UseShellExecute=false

会有一股神秘感。 提交于 2019-11-26 08:29:49
问题 I want to start a child process (indeed the same, console app) with elevated privileges but with hidden window. I do next: var info = new ProcessStartInfo(Assembly.GetEntryAssembly().Location) { UseShellExecute = true, // ! Verb = \"runas\", }; var process = new Process { StartInfo = info }; process.Start(); and this works: var identity = new WindowsPrincipal(WindowsIdentity.GetCurrent()); identity.IsInRole(WindowsBuiltInRole.Administrator); // returns true But UseShellExecute = true creates

Why do files get placed in “C:\Users\<username>AppData\Local\VirtualStore\Program Files(x86)”?

安稳与你 提交于 2019-11-26 07:33:24
问题 I recently updated my Visual Basic 6.0 application and now include an exe.manifest file to prevent UAC Virtualization. After applying this update, some users can\'t find their data files (Access MDB files) and after a system search they end up finding it in C:\\Users\\<username>AppData\\Local\\VirtualStore\\Program Files(x86) . What is this folder area for and how/when do files get moved to this area? How do we prevent it? I\'m hoping now that my application uses a .manifest this won\'t

Giving application elevated UAC

蓝咒 提交于 2019-11-26 06:47:12
问题 I have an application which needs the UAC elevation. I have the code which lets me give that but the application opens twice.. which is the issue.. so here is the code in Form1: public Form1() { InitializeComponent(); WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true

The UAC prompt shows a temporary random Program Name for msi, can the correct name be displayed?

一笑奈何 提交于 2019-11-26 06:42:37
问题 I\'m building an MSI installer for windows and sign the installer using signtool. When I run the .msi to test it, the UAC (User Account Control) prompt shows up to ask me if I want to allow the installation to proceed. That\'s fine, but the prompt shows a number of fields, and for the Program Name field it displays something like \"403b3.msi\". This is not the name of the msi I\'m running. How can I get the correct Program Name to be displayed? 回答1: Use the /d command line argument with the

How can I run a child process that requires elevation and wait?

荒凉一梦 提交于 2019-11-26 06:35:52
问题 Win 7/UAC is driving me crazy. From within my C++ application, I need to run an executable that requires elevation on Windows 7. I want to fire this thing off and wait for it to finish before proceeding. What\'s the easiest way to do this? I normally do this kind of thing via CreateProcess() , but it fails for executables that require elevation. I tried running using cmd.exe /c ... through CreateProcess , which works but pops up an ugly cmd terminal window. I am reading that ShellExecute()

Windows 7 and Vista UAC - Programmatically requesting elevation in C#

冷暖自知 提交于 2019-11-26 06:06:44
问题 I have a program that only requires elevation to Admin on very rare occasions so I do not want to set-up my manifest to require permanent elevation. How can I Programmatically request elevation only when I need it? I am using C# 回答1: WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator); if (!hasAdministrativeRight) { RunElevated(Application.ExecutablePath); this.Close(); Application

Does Windows 7 restrict folder access as Vista does?

南笙酒味 提交于 2019-11-26 05:56:39
问题 I noticed that in my application, most compatibility problems were caused by \'access denied\' for some folders, such as: Application Data [C:\\ProgramData] Desktop [C:\\Users\\Public\\Desktop] Documents [C:\\Users\\Public\\Documents] Favorites [C:\\Users\\Public\\Favorites] Start Menu [C:\\ProgramData\\Microsoft\\Windows\\Start Menu] Templates [C:\\ProgramData\\Microsoft\\Windows\\Templates] Does Windows 7 have the same problem as Vista? With help from the members of Stack Overflow, I know

How to run a program automatically as admin on Windows 7 at startup?

风格不统一 提交于 2019-11-26 05:55:28
问题 I created my own parental control app to monitor my kids activity. The app\'s only GUI is a task bar icon. The program is installed as admin. I\'d like this program to be started up automatically as admin user on Windows startup, so that standard users cannot kill it from task manager. I can create a registry key at: HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run to make it run automatically when Windows starts up. The problem is that the program is started as the logged in (standard

How to run NOT elevated in Vista (.NET)

China☆狼群 提交于 2019-11-26 04:51:52
问题 I have an application that I have to run as Administrator. One small part of that application is to start other applications with Process.Start The started applications will also be run as administrators, but I\'d rather see them run as the \'normal\' user. How do I accomplish that? /johan/ 回答1: The WinSafer API's allow a process to be launched as a limited, normal, or elevated user. Sample Usage: CreateSaferProcess(@"calc.exe", "", SaferLevel.NormalUser); Source code: //http://odetocode.com

Make Inno Setup installer request privileges elevation only when needed

∥☆過路亽.° 提交于 2019-11-26 04:36:22
Inno Setup installer has the PrivilegesRequired directive that can be used to control, if privileges elevation is required, when installer is starting. I want my installer to work even for non-admin users (no problem about installing my app to user folder, instead of the Program Files ). So I set the PrivilegesRequired to none (undocumented value). This makes UAC prompt popup for admin users only, so they can install even to the Program Files . No UAC prompt for non-admin users, so even them can install the application (to user folder). This has some drawbacks though: Some people use distinct