OpenThreadToken function Null safety advapi32

int OpenThreadToken(
  1. int ThreadHandle,
  2. int DesiredAccess,
  3. int OpenAsSelf,
  4. Pointer<IntPtr> TokenHandle
)

The OpenThreadToken function opens the access token associated with a thread.

BOOL OpenThreadToken(
  HANDLE  ThreadHandle,
  DWORD   DesiredAccess,
  BOOL    OpenAsSelf,
  PHANDLE TokenHandle
);

Implementation

int OpenThreadToken(int ThreadHandle, int DesiredAccess, int OpenAsSelf,
    Pointer<IntPtr> TokenHandle) {
  final _OpenThreadToken = _advapi32.lookupFunction<
      Int32 Function(IntPtr ThreadHandle, Uint32 DesiredAccess,
          Int32 OpenAsSelf, Pointer<IntPtr> TokenHandle),
      int Function(int ThreadHandle, int DesiredAccess, int OpenAsSelf,
          Pointer<IntPtr> TokenHandle)>('OpenThreadToken');
  return _OpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle);
}