CreateConsoleScreenBuffer function Null safety kernel32

int CreateConsoleScreenBuffer(
  1. int dwDesiredAccess,
  2. int dwShareMode,
  3. Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
  4. int dwFlags,
  5. Pointer<NativeType> lpScreenBufferData
)

Creates a console screen buffer.

HANDLE WINAPI CreateConsoleScreenBuffer(
  _In_             DWORD               dwDesiredAccess,
  _In_             DWORD               dwShareMode,
  _In_opt_   const SECURITY_ATTRIBUTES *lpSecurityAttributes,
  _In_             DWORD               dwFlags,
  _Reserved_       LPVOID              lpScreenBufferData
);

Implementation

int CreateConsoleScreenBuffer(
    int dwDesiredAccess,
    int dwShareMode,
    Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
    int dwFlags,
    Pointer lpScreenBufferData) {
  final _CreateConsoleScreenBuffer = _kernel32.lookupFunction<
      IntPtr Function(
          Uint32 dwDesiredAccess,
          Uint32 dwShareMode,
          Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
          Uint32 dwFlags,
          Pointer lpScreenBufferData),
      int Function(
          int dwDesiredAccess,
          int dwShareMode,
          Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
          int dwFlags,
          Pointer lpScreenBufferData)>('CreateConsoleScreenBuffer');
  return _CreateConsoleScreenBuffer(dwDesiredAccess, dwShareMode,
      lpSecurityAttributes, dwFlags, lpScreenBufferData);
}