GetTokenInformation function Null safety advapi32

int GetTokenInformation(
  1. int TokenHandle,
  2. int TokenInformationClass,
  3. Pointer<NativeType> TokenInformation,
  4. int TokenInformationLength,
  5. Pointer<Uint32> ReturnLength
)

The GetTokenInformation function retrieves a specified type of information about an access token. The calling process must have appropriate access rights to obtain the information.

BOOL GetTokenInformation(
  HANDLE                  TokenHandle,
  TOKEN_INFORMATION_CLASS TokenInformationClass,
  LPVOID                  TokenInformation,
  DWORD                   TokenInformationLength,
  PDWORD                  ReturnLength
);

Implementation

int GetTokenInformation(
    int TokenHandle,
    int TokenInformationClass,
    Pointer TokenInformation,
    int TokenInformationLength,
    Pointer<Uint32> ReturnLength) {
  final _GetTokenInformation = _advapi32.lookupFunction<
      Int32 Function(
          IntPtr TokenHandle,
          Uint32 TokenInformationClass,
          Pointer TokenInformation,
          Uint32 TokenInformationLength,
          Pointer<Uint32> ReturnLength),
      int Function(
          int TokenHandle,
          int TokenInformationClass,
          Pointer TokenInformation,
          int TokenInformationLength,
          Pointer<Uint32> ReturnLength)>('GetTokenInformation');
  return _GetTokenInformation(TokenHandle, TokenInformationClass,
      TokenInformation, TokenInformationLength, ReturnLength);
}