473,491 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to prompt for elevation for a single operation?

Hi, I have a program running with normal user privileges, that needs
to update an entry in an ini file that happens to be in ProgramData,
so that a server program, running as administrator can read it.
Editing the ini file directly causes only the VirtualStore copy to be
edited, so my plan is to prompt for elevation as administrator before
this edit and restore normal user permission after. If the elevation
fails then a message box reminding the user to edit the file as admin
is sufficient.

I haven't found any information on how to do this though. I am using
c# with .net 2.0.

Thanks
Oolis.
Jul 15 '08 #1
1 2321
Oolis Kraprin wrote:
Hi, I have a program running with normal user privileges, that needs
to update an entry in an ini file that happens to be in ProgramData,
so that a server program, running as administrator can read it.
Editing the ini file directly causes only the VirtualStore copy to be
edited, so my plan is to prompt for elevation as administrator before
this edit and restore normal user permission after. If the elevation
fails then a message box reminding the user to edit the file as admin
is sufficient.
Best as I can tell, you can't do this. Elevation happens at the start of a
process and you can't change elevation status once the process is running.

You can delegate the task to a helper application that's marked as requiring
administrative privileges. I don't know of a native way to check whether
your own application is being virtualized in .NET, but you can use P/Invoke
to call OpenProcessToken() and GetTokenInformation() with the
TokenVirtualizationEnabled flag. If your application detects that it's
virtualized, it could call the helper application.

All this may be more trouble than it's worth, if a reminder is already
acceptable.

--
J.
Jul 15 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6347
by: zhi | last post by:
Really confused, when I use keyword style argument as following: >>> input(prompt="hello") Traceback (most recent call last): File "<pyshell#52>", line 1, in -toplevel- input(prompt="hello")...
2
1493
by: Sebastian | last post by:
Dear members, I'am thinking about the "best" way to connect to my sql-server via ADO.Net (if there is a best way). My application uses the sql-server very intensively. At the moment every...
13
10679
by: joemac | last post by:
I'm just starting out with javascript and the following is not working as it should. The expected prompt dialog box never appears. <head> <script language="JavaScript"><!-- var name;...
1
3976
by: Jose Reckoner | last post by:
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks!
1
2063
by: TC | last post by:
I am getting small math errors when I use a query to convert a column's data type from Text to Single. I am using a calculated column with the following expression. HighSchoolGPA:...
0
1344
by: DBC User | last post by:
Hi all, I have a quick question on vista elevation. I have 2 application, one main GUI which user interacts with and another one is a tray program. User have options to install products from the...
2
2297
by: Greg Taylor | last post by:
Greetings, I was wondering if there was a way to make prompt() calls in Safari show a single-line input box instead of the default multi-line prompt that it currently does. It seems like most...
2
2956
by: GuiD | last post by:
Hi all, Happy new year ;-) Here is my crazy issue. Situation : On vista, i have my admin account named "ADMIN" and another account named "TOTO" i created a C# application and launch it...
0
987
by: jojo41300000 | last post by:
Hi All, Anyone has experienced with Elevation Data? I really need help with that. I can download the data from USGS site, but I don't know how to extract the raw data from (.BIL) format. ...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7154
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.