uac

Process.Start with different credentials with UAC on

£可爱£侵袭症+ 提交于 2019-12-17 10:43:07
问题 I am trying to start another process with Process.Start running under different credentials with the UAC turned on. I get the following error: System.ComponentModel.Win32Exception: Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy restriction has been enforced at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start

Correct way to deal with UAC in C#

偶尔善良 提交于 2019-12-17 08:52:29
问题 I have an application (Windows service) that is installed into a directory in the Program Files folder. Alongside this application is another WinForms application that is used to configure the service (amongst other things). When it does configuration, it saves changes to a config file that lives alongside the service. When running on Vista/Win7, UAC prevents the user from saving to the config file. What I would like to do is: put the shield icon next to the menu item used to configure prompt

Run process as administrator from a non-admin application

一曲冷凌霜 提交于 2019-12-17 05:53:31
问题 From an application that is not being run as administrator, I have the following code: ProcessStartInfo proc = new ProcessStartInfo(); proc.WindowStyle = ProcessWindowStyle.Normal; proc.FileName = myExePath; proc.CreateNoWindow = false; proc.UseShellExecute = false; proc.Verb = "runas"; When I call Process.Start(proc), I do not get a pop up asking for permission to run as administrator, and the exe is not run as administrator. I tried adding an app.manifest to the executable found at

Detect if program is running with full administrator rights

不问归期 提交于 2019-12-17 05:07:22
问题 I need to determine if my program is running with full administrator rights. By that I mean if uac is turned on (for win vista/7) that I need to determine if the program actually has admin rights (like if the user right clicked and selected "run as administator") and not limited by uac. How do I do this in C++? 回答1: Win9x: Everyone is "admin" NT4: OpenThreadToken/OpenProcessToken + GetTokenInformation(...,TokenGroups,...) on DOMAIN_ALIAS_RID_ADMINS SID in a loop 2000+: OpenThreadToken

Request Windows Vista UAC elevation if path is protected?

冷暖自知 提交于 2019-12-17 04:31:20
问题 For my C# app, I don't want to always prompt for elevation on application start, but if they choose an output path that is UAC protected then I need to request elevation. So, how do I check if a path is UAC protected and then how do I request elevation mid-execution? 回答1: The best way to detect if they are unable to perform an action is to attempt it and catch the UnauthorizedAccessException . However as @DannySmurf correctly points out you can only elevate a COM object or separate process.

Requesting administrator privileges at run time

烈酒焚心 提交于 2019-12-17 02:36:26
问题 Is it possible to get a C++ application running in Windows to request administrator privileges from the operating system at run time? I know it can be done at compile time, but can't seem to find anywhere whether it can be done at run time. Thanks for your help! EDIT: What if I want the current instance to have elevated privileges? For example, I might have data stored in memory which I want to keep. 回答1: Not quite, but you can do the opposite—you can drop privileges if you already have them.

Make Inno Setup installer request privileges elevation only when needed

老子叫甜甜 提交于 2019-12-17 00:12:59
问题 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

ioexception : a required privilege is not held by client while writing in file in java

做~自己de王妃 提交于 2019-12-13 16:06:22
问题 I searched many of the similar questions, but could not solve my problem. I am trying to write something in a file, which gives me error. My code try { File f = new File(file_name); f.createNewFile(); //System.out.println("Hello"); f.setWritable(true); FileWriter fstream = new FileWriter(f); BufferedWriter out = new BufferedWriter(fstream); ListIterator<String> itr = account.listIterator();//account is a List object while (itr.hasNext()) { String element = itr.next(); out.write(element); out

Activating Administrator via C++ when users are already administrator [Run as administrator]

馋奶兔 提交于 2019-12-13 08:05:48
问题 Well I noticed that on Windows 7, sometimes even when you are an administrator, you can't do a lot of things, probably it's some sort of bug, my application I check if an user is administrator before start the program because my program creates file in folders that are protected default like the root folder ( C: ), and if you aren't an administrator on Windows 7, you can only create folders there. So if I right click in my application and go "Run as Administrator", it just works fine. Is

Can I sign a self-extracting exe with a certificate without the Code signing EKU?

…衆ロ難τιáo~ 提交于 2019-12-13 07:28:04
问题 I've a self-extracting .exe created with 7zip (7z.sfx). I've signed it with signtool. The signing certificate is in my Local Machine store, and it's root certificate is in the "Trusted root certificate authorities" and "Trusted publishers" folders. I would like the signature details to appear in the publisher field of the UAC prompt, but it still shows "Unknown Publisher". Anyone know what's going on? The certificate does not have the "Code signing" EKU. Will this cause the problem? This