unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  MMSystem, ExeMod, StdCtrls, ExtCtrls, JPEG, MPlayer;

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button10: TButton;
    Button11: TButton;
    Button12: TButton;
    Button13: TButton;
    Image1: TImage;
    Panel1: TPanel;
    MediaPlayer1: TMediaPlayer;
    panel2: TPanel;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure Button13Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


function GetTempDir: String;
var
  TempVar : PChar;
begin
  TempVar := StrAlloc(255);
  GetTempPath(255, TempVar);
  Result := StrPas(TempVar);
  StrDispose(TempVar);
end;

function  DoXOR(MyString: string): string;//weak encryption-will hide data
var                                       //from the weak minded :-)
X: Integer;                               //Use something like the very easy
begin                                     //to implement RC4 stream cypher
  for X := 1 to Length(MyString) do       //to get some real data security
  begin
    MyString[X] := chr(ord(MyString[X]) xor 77);
  end;
Result := MyString;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
Temp: String;
Begin;
OpenDialog1.Execute;
If Pos('.WAV',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp); //scramble it!
  InsOrReplaceInExe('Wav1',Temp);//name wav as 'Wav1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like a WAV!'+chr(13)+'Operation ABORTED');
end;

procedure TForm1.Button3Click(Sender: TObject);
var
Temp: String;
Begin;
OpenDialog1.Execute;
If Pos('.WAV',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp); //scramble it!
  InsOrReplaceInExe('Wav2',Temp);//name wav as 'Wav1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like a WAV!'+chr(13)+'Operation ABORTED');
end;
procedure TForm1.Button4Click(Sender: TObject);
var
Temp: String;
Begin;
OpenDialog1.Execute;
If Pos('.WAV',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp); //scramble it!
  InsOrReplaceInExe('Wav3',Temp);//name wav as 'Wav1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like a WAV!'+chr(13)+'Operation ABORTED');
end;

procedure TForm1.Button5Click(Sender: TObject);
var
Temp: String;
begin
ExtractFromExe('Wav1',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has Wav1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  sndPlaySound(PChar(Temp),SND_MEMORY or SND_SYNC);
end;
end;


procedure TForm1.Button6Click(Sender: TObject);
var
Temp: String;
begin
ExtractFromExe('Wav2',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has Wav1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  sndPlaySound(PChar(Temp),SND_MEMORY or SND_SYNC);
end;
end;


procedure TForm1.Button7Click(Sender: TObject);
var
Temp: String;
begin
ExtractFromExe('Wav3',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has Wav1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  sndPlaySound(PChar(Temp),SND_MEMORY or SND_SYNC);
end;
end;

procedure TForm1.Button8Click(Sender: TObject);
var
Temp: String;
begin
OpenDialog1.Execute;
If Pos('.MP',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp);//scramble it!
  InsOrReplaceInExe('MPG1',Temp);//name file as 'MPG1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like an MPG!'+chr(13)+'Operation ABORTED');
end;

procedure TForm1.Button9Click(Sender: TObject);
var
Temp: String;
begin
OpenDialog1.Execute;
If Pos('.JP',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp);//scramble it!
  InsOrReplaceInExe('JPG2',Temp);//name image as 'JPG1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like a JPG!'+chr(13)+'Operation ABORTED');
end;

procedure TForm1.Button10Click(Sender: TObject);
var
Temp: String;
begin
OpenDialog1.Execute;
If Pos('.JP',UpperCase(OpenDialog1.FileName)) <> 0 then
begin
  Temp := File2String(OpenDialog1.FileName);
  Temp := DoXOR(Temp);//scramble it!
  InsOrReplaceInExe('JPG3',Temp);//name image as 'JPG1' -could be any name
  AlterExe;
end
else
  ShowMessage('File does not look like a JPG!'+chr(13)+'Operation ABORTED');
end;

procedure TForm1.Button11Click(Sender: TObject);
var
Temp,TempDir: String;

begin

ExtractFromExe('MPG1',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has MPG1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  TempDir := GetTempDir;
  String2File(Temp,TempDir+'MPG1.mpg');
  MediaPlayer1.Filename := TempDir+'MPG1.mpg';
  MediaPlayer1.Open;
  MediaPlayer1.Display := Panel2;
  MediaPlayer1.DisplayRect := Panel2.ClientRect;
  MediaPlayer1.Play;
end;
end;

procedure TForm1.Button12Click(Sender: TObject);
var
Temp: String;
MyStream: TMemoryStream;
MyPic: TJpegImage;
begin
ExtractFromExe('JPG2',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has JPG1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  MyPic := TJpegImage.Create;
  MyStream := TMemoryStream.Create;
  try
  String2Stream(temp,MyStream);
  MyPic.LoadFromStream(MyStream);
  Form1.Image1.Picture.Assign(MyPic);
  finally
  MyStream.Free;
  MyPic.Free;
  end;
end;
end;

procedure TForm1.Button13Click(Sender: TObject);
var
Temp: String;
MyStream: TMemoryStream;
MyPic: TJpegImage;
begin
ExtractFromExe('JPG3',Temp);
If Temp = '' then
begin
  ShowMessage('Data NOT loaded! Has JPG1 been saved?');
end
else
begin
  Temp := DoXOR(Temp);//descramble it
  MyPic := TJpegImage.Create;
  MyStream := TMemoryStream.Create;
  try
  String2Stream(temp,MyStream);
  MyPic.LoadFromStream(MyStream);
  Form1.Image1.Picture.Assign(MyPic);
  finally
  MyStream.Free;
  MyPic.Free;
  end;
end;
end;

end.
