Funktionreferenz


_WinAPI_GetBinaryType


Determines whether a file is an executable (.exe) file, and if so, which subsystem runs the executable file

#include <WinAPIFiles.au3>
_WinAPI_GetBinaryType ( $sFilePath )

Parameter

$sFilePath The full path of the file whose executable type is to be determined.

Rückgabewert

Success: 1 - The file is executable, @extended flag will contain one of the $SCS_* constants to indicate the file's executable type.
Failure: 0, call _WinAPI_GetLastError() to get extended error information.

Bemerkungen

$SCS_* constants require #include <APIFilesConstants.au3>

Symbolic link behavior : if the path points to a symbolic link, the target file is used.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies:
    Server Message Block (SMB) 3.0 protocol
    SMB 3.0 Transparent Failover (TFO)
    SMB 3.0 with Scale-out File Shares (SO)
    Cluster Shared Volume File System (CsvFS)
    Resilient File System (ReFS)

Siehe auch

Suche nach GetBinaryType in der MSDN Bibliothek.

Beispiel

#include <APIFilesConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIShPath.au3>

Local $sText, $sPath = @MyDocumentsDir & '\'
While 1
    $sPath = FileOpenDialog('Select File', _WinAPI_PathRemoveFileSpec($sPath), 'All Files (*.*)', BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST))
    If $sPath Then
        If _WinAPI_GetBinaryType($sPath) Then
            Switch @extended
                Case $SCS_32BIT_BINARY
                    $sText = '32-bit Windows-based application'
                Case $SCS_64BIT_BINARY
                    $sText = '64-bit Windows-based application'
                Case $SCS_DOS_BINARY
                    $sText = 'MS-DOS-based application'
                Case $SCS_OS216_BINARY
                    $sText = '16-bit OS/2-based application.'
                Case $SCS_PIF_BINARY
                    $sText = 'PIF file that executes an MS-DOS-based application'
                Case $SCS_POSIX_BINARY
                    $sText = 'POSIX-based application'
                Case $SCS_WOW_BINARY
                    $sText = '16-bit Windows-based application'
                Case Else
                    $sText = 'unknown executable type'
            EndSwitch
        Else
            $sText = 'not executable file'
        EndIf
        MsgBox(($MB_ICONINFORMATION + $MB_SYSTEMMODAL), '_WinAPI_GetBinaryType()', '"' & _WinAPI_PathStripPath($sPath) & '" is ' & $sText & ".")
    Else
        ExitLoop
    EndIf
WEnd