![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to prompt for elevation for a single operation? Oolis Kraprin wrote: Quote: > 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. > 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. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to prompt for elevation for a single operation? Oolis Kraprin wrote: Quote: > 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. > 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. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| the requested operation requires elevation | System Security | |||
| Operation Requires Elevation | General Discussion | |||
| The requested operation requires elevation | Vista security | |||
| This Requested Operation Needs Elevation | Vista account administration | |||
| Requested operation require elevation | Vista General | |||