RE: Elevate permission of code



No, the bottom line is that within your APPLICATION it cannot be done.
But if you write a SERVICE, it can work.

Laszlo Elteto
SafeNet, Inc.

"Zinon" wrote:

Thanks for the replies.

The app will be deployed on WinXP machines, so unfortunately any solution
involving Vista features is not an option.

So the bottom line, from what I understand, is that it cannot be done?


""Steven Cheng"" wrote:

Hi Zinon,

As for the privilege elevation, I'm afraid you're limited to the Vista
interactive elevation behavior since the UAC is used to detect any
privileged operations that may occcur in application's code. If it is
allowed to programmatically elevate privilege, then the security hole is
opened again.

So far for applications that may require admin token(elevated privilege),
there are two means:

1. Just let the UAC detect it and request the user to do the elevation
on-demand when executing.

2. Add a manifest for your application and tell what level of execution
permission will it require. Thus, the operating system will demand that
elevation(if necessary) at startup time.

#How To: Tell Vista's UAC What Privelege Level Your App Requires
http://channel9.msdn.com/Showpost.aspx?postid=211271

http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: =?Utf-8?B?Wmlub24=?= <zinon@xxxxxxxxxxxxxxxx>
Subject: Elevate permission of code
Date: Wed, 20 Feb 2008 08:21:01 -0800


Hi All,

I have an application which accesses and modifies the registry during
runtime. The application is being deployed using ClickOnce. However, the
users running the application do not have the required privileges to
modify
the registry and the application fails.

Is there a way to elevate the security priveleges of a particular piece of
code in order to modify the registry or carry out other tasks which may
have
security restrictions?

I've tried declaring [RegistryPermission(SecurityAction.Assert,
Unrestricted
= true)] on the calling class, as well as:
RegistryPermission permission = new
RegistryPermission(PermissionState.Unrestricted);
permission.Assert();
..in the method body but with no luck so far. What am I not doing? Or
maybe,
what should I be doing?

Thanks
Zinon



.



Relevant Pages

  • RE: Elevate permission of code
    ... As for the privilege elevation, I'm afraid you're limited to the Vista ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.platformsdk.security)
  • Re: Logging off
    ... bool force) { ... /// Tries to enable the specified privilege. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Elevate permission of code
    ... As for the privilege elevation, I'm afraid you're limited to the Vista ... Just let the UAC detect it and request the user to do the elevation ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.platformsdk.security)
  • RE: Notifications running unsigned EXE on Vista
    ... trying to elevate to Administrator. ... There are 4 types of elevation dialog themes in Windows Vista. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.platformsdk.security)
  • RE: Assembly Resolve Anomaly-Please Help
    ... It could also be a problem with your account privilege. ... load your assemble, for windows service application, .net runtime will look ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework)