Assemblies requiring admin on Vista

  • Thread starter Thread starter Carl Woodward
  • Start date Start date
C

Carl Woodward

Dear all,

Reasonably new to .NET I am confused. Some of the .exe assemblies I am
creating using VS2005 are requiring User Account Control confirmation on
Vista, but some are not. I am not intentionally (could have done it by
accident I suppose) specifiying anywhere that they should need Admin
privileges.

If I use the default project names i.e. WindowsApplication1 and so forth,
they dont need Admin. If I change the name to UpdateClient for example, then
they do.

Why is this?

Many thanks in advance!

Carl
 
Hello Carl,

Seems that you use some methods which request admin privileges.
So, if you want to run your application as elevated just mark your app out
with the manifest where declare UAC status

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

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

CW> Dear all,
CW>
CW> Reasonably new to .NET I am confused. Some of the .exe assemblies I
CW> am creating using VS2005 are requiring User Account Control
CW> confirmation on Vista, but some are not. I am not intentionally
CW> (could have done it by accident I suppose) specifiying anywhere that
CW> they should need Admin privileges.
CW>
CW> If I use the default project names i.e. WindowsApplication1 and so
CW> forth, they dont need Admin. If I change the name to UpdateClient
CW> for example, then they do.
CW>
CW> Why is this?
CW>
CW> Many thanks in advance!
CW>
CW> Carl
CW>
 
Carl said:
Dear all,

Reasonably new to .NET I am confused. Some of the .exe assemblies I am
creating using VS2005 are requiring User Account Control confirmation on
Vista, but some are not. I am not intentionally (could have done it by
accident I suppose) specifiying anywhere that they should need Admin
privileges.

If I use the default project names i.e. WindowsApplication1 and so
forth, they dont need Admin. If I change the name to UpdateClient for
example, then they do.

Why is this?

If your application doesn't have a manifest (See Michael Nemtsev's post)
Vista tries to work out whether it's a setup program, using heuristics.
If Vista believes it is a setup program, it will get run as
administrator (assuming the user allows that), and given access to the
'real' program files so that it can 'install'.
If Vista believes it's not a setup program, it will get run as a normal
user.

By putting the word "Update" in the name of the executable, you're
making Vista believe it's a setup/update program.

Alun Harford
 
Back
Top