Function Reference


_WinAPI_GetFinalPathNameByHandleEx

Retrieves the final path of the specified file

#include <WinAPIFiles.au3>
_WinAPI_GetFinalPathNameByHandleEx ( $hFile [, $iFlags = 0] )

Parameters

$hFile Handle to a file or directory.
$iFlags [optional] The type of result to return.
This parameter can be combination of one $FILE_NAME_* and one $VOLUME_NAME_* values.
$FILE_NAME_NORMALIZED
$FILE_NAME_OPENED

$VOLUME_NAME_DOS
$VOLUME_NAME_GUID
$VOLUME_NAME_NONE
$VOLUME_NAME_NT

Return Value

Success: The path of the file.
Failure: Sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information.

Remarks

This function requires Windows Vista or later.

See Also

Search GetFinalPathNameByHandle in MSDN Library.

Example

#include <APIFilesConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIHObj.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')
        Exit
EndIf

Local $hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)

ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile) & @CRLF)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_GUID) & @CRLF)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NT) & @CRLF)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NONE) & @CRLF)

_WinAPI_CloseHandle($hFile)