GetTempPath function Null safety kernel32

int GetTempPath (
  1. int nBufferLength,
  2. Pointer<Utf16> lpBuffer
)

Retrieves the path of the directory designated for temporary files.

DWORD GetTempPathW(
  DWORD  nBufferLength,
  LPWSTR lpBuffer
);

Implementation

int GetTempPath(int nBufferLength, Pointer<Utf16> lpBuffer) {
  final _GetTempPath = _kernel32.lookupFunction<
      Uint32 Function(Uint32 nBufferLength, Pointer<Utf16> lpBuffer),
      int Function(int nBufferLength, Pointer<Utf16> lpBuffer)>('GetTempPathW');
  return _GetTempPath(nBufferLength, lpBuffer);
}