GetModuleFileNameEx function Null safety psapi

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 GetModuleFileNameExW(
  HANDLE  hProcess,
  HMODULE hModule,
  LPWSTR  lpFilename,
  DWORD   nSize
);

Implementation

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