Link to home
Start Free TrialLog in
Avatar of D-Master
D-MasterFlag for Palestine, State of

asked on

Executable Compressor

hi,

I want to know how to make an executable compressor, like aspack...

can anyone help, with examples please . . .
Avatar of MannSoft
MannSoft

I think that's probably a pretty complicated subject that'll require a bit of studying.

It's not written in Delphi, but UPX (http://upx.sf.net) is opensource.  You might be able to get some of the logic behind it from there.
Firstly... FORGET about doing this sort of thing in Delphi..


Your delphi stub that would be placed in front of the compressed exe to decompress it and place it into ram would be way too big... what's the point of compressing an exe to 1/3 original size but then sticking a big Delphi exe in front of it :-(

Do this in C or asm.... Delphi is not suitable for something that must be very tiny...


The hardest part will be figuring out how to place a decompressed exe into ram and then trick windoze into running it just as though it had been loaded from disk.

UPX is great.. and free.. so why re-invent the wheel?

There is also the free Pepack.exe which does a great job of compressing an exe... and it is sooo tiny at 14,848 bytes.

 http://groups.yahoo.com/group/BCX/files/Cool_Tools/Pepack.Exe

Pepack is so small you can just tuck it away inside a delphi exe and pop it out to windows/temp to compress an exe...

Odd thing about pepack is that the first 3 bytes of the exe are 'MZP'  just like a delphi app ???  ...maybe borland used the same signature for it's C compilers.
Avatar of D-Master

ASKER

Dear Gwena
I am not looking for the compression that aspack or upx do,
but when you compress a program in aspack you make it difficult for crackers , but aspack have a decompressor thats why I want to make my own software to make it difficult for crackers (non-professionals) to crack and open...

did you get the point (I want to make a software the crackers didn't yet have its decompressor)

Thanks
The main part of cracking is to debug. So here is the source for turn off the debugging function at runtime... You may not need to write a compressor...


procedure HaltDebug; assembler;
asm
  push ds
  xor ax, ax
  mov ds, ax
  mov ah, [046Ch]
@@TimerWait:
  mov al, [046Ch]
  cmp al, ah
  je @@TimerWait
  pop ds
end;

procedure AntiOn;
begin
  Port[$21] := Port[$21] or $02;
  Cli;
  Int03 := IntXX;
  Int01 := IntXX;
  Sti;
end;

procedure AntiOff;
begin
  Port[$21] := Port[$21] and $fd;
  Cli;
  Int01 := SaveInt01;
  Int03 := SaveInt03;
  Sti;
end;

begin // copy this code to your project's entry point
  HaltDebug;
  SaveInt01 := Int01;
  SaveInt03 := Int03;
end.
When you dont use the VCL, Delphi will make tiny executables.  And since you wouldnt need the VCL for something like this, you wouldnt have to worry about a 300k EXE.
ASKER CERTIFIED SOLUTION
Avatar of Gwena
Gwena

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial