<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Comments for How to detect if the current user is logged in administrator.</title>
<link rel="alternate" type="text/plain" href="http://dn.codegear.com/article/26752" title="How to detect if the current user is logged in administrator." />
<link rel="self" type="application/atom+xml" href="http://dn.codegear.com/article/26752/feed" title="Comments for How to detect if the current user is logged in administrator." />
<id>http://dn.codegear.com/article/26752</id>
<updated>2008-11-19T06:58:47-08:00</updated>
<entry>
<title>How to detect if the current user is logged in administrator.</title>
<author>
<name>William Randlett</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=39248</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=39248</id>
<updated>2006-07-19T09:19:43-07:00</updated>
<published>2006-07-19T09:19:43-07:00</published>
<summary>How to detect if the current user is logged in administrator.</summary>
<content>The logic for the GetTokenInformation call is not correct. It does not work if the user is only in the local Administrators group. You need to get the buffer size rather than allocating a fixed 1024 bytes:  { Call the method one time using a nil reference in order to    determine the buffer size that is required. }  GetTokenInformation( hAccessToken,                       TokenGroups,                       nil,                       0,                       dwTokenInfoBufferSize );  { Allocate the memory necessary to receive the buffer. }  GetMem(ptgGroups, dwTokenInfoBufferSize);  { Call the method a second time using the buffer size that was    returned by the first call. }  fGotTokenInfo := GetTokenInformation( hAccessToken,                                        TokenGroups,                                        ptgGroups,                                        dwTokenInfoBufferSize,                                        dwTokenInfoBufferSize );  CloseHandle( hAccessToken );</content>
</entry>
<entry>
<title>How to detect if the current user is logged in administrator.</title>
<author>
<name>parag joshi</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=38182</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=38182</id>
<updated>2005-02-21T07:04:01-08:00</updated>
<published>2005-02-21T07:04:01-08:00</published>
<summary>How to detect if the current user is logged in administrator.</summary>
<content>Works fine on XP.Tested it.Just add these constants:const  SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority =                                      (Value: (0, 0, 0, 0, 0, 5));  SECURITY_BUILTIN_DOMAIN_RID = $00000020;  DOMAIN_ALIAS_RID_ADMINS = $00000220;Thanks :)</content>
</entry>
<entry>
<title>How to detect if the current user is logged in administrator.</title>
<author>
<name>Chen Ping</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=28129</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=28129</id>
<updated>2001-02-26T21:46:37-08:00</updated>
<published>2001-02-26T21:46:37-08:00</published>
<summary>How to detect if the current user is logged in administrator.</summary>
<content>I can't Complie this function in D5.Maybe I miss to uses some units. Why can tell me which units it is?</content>
</entry>
<entry>
<title>How to detect if the current user is logged in administrator. - Missing constants</title>
<author>
<name>Thomas Schimming</name>
<uri>http://threads.codegear.com/threads/threads.exe/userall?commentid=27836</uri>
</author>
<id>http://threads.codegear.com/threads/threads.exe/view?commentid=27836</id>
<updated>2001-02-05T05:54:06-08:00</updated>
<published>2001-02-05T05:54:06-08:00</published>
<summary>How to detect if the current user is logged in administrator. - Missing constants</summary>
<content>What's missing in the Delphi 5 version of Windows.pas is the definition of some related constants:const  SECURITY_NT_AUTHORITY: SID_IDENTIFIER_AUTHORITY = (Value: (0,0,0,0,0,5));   // ntifs  SECURITY_BUILTIN_DOMAIN_RID: DWORD = $00000020;  DOMAIN_ALIAS_RID_ADMINS: DWORD = $00000220;  DOMAIN_ALIAS_RID_USERS : DWORD = $00000221;  DOMAIN_ALIAS_RID_GUESTS: DWORD = $00000222;  DOMAIN_ALIAS_RID_POWER_: DWORD = $00000223;</content>
</entry>
</feed>
