Re: Detecting Admin Privileges Via Code
- From: "Alun Jones" <alun@xxxxxxxxxxxxx>
- Date: Tue, 22 Jul 2008 22:48:34 -0700
"Bowman, John C." <john.bowman@xxxxxxxxxxxxxxxx> wrote in message news:#jvmcnC7IHA.4204@xxxxxxxxxxxxxxxxxxxxxxx
I'm not certain if this is the best place to post this, so please educate me if it's not. Bascially, I need to know the "correct"(?) method for how to detect if a the current user has administrative privileges via c or c++ code for some installation routines. I've been striking out so far finding this in MSDN or anywhere. Any help would be appreciated.
Meta-question:
What can a "user with administrative privileges" do that you need to do?
Meta-answer:
Then you should test to see if the user can do that.
In general, you should not ask "have I got permission to do X" when asked to do X, you should try to do X, and then display an error if you are told you do not have permissions.
The reason is that frequently the task you are looking at is one that can be delegated to non-administrators.
As an example, in Windows 2000, you had to have SE_TCB_NAME privilege in order to call LogonUser. I didn't bother checking in my code to see if I had SE_TCB_NAME privilege, I just called LogonUser. As a result, when Windows 2003 came out, and didn't have that restriction, my code just plain worked exactly the same. Code that says "does the user have SE_TCB_NAME privilege" would carry on refusing to call LogonUser.
Alun.
~~~~
--
Texas Imperial Software | Web: http://www.wftpd.com/
23921 57th Ave SE | Blog: http://msmvps.com/alunj/
Woodinville WA 98072-8661 | WFTPD, WFTPD Pro are Windows FTP servers.
Fax/Voice +1(425)807-1787 | Try our NEW client software, WFTPD Explorer.
.
- Follow-Ups:
- Re: Detecting Admin Privileges Via Code
- From: Bowman, John C.
- Re: Detecting Admin Privileges Via Code
- From: Anteaus
- Re: Detecting Admin Privileges Via Code
- References:
- Detecting Admin Privileges Via Code
- From: Bowman, John C.
- Detecting Admin Privileges Via Code
- Prev by Date: Re: Biometrics
- Next by Date: Re: POSSIBLE HACK...PLEASE, PLEASE HELP!
- Previous by thread: Detecting Admin Privileges Via Code
- Next by thread: Re: Detecting Admin Privileges Via Code
- Index(es):
Relevant Pages
|