GetVolumePathName function Null safety kernel32

int GetVolumePathName(
  1. Pointer<Utf16> lpszFileName,
  2. Pointer<Utf16> lpszVolumePathName,
  3. int cchBufferLength
)

Retrieves the volume mount point where the specified path is mounted.

BOOL GetVolumePathNameW(
  LPCWSTR lpszFileName,
  LPWSTR  lpszVolumePathName,
  DWORD   cchBufferLength);

Implementation

int GetVolumePathName(Pointer<Utf16> lpszFileName,
    Pointer<Utf16> lpszVolumePathName, int cchBufferLength) {
  final _GetVolumePathName = _kernel32.lookupFunction<
      Int32 Function(Pointer<Utf16> lpszFileName,
          Pointer<Utf16> lpszVolumePathName, Uint32 cchBufferLength),
      int Function(
          Pointer<Utf16> lpszFileName,
          Pointer<Utf16> lpszVolumePathName,
          int cchBufferLength)>('GetVolumePathNameW');
  return _GetVolumePathName(lpszFileName, lpszVolumePathName, cchBufferLength);
}