设置EXE VersionInfo

我通过VerQueryValue获取版本的Exe-file信息。 有反函数(WinApi或Delphi)可以注册(build立或更改)这些信息吗? 在这里,例如有一个能够这样做的程序。 它怎么可能工作( http://www.angusj.com/resourcehacker )?

版本信息通过资源存储; 编辑你只需要编辑该资源。 这里是一个单位,我发现可以克隆现有的文件版本信息,并将其附加到另一个文件。 从这个代码开始,你可以非常容易地完成你想要的任务(它是由我的一个朋友编写的,并且是公开的):

 unit cloneinfo; interface uses Windows, SysUtils; type LANGANDCODEPAGE = record wLanguage: Word; wCodePage: Word; end; procedure clone(sFile,output:string); implementation procedure clone(sFile,output:string); var dwHandle, cbTranslate: cardinal; sizeVers: DWord; lpData, langData: Pointer; lpTranslate: ^LANGANDCODEPAGE; hRes : THandle; begin sizeVers := GetFileVersionInfoSize(PChar(sFile), dwHandle); If sizeVers = 0 then exit; GetMem(lpData, sizeVers); try ZeroMemory(lpData, sizeVers); GetFileVersionInfo (PChar(sFile), 0, sizeVers, lpData); If not VerQueryValue (lpData, '\VarFileInfo\Translation', langData, cbTranslate) then exit; hRes := BeginUpdateResource(pchar(output), FALSE); //For i := 0 to (cbTranslate div sizeof(LANGANDCODEPAGE)) do //begin lpTranslate := Pointer(Integer(langData) + sizeof(LANGANDCODEPAGE)); UpdateResource(hRes, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), lpTranslate^.wLanguage,lpData, sizeVers); //end; EndUpdateResource(hRes, FALSE); finally FreeMem(lpData); end; end; end.