Dateiinformationen ändern

  • Hallo an alle^^

    vielleicht weiß es noch einer, ich hatte vor kurzem noch meinen Bat2Exe hier drinnen
    ich wollte die Compile funktion jetzt so umbauen dass sie auch auf pcs ohne autoit läuft :D
    ich hab mir jetzt mal (2 stunden lang :pinch: ) die AutoIt3Wrapper durchgeschaut und versucht die funktion zu finden die die Informationen einer Datei bearbeitet.
    Die einzige funktion die nach sowas ausschaut is die hier:

    Spoiler anzeigen
    [autoit]


    Func _Res_Update($Filename, $InpResFile, $RSection, $RType = 1, $RLanguage = 2057)
    Local $hDll, $result, $rh, $hFile, $tSize, $tBuffer, $pBuffer, $poBuffer, $bread = 0
    ;
    ; Remove requested Section from the program resources.
    If $InpResFile = "" Then
    ; No resource file defined thus delete the existing resource
    $tBuffer = DllStructCreate("char Text[1]") ; Create the buffer.
    DllStructSetData($tBuffer, 1, Binary("0x00"))
    $poBuffer = DllStructGetPtr($tBuffer)
    $tSize = 0
    $hDll = DllOpen("kernel32.dll")
    $result = DllCall($hDll, "ptr", "BeginUpdateResource", "str", $Filename, "int", 0)
    $rh = $result[0]
    $result = DllCall($hDll, "int", "UpdateResource", "ptr", $rh, "Long", $RSection, "Long", $RType, "short", $RLanguage, "ptr", $poBuffer, 'dword', $tSize)
    $result = DllCall($hDll, "int", "EndUpdateResource", "ptr", $rh, "int", 0)
    DllClose($hDll)
    Return
    EndIf
    ; Make sure the input res file exists
    If Not FileExists($InpResFile) Then
    Write_RC_Console_Msg("Recourse Update skipped: missing Resfile :" & $InpResFile, "", "+")
    Return
    EndIf
    ;
    ; Open the Resource File
    $hFile = _WinAPI_CreateFile($InpResFile, 2, 2)
    If Not $hFile Then
    Write_RC_Console_Msg("Recourse Update skipped: error opening Resfile :" & $InpResFile, "", "+")
    Return
    EndIf
    ;
    ; Process the different Update types
    $hDll = DllOpen("kernel32.dll")
    Switch $RSection
    Case 3 ; *** RT_ICON
    ;ICO section
    $tSize = FileGetSize($InpResFile) - 6
    Local $tB_Input_Header = DllStructCreate("short res;short type;short ImageCount;char rest[" & $tSize + 1 & "]") ; Create the buffer.
    Local $pB_Input_Header = DllStructGetPtr($tB_Input_Header)
    _WinAPI_ReadFile($hFile, $pB_Input_Header, FileGetSize($InpResFile), $bread, 0)
    If $hFile Then _WinAPI_CloseHandle($hFile)
    ; Read input file header
    Local $IconType = DllStructGetData($tB_Input_Header, "Type")
    Local $IconCount = DllStructGetData($tB_Input_Header, "ImageCount")
    ; Created IconGroup Structure
    Local $tB_IconGroupHeader = DllStructCreate("short res;short type;short ImageCount;char rest[" & $IconCount * 14 & "]") ; Create the buffer.
    Local $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader)
    DllStructSetData($tB_IconGroupHeader, "Res", 0)
    DllStructSetData($tB_IconGroupHeader, "Type", $IconType)
    DllStructSetData($tB_IconGroupHeader, "ImageCount", $IconCount)
    ; process all internal Icons
    For $x = 1 To $IconCount
    ; Set pointer correct in the input struct
    Local $pB_Input_IconHeader = DllStructGetPtr($tB_Input_Header, 4) + ($x - 1) * 16
    Local $tB_Input_IconHeader = DllStructCreate("byte Width;byte Heigth;Byte Colors;Byte res;Short Planes;Short BitPerPixel;dword ImageSize;dword ImageOffset", $pB_Input_IconHeader) ; Create the buffer.
    ; get info form the input
    Local $IconWidth = DllStructGetData($tB_Input_IconHeader, "Width")
    Local $IconHeigth = DllStructGetData($tB_Input_IconHeader, "Heigth")
    Local $IconColors = DllStructGetData($tB_Input_IconHeader, "Colors")
    Local $IconPlanes = DllStructGetData($tB_Input_IconHeader, "Planes")
    Local $IconBitPerPixel = DllStructGetData($tB_Input_IconHeader, "BitPerPixel")
    Local $IconImageSize = DllStructGetData($tB_Input_IconHeader, "ImageSize")
    Local $IconImageOffset = DllStructGetData($tB_Input_IconHeader, "ImageOffset")
    ; Update the ICO Group header struc
    $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader, 4) + ($x - 1) * 14
    Local $tB_GroupIcon = DllStructCreate("byte Width;byte Heigth;Byte Colors;Byte res;Short Planes;Short BitPerPixel;dword ImageSize;byte ResourceID", $pB_IconGroupHeader) ; Create the buffer.
    DllStructSetData($tB_GroupIcon, "Width", $IconWidth)
    DllStructSetData($tB_GroupIcon, "Heigth", $IconHeigth)
    DllStructSetData($tB_GroupIcon, "Colors", $IconColors)
    DllStructSetData($tB_GroupIcon, "res", 0)
    DllStructSetData($tB_GroupIcon, "Planes", $IconPlanes)
    DllStructSetData($tB_GroupIcon, "BitPerPixel", $IconBitPerPixel)
    DllStructSetData($tB_GroupIcon, "ImageSize", $IconImageSize)
    $IconResBase += 1
    DllStructSetData($tB_GroupIcon, "ResourceID", $IconResBase)
    ; Get data pointer
    Local $pB_IconData = DllStructGetPtr($tB_Input_Header) + $IconImageOffset
    ; Begin resource Update
    $result = DllCall($hDll, "ptr", "BeginUpdateResource", "str", $Filename, "int", 0)
    $rh = $result[0]
    ; add Icon
    $result = DllCall($hDll, "int", "UpdateResource", "ptr", $rh, "Long", 3, "Long", $IconResBase, "short", $RLanguage, "ptr", $pB_IconData, 'dword', $IconImageSize)
    If $result[0] <> 1 Then ConsoleWrite('UpdateResources: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
    $result = DllCall($hDll, "int", "EndUpdateResource", "ptr", $rh, "int", 0)
    If $result[0] <> 1 Then ConsoleWrite('EndUpdateResource: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
    Next
    ; Add Icongroup entry
    $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader)
    ; Begin resource Update
    $result = DllCall($hDll, "ptr", "BeginUpdateResource", "str", $Filename, "int", 0)
    $rh = $result[0]
    $result = DllCall($hDll, "int", "UpdateResource", "ptr", $rh, "Long", 14, "Long", $RType, "short", $RLanguage, "ptr", $pB_IconGroupHeader, 'dword', DllStructGetSize($tB_IconGroupHeader))
    If $result[0] <> 1 Then ConsoleWrite('UpdateResources: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
    $result = DllCall($hDll, "int", "EndUpdateResource", "ptr", $rh, "int", 0)
    If $result[0] <> 1 Then ConsoleWrite('EndUpdateResource: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())

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

    Case 10, 16, 24 ; *** RT_RCDATA, RT_VERSION and RT_MANIFEST
    ; Begin resource Update
    $result = DllCall($hDll, "ptr", "BeginUpdateResource", "str", $Filename, "int", 0)
    $rh = $result[0]
    $tSize = FileGetSize($InpResFile)
    $tBuffer = DllStructCreate("char Text[" & $tSize & "]") ; Create the buffer.
    $pBuffer = DllStructGetPtr($tBuffer)
    _WinAPI_ReadFile($hFile, $pBuffer, FileGetSize($InpResFile), $bread, 0)
    If $hFile Then _WinAPI_CloseHandle($hFile)
    If $bread > 0 Then
    $result = DllCall($hDll, "int", "UpdateResource", "ptr", $rh, "Long", $RSection, "Long", $RType, "short", $RLanguage, "ptr", $pBuffer, 'dword', $tSize)
    If $result[0] <> 1 Then ConsoleWrite('UpdateResources: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
    EndIf
    $result = DllCall($hDll, "int", "EndUpdateResource", "ptr", $rh, "int", 0)
    If $result[0] <> 1 Then ConsoleWrite('EndUpdateResource: $result[0] = ' & $result[0] & " - LastError:" & _WinAPI_GetLastError() & ":" & _WinAPI_GetLastErrorMessage())
    EndSwitch
    DllClose($hDll)
    EndFunc ;==>_Res_Update

    [/autoit]


    allerdings versteh ich sie nicht :D
    und die AutoIt3Wrapper ist doch etwas kompliziert:D
    hat vielleicht einer von euch eine Lösung um die Dateiinformationen zu ändern?
    ich hab jez schon gegoogelt aber nix gefunden -.-
    ich wär sogar mit einer Dll zufrieden :D

    Padmak

    Einmal editiert, zuletzt von Padmak (30. Januar 2009 um 22:39)

  • beides :D
    ne also wenn man mit der AutoIt3Wrapper kompiliert dann werden ja die dateiinformationen eingefügt
    und ich hab die funktion gesucht die des macht^^
    weil ich ja in meinen Bat2Exe eine Kompilieren-Funktion eingebaut habe
    und da hätt ich gerne die Dateiinformationen dabei
    nachdem mein versuch die Wrapper da zu bearbeiten eher net soo erfolgreich war^^
    möchte ich es nun nachträglich bei der compilierten exe machen
    jetzt glaub ich hab ich alles beschrieben :D

    Padmak

  • ja aber wie macht es denn die Wrapper???
    das will ich ja herausfinden...
    die schreibt des doch iwie in die .au3 datei bevor diese kompiliert wird...

    Padmak

  • sag bloß :D
    ich hab gestern 2 stunden damit zugebracht iwie in der wrapper den festen pfad zur (per fileinstall mitgebrachten) aut2exe beizubringen
    aber es haut einfach nicht =(

    Padmak

  • grr^^
    dankeschööön^^
    ich war annähernd so weit, aber bei mir hats dann nicht mehr gestartet-.-

    Padmak