GetComputerNameEx function Null safety kernel32

int GetComputerNameEx (
  1. int NameType,
  2. Pointer<Utf16> lpBuffer,
  3. Pointer<Uint32> nSize
)

Retrieves a NetBIOS or DNS name associated with the local computer. The names are established at system startup, when the system reads them from the registry.

BOOL GetComputerNameExW(
  COMPUTER_NAME_FORMAT NameType,
  LPWSTR               lpBuffer,
  LPDWORD              nSize
);

Implementation

int GetComputerNameEx(
    int NameType, Pointer<Utf16> lpBuffer, Pointer<Uint32> nSize) {
  final _GetComputerNameEx = _kernel32.lookupFunction<
      Int32 Function(
          Int32 NameType, Pointer<Utf16> lpBuffer, Pointer<Uint32> nSize),
      int Function(int NameType, Pointer<Utf16> lpBuffer,
          Pointer<Uint32> nSize)>('GetComputerNameExW');
  return _GetComputerNameEx(NameType, lpBuffer, nSize);
}