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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

__real@3ff0000000000000 DQ 03ff0000000000000r ; 1<br />

tv140 = -4 ; size = 4<br />

_tmp$ = -4 ; size = 4<br />

_main PROC<br />

push ebp<br />

mov ebp, esp<br />

and esp, -64 ; ffffffc0H<br />

sub esp, 56 ; 00000038H<br />

push esi<br />

push edi<br />

push 0<br />

call __time64<br />

add esp, 4<br />

mov esi, eax<br />

mov edi, 100 ; 00000064H<br />

$LN3@main:<br />

; let’s generate random 32-bit number<br />

imul esi, 1664525 ; 0019660dH<br />

add esi, 1013904223 ; 3c6ef35fH<br />

mov eax, esi<br />

; leave bits <strong>for</strong> significand only<br />

and eax, 8388607 ; 007fffffH<br />

; set exponent <strong>to</strong> 1<br />

or eax, 1065353216 ; 3f800000H<br />

; s<strong>to</strong>re this value as int<br />

mov DWORD PTR _tmp$[esp+64], eax<br />

sub esp, 8<br />

; load this value as float<br />

fld DWORD PTR _tmp$[esp+72]<br />

; subtract one from it<br />

fsub QWORD PTR __real@3ff0000000000000<br />

fstp DWORD PTR tv140[esp+72]<br />

fld DWORD PTR tv140[esp+72]<br />

fstp QWORD PTR [esp]<br />

push OFFSET $SG4232<br />

call _printf<br />

add esp, 12 ; 0000000cH<br />

dec edi<br />

jne SHORT $LN3@main<br />

pop edi<br />

86

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

Saved successfully!

Ooh no, something went wrong!