How do I make a program that can only be run by an administrator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to produce a program that can only be run by a user with administrator
privileges (ie a member of the BUILTINS/Adminstrators group - I think.
Correct me if I'm getting my terminology wrong). Can someone start me in the
right direction. I'm using VS2005 (just upgraded from 2003)
 
Dave said:
I want to produce a program that can only be run by a user with
administrator privileges (ie a member of the BUILTINS/Adminstrators group
- I think. Correct me if I'm getting my terminology wrong). Can someone
start me in the right direction. I'm using VS2005 (just upgraded from
2003)

Hi Dave,

To accomplish this without using embedded code, you can set the security
permissions on the application to only allow Administrators to execute the
application... then it's Windows itself which will Allow/Deny execution of
your program. Otherwise, you'll need to write code in your entry point to
test group membership, and either continue executing, or stop execution.
IMHO, the former is significantly better than the latter, since if you are
writing your application in .NET, what's to stop someone using Reflection
to load your assembly, and accessing parts of the code after your tests...
or even worse, simply disassembling your assembly, taking out the admin
verification code, and reassembling it.
 
Back
Top