CreatePipe function Null safety kernel32

int CreatePipe (
  1. Pointer<IntPtr> hReadPipe,
  2. Pointer<IntPtr> hWritePipe,
  3. Pointer<SECURITY_ATTRIBUTES> lpPipeAttributes,
  4. int nSize
)

Creates an anonymous pipe, and returns handles to the read and write ends of the pipe.

BOOL CreatePipe(
  PHANDLE               hReadPipe,
  PHANDLE               hWritePipe,
  LPSECURITY_ATTRIBUTES lpPipeAttributes,
  DWORD                 nSize
);

Implementation

int CreatePipe(Pointer<IntPtr> hReadPipe, Pointer<IntPtr> hWritePipe,
    Pointer<SECURITY_ATTRIBUTES> lpPipeAttributes, int nSize) {
  final _CreatePipe = _kernel32.lookupFunction<
      Int32 Function(Pointer<IntPtr> hReadPipe, Pointer<IntPtr> hWritePipe,
          Pointer<SECURITY_ATTRIBUTES> lpPipeAttributes, Uint32 nSize),
      int Function(
          Pointer<IntPtr> hReadPipe,
          Pointer<IntPtr> hWritePipe,
          Pointer<SECURITY_ATTRIBUTES> lpPipeAttributes,
          int nSize)>('CreatePipe');
  return _CreatePipe(hReadPipe, hWritePipe, lpPipeAttributes, nSize);
}