OpenProcessToken function Null safety advapi32

int OpenProcessToken(
  1. int ProcessHandle,
  2. int DesiredAccess,
  3. Pointer<IntPtr> TokenHandle
)

The OpenProcessToken function opens the access token associated with a process.

BOOL OpenProcessToken(
  HANDLE  ProcessHandle,
  DWORD   DesiredAccess,
  PHANDLE TokenHandle
);

Implementation

int OpenProcessToken(
    int ProcessHandle, int DesiredAccess, Pointer<IntPtr> TokenHandle) {
  final _OpenProcessToken = _advapi32.lookupFunction<
      Int32 Function(IntPtr ProcessHandle, Uint32 DesiredAccess,
          Pointer<IntPtr> TokenHandle),
      int Function(int ProcessHandle, int DesiredAccess,
          Pointer<IntPtr> TokenHandle)>('OpenProcessToken');
  return _OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle);
}