Written by Acid_Cool_178
Date July 2000
Target How to use the invoke function
Protection N / A
Comment's The beginning...

 

1. Our tools
2. The beginning...
3 API Call 1 (MessageBoxa)
4. The understanding
5. Ending
6. Greetings

 

 

1. Our tools

Win32API.hlp for help...
MASM32.hlp for usefully information...


 

2. The beginning...

When i started for, maybe 2 weks ago so had i already about 6 months newbie cracking knowlegde and i have alwasy seen a call to find the serial, create the NAG etc etc.. Now, when i started win32asm coding with a reference from http://win32asm.cjb.net (VISIT IT!!!) and there are the heave for me now these days... But the question was   TASM or MASM "What shall I use" I downloaded MASM and maybe i'ma re glad for it, and maybe not.. I don't know yet, i'm are not skilled to know at this time..

But i had one pluss when i started with cracking, i had some powerfull knowlegde friends and i'm are greatfull to them for helping me...

I wrote my forst program in MASM and it was one simple (hard) MessageBox program "Hello World".. It was realy kwel to make it work, but i had only one BIG problem.. "invoke MessageBox, NULL, addr MsgBoxText, addr MsgCaption, MB_OK" I didn't understand a shit of it... now, here are the MessageBox API properties..


 

3 API Call 1 (MessageBoxa)

int MessageBox(

HWND hwndOwner,    // handle of owner window
LPCTSTR lpszText,    // address of text in message box
LPCTSTR lpszTitle,    // address of title of message box
UINT fuStyle     // style of message box
);   

Parameters

hwndOwner
Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

lpszText
Points to a null-terminated string containing the message to be displayed.

lpszTitle
Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.

fuStyle
Specifies the contents and behavior of the dialog box.


 

4. The understanding

Now "invoke MessageBox, NULL, addr MsgBoxText, addr MsgCaption, MB_OK"  here are

MsgBoxText = lpszText
MsgBoxTCaption = lpszTitle
MB_OK = The botton to use... It have many other types...

normally it would be something like this..

Push MB_OK
Push MsgBox Caption
Push MsgBoxText
Push NULL
Call MessageBox

But that are not it, it are in one line... Here are something what i have founded in one help file..

 

Help File Start:

Traditional
        push offset par4
        push par3
        push offset par2
        push par1
        call FunctionName
        mov retval, eax

    Invoke
        invoke FunctionName,par1,ADDR par2,par3,ADDR par4
        mov retval, eax

And here are the properties for Invoke..

Syntax: INVOKE expression [,arguments]

Description:
Automates the call interface to stack-based procedures. Handles all pushing of parameters onto the stack. Cleans up the stack when the procedure returns.

The <invokelist> is passed to the procedure according to the types given in that procedure's prototype. If necessary, the assembler will generate code to convert the elements of <invokelist> to the types specified in the prototype.


Parameter Description
expression Expression yielding address or label of procedure to be called. Must resolve to a valid address and cannot include any forward references.

Arguments
Sequential list of parameters passed. Can be register::register (for a register pair), expression, or ADDR label. ADDR label passes the address of
<label> (segment and offset if DWORD, segment only

if WORD) to the procedure.

Help File End


What we can see are the the invoke are one other way of using the call and more cleaner, but strange for the newbies to understand.. The normal call have to push the paraments before you can use the real call, invoke are only one line....


 

5. Ending


Now, do you understand how invoke are working abit better now ?? If not then mail me at acid_cool_178@hotmail.com and i will update my text so fast as i can...

The reason for that i wrote this text was to learn hot invoke was working and now i got an harder knowlegde of it and that is great,, one light in the great asm tunnel..


 

6. Greetings

Special: RG_ For a great help and knowlegde when i needed it mostly...

All of the members in Hellforge, TCA and FHCF.. MagicRalph, Marton, Whizkid, Eternal Bliss, Borna Janes, Eddie Van Camper and all the rest that have helpen me with tutorials and knowlegde...



AcidCool.cjb.net