GetConsoleTitle function Null safety kernel32

int GetConsoleTitle(
  1. Pointer<Utf16> lpConsoleTitle,
  2. int nSize
)

Retrieves the title for the current console window.

DWORD WINAPI GetConsoleTitleW(
  _Out_ LPTSTR lpConsoleTitle,
  _In_  DWORD  nSize
);

Implementation

int GetConsoleTitle(Pointer<Utf16> lpConsoleTitle, int nSize) {
  final _GetConsoleTitle = _kernel32.lookupFunction<
      Uint32 Function(Pointer<Utf16> lpConsoleTitle, Uint32 nSize),
      int Function(
          Pointer<Utf16> lpConsoleTitle, int nSize)>('GetConsoleTitleW');
  return _GetConsoleTitle(lpConsoleTitle, nSize);
}