ShellExecute function Null safety shell32

int ShellExecute(
  1. int hwnd,
  2. Pointer<Utf16> lpOperation,
  3. Pointer<Utf16> lpFile,
  4. Pointer<Utf16> lpParameters,
  5. Pointer<Utf16> lpDirectory,
  6. int nShowCmd
)

Performs an operation on a specified file.

HINSTANCE ShellExecuteW(
  HWND    hwnd,
  LPCWSTR lpOperation,
  LPCWSTR lpFile,
  LPCWSTR lpParameters,
  LPCWSTR lpDirectory,
  INT     nShowCmd
);

Implementation

int ShellExecute(int hwnd, Pointer<Utf16> lpOperation, Pointer<Utf16> lpFile,
    Pointer<Utf16> lpParameters, Pointer<Utf16> lpDirectory, int nShowCmd) {
  final _ShellExecute = _shell32.lookupFunction<
      IntPtr Function(
          IntPtr hwnd,
          Pointer<Utf16> lpOperation,
          Pointer<Utf16> lpFile,
          Pointer<Utf16> lpParameters,
          Pointer<Utf16> lpDirectory,
          Int32 nShowCmd),
      int Function(
          int hwnd,
          Pointer<Utf16> lpOperation,
          Pointer<Utf16> lpFile,
          Pointer<Utf16> lpParameters,
          Pointer<Utf16> lpDirectory,
          int nShowCmd)>('ShellExecuteW');
  return _ShellExecute(
      hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
}