Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking for Administrator user login in non-English installations of windows

I have some small questions...I have a program that stores a list of users in a database and compares on program startup if the user is in the list or is an administrator before letting them use it. At the moment, the way I'm using to check if the user is an administrator is simply by comparing the username to a string constant called 'ADMINISTRATOR'. Will this work on a non-Engish system? I.E. does Windows use a language specific version of 'administrator'? Or maybe is there an enumerated version of the Admin user that I can use to check with instead of my 'ADMINISTRATOR' string? (you know, just like how Windows folders are enumerated). I'm using Delphi 2009 by the way. Thanks in advance!

like image 739
Cassandra87 Avatar asked Oct 25 '10 22:10

Cassandra87


People also ask

How do I check if a Windows user is Administrator?

Microsoft Windows 10In the User Accounts window, click on the User Accounts link. On the right hand side of the User Accounts window will be listed your account name, account icon and a description. If the word “Administrator” is in your account's description, then you are an administrator.

How do I make sure I am logged in as Administrator?

To log on as an administrator, you need to have a user account on the computer with an Administrator account type. If you are not sure if the account that you have on the computer is an administrator account, you can check the account type after you have logged on.

How do I find out who is the Administrator on my computer?

Open the Control Panel. Click the User Accounts option. In User Accounts, you see your account name listed on the right side. If your account has admin rights, it will say "Administrator" under your account name.


1 Answers

No, don't do it that way. It will surely break. You could get a list of all the groups the user is a member of and check if one of the SIDs is S-1-5-32-544, which is the SID of the Administrators group. There is a list of well known SIDs. There is also an SID for the original administrator account.

Here is the list:

http://support.microsoft.com/kb/243330

like image 175
BobbyShaftoe Avatar answered Nov 10 '22 01:11

BobbyShaftoe