Kulverstukas

ExeStripper

May 15th, 2010
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 3.05 KB | None | 0 0
  1. { Started writing on 2010.05.15 by Kulverstukas || last update: none }
  2.  
  3. unit Stripper;
  4.  
  5. {$mode objfpc}{$H+}
  6.  
  7. interface
  8.  
  9. uses
  10.   Classes,SysUtils,FileUtil,LResources,Forms,Controls,Graphics,Dialogs,StdCtrls,ShellApi;
  11.  
  12. type
  13.  
  14.   { TForm1 }
  15.  
  16.   TForm1 = class(TForm)
  17.     Button1:TButton;
  18.     Button2:TButton;
  19.     CheckBox1:TCheckBox;
  20.     CheckBox2:TCheckBox;
  21.     CheckBox3:TCheckBox;
  22.     Edit1:TEdit;
  23.     Label1:TLabel;
  24.     procedure Button1Click(Sender:TObject);
  25.     procedure Button2Click(Sender:TObject);
  26.     procedure CheckBox1Click(Sender:TObject);
  27.     procedure CheckBox2Click(Sender:TObject);
  28.     procedure CheckBox3Click(Sender:TObject);
  29.   private
  30.     { private declarations }
  31.   public
  32.     { public declarations }
  33.   end;
  34.  
  35. var
  36.   Form1: TForm1;
  37.   openDialog : TOpenDialog;
  38.  
  39. implementation
  40.  
  41. { TForm1 }
  42. //====================================================
  43. procedure TForm1.Button1Click(Sender:TObject);
  44. begin
  45. //========
  46.   openDialog := TOpenDialog.Create(self);  // assign the dialog to the variable
  47.   openDialog.InitialDir := GetCurrentDir;  // open directory where exe was launched from
  48.   openDialog.Options := [ofFileMustExist];  // only allow existing files
  49.   openDialog.Filter := '*.exe files|*.exe';
  50.   openDialog.Title := 'Select a dump';
  51. //========
  52.    if openDialog.Execute then
  53.   begin
  54.    Form1.Edit1.Text := openDialog.FileName;
  55.   end;
  56. //========
  57. end;
  58. //====================================================
  59. procedure TForm1.Button2Click(Sender:TObject);
  60. begin
  61.   if FileExists(Form1.Edit1.Text) then
  62.  begin
  63.    if CheckBox1.Checked then
  64.      begin
  65.     Form1.Caption := 'ExeStripper - Stripping...';
  66.     ShellExecute(Handle,'open',PChar('strip.exe'),PChar('--strip-all '+'"'+Edit1.Text+'"'),nil,0);
  67.     Form1.Caption := 'ExeStripper';
  68.      end;
  69.    if CheckBox2.Checked then
  70.      begin
  71.     Form1.Caption := 'ExeStripper - Stripping...';
  72.     ShellExecute(Handle,'open',PChar('strip.exe'),PChar('--strip-debug '+'"'+Edit1.Text+'"'),nil,0);
  73.     Form1.Caption := 'ExeStripper';
  74.      end;
  75.    if CheckBox3.Checked then
  76.      begin
  77.     Form1.Caption := 'ExeStripper - Stripping...';
  78.     ShellExecute(Handle,'open',PChar('strip.exe'),PChar('--strip-unneeded '+'"'+Edit1.Text+'"'),nil,0);
  79.     Form1.Caption := 'ExeStripper';
  80.      end;
  81.  end
  82.   else ShowMessage('File doesn''t exist!');
  83. end;
  84. //====================================================
  85. procedure TForm1.CheckBox1Click(Sender:TObject);
  86. begin
  87.   if CheckBox1.Checked then
  88.      begin
  89.     CheckBox2.Checked := False;
  90.     CheckBox3.Checked := False;
  91.      end;
  92. end;
  93. //========================
  94. procedure TForm1.CheckBox2Click(Sender:TObject);
  95. begin
  96.   if CheckBox2.Checked then
  97.      begin
  98.     CheckBox1.Checked := False;
  99.     CheckBox3.Checked := False;
  100.      end;
  101. end;
  102. //========================
  103. procedure TForm1.CheckBox3Click(Sender:TObject);
  104. begin
  105.   if CheckBox3.Checked then
  106.      begin
  107.     CheckBox1.Checked := False;
  108.     CheckBox2.Checked := False;
  109.      end;
  110. end;
  111. //====================================================
  112. initialization
  113.   {$I stripper.lrs}
  114.  
  115. end.
Add Comment
Please, Sign In to add comment