PeekNamedPipe function Null safety kernel32

int PeekNamedPipe(
  1. int hNamedPipe,
  2. Pointer<NativeType> lpBuffer,
  3. int nBufferSize,
  4. Pointer<Uint32> lpBytesRead,
  5. Pointer<Uint32> lpTotalBytesAvail,
  6. Pointer<Uint32> lpBytesLeftThisMessage
)

Copies data from a named or anonymous pipe into a buffer without removing it from the pipe. It also returns information about data in the pipe.

BOOL PeekNamedPipe(
  HANDLE  hNamedPipe,
  LPVOID  lpBuffer,
  DWORD   nBufferSize,
  LPDWORD lpBytesRead,
  LPDWORD lpTotalBytesAvail,
  LPDWORD lpBytesLeftThisMessage);

Implementation

int PeekNamedPipe(
    int hNamedPipe,
    Pointer lpBuffer,
    int nBufferSize,
    Pointer<Uint32> lpBytesRead,
    Pointer<Uint32> lpTotalBytesAvail,
    Pointer<Uint32> lpBytesLeftThisMessage) {
  final _PeekNamedPipe = _kernel32.lookupFunction<
      Int32 Function(
          IntPtr hNamedPipe,
          Pointer lpBuffer,
          Uint32 nBufferSize,
          Pointer<Uint32> lpBytesRead,
          Pointer<Uint32> lpTotalBytesAvail,
          Pointer<Uint32> lpBytesLeftThisMessage),
      int Function(
          int hNamedPipe,
          Pointer lpBuffer,
          int nBufferSize,
          Pointer<Uint32> lpBytesRead,
          Pointer<Uint32> lpTotalBytesAvail,
          Pointer<Uint32> lpBytesLeftThisMessage)>('PeekNamedPipe');
  return _PeekNamedPipe(hNamedPipe, lpBuffer, nBufferSize, lpBytesRead,
      lpTotalBytesAvail, lpBytesLeftThisMessage);
}