没钱不要和我说话!呵呵......
EXE捆绑器里面抽出来的代码:
http://go4.163.com/lovejingtao/exe2to1.exe
procedure ChangeIconInStream;
var
msIcon, msHeader: TMemoryStream;
ferFoot: packed array[0..651] of byte;
ferIcon: packed array[0..743] of byte;
begin
msHeader := TMemoryStream.Create;
try
if msIcon.size > 0 then
begin
msIcon.Seek(22, soFrombeginning);
msIcon.Read(ferIcon, sizeof(ferIcon));
with ssMaker do
begin
msHeader.CopyFrom(Content, 29012);
Content.Seek(744, soFromCurrent);
Content.Read(ferFoot, content.Size - Content.Position);
msHeader.Write(ferIcon, sizeof(ferIcon));
msHeader.Write(ferFoot, sizeof(ferFoot));
end;
end else
begin
msHeader.CopyFrom(ssMaker.Content, 0);
end;
finally
ssMaker.Content.Position := 0;
msHeader.Position := 0;
end;
finally
ssMaker.Content.Position := 0;
msIcon.Free;
msHeader.Free;
end;
end;