23.03.2013 Views

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

Quick introduction to reverse engineering for beginners

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

sub ebx, edx<br />

jne SHORT $LN2@f<br />

inc ecx<br />

cmp BYTE PTR [esi+ecx], bl<br />

jne SHORT $LL3@f<br />

$LN2@f:<br />

cmp BYTE PTR [ecx], 0<br />

je SHORT $LN14@f<br />

mov dl, BYTE PTR [eax+1]<br />

inc eax<br />

inc esi<br />

test dl, dl<br />

jne SHORT $LL5@f<br />

xor eax, eax<br />

pop ebx<br />

pop edi<br />

pop esi<br />

ret 0<br />

_f ENDP<br />

_TEXT ENDS<br />

END<br />

Same code compiled in GCC 4.4.1:<br />

public f<br />

f proc near<br />

var_C = dword ptr -0Ch<br />

var_8 = dword ptr -8<br />

var_4 = dword ptr -4<br />

arg_0 = dword ptr 8<br />

arg_4 = dword ptr 0Ch<br />

loc_80483F4:<br />

loc_8048402:<br />

push ebp<br />

mov ebp, esp<br />

sub esp, 10h<br />

mov eax, [ebp+arg_0]<br />

mov [ebp+var_4], eax<br />

mov eax, [ebp+arg_4]<br />

movzx eax, byte ptr [eax]<br />

test al, al<br />

jnz short loc_8048443<br />

mov eax, [ebp+arg_0]<br />

jmp short locret_8048453<br />

mov eax, [ebp+var_4]<br />

mov [ebp+var_8], eax<br />

mov eax, [ebp+arg_4]<br />

mov [ebp+var_C], eax<br />

jmp short loc_804840A<br />

add [ebp+var_8], 1<br />

add [ebp+var_C], 1<br />

130

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!