FindFirstFile function Null safety kernel32

int FindFirstFile (
  1. Pointer<Utf16> lpFileName,
  2. Pointer<WIN32_FIND_DATA> lpFindFileData
)

Searches a directory for a file or subdirectory with a name that matches a specific name (or partial name if wildcards are used).

HANDLE FindFirstFileW(
  LPCWSTR            lpFileName,
  LPWIN32_FIND_DATAW lpFindFileData
);

Implementation

int FindFirstFile(
    Pointer<Utf16> lpFileName, Pointer<WIN32_FIND_DATA> lpFindFileData) {
  final _FindFirstFile = _kernel32.lookupFunction<
      IntPtr Function(
          Pointer<Utf16> lpFileName, Pointer<WIN32_FIND_DATA> lpFindFileData),
      int Function(Pointer<Utf16> lpFileName,
          Pointer<WIN32_FIND_DATA> lpFindFileData)>('FindFirstFileW');
  return _FindFirstFile(lpFileName, lpFindFileData);
}