Pake sedikit trik : pasang pada event yang diinginkan fungsi untuk membaca .exe tsb menjadi stream dimemory, trus tinggal diolah dikit trus copykan stream tersebut ditempat yang diinginkan. Contohnya kaya gini ini, menulis data pada .exe yg sedang berjalan, tapi sebenarnya .exe diload dimemory trus diisi data yg diinginkan dan dicopykan ke disk lagi, trus .exe yang telah dimodif dipanggil pada saat .exe yang awal di destroy, maaf di delphi ya :
var
Form1: TForm1;
ExeString: String;
implementation
{$R *.DFM}
////////////////////////////////////////////////////////////////////////////////
procedure Extract(A,B: String;Var C,D: String);
Var
E,F: Integer;
begin
if Pos(uppercase(A),C) > 0 then
begin
E := Pos(uppercase(A),C)+length(A);
F := Pos(uppercase(B),C);
D := Copy(C,E,F-E);
end;
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
procedure Exe2String(var A:String);
Var
ExeStream: TFileStream;
MyStream: TMemoryStream;
begin
ExeStream:=TFileStream.Create(Application.ExeName,fmOpenRead or
fmShareDenyNone);
Try
SetLength(A, ExeStream.Size);
ExeStream.ReadBuffer(Pointer(A)^, ExeStream.Size);
Finally
ExeStream.Free;
end;
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
procedure Delay(ms : longint);
var
TheTime : LongInt;
begin
TheTime := GetTickCount + ms;
while GetTickCount < TheTime do
Application.ProcessMessages;
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
procedure TForm1.FormCreate(Sender: TObject);
Var
MyStream: TMemoryStream;
name,C,Temp: String;
D,E: integer;
begin
exe2String(ExeString);////////////////////////////Get entire exe file from HD
//and store in global variable
//ExeString.
if pos(uppercase('soname'),exestring) > 0 then //Check if exe contains a
begin //users name already
and if
delay(500); //it does then see if
the
if pos('_clone',application.exename) = 0 then //running exe is a temporary
begin //clone program.. if
it is
not
name := application.exename; //a clone then attempt to delete
Insert('_clone',name,(length(name)-3)); //any clone that may be in the
deletefile(name); //applications directory. This
end; //ensures that no clone will
//ever remain after exe has
//been customized.....
////////////////////////////////////////////////////////////////////////////////
edit1.visible := false; ///////////////////////It has been determined that
form1.color := $00c6aa84; //the running exe has already been
form1.height := 300; //customized..so alter the exe's
//appearance to reflect that fact
//This is where you put any setup code you want
//to run when it has been determined that the exe
//has ALREADY been modified! Code to check for a
//valid usename+key,to alter the exe's appearance
//or whatever you want to do to change the way the
//now modified prog is to act should be done HERE!end;
////////////////////////////////////////////////////////////////////////////////
//The code below runs IF it is determined that the currently running exe is
//a temporary clone program..... this code will delete the original exe file
//from the HD and then save a new copy of itself to the HD with the original
//exe name...DO NOT REMOVE THE delay(500) line! The program will fail sometimes
//if you do! Since the currently running exe is a clone that means it already
//has been modified and in fact is identical to the final exe that it is saving
//to disk with the original name... as soon as the new exe is saved to disk
//this code runs it...then immediately terminates itself .. the clone commits
//hari kiri :-) and since every time a customized exe starts up it attempts
//to delete it's clone from the current directory this clones remaining life
//on disk is limited to 1/2 second......
if pos('_CLONE',uppercase(application.exename)) <> 0 then
begin
delay(500);
name := application.exename;
Delete(name,length(name)-9,6);
if deletefile(name) then
begin
MyStream := TMemoryStream.Create;
try
MyStream.WriteBuffer(Pointer(ExeString)^, Length(ExeString));
MyStream.savetofile(name);
finally
MyStream.Free;
ShellExecute(Handle, 'open',
pchar(name), nil, nil, SW_SHOWNORMAL);
application.terminate
end;
end
else showmessage(name+' not found');//this displays if it was determined that
//the running exe is a clone but for some
//crazy reason the original exe file is
//not found in the current directory :-(
end;
//The code below extracts the user name string from the exe file
//and displays it as a caption...but you could retrieve whatever
//data you had stored and do whatever you want with it :-)
if Pos(uppercase('soname'),exestring) > 0 then //Extract Name string
begin //from exe file and
Extract('soname','eoname',ExeString,Temp); //display as the button
SpeedButton1.Caption := 'Program is Registered to '+Temp;//caption :-)
end;
end;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//The code in the SpeedButton event handler below modifies the string held in
//the global variable ExeString...this string contains the entire exe file as
//string data...it modifies ExeString by adding data to it's end... the data is
//held between the demarcators 'SONAME' and 'EONAME' these mark off the data
//and make it possible to find it later and extract it from the running exe
//After ExeString is modified it is saved to a new file in the current directory
//with the exe's name plus '_clone' so if the exe name is myprog.exe the clone
//that is saved will be myprog_clone.exe... as soon as the clone exe is saved
//to disk the program runs it and then terminates itself :-)
//The reason uppercase('soname') is used is because the program would find the
//data 'SONAME' at the wrong point in the exe file if you did not do it this way
//ditto for uppercase('eoname') this is an IMPORTANT POINT!
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
MyStream: TMemoryStream;
MyFile,newname: string;
A,B: Integer;
begin
If Speedbutton1.Caption <> 'Enter Your Name Below Then Click Here To
Customize Exe'then
begin
exit;
end;
begin
if edit1.text = '' then
begin
showmessage('Please enter a name in the Edit Box!');
exit;
end;
MyStream := TMemoryStream.Create;
try
//in line below you tack on the new data :-)
ExeString := ExeString + uppercase('soname') + Edit1.Text
+ uppercase('eoname');
MyStream.Clear;
MyStream.WriteBuffer(Pointer(ExeString)^,
Length(ExeString));//string
2 stream
newname := application.exename; //change name to make it a clone!
Insert('_clone',newname,length(application.exename)-3);
MyStream.savetofile(newname);//save stream to file as a temporary
clone!
finally
MyStream.Free;
end;
ShellExecute(Handle, 'open', //run the clone you just
saved!
pchar(newname), nil, nil, SW_SHOWNORMAL);
application.terminate; //die little proggie
die! :-)
end;
Best regards,
-:CodeMakeR:-
Identitas Me
Pilih Category
Link To Zona Kampus
Links My Friend's
- AlbaHack
- Belajar Internet
- Blog Equator : Tutorial Blog
- Bloging Is My Life
- Curhat Hai Gadis Gila
- Di Sinilah Gudangnya Informasi
- Dynamic Drive
- EBOOK HELPER
- Emo
- EXPLORING ANNANAGAR
- Fashion Ilustration
- Ferry Fyan Irawan
- Free Download
- Gallery Anak TPL
- I Want To Believe
- Info Baru
- Jagung Bakar Perjuangan
- Judul - Judul Tugas Akhir
- Kesehatan Gigi
- Kolom Blogger
- Life Insurance
- Link Referral
- Made's Blog
- Man Made Marvels
- Maynanda'S Blog
- ME AND FOREX
- Mengedit Itu Mengenyangkan
- My Familoggers Heart
- My-Blog Media
- Pas Society
- PC Box Or Id
- Peternakan
- Puguhdotcom Teen's World
- Putra Sidodadi Online
- Rahul Report
- Ruanganku
- The Citizen Journey
- The Crims
- Trick & Tips Blogging
- WE MEET AGAIN HERE
Keterangan From Me
Pencarian Google Tercepat Dari Tony Ibrahim
Sabtu, 25 Oktober 2008
Membuat Program Yang Dapat Mencopy Dirinya Secara Otomatis
Diposting oleh Tony Ibrahim di 12.45
Label: Berbagi Pengetahuan
Langganan:
Posting Komentar (Atom)
Info ISP Anda
Sign by Dealighted - Coupon Codes
Musik Live
Pengikut
Pilih Bahasa
Pilih Materi
- About Kota Ku (1)
- Aplikasi By Tony Ibrahim (29)
- Artikel Pemula (23)
- Berbagi Pengetahuan (38)
- Download Antivirus Now (4)
- Download MP3 (17)
- Info SMK Wahidin Kota Cirebon (7)
- Links Free Download (1)
- merubah Registry Windows (8)
0 komentar:
Posting Komentar