uac

NSIS: Installing an Application to always Run as Administrator

我的未来我决定 提交于 2019-11-29 08:52:28
问题 I have a NSIS script that is working well for a large application. I have read many threads all over the web, but cannot get a clear answer to the following: is it possible to install an application using NSIS which, when launched (regardless of the type of user) automatically is run as administrator? If this is possible how can it be achieved? Note: I am already imposing that the NSIS package must be run as admin using RequestExecutionLevel admin I have tried writing the UAC requirement to

Can a process elevate itself after startup?

社会主义新天地 提交于 2019-11-29 07:28:41
Is it possible for a process to gain administrator priviledges after it has started? If so, how? Examples should be in C or C++. Edit - Examples should also use umanaged code. Yacoby You cannot elevate the permissions of a process while the process is running. the common way around this is to spawn a new process with elevated permissions when required. This process then does the work that requires higher privileges and then quits, releasing control back to the main process. You should be able to make it fairly seamless by setting the new processes parent window to that of the main process

Save File to Desktop in Vista/Windows 7 in .NET 2.0

↘锁芯ラ 提交于 2019-11-29 07:26:28
I'm working on updating one of our applications. It must use .NET 2.0. One portion creates a file on the Desktop using FileStream fs = new FileStream(Environment.GetFolderPath (Environment.SpecialFolder.DesktopDirectory), FileMode.Create); But I get an UnauthorizedAccessException in Windows 7 (and Vista too, I'm assuming, though I haven't tested that yet). I looked into elevation (not for the entire program, but for a separate assembly which would create the file and perform actions on it); however that seems to require .NET 3.0 or 3.5. Is there any way to gain access to the Desktop folder

Win C#: Run app as administrator without UAC prompt

六月ゝ 毕业季﹏ 提交于 2019-11-29 06:52:18
问题 I need one of my .exe to always run as administrator without UAC prompt. My program will be installed with setup, which will have for one time admin rights, and I need to perform such step in this setup that my exe will be always executed as admin without UAC prompt. I've found 2 solutions so far: 1. Use custom service, which will elevate the program for me. 2. Use Task Scheduler. Is there any other solution? Some manifest probably? Thanks. 回答1: Of course what you are supposed to do if you

How to detect if executable requires UAC elevation (C# pref)

℡╲_俬逩灬. 提交于 2019-11-29 05:20:50
how can I detect if executable requires UAC elevation? So far I came to two ideas: picture recognition of executable's icon to check if UAC shield icon is on it and information from wikipedia: http://en.wikipedia.org/wiki/User_Account_Control it is possible to programmatically detect if an executable will require elevation by using CreateProcess() and setting the dwCreationFlags parameter to CREATE_SUSPENDED. If elevation is required, then ERROR_ELEVATION_REQUIRED will be returned.[16] If elevation is not required, a success return code will be returned at which point you can use

Vista UAC - Trouble Mapping Network Drives

戏子无情 提交于 2019-11-29 04:19:34
We have an application that programmatically maps network drives. On Vista with UAC on, we get some strange issues. Our application maps the drive non-elevated, so if the user browses explorer and double clicks to run an exe, it prompts for UAC. So when they approve it, it prompts for a username/password for the share... Strange since the credentials are saved. It turns out, an elevated process cannot access a mapped drive that was mapped from a non-elevated process. To see this issue in action, do the following steps: Run cmd.exe with no UAC Run "net use w: \yourHostname\yourShare /user

How do I create add a shortcut (.lnk) for my application to the Startup folder programatically in .NET/C#

白昼怎懂夜的黑 提交于 2019-11-29 03:32:26
问题 My application will have a per machine (not per user) Startup shortcut. I can create a shortcut during the installer process no problem. My problem comes when the user later removes it and then tries to re-enable. In otherwords, they turn off RunOnStartup (which deletes the Startup ink) and at a later time they decide they do want it to run on startup so they go back into preferences and re-enable. Apparently, this is a pretty common gripe with .NET that there isn't a native way to create

Granting administrator privileges to an application launched at startup without UAC prompt?

守給你的承諾、 提交于 2019-11-29 03:24:08
问题 Background I've written a small C#/.NET 4.0 application that syncs various settings from a game installed in Program Files to and from other copies of the same game on different machines (think Chrome bookmark sync, but for this game). The sync itself is a relatively simple affair, dealing with files stored inside the game's Program Files folder. On my machine, this works fine without having to elevate my application through UAC. Windows 7 makes the game use Program Files virtualisation and

Write in “ProgramData” folder (W7 and Vista) .NET

♀尐吖头ヾ 提交于 2019-11-29 03:23:48
I install my app under "Program Files" directory. And I install data, under "ProgramData" directory: Environment.SpecialFolder.CommonApplicationData In programData I have created folder to save data. Example: C:\ProgramData\MyApp\MyData\here I have files and folders Under XP all runs fine. But not under Vista or W7 OS. I can read files in this directory, but I can not write files, I can not create new files, etc. The user is logged as Admin. Where I can store data without restrictions? I need store data in a folder visible for all users EDITED: I have this code in my app.manifest file: <?xml

遍历窗口权限问题

血红的双手。 提交于 2019-11-29 03:16:02
一、问题点:获取桌面窗口数据,但是在系统权限且session0下,获取不到非系统权限且session1下的窗口。   问题分析:在不同权限的session0和session1下遍历窗口,获取的窗口数据是否存在影响? 二、进程权限:   为了系统的安全,Windows系统划分了多种权限来控制用户和程序访问数据的权限,可以有效避免来自病毒的攻击。尤其是在vista系统开始,Windows提供了UAC机制,即使当前登录的用户权限是管理员,运行某些管理员权限的程序或修改需要管理员权限的数据时,系统会弹出一个覆盖桌面的窗口,提示用户是否执行操作或取消操作。那么,为什么管理员账户也会被UAC拦截下来?这里,大概讲解下UAC的内部机制,当系统开启UAC时,如果当前是管理员账户登录,系统会保存一份管理员的token和一份普通权限的token,默认情况下使用普通权限token。如果当前是普通账户登录,系统就保存一份普通权限的token。当运行需要管理员权限或修改管理员权限的数据时,系统就会启动UAC机制,弹出覆盖桌面的弹窗。目前Windows系统提供的权限有:超管(高于系统权限)、系统权限、管理员权限,普通用户权限。不同进程在不同权限范围内各司其职。其中,系统权限及以上的进程(一般为服务进程),运行在session0层,一般是接受不到Windows消息,这就是为什么服务程序没有窗口。