|
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.SecurityAssembly: 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
)
<DllImportAttribute("advapi32.dll", CharSet := CharSet.Auto>]
Public Shared Function AdjustTokenGroups (
tokenHandle As IntPtr,
resetToDefault As Boolean,
<OptionalAttribute> newState As TokenGroups,
bufferLength As UInteger,
<OptionalAttribute> <OutAttribute> previousState As TokenGroups,
<OptionalAttribute> <OutAttribute> returnLength As UInteger
) As Boolean
public:
[DllImportAttribute(L"advapi32.dll", CharSet = CharSet::Auto)]
static bool AdjustTokenGroups(
[InAttribute] IntPtr tokenHandle,
[InAttribute] bool resetToDefault,
[OptionalAttribute] [InAttribute] TokenGroups newState,
[InAttribute] unsigned int bufferLength,
[OptionalAttribute] [OutAttribute] TokenGroups previousState,
[OptionalAttribute] [OutAttribute] unsigned int returnLength
)
[<DllImportAttribute("advapi32.dll", CharSet = CharSet.Auto)>]
static member AdjustTokenGroups :
tokenHandle : IntPtr *
resetToDefault : bool *
[<OptionalAttribute>] newState : TokenGroups *
bufferLength : uint32 *
[<OptionalAttribute>] previousState : TokenGroups byref *
[<OptionalAttribute>] returnLength : uint32 byref -> bool
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
BooleanSee Also