Reverse Engineering for Beginners

(avery) #1

CHAPTER 53. WINDOWS 16-BIT CHAPTER 53. WINDOWS 16-BIT


call MESSAGEBOX
cmp ax, 2 ; IDCANCEL
jnz short loc_2F
xor ax, ax
push ax
push ds
mov ax, offset aYouPressedCanc ; "you pressed cancel"
jmp short loc_49
loc_2F:
cmp ax, 6 ; IDYES
jnz short loc_3D
xor ax, ax
push ax
push ds
mov ax, offset aYouPressedYes ; "you pressed yes"
jmp short loc_49
loc_3D:
cmp ax, 7 ; IDNO
jnz short loc_57
xor ax, ax
push ax
push ds
mov ax, offset aYouPressedNo ; "you pressed no"
loc_49:
push ax
push ds
mov ax, offset aCaption ; "caption"
push ax
xor ax, ax
push ax
call MESSAGEBOX
loc_57:
xor ax, ax
pop bp
retn 0Ah
WinMain endp


Somewhat extended example from the previous section.


53.4 Example #4


#include <windows.h>


int PASCAL func1 (int a, int b, int c)
{
return a*b+c;
};


long PASCAL func2 (long a, long b, long c)
{
return a*b+c;
};


long PASCAL func3 (long a, long b, long c, int d)
{
return a*b+c-d;
};


int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
func1 (123, 456, 789);
func2 (600000, 700000, 800000);
func3 (600000, 700000, 800000, 123);
return 0;

Free download pdf