uac

VS2010 Setup Project - Run As Administrator

只谈情不闲聊 提交于 2019-12-03 11:59:43
I have a VS2010 solution with 2 projects in it - a .NET 4 program, and an installer for it. The Installer is just a simple Setup Project with a prerequisite - .NET Framework 4. The problem is that I need the installer setup.exe to always run as Administrator otherwise the setup will fail under the UAC. (It does not prompt me for privilege elevation by default.) I tried putting a setup.exe.manifest (shown below) alongside the setup.exe to force it to run as administrator, but unfortunately Windows ignores it, most likely because there is already another manifest file embedded within the setup

How do I deploy applications in run as administrator mode?

半城伤御伤魂 提交于 2019-12-03 09:47:02
问题 How Do I deploy applications so that they require administrator rights without the end-user doing that by hand? I use Delphi 2009 to build the application. 回答1: You can inform Windows that your application needs to run as an administrator by using the requestedExecutionLevel element in your application manifest. The manifest file is an XML file that looks as follows. It should be named YourApp.exe.manifest and placed in the same folder as the executable. (It can also be embedded in the

Starting another process with elevation using different user credentials

青春壹個敷衍的年華 提交于 2019-12-03 09:28:40
问题 I'm trying to start an elevated process from with a non-elevated process, but I also need to supply the username and password for a user with administrative credentials. I've tried both the "runas" method for elevation as well as using a manifest, but both yield different errors. For example, if I do this (without using a manifest that requires elevation): ProcessStartInfo info = new ProcessStartInfo(path); info.UseShellExecute = false; info.UserName = username; info.Password = securePwd;

Detecting registry virtualization

淺唱寂寞╮ 提交于 2019-12-03 05:46:11
问题 I have a set of C# (v2) apps and I am struggling with registry virtualization in Win7 (and to a lesser extent Vista). I have a shared registry configuration area that my applications need to access in HKLM\Software\Company... Prior to Vista, everything was just written to and read from that location as needed. The code appropriately detected failures to write to that registry key and would fall back appropriately (writing to HKCU instead and notifying the user that the settings they had

Allowing connection to .NET COM server with mismatching integrity level

杀马特。学长 韩版系。学妹 提交于 2019-12-03 04:09:50
I'm having an issue with a COM based client-server setup. The COM server is written in C# (.NET 4.0) and runs as a (registered) local server. Depending on which application connects to the server, other clients will receive a Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE) The underlying issue is explained here (in the section COM is integrity aware) . The way I understand it, it is being caused by the fact that an elevated application creates the server with a higher integrity level. When another non-elevated application then connects, it is not allowed

Setting the UAC 'Publisher' Field for a NSIS Installer

旧巷老猫 提交于 2019-12-03 03:53:11
问题 When I open my installer(that I created using NSIS), the UAC dialog appears with information about my installer. The field Publisher is 'unknown'. I've heard of digitally signing the application, do you know how to do this in NSIS? How can I set the field/attribute Publisher to "My Installer" or some other text? I think the following code is supposed to set the Publisher field but it doesn't, it still remains 'unknown': InstallDir "abc" Name "def" OutFile "def.exe" VIProductVersion "1.0.0.0"

How to detect whether Vista UAC is enabled?

只愿长相守 提交于 2019-12-03 03:13:43
问题 I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer? 回答1: This registry key should tell you: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System Value EnableLUA (DWORD) 1 enabled / 0 or missing disabled But that assumes you have the rights to read it. Programmatically you can try to read the user's token and guess if it's an admin running with UAC enabled (see here). Not

Add a UAC shield to a button and retain its background image?

别等时光非礼了梦想. 提交于 2019-12-03 03:11:36
Using C# and .Net 4.0 in a winforms application: Is it possible to add the UAC shield to a button and retain the buttons background image? How? This is what I'm using at the moment, but it removes the image... [DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); public static void UACToButton(Button button, bool add) { const Int32 BCM_SETSHIELD = 0x160C; if (add) { // The button must have the flat style button.FlatStyle = FlatStyle.System; if (button.Text == "") // and it must have text to display the shield button.Text = " ";

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

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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.Exit(); } private static bool RunElevated(string

How do I make a console app always run as an administrator?

房东的猫 提交于 2019-12-02 23:39:18
I have a console application that was developed to be called by a erp software. They call my app inside the erp and when they do it, i always get errors related to the insufficient permission to do it. I have checked the "run this program as an administrator" checkbox in the properties of the exe for all users but the result is the same. I have read something about adding a manifest that will make the app prompt for the uac dialog, but thats not what i want because the app will be called from erp on the server and clients will not see the dialog on server. Can someone explain me how to make