Location: Symbol Reference > Classes > TJwSecurityId Class
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwSecurityId Class
Pascal
TJwSecurityId = class(TInterfacedObject, IJwBase);

The security identifier (SID) structure is a variable-length structure used to uniquely identify users or groups. 

TJwSecurityId encapsulates a SID structures and provides functions to create, read and convert SID data. Once an instance is created the SID data cannot be changed. Therefore there is no Assign function to copy data. 

MSDN on http://msdn2.microsoft.com/en-us/library/aa379594.aspx http://msdn2.microsoft.com/en-us/library/aa379597.aspx

TJwSecurityId Class
 
Name 
Description 
 
This is the overview for the Create constructor overload. 
 
CreateWellKnownSid creates a SID instance from a known well sid type. The resulted SID will be checked by CheckSID .
COM: Also available as com method.
 
 
Destroy destroys the instance and frees the SID
Name 
Description 
The following tables list the members exposed by IJwBase. 
The methods of the IJwBase class are listed here. 
TJwSecurityId Class
Name 
Description 
The following tables list the members exposed by TJwSecurityId. 
The methods of the TJwSecurityId class are listed here. 
The properties of the TJwSecurityId class are listed here. 
 
Name 
Description 
 
.$IFNDEF DELPHI2009_UP 
 
This is GetHashCode, a member of class IJwBase. 
 
This is ToString, a member of class IJwBase. 
TJwSecurityId Class
 
Name 
Description 
 
CheckSID checks if the SID instance contains a valid SID structure. If SID is not a correct SID, an exception will be raised. 
 
Create_PSID_AND_ATTRIBUTES allocates memory for a SID and Attributes structure. The SID instance will be copied into a new SID structure that is attached to the returned structure in its SID value. The new created structure must be freed by Free_PSID_AND_ATTRIBUTES.
Currently two memory blocks will be allocated and initialized:
  1. PSID_AND_ATTRIBUTES
  2. PSID

 
 
CreateCopyOfSID creates a new SID initilized sid. The values are copied from this SID instance. The SID must be freed by FreeSID
 
CreateSidIdentifierAuthority creates a TSidIdentifierAuthority structure from values. 
 
EqualDomainSid determines whether two SIDs are from the same domain.  
 
EqualPrefixSid tests two security-identifier (SID) prefix values for equality. A SID prefix is the entire SID except for the last subauthority value
This function simulates the WINAPI function GetWindowsAccountDomainSid and is therefore also available on Windows 2000.
 
 
.$IFNDEF DELPHI2009_UP 
 
EqualSid tests two security-identifier (SID) values for equality.  
 
Free_PSID_AND_ATTRIBUTES frees the memory allocated by Create_PSID_AND_ATTRIBUTES.
 
 
FreeSID frees a SID allocated by NewSID .  
 
GetAccountDomainName returns the domain account name of the SID on the computer given in SystemName. For more information see the see also section. 
 
GetAccountName returns the account name of the SID on the computer given in SystemName. For more information see the see also section. 
 
GetAccountNameUse returns the account name use of the SID on the computer given in SystemName. For more information see the see also section. 
 
GetAccountSidString gets the domain and acount name of the SID. It also returns the type of Sid Name.  
 
This is the overview for the GetAttributeString method overload. 
 
This is GetAttributesType, a member of class TJwSecurityId. 
 
This is GetCachedUserFromSid, a member of class TJwSecurityId. 
 
This is GetHashCode, a member of class TJwSecurityId. 
 
GetText creates a text that contains domain, account name and humand readable SID structure. The form is "[domain@]name (S-1-XXXXXX)" where [] is optional.  
 
This is the overview for the GetWindowsAccountDomainSid method overload. 
 
IntToSidAuth converts a value into a sid identifier structure.  
 
IsStandardSID checks if the SID is a SID defined in unit JwsclKnownSid. If this SID is a standard SID it must not be freed!  
 
NewSID allocates memory for a SID and returns the pointer to it. The size of allocated memory is always the maximum possible size of a SID. The constant SECURITY_MAX_SID_SIZE is used. The data must be freed by FreeSID .  
 
This is SetAttributesType, a member of class TJwSecurityId. 
 
SidAuthToInt converts a TSidIdentifierAuthority into an integer.  
 
This is SplitAccountString, a member of class TJwSecurityId. 
 
This is ToString, a member of class TJwSecurityId. 
TJwSecurityId Class
 
Name 
Description 
 
AccountDomainName[SystemName returns the domain account name of the SID on the computer given in SystemName. For more information see the see also section. EJwsclWinCallFailedException if the call to a winapi function failed  
 
AccountName[SystemName returns the account name of the SID on the computer given in SystemName. For more information see the see also section. EJwsclWinCallFailedException if the call to a winapi function failed  
 
AccountNameUse[SystemName returns the account name use of the SID on the computer given in SystemName. For more information see the see also section. EJwsclWinCallFailedException if the call to a winapi function failed  
 
Attributes can be used to set specific attributes to the SID. It is also used by TJwSecurityIdList to save attributes from PTokenGroups
The attributes is also filled by token groups. However changing this value has no effect on the token sid. Use instead TJwSecurityToken methods.
COM: Also available as com method. 
 
AttributesType is the same as Attributes but using specific attribute types (TJwSidAttributeSet) The constant sidaUnknown is flaged in the result if a bit in property Attributes could not be converted. Setting a value does only support values that are listed in TJwSidAttribute but without sidaUnknown and SA_PADx (where x is between 0 and 5). Changing the value does also affect property Attributes.
COM: Also available as com method. 
 
CachedSidString returns the stored SID String. It is created once on the creation of the object and returns the same value as property StringSID
 
CachedSystemName contains the system or domain name that was supplied when the instance was created. It is simply cached for later retrieving and can be used for AccountName, AccountDomainName or AccountNameUse to get the information in the context of the given system or domain.
COM: Also available as com method. 
 
CachedGetUserFromSid uses an undocumented function that is exported by utildll.dll. It keeps a variable with this structure: CACHED_USERNAME = record // RW The structure probably has a different name cbUsername: DWORD; Crc16: WORD Username: array[0..USERNAME_LENGTH-1] of WCHAR; // USERNAME_LENGTH = 20 end;
The function compares the Crc16 of the given Sid to the stored one and if it matches returns the stored username. If it doesn't match a lookup is done and the result in stored in the structure.
Access to the variable is guarded by CRITICAL_SECTIONS to prevent multi threading issues.
This functions was written and is optimal for... more 
 
GUID 
This is GUID, a member of class TJwSecurityId. 
 
IdentifierAuthority returns a copy of the sid identifier authority of the SID. You can use SidAuthToInt to convert the array into a 48bit number as a 64bit integer. EJwsclWinCallFailedException will be raised if the call to GetSidIdentifierAuthority failed.
COM: Also available as com method. 
 
This is InheritedObjectTypeGuid, a member of class TJwSecurityId. 
 
This is InheritedObjectTypeName, a member of class TJwSecurityId. 
 
IsWellKnownSid returns whether this instance contains a well known sid (true) or not (false).
COM: Also available as com method. 
 
This is ObjectType, a member of class TJwSecurityId. 
 
This is ObjectTypeGuid, a member of class TJwSecurityId. 
 
SID 
SID contains a pointer to the internal SID structure. The SID structure must not be freed by CloseHandle otherwise the behavior of the instance is undefined.
COM: Also available as com method. 
 
SIDLength returns the length of the SID structure. EJwsclWinCallFailedException will be raised if the call to GetLengthSID failed.
COM: Also available as com method. 
 
StringSID returns a string representation of the SID. The string has the form : "S-1-III-SSS[-SSS]^7" Where I = identifier authority and S = subautority (from 1 to 8 values))
EJwsclWinCallFailedException will be raised if the call to GetStringSID failed.
COM: Also available as com method. 
 
SubAuthority[Index returns the sub authority value specified by an index. The exception EJwsclIndexOutOfBoundsException will be raised if parameter index is smaller than 0 or greater equal than SubAuthorityCount.
COM: Also available as com method.
EJwsclWinCallFailedException will be raised if the call to GetSidSubAuthority failed. 
 
SubAuthorityArray returns a copy of the sub authority values as a dynamic array. EJwsclWinCallFailedException will be raised if the array could not be retrieved because a call to GetSidSubAuthority failed
COM: Also available as com method. 
 
SubAuthorityCount returns the count of authority values. A EJwsclWinCallFailedException exception will be raised if the count could not be retrieved.
COM: Also available as com method. 
 
Returns the trustee using a SID structure. 
 
Defines which properties are valid - if set. otType : ObjectType is valid otTypeGuid : ObjectTypeGuid is valid otTypeInheritedGuid : InheritedObjectTypeGuid is valid otTypeInheritedName : InheritedObjectTypeName is valid 
 
WellKnownSidType returns the SID type as a well known sid type.
COM: Also available as com method. 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!