GetTokenInformation function advapi32

Win32Result<bool> GetTokenInformation(
  1. HANDLE tokenHandle,
  2. TOKEN_INFORMATION_CLASS tokenInformationClass,
  3. Pointer<NativeType>? tokenInformation,
  4. int tokenInformationLength,
  5. Pointer<Uint32> returnLength,
)

Retrieves a specified type of information about an access token.

The calling process must have appropriate access rights to obtain the information.

To learn more, see learn.microsoft.com/windows/win32/api/securitybaseapi/nf-securitybaseapi-gettokeninformation.

Implementation

Win32Result<bool> GetTokenInformation(
  HANDLE tokenHandle,
  TOKEN_INFORMATION_CLASS tokenInformationClass,
  Pointer? tokenInformation,
  int tokenInformationLength,
  Pointer<Uint32> returnLength,
) {
  final result_ = GetTokenInformation_Wrapper(
    tokenHandle,
    tokenInformationClass,
    tokenInformation ?? nullptr,
    tokenInformationLength,
    returnLength,
  );
  return Win32Result(value: result_.value.i32 != FALSE, error: result_.error);
}