Change the Version Info on an EXE?? how??
-
- Posts: 75
- Joined: Sun Oct 31, 2004 5:45 am
Change the Version Info on an EXE?? how??
Hello all is it possible by using MadRes to change another exe file Version info, You know the comments and company name.. so on...?
I tried using the PE Edtior which works but the modified exe version info appears empty under win9x, where it looks fine under win2k... does anyone know why?
my guess is that something is not calculated right when the change is made..
Thank you.
I tried using the PE Edtior which works but the modified exe version info appears empty under win9x, where it looks fine under win2k... does anyone know why?
my guess is that something is not calculated right when the change is made..
Thank you.
-
- Posts: 75
- Joined: Sun Oct 31, 2004 5:45 am
Thanks for the reply:
This is what i can find out so far..
Is this what i need if yes how do i update the exe..
Thank you.
This is what i can find out so far..
Code: Select all
1 VERSIONINFO
FILEVERSION 1, 0, 0, 0
PRODUCTVERSION 1, 0, 0, 0
FILEFLAGSMASK VS_FF_DEBUG, VS_FF_INFOINFERRED, VS_FF_PATCHED, VS_FF_PRERELEASE, VS_FF_PRIVATEBUILD, VS_FF_SPECIALBUILD
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "Comments", "My Comments\000"
VALUE "CompanyName", "My Company\000"
VALUE "FileDescription", "My Description\000"
VALUE "FileVersion", "1, 0, 0, 0\000"
VALUE "InternalName", "My File Name\000"
VALUE "LegalCopyright", "Copyright © My Company\000"
VALUE "LegalTrademarks", "$$\000"
VALUE "OriginalFilename", "MyFileName.exe\000"
VALUE "ProductName", "My Product\000"
VALUE "ProductVersion", "1, 0, 0, 0\000"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 1033, 1200
}
}
VALUE "", "\000"
Thank you.
Go to http://www.wilsonc.demon.co.uk/delphi.htm, download ResourceUtils. Demos are not included, so you must also download Resource Editor source to learn how to use it.
I written simple demo how to edit version info (put on form button and listbox):
If somebody know how to do this with madRes please notify me!
I written simple demo how to edit version info (put on form button and listbox):
Code: Select all
uses unitPEFile, unitNTModule, unitResourceDetails, unitResourceVersionInfo;
const
UseWinAPIParser = False;
var
M: TResourceModule;
D: TResourceDetails;
V: TVersionInfoResourceDetails;
F: TVersionFileFlags;
function VersionToString(version: TULargeInteger): string;
begin
with version do
result := Format('%d.%d.%d.%d', [HiWord(HighPart), LoWord(HighPart),
HiWord(LowPart), LoWord(LowPart)]);
end;
function StringToVersion (const version : string) : TULargeInteger;
var
p : Integer;
s : string;
hh, h, l, ll : word;
ok : boolean;
begin
hh := 0;
ll := 0;
h := 0;
l := 0;
s := version;
p := Pos ('.', s);
ok := False;
if p > 0 then
begin
hh := StrToInt (Copy (s, 1, p - 1));
s := Copy (s, p + 1, MaxInt);
p := Pos ('.', s);
if p > 0 then
begin
h := StrToInt (Copy (s, 1, p - 1));
s := Copy (s, p + 1, MaxInt);
p := Pos ('.', s);
if p > 0 then
begin
l := StrToInt (Copy (s, 1, p - 1));
ll := StrToInt (Copy (s, p + 1, MaxInt));
ok := True;
end
end
end;
if not ok then
raise exception.Create ('ver format error');
result.HighPart := 65536 * hh + h;
result.LowPart := 65536 * l + ll;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
I, J: Integer;
begin
if (Win32Platform = VER_PLATFORM_WIN32_NT) and UseWinAPIParser then
M := TNTModule.Create
else
M := TPEResourceModule.Create // more effective than TNTModule
;
try
M.LoadFromFile('test.exe');
for I := 0 to M.ResourceCount - 1 do
begin
D := M.ResourceDetails[I];
if D is TVersionInfoResourceDetails then
begin
V := TVersionInfoResourceDetails(D);
F := V.FileFlags;
for J := 0 to V.KeyCount - 1 do
ListBox1.Items.Add(V.Key[J].KeyName + ': ' + V.Key[J].Value);
;
V.ProductVersion := StringToVersion('10.0.2.59');
V.FileVersion := V.ProductVersion;
V.FileFlags := F; // flags must be update ever (!!!)
V.SetKeyValue('FileVersion', '10.0.2.59');
V.SetKeyValue('ProductVersion', '10.0.2.59');
M.SaveToFile('test.exe');
Break;
end;
end;
finally
M.Free;
end;
end;
hallo cox,
i've tried your example but everytime i'm using the V.SetKeyValue
i'm getting corrupt version info data - which means windows is not able
to display them. basicly the updated information looks correct with
a resource hacker, the only different is the block value (BLOCK "0C090000").
but i'm not sure that the problemes lays there.
do you have an idea how to fix this?
thanks and regards
i've tried your example but everytime i'm using the V.SetKeyValue
i'm getting corrupt version info data - which means windows is not able
to display them. basicly the updated information looks correct with
a resource hacker, the only different is the block value (BLOCK "0C090000").
but i'm not sure that the problemes lays there.
do you have an idea how to fix this?
thanks and regards
Probably the wrong codepage is set, you should fix it like this:endage wrote: getting corrupt version info data - which means windows is not able to display them.
Code: Select all
if D is TVersionInfoResourceDetails then
begin
D.CodePage := 1251; //your codepage here
V := TVersionInfoResourceDetails(D);
F := V.FileFlags;