SHGetFolderPath function Null safety shell32

int SHGetFolderPath(
  1. int hwnd,
  2. int csidl,
  3. int hToken,
  4. int dwFlags,
  5. Pointer<Utf16> pszPath
)

Gets the path of a folder identified by a CSIDL value.

SHFOLDERAPI SHGetFolderPathW(
  HWND   hwnd,
  int    csidl,
  HANDLE hToken,
  DWORD  dwFlags,
  LPWSTR pszPath
);

Implementation

int SHGetFolderPath(
    int hwnd, int csidl, int hToken, int dwFlags, Pointer<Utf16> pszPath) {
  final _SHGetFolderPath = _shell32.lookupFunction<
      Int32 Function(IntPtr hwnd, Int32 csidl, IntPtr hToken, Uint32 dwFlags,
          Pointer<Utf16> pszPath),
      int Function(int hwnd, int csidl, int hToken, int dwFlags,
          Pointer<Utf16> pszPath)>('SHGetFolderPathW');
  return _SHGetFolderPath(hwnd, csidl, hToken, dwFlags, pszPath);
}