I need to modify this information in numerous exe
I have find this code of "ABC123" who apparently works, but it modify only the versionFileVersion
FileDescription
LegalCopyright
InternalName
OriginalFilename
ProductName
ProductVersion
CompanyName
LegalTrademarks
SpecialBuild
PrivateBuild
Comments
Language
http://forums.purebasic.com/english/vie ... 5d#p205903
Code: Select all
#RT_VERSION = 16
Structure VS_VERSIONINFO
wLength.w
wValueLength.w
wType.w
szKey.w[16]
Padding1.w
Value.VS_FIXEDFILEINFO
Padding2.w
Children.w
EndStructure
Procedure.w MakeLangID(p.w, s.w)
ProcedureReturn (s << 10) | p
EndProcedure
Macro MAKEINTRESOURCE(I)
(I)
EndMacro
Procedure.l SetFileVersion(AFileName.s, Major.w, Minor.w, Release.w, Build.w)
Protected lHLib.l, lHRes.l, lHResLoad.l, lPResLock.l
Protected lSz.l
Protected lFS.l
Protected *lpVersionInfo.VS_VERSIONINFO
Protected *lFV.l ; TFileVer
Protected lPt.l
Protected lVer.s
Protected lVarFileInfo ; Unknown type
Protected lHResUpd.l
Protected lDiscard.l
Protected Result.l
Result = 0
If FileSize(AFileName) < 0
ProcedureReturn Result
EndIf
lHLib = LoadLibrary_(AFileName)
If lHLib = 0
ProcedureReturn Result
EndIf
lHRes = FindResource_(lHlib, MAKEINTRESOURCE(1), #RT_VERSION)
If lHRes = 0
FreeLibrary_(lHLib)
ProcedureReturn Result
EndIf
lHResLoad = LoadResource_(lHLib, lHRes)
lSz = SizeofResource_(lHLib, lHRes)
If lHResLoad = 0
FreeLibrary_(lHLib)
ProcedureReturn Result
EndIf
LPResLock = LockResource_(lHResLoad)
lPt = AllocateMemory(lSz)
MoveMemory(lPResLock, lPt, lSz)
FreeLibrary_(lHLib)
*lpVersionInfo = lPt
With *lpVersionInfo\Value
\dwFileVersionMS = (Major << 16) | Minor
\dwFileVersionLS = (Release << 16) | Build
\dwProductVersionMS = \dwFileVersionMS
\dwProductVersionLS = \dwFileVersionLS
EndWith
lHResUpd = BeginUpdateResource_(AFilename, 0)
If lHResUpd = 0
Goto Except
EndIf
lDiscard = 1
lDiscard = -UpdateResource_(lHResUpd, #RT_VERSION, MAKEINTRESOURCE(1), 0, lPt, lSz) + 1
EndUpdateResource_(lHResUpd, lDiscard)
Except:
FreeMemory(lPt)
EndProcedure
;SetFileVersion("D:\Documents and Settings\User\Desktop\File.exe", 1, 0, 0, 0)
Have a good day