本帖最后由 lynfr8 于 2009-6-26 13:33 编辑
楼上找来的的确可行的
稍微汉化一下:#include "UpdateResources.au3"
;本UDF能成功修改64位和32位可执行程序exe的版本属性
;注意:如果目标exe已经压缩编译过会导致无法打开脚本
$sFileName = @ScriptDir & "\Test.exe";需要修改版本信息的目标程序路径
Dim $hFileHandle, $iReturn
$hFileHandle = _BeginUpdateResource($sFileName);准备开始写入资源
If @error Then
_ResourceUpdateTracelog("!> 错误. _BeginUpdateResource 失败. 请确认文件的 parameter 1 是 valid.")
Exit
EndIf
;下面的hex数据将会替换目标exe的版本信息,无错误的编辑在这个环节最为关键!
;注意:hex 数据需要添加0x .
Dim $bData = "8C0234000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE000001000000010000000000000003000000000000000000000000000400000000000000000000000000000000000000" _
& "EA010000010053007400720069006E006700460069006C00650049006E0066006F000000C601000001003000340030003900300034006200300000007E003300010043006F006D006D0065006E0074007300000041002000360" _
& "0340062006900740020006100750074006F00690074002000650078006500630075007400610062006C0065002000770069007400680020006D006F0064006900660069006500640020007200650073006F0075007200630065" _
& "0073002E000000000066001F000100460069006C0065004400650073006300720069007000740069006F006E0000000000410020006E0069006300650020006C006900740074006C00650020006400650073006300720069007" _
& "000740069006F006E002000680065007200650000000000300008000100460069006C006500560065007200730069006F006E000000000031002E0030002E0030002E00300000009600390001004C006500670061006C004300" _
& "6F007000790072006900670068007400000043006F00700079006C0065006600740020003200300030003800200054006800650020004B0061006E0064006900650020004D0061006E00200041006C006C00200052006900670" _
& "0680074007300200041007200650020004E006F00740020005200650073006500720076006500640000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E" _
& "0073006C006100740069006F006E00000000000904B004"
;执行去除目标程序现有的版本信息
$iReturn = _UpdateResource($hFileHandle,$RT_VERSION,1,2057,"")
If $iReturn = 0 Then
;出错可能是因为资源文件已经被移除
;随之所有相关产生的资源文件都会被删除
_EndUpdateResource($hFileHandle,1)
_BeginUpdateResource($sFileName)
EndIf
_UpdateResource($hFileHandle,$RT_VERSION,1,1033,$bData);写入新的版本信息
_EndUpdateResource($hFileHandle,0);成功写入,执行退出动作
|