GetModuleFileNameEx function Null safety kernel32

int GetModuleFileNameEx(
  1. int hProcess,
  2. int hModule,
  3. Pointer<Utf16> lpFilename,
  4. int nSize
)

Retrieves the fully qualified path for the file containing the specified module.

DWORD K32GetModuleFileNameExW(
  HANDLE  hProcess,
  HMODULE hModule,
  LPWSTR  lpFilename,
  DWORD   nSize
);

Implementation

int GetModuleFileNameEx(
    int hProcess, int hModule, Pointer<Utf16> lpFilename, int nSize) {
  final _GetModuleFileNameEx = _kernel32.lookupFunction<
      Uint32 Function(IntPtr hProcess, IntPtr hModule,
          Pointer<Utf16> lpFilename, Uint32 nSize),
      int Function(int hProcess, int hModule, Pointer<Utf16> lpFilename,
          int nSize)>('K32GetModuleFileNameExW');
  return _GetModuleFileNameEx(hProcess, hModule, lpFilename, nSize);
}