Difference between revisions of "Example 3"

From SkullSecurity
Jump to navigation Jump to search
(New page: <pre> push ebp mov ebp, esp mov eax, [ebp+arg_0] test eax, eax jnz short loc_1 ...)
 
Line 1: Line 1:
{{Infobox assembly}}
[[Category: Assembly Examples]]
<pre>                push    ebp
<pre>                push    ebp
                 mov    ebp, esp
                 mov    ebp, esp

Revision as of 19:30, 12 March 2007

Assembly Language Tutorial
Please choose a tutorial page:
                 push    ebp
                 mov     ebp, esp
                 mov     eax, [ebp+arg_0]
                 test    eax, eax
                 jnz     short loc_1

                 push    57h             ; dwErrCode
                 call    ds:SetLastError
                 xor     eax, eax
                 pop     ebp
                 retn    8
 ; ---------------------------------------------------------------------------

 loc_1:
                 mov     cl, [eax]
                 test    cl, cl
                 jz      short loc_3
                 mov     dl, [ebp+arg_4]
                 jmp     short loc_2
 ; ---------------------------------------------------------------------------

 loc_2:
                 cmp     cl, dl
                 jz      short loc_4
                 mov     cl, [eax+1]
                 inc     eax
                 test    cl, cl
                 jnz     short loc_2

 loc_3:
                 xor     eax, eax

 loc_4:
                 pop     ebp
                 retn    8