Click or drag to resize
Xcalibur Systems LLC Logo

SecurityHelperAdjustTokenGroups Method

The AdjustTokenGroups function enables or disables groups already present in the specified access token. Access to is required to enable or disable groups in an access token.

Namespace: Xcalibur.NativeMethods.V2.Security
Assembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax
[DllImportAttribute("advapi32.dll", CharSet = CharSet.Auto)]
public static bool AdjustTokenGroups(
	IntPtr tokenHandle,
	bool resetToDefault,
	[OptionalAttribute] TokenGroups newState,
	uint bufferLength,
	[OptionalAttribute] TokenGroups previousState,
	[OptionalAttribute] uint returnLength
)

Parameters

tokenHandle  IntPtr
A handle to the access token that contains the groups to be enabled or disabled. The handle must have access to the token. If the PreviousState parameter is not NULL, the handle must also have access.
resetToDefault  Boolean
Boolean value that indicates whether the groups are to be set to their default enabled and disabled states. If this value is TRUE, the groups are set to their default states and the newState parameter is ignored. If this value is FALSE, the groups are set according to the information pointed to by the newState parameter.
newState  TokenGroups  (Optional)
A pointer to a structure that contains the groups to be enabled or disabled. If the resetToDefault parameter is FALSE, the function sets each of the groups to the value of that group's attribute in the structure. If resetToDefault is TRUE, this parameter is ignored.
bufferLength  UInt32
The size, in bytes, of the buffer pointed to by the previousState parameter. This parameter can be zero if the previousState parameter is NULL.
previousState  TokenGroups  (Optional)
A pointer to a buffer that receives a structure containing the previous state of any groups the function modifies. That is, if a group has been modified by this function, the group and its previous state are contained in the structure referenced by previousState. If the GroupCount member of is zero, then no groups have been changed by this function. This parameter can be NULL. If a buffer is specified but it does not contain enough space to receive the complete list of modified groups, no group states are changed and the function fails.In this case, the function sets the variable pointed to by the returnLength parameter to the number of bytes required to hold the complete list of modified groups.
returnLength  UInt32  (Optional)
A pointer to a variable that receives the actual number of bytes needed for the buffer pointed to by the previousState parameter. This parameter can be NULL and is ignored if previousState is NULL.

Return Value

Boolean
See Also