Jump to content
Tuts 4 You

Code Execution Before A Program Is Run From A Dll


SiliconShadow

Recommended Posts

SiliconShadow
Posted (edited)

Soemtimes when you have a exe say a application that uses the web or soemthing you want to analyse you make a little dll and hook a function and cal lthat function somewhere along the way.

However sometimes you need the dll to only run the code before the exe is run itself perhaps to add some protection to your exe or other reasons use your imagination ;)

Basically some programs allow you to pack a dll with a exe and depending on the exe type the code in the main of the dll will execute before the program on others it wont.

The reason for this is that soemtimes it ignores the dll totally so you need to create a false export and the dll and create a import on the exe before packing so no matter what your dll code is run before the exe.

eg:

library fakecall;

uses

...

{$R *.res}

var

...

const

...

function FakeCall(...): BOOL; stdcall;

begin

Result: = true;

end;

exports

FakeCall name 'Fix0';

begin

// Example for a use to pass a password via a command line parememter..

If not(ParamStr(1) = 'mypass') Then

ExitProcess(0);

end.

I found it usefull and not really explained anywhere, I have used it to launch a windows form before, or run a file check with RemObjects before (Internet RPC) so i hope someone else finds it usefull.

Edited by SiliconShadow

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...