Infos aus Anwendung (EXE) auslesen

  • Hallo liebe Community,

    Leider bin ich kein Vielposter, sondern nur ein stiller Mitleser, doch heute brauche ich eure Hilfe. Seit Tagen bin ich auf der Such nach einer Funktion mit der man aus einer Anwendung (EXE-Datei) verschiedene Informationen auslesen kann (Dateiversion, Beschreibung, Copyright, etc). Ich hab so was ähnliches schon mal für MP3s gesehen (ID3 UDF). Gibt es auch sowas für Anwendungen? Und wie nennt man das? Um das mal zu verdeutlichen was ich suche, hab ich mal einen Screenshot gemacht.

    [Blockierte Grafik: http://marcusprzy.bplaced.net/exe_infos.png
    Wäre cool wenn ihr mir helfen könntet ^^

    MFG

    Lord383

    Einmal editiert, zuletzt von Lord383 (12. März 2009 um 15:59)

  • Hi,

    Spoiler anzeigen
    [autoit]

    ;===============================================================================
    ; Function Name: _GetExtProperty($sPath,$iProp)
    ; Description: Returns an extended property of a given file.
    ; Parameter(s): $sPath - The path to the file you are attempting to retrieve an extended property from.
    ; $iProp - The numerical value for the property you want returned. If $iProp is is set
    ; to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.
    ; The properties are as follows:
    ; Name = 0
    ; Size = 1
    ; Type = 2
    ; DateModified = 3
    ; DateCreated = 4
    ; DateAccessed = 5
    ; Attributes = 6
    ; Status = 7
    ; Owner = 8
    ; Author = 9
    ; Title = 10
    ; Subject = 11
    ; Category = 12
    ; Pages = 13
    ; Comments = 14
    ; Copyright = 15
    ; Artist = 16
    ; AlbumTitle = 17
    ; Year = 18
    ; TrackNumber = 19
    ; Genre = 20
    ; Duration = 21
    ; BitRate = 22
    ; Protected = 23
    ; CameraModel = 24
    ; DatePictureTaken = 25
    ; Dimensions = 26
    ; Width = 27
    ; Height = 28
    ; Company = 30
    ; Description = 31
    ; FileVersion = 32
    ; ProductName = 33
    ; ProductVersion = 34
    ; Requirement(s): File specified in $spath must exist.
    ; Return Value(s): On Success - The extended file property, or if $iProp = -1 then an array with all properties
    ; On Failure - 0, @Error - 1 (If file does not exist)
    ; Author(s): Simucal ([email='Simucal@gmail.com'][/email])
    ; Note(s):
    ;
    ;===============================================================================
    Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
    SetError(1)
    Return 0
    Else
    $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
    $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
    $oShellApp = ObjCreate ("shell.application")
    $oDir = $oShellApp.NameSpace ($sDir)
    $oFile = $oDir.Parsename ($sFile)
    If $iProp = -1 Then
    Local $aProperty[35]
    For $i = 0 To 34
    $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
    Next
    Return $aProperty
    Else
    $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
    If $sProperty = "" Then
    Return 0
    Else
    Return $sProperty
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_GetExtProperty

    [/autoit]
  • Hallo Anno2008,

    Danke für deine schnelle Antwort. Dieses Skript hab ich schonmal ausprobiert, doch es liefert nicht das was ich brauche. Wenn ich eine Funktion damit erstelle gibt sie nur 0 zurück. Ich weiß das 0 Fehler heißt. Ich hab es mit mehreren Anwendungen probiert, doch das Ergebnis ist immer 0. Gibt es noch eine andere Möglichkeit?

    MFG

    Lord383

    • Offizieller Beitrag
    Spoiler anzeigen
    [autoit]

    #include<Array.au3>
    ;~ Global $filePath = @WindowsDir & '\System32\calc.exe'
    Global $filePath = @WindowsDir & '\notepad.exe'
    Global $info = _getFileInfo($filePath)

    [/autoit] [autoit][/autoit] [autoit]

    If Not IsArray($info) Then
    MsgBox(16, 'Error', 'File not found!')
    Exit (0)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _ArrayDisplay($info, 'FileInfo')

    [/autoit] [autoit][/autoit] [autoit]

    Func _getFileInfo($path)
    If Not FileExists($path) Then Return -1
    Local $info_A[12][2]
    Local $string_A[12] = ['FileVersion', 'FileDescription', 'LegalCopyright', 'Comments', 'InternalName', _
    'ProductName', 'CompanyName', 'ProductVersion', 'LegalTrademarks', 'PrivateBuild', 'OriginalFilename', 'SpecialBuild']
    For $i = 0 To UBound($info_A) - 1
    $info_A[$i][0] = $string_A[$i]
    $info_A[$i][1] = FileGetVersion($path, $string_A[$i])
    Next
    Return $info_A
    EndFunc ;==>_getFileInfo

    [/autoit]

    Mega

    • Offizieller Beitrag
    Spoiler anzeigen
    [autoit]

    #include-once

    [/autoit] [autoit][/autoit] [autoit]

    ; #INDEX# =======================================================================================================================
    ; Title .........: FileSetVersion
    ; AutoIt Version: 3.2.10++
    ; Language: English
    ; Description ...: Updating the StringFileInfo section.
    ; ===============================================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; Example
    ;#include <_FileSetVersion.au3>
    #cs
    ; Use Notepad as example...
    FileCopy(@WindowsDir & "\Notepad.exe", @ScriptDir)
    $FineName = @ScriptDir & "\OutPutFile.exe"
    $FineName = @ScriptDir & "\Notepad.exe"

    [/autoit] [autoit][/autoit] [autoit]

    ; save old field information
    $OldCompanyName = FileGetVersion($FineName, "CompanyName")
    MsgBox(4096, "Old Company name", $OldCompanyName)

    [/autoit] [autoit][/autoit] [autoit]

    ; set new field information
    If _FileSetVersion($FineName, "CompanyName", "_FileSetVersion ;-)") = 1 Then
    $NewCompanyName = FileGetVersion($FineName, "CompanyName")
    MsgBox(4096, "New Company name", $NewCompanyName)
    ; Restore old field information
    _FileSetVersion($FineName, "CompanyName", $OldCompanyName)
    Else
    MsgBox(4096, "Error!", "Can not set the field CompanyName!")
    EndIf
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; __NullEntryPoint
    ; __NullRepeat
    ; __Binary
    ;================================================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _FileSetVersion
    ; Description ...: Updating the StringFileInfo section.
    ; Syntax.........: _FileSetVersion( FileName, "StringName", "StringText" )
    ; Parameters ....: FileName - Path and filename.
    ; StringName- name of the field info, default is "FileVersion".
    ; StringText- string to fill the field info, default is @AutoItVersion.
    ; Return values .: Success - Returns 1 and set @error to 0
    ; Failure - Returns 0 and set @error to 1
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......: The information contained in the StringFileInfo section is not necessarily more difficult
    ; to change, but it does have the constraint that the new information be the same size or smaller
    ; than the old information. Extra characters would inevitably write on something important.
    ; Related .......: FileGetVersion
    ; Link ..........;
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _FileSetVersion($hFileName, $sStringName = "FileVersion", $sStringText = @AutoItVersion)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $iResourceSize, $hFileOpen, $bFileRead, $bSearch, $bReplace, $bHex, $NewResSize, $iPos
    Local $aStrSplit, $iResFieldSize, $bBinStrName, $sBinStrText, $sFileGetInfo, $iValue, $iCont
    Local $bHeader = "34000000560053005f00560045005200530049004f004e005f0049004e0046004f"
    Local $bEndHeader = "5400720061006e0073006c006100740069006f006e0000000000"
    ;
    ; If not file found return 0 and set @error to 1
    If Not FileExists($hFileName) Then Return SetError(1, 0, 0)
    ;
    ; First open file in only binary read mode and close
    $hFileOpen = FileOpen($hFileName, 16)
    $bFileRead = FileRead($hFileOpen)
    FileClose($hFileOpen)
    ;
    ; Get resource info, if no version information found, return 0 and set @error to 1
    If FileGetVersion($hFileName) = "0.0.0.0" Then Return SetError(1, 0, 0)
    #cs
    ;
    ; Determine the size of the resource information
    $bSearch = StringMid($bFileRead, StringInStr($bFileRead, $bHeader, 0, -1) - 4, 4)
    ; Invert and return value in bytes
    $iResourceSize = Dec(StringRight($bSearch, 2) & StringLeft($bSearch, 2))
    #ce
    ;
    ; Update Resource information
    If $sStringName = "FILEVERSION" Or $sStringName = "PRODUCTVERSION" Then
    ;
    ; Split FileVersion, format is: 00.00.0000.0000
    $aStrSplit = StringSplit($sStringText, ".")
    ; If wrong FileVersion format, return 0 and set @error to 1
    If $aStrSplit[0] > 4 Then Return SetError(1, 0, 0)
    ;
    ; Convert to Hex and Invert data
    Dim $bReplace[5] = [5, Hex(0, 4), Hex(0, 4), Hex(0, 4), Hex(0, 4)]
    For $i = 1 To $aStrSplit[0]
    $bHex = Hex($aStrSplit[$i], 4)
    $bReplace[$i] = StringRight($bHex, 2) & StringLeft($bHex, 2)
    Next
    ;
    ; Set FILEVERSION / PRODUCTVERSION
    If $sStringName = "FILEVERSION" Then $iPos = StringInStr($bFileRead, "bd04effe00000100", 0, -1) + 16
    If $sStringName = "PRODUCTVERSION" Then $iPos = StringInStr($bFileRead, "bd04effe00000100", 0, -1) + 32
    $bFileRead = StringReplace($bFileRead, $iPos, $bReplace[2] & $bReplace[1] & $bReplace[4] & $bReplace[3])
    ; free the memory
    $aStrSplit = 0
    $bReplace = 0
    ;
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    Else
    ; If FileGetVersion returns error then
    If @error Then Return SetError(1, 0, 0)
    ;
    ; Set the length of $sStringName resource field
    $bBinStrName = __Binary(__NullEntryPoint($sStringName))
    $iPos = StringInStr($bFileRead, $bBinStrName)
    $iValue = StringMid($bFileRead, $iPos + StringLen($bBinStrName), 10)
    For $i = 1 To 10
    $iCont = StringMid($iValue, $i, 2)
    If $iCont = "00" Then $bBinStrName &= __Binary(Chr("00"))
    If $iCont <> "00" Then ExitLoop
    $i += 1
    Next
    ;
    ; Get the resource field size
    $iValue = StringMid($bFileRead, $iPos + StringLen($bBinStrName), 400)
    For $i = 1 To 400
    If StringMid($iValue, $i, 6) = "000000" Then
    $iValue = Int($i / 2) + 3
    ExitLoop
    EndIf
    $i += 1
    Next
    $iResFieldSize = Dec(StringMid($bFileRead, $iPos - 8, 2))
    If $iValue > $iResFieldSize Then $iResFieldSize = $iValue
    ;
    If $iResFieldSize <= 1 Then Return SetError(1, 0, 0)
    ;
    ; fix $sStringText length
    $sBinStrText = __Binary(StringMid(__NullEntryPoint(__NullRepeat($sStringText, $iResFieldSize, 32)), 1, $iResFieldSize - 3))
    ;
    ; Replace resource
    $bFileRead = StringReplace($bFileRead, $iPos + StringLen($bBinStrName), $sBinStrText)
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    ;
    ; Update resource field size
    $bHex = Hex($iResFieldSize, 2)
    $bFileRead = StringReplace($bFileRead, StringInStr($bFileRead, $bBinStrName, 0, -1) - 8, $bHex, 1)
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    EndIf
    #cs
    ;
    ; Get new resource size
    $bSearch = StringMid($bFileRead, StringInStr($bFileRead, $bHeader, 0, 1) - 4)
    $bSearch = StringMid($bSearch, 1, StringInStr($bSearch, $bEndHeader, 0, -1) + 60)
    $iResourceSize = Int(BinaryLen($bSearch) / 2)
    ; Convert to Hex, invert and set new resource size
    $bHex = Hex($iResourceSize, 4)
    $iResourceSize = StringRight($bHex, 2) & StringLeft($bHex, 2)
    $bFileRead = StringReplace($bFileRead, StringInStr($bFileRead, $bHeader, 0, -1) - 4, $iResourceSize, 1)
    ;
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    #ce
    ;
    ; Open file in binary write mode, save modified data and close
    $hFileOpen = FileOpen($hFileName, 18)
    ; If error found, return 0 and set @error to 1
    If $hFileOpen = -1 Then Return SetError(1, 0, 0)
    FileWrite($hFileOpen, $bFileRead)
    FileClose($hFileOpen)
    ;
    ; Set @error to 0 and return 1
    Return SetError(0, 0, 1)
    EndFunc ;==>_FileSetVersion

    [/autoit] [autoit][/autoit] [autoit]

    Func _UnHexEntry($t)
    ;Return _StringReverse(_HexToString($t))
    EndFunc ;==>_UnHexEntry

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __NullEntryPoint
    ; Description ...: Adding the Chr("00") enter each char.
    ; Syntax.........: __NullEntryPoint( $sString )
    ; Parameters ....: $sString - String to pass.
    ; Return values .: Success - Returns Chr("00") enter each char
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __NullEntryPoint($sString)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $iLen = StringLen($sString), $bNullString = "";Chr("00")
    ;
    For $i = 1 To $iLen
    $bNullString &= StringMid($sString, $i, 1)
    If $i = $iLen Then ExitLoop
    $bNullString &= Chr("00")
    Next
    Return $bNullString
    EndFunc ;==>__NullEntryPoint

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __NullRepeat
    ; Description ...: Adding the Chr("00") at the end of the string
    ; Syntax.........: __NullRepeat( $sString, $iValue, $vChar = 0 )
    ; Parameters ....: $sString- String to pass.
    ; $iValue - Number of times to repeat
    ; $vChar - Char type, default is 00
    ; Return values .: Success - Returns Chr("00") enter each char
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __NullRepeat($sString, $iValue, $vChar = 0)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sRepeat = ""
    ;
    $iValue = $iValue - StringLen($sString)
    If $iValue > 0 Then
    For $i = 1 To $iValue
    $sRepeat &= Chr($vChar)
    Next
    EndIf
    Return $sString & $sRepeat
    EndFunc ;==>__NullRepeat

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __Binary
    ; Description ...: Returns the binary representation of an expression.
    ; Syntax.........: __Binary( $sExpression )
    ; Parameters ....: $sExpression - An expression to convert into binary/byte data.
    ; Return values .: Success - Returns a Binary variant without: 0x
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __Binary($sExpression)
    Return StringTrimLeft(Binary($sExpression), 2)
    EndFunc ;==>__Binary

    [/autoit]
  • Ich hatte mir diese Funktion für spätere Nutzung mal zurückgelegt.

    Ich habe mir die Funktion von Xenobiologist einmal angesehen. Mit dem "CompanyName" haut es einwandfrei hin, nur in meinem Test mit der "FileVersion" (siehe unten) will das ganze nicht. Wo liegt mein Fehler ?

    Spoiler anzeigen
    [autoit]

    FileCopy(@WindowsDir & "\Notepad.exe", @ScriptDir)
    $filename = @ScriptDir & "\Notepad.exe"

    [/autoit] [autoit][/autoit] [autoit]

    Msgbox(0,"Old FileVersion",FileGetVersion($filename,"FileVersion"))
    If _FileSetVersion($filename,"FileVersion","1.2.3333.4444") = 1 Then
    $NewVersion = FileGetVersion($filename,"FileVersion")
    MsgBox(4096, "New FileVersion", $NewVersion)
    Else
    MsgBox(4096, "Error!", "Can not set the field FileVersion!")
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; __NullEntryPoint
    ; __NullRepeat
    ; __Binary
    ;================================================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _FileSetVersion
    ; Description ...: Updating the StringFileInfo section.
    ; Syntax.........: _FileSetVersion( FileName, "StringName", "StringText" )
    ; Parameters ....: FileName - Path and filename.
    ; StringName- name of the field info, default is "FileVersion".
    ; StringText- string to fill the field info, default is @AutoItVersion.
    ; Return values .: Success - Returns 1 and set @error to 0
    ; Failure - Returns 0 and set @error to 1
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......: The information contained in the StringFileInfo section is not necessarily more difficult
    ; to change, but it does have the constraint that the new information be the same size or smaller
    ; than the old information. Extra characters would inevitably write on something important.
    ; Related .......: FileGetVersion
    ; Link ..........;
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _FileSetVersion($hFileName, $sStringName = "FileVersion", $sStringText = @AutoItVersion)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $iResourceSize, $hFileOpen, $bFileRead, $bSearch, $bReplace, $bHex, $NewResSize, $iPos
    Local $aStrSplit, $iResFieldSize, $bBinStrName, $sBinStrText, $sFileGetInfo, $iValue, $iCont
    Local $bHeader = "34000000560053005f00560045005200530049004f004e005f0049004e0046004f"
    Local $bEndHeader = "5400720061006e0073006c006100740069006f006e0000000000"
    ;
    ; If not file found return 0 and set @error to 1
    If Not FileExists($hFileName) Then Return SetError(1, 0, 0)
    ;
    ; First open file in only binary read mode and close
    $hFileOpen = FileOpen($hFileName, 16)
    $bFileRead = FileRead($hFileOpen)
    FileClose($hFileOpen)
    ;
    ; Get resource info, if no version information found, return 0 and set @error to 1
    If FileGetVersion($hFileName) = "0.0.0.0" Then Return SetError(1, 0, 0)
    #cs
    ;
    ; Determine the size of the resource information
    $bSearch = StringMid($bFileRead, StringInStr($bFileRead, $bHeader, 0, -1) - 4, 4)
    ; Invert and return value in bytes
    $iResourceSize = Dec(StringRight($bSearch, 2) & StringLeft($bSearch, 2))
    #ce
    ;
    ; Update Resource information
    If $sStringName = "FILEVERSION" Or $sStringName = "PRODUCTVERSION" Then
    ;
    ; Split FileVersion, format is: 00.00.0000.0000
    $aStrSplit = StringSplit($sStringText, ".")
    ; If wrong FileVersion format, return 0 and set @error to 1
    If $aStrSplit[0] > 4 Then Return SetError(1, 0, 0)
    ;
    ; Convert to Hex and Invert data
    Dim $bReplace[5] = [5, Hex(0, 4), Hex(0, 4), Hex(0, 4), Hex(0, 4)]
    For $i = 1 To $aStrSplit[0]
    $bHex = Hex($aStrSplit[$i], 4)
    $bReplace[$i] = StringRight($bHex, 2) & StringLeft($bHex, 2)
    Next
    ;
    ; Set FILEVERSION / PRODUCTVERSION
    If $sStringName = "FILEVERSION" Then $iPos = StringInStr($bFileRead, "bd04effe00000100", 0, -1) + 16
    If $sStringName = "PRODUCTVERSION" Then $iPos = StringInStr($bFileRead, "bd04effe00000100", 0, -1) + 32
    $bFileRead = StringReplace($bFileRead, $iPos, $bReplace[2] & $bReplace[1] & $bReplace[4] & $bReplace[3])
    ; free the memory
    $aStrSplit = 0
    $bReplace = 0
    ;
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    Else
    ; If FileGetVersion returns error then
    If @error Then Return SetError(1, 0, 0)
    ;
    ; Set the length of $sStringName resource field
    $bBinStrName = __Binary(__NullEntryPoint($sStringName))
    $iPos = StringInStr($bFileRead, $bBinStrName)
    $iValue = StringMid($bFileRead, $iPos + StringLen($bBinStrName), 10)
    For $i = 1 To 10
    $iCont = StringMid($iValue, $i, 2)
    If $iCont = "00" Then $bBinStrName &= __Binary(Chr("00"))
    If $iCont <> "00" Then ExitLoop
    $i += 1
    Next
    ;
    ; Get the resource field size
    $iValue = StringMid($bFileRead, $iPos + StringLen($bBinStrName), 400)
    For $i = 1 To 400
    If StringMid($iValue, $i, 6) = "000000" Then
    $iValue = Int($i / 2) + 3
    ExitLoop
    EndIf
    $i += 1
    Next
    $iResFieldSize = Dec(StringMid($bFileRead, $iPos - 8, 2))
    If $iValue > $iResFieldSize Then $iResFieldSize = $iValue
    ;
    If $iResFieldSize <= 1 Then Return SetError(1, 0, 0)
    ;
    ; fix $sStringText length
    $sBinStrText = __Binary(StringMid(__NullEntryPoint(__NullRepeat($sStringText, $iResFieldSize, 32)), 1, $iResFieldSize - 3))
    ;
    ; Replace resource
    $bFileRead = StringReplace($bFileRead, $iPos + StringLen($bBinStrName), $sBinStrText)
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    ;
    ; Update resource field size
    $bHex = Hex($iResFieldSize, 2)
    $bFileRead = StringReplace($bFileRead, StringInStr($bFileRead, $bBinStrName, 0, -1) - 8, $bHex, 1)
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    EndIf
    #cs
    ;
    ; Get new resource size
    $bSearch = StringMid($bFileRead, StringInStr($bFileRead, $bHeader, 0, 1) - 4)
    $bSearch = StringMid($bSearch, 1, StringInStr($bSearch, $bEndHeader, 0, -1) + 60)
    $iResourceSize = Int(BinaryLen($bSearch) / 2)
    ; Convert to Hex, invert and set new resource size
    $bHex = Hex($iResourceSize, 4)
    $iResourceSize = StringRight($bHex, 2) & StringLeft($bHex, 2)
    $bFileRead = StringReplace($bFileRead, StringInStr($bFileRead, $bHeader, 0, -1) - 4, $iResourceSize, 1)
    ;
    ; If error found, return 0 and set @error to 1
    If @error Then Return SetError(1, 0, 0)
    #ce
    ;
    ; Open file in binary write mode, save modified data and close
    $hFileOpen = FileOpen($hFileName, 18)
    ; If error found, return 0 and set @error to 1
    If $hFileOpen = -1 Then Return SetError(1, 0, 0)
    FileWrite($hFileOpen, $bFileRead)
    FileClose($hFileOpen)
    ;
    ; Set @error to 0 and return 1
    Return SetError(0, 0, 1)
    EndFunc ;==>_FileSetVersion

    [/autoit] [autoit][/autoit] [autoit]

    Func _UnHexEntry($t)
    ;Return _StringReverse(_HexToString($t))
    EndFunc ;==>_UnHexEntry

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __NullEntryPoint
    ; Description ...: Adding the Chr("00") enter each char.
    ; Syntax.........: __NullEntryPoint( $sString )
    ; Parameters ....: $sString - String to pass.
    ; Return values .: Success - Returns Chr("00") enter each char
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __NullEntryPoint($sString)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $iLen = StringLen($sString), $bNullString = "";Chr("00")
    ;
    For $i = 1 To $iLen
    $bNullString &= StringMid($sString, $i, 1)
    If $i = $iLen Then ExitLoop
    $bNullString &= Chr("00")
    Next
    Return $bNullString
    EndFunc ;==>__NullEntryPoint

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __NullRepeat
    ; Description ...: Adding the Chr("00") at the end of the string
    ; Syntax.........: __NullRepeat( $sString, $iValue, $vChar = 0 )
    ; Parameters ....: $sString- String to pass.
    ; $iValue - Number of times to repeat
    ; $vChar - Char type, default is 00
    ; Return values .: Success - Returns Chr("00") enter each char
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __NullRepeat($sString, $iValue, $vChar = 0)
    ;==============================================
    ; Local Constant/Variable Declaration Section
    ;==============================================
    Local $sRepeat = ""
    ;
    $iValue = $iValue - StringLen($sString)
    If $iValue > 0 Then
    For $i = 1 To $iValue
    $sRepeat &= Chr($vChar)
    Next
    EndIf
    Return $sString & $sRepeat
    EndFunc ;==>__NullRepeat

    [/autoit] [autoit][/autoit] [autoit]

    ; #INTERNAL_USE_ONLY#============================================================================================================
    ; Name...........: __Binary
    ; Description ...: Returns the binary representation of an expression.
    ; Syntax.........: __Binary( $sExpression )
    ; Parameters ....: $sExpression - An expression to convert into binary/byte data.
    ; Return values .: Success - Returns a Binary variant without: 0x
    ; Failure -
    ; Author ........: jscript "FROM BRAZIL"
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ; Example .......;
    ; ===============================================================================================================================
    Func __Binary($sExpression)
    Return StringTrimLeft(Binary($sExpression), 2)
    EndFunc ;==>__Binary

    [/autoit]

    Es sind immer alte und neue Version der "Notepad.exe" gleich !

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • Hm in den Details steht dann die neue version aber drinnen oder?
    Bei mir nämlich schon
    Aber per FileGetVersion() gehts net...
    Hm ka

    Padmak

  • Stimmt, über die Eigenschaftsseite der Datei geht es !

    Und warum über FileGetVersion nicht ? Ideen ?

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • Hallo,

    Zitat von Xenobiologist


    ...
    Func _getFileInfo($path)
    ...


    habe mich bisher nicht mit Arrays so richtig beschäftigt.
    Aber hier sehe ich erstmal, wozu das alles gut sein kann. Aber wie kann ich jetzt mit diesen ermittelten Werten weiterarbeiten.
    Also das Array auslesen, so dass ich z. B. mit der 'FileVersion' oder der 'ProductVersion' im Script weiter arbeiten kann?
    Sowas wie
    MSGBOX (0, "", 'hier steht dann die Version!')

    Irgendwie bin ich hinter das System der Arrays noch nicht hinter gestiegen :(

    <3 Jetzt, Hier, Immer <3

  • Zitat von Laith

    Also das Array auslesen, so dass ich z. B. mit der 'FileVersion' oder der 'ProductVersion' im Script weiter arbeiten kann?

    Dank der Anleitung von BugFix, die ich jetzt erst gefunden, aber nur halb kapiert habe, konnte ich zumindest dieses Problem lösen :)
    THX BugFix (sehr detailliert, hoffentlich klickt es dann auch mal...)

    <3 Jetzt, Hier, Immer <3