bradgonesurfing
bradgonesurfing

Reputation: 32192

Checking user account settings in C#

Is it possible from within a c# / .Net program to see the state of the User Account Control Settings. Specifically I want to know if it is set to one of

I do not want to change the settings but I would like to know what they are.enter image description here

Upvotes: 2

Views: 523

Answers (1)

evgenyl
evgenyl

Reputation: 8117

I am not sure you can do it. What you can do is to create and embed the manifest.

In Windows Vista®, the correct way to mark your applications is to embed an application manifest within your program that tells the operating system what the application needs. In the Windows Vista release, there are provisions to allow non-manifested or unsigned code to run with a full administrative access token.

Please, look at this post.

From my experiences, It correct not only for Vista, but also for Win7, Win2008.

We did try to play with manifest, and it did works.

Also, may be this also help you:

Run command like this to embed manifest to exe:

mt.exe -manifest  "C:\path\to\ypur\manifest\my.manifest" -outputresource:"Path\to\your\exefile\My.exe"

Use this command for postbuild events:

mt.exe -manifest "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;"

Upvotes: 2

Related Questions