uac

C# Access registry of another user

*爱你&永不变心* 提交于 2019-12-13 02:35:18
问题 I'm having a problem with the windows service I work on currently. Basically I store some values in HKCU registry (from a GUI tool run as administrator) and from within that GUI I am starting a service. The service uses SYSTEM account to run and I believe that's my problem - I can't access registry keys stored with my GUI tool inside the service, as it points to a different HKCU! How can I "redirect" the service to use the HKCU of the user it was stored with? (Actually I can pass a user name

Windows force UAC elevation for files if their names contain “update”?

ぐ巨炮叔叔 提交于 2019-12-13 01:53:54
问题 I am using Windows 7 and Microsoft Visual Studio 2010. I created simple project with one MessageBox() call in WinMain() . The name of the project is "update" , so name of EXE file is update.exe . I have turned off manifest generation in Linker settings. But when I try to start debugging in Visual Studio, it says that my application requires elevation. I decided to start application by clicking on it in Windows Explorer, but it still requires administrator privileges. I renamed it to

Disabling UAC programmatically - Change doesn't take effect?

南楼画角 提交于 2019-12-12 17:08:30
问题 I created a C# application that changes the "EnableLUA" key to 0, the application is run with admin rights, and no errors pop up: //Runs with admin rights try { RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", true); key.SetValue("EnableLUA", "0"); key.Close(); } catch(Exception e) { MessageBox.Show("Error: " + e); } The registry key indeed gets changed from 1 to 0, but even after restarting the computer, UAC is still enabled.

Impersonating in .NET using Process.Start and UAC

主宰稳场 提交于 2019-12-12 15:40:56
问题 I am trying to run programs from another .NET program that requires elevation using the impersonation option of the Process.Start (System.Diagnostics) method. The user for impersonation is a local administrator. The O/S is 2008 and UAC is turned on. Whenever calling process start I'm getting a Win32 permission error: "The requested operation requires elevation" 回答1: If the .NET application you are calling is configured properly in the app.manifest, you don't have to specify anything in the

How to check if a process has elevated privileges in windows 7 using native C++?

冷暖自知 提交于 2019-12-12 10:38:34
问题 How can I check if a process has elevated privileges in Windows 7 (using native C++, not C#/C++.net) ? I've been looking for an answer for quite sometimes, but all I can find are the answers that use the .NET framework. 回答1: The simplest approach is to call the IsUserAnAdmin function. If you need more precision you can also use GetTokenInformation but in most cases that is overkill. 来源: https://stackoverflow.com/questions/4196552/how-to-check-if-a-process-has-elevated-privileges-in-windows-7

How do you call an exe from code and get around possible UAC action against this?

天大地大妈咪最大 提交于 2019-12-12 10:21:31
问题 I'm using system.diagnostics.process to start an msi file in quiet mode. I'm getting an exit code 1625, and I suspect its because UAC is preventing it from running. I've turned off the UAC prompts but no dice... How can I make sure that I'm properly elevating the privileges of the msiexec so it actually runs? Thanks, Isaac 回答1: UAC Elevation in Managed Code: Starting Elevated Processes 回答2: ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.Arguments = "/i " + "\""+Directory

How can I get around UAC when using ReadDirectoryChanges?

て烟熏妆下的殇ゞ 提交于 2019-12-12 09:52:31
问题 I have an application that needs to monitor the primary drive for file changes via ReadDirectoryChangesW . However, when UAC is enabled, it doesn't work. All of the Windows API calls succeed, but I'm not notified of any changes. I can work around this by individually monitoring each directory in the root, but this is a problem, because it can potentially cause a blue screen if there are too many directories. Is there an acceptable way to get around UAC and receive file change notifications on

Get real path of a log file stored in VirtualStore

我与影子孤独终老i 提交于 2019-12-12 08:58:55
问题 My application stores log files in a location which, depending on admin settings, can get redirected to a folder in the VirtualStore. They sometimes end up in, for example: The log file is in: C:\Users\-my username-\AppData\Local\VirtualStore\Program Files (x86)\ *my-application* \logs C# thinks it is here: C:\Program Files (x86)\ my-application \logs This is only a problem in one part of the code - a button which tries to open the log file in notepad. It runs Process.Start( path-where

Windows 7 doesn't allow me edit files in Common Application Data folder

匆匆过客 提交于 2019-12-12 07:15:23
问题 I want to store some files and edit them for my software in common Application Data under Windows 7. I do not know why Windows 7 doesn't allow my software to change files unless I run them as administrator. Where can I store my files, so it won't require admin permission? 回答1: You should store your application data in a subfolder under Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); . Note that this folder is user-specific. Non-Admin users do not have permission to write

.net & admin rights - how to embed manifest file for 2 different scenarios

微笑、不失礼 提交于 2019-12-12 01:59:15
问题 I have one .net application which would be installed under "program files" running in 2 different modes: "ADVANCED_MODE" with all plugins enabled which should pop-up the UAC to run as administrator "BASIC_MODE" with only few plugins loaded which should work as normal user What to do to solve this case? If I embed a manifest file ( requireAdmin set on), it will not work for BASIC_MODE. If I don't use any manifests, then I don't have the chance to popup the UAC in ADVANCED_MODE. If I use "