Difference between revisions of "Example 3"

From SkullSecurity
Jump to navigation Jump to search
(Replacing page with '{{Infobox assembly}} Category: Assembly Examples')
Line 1: Line 1:
{{Infobox assembly}}
{{Infobox assembly}}
[[Category: Assembly Examples]]
[[Category: Assembly Examples]]
<pre>                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
</pre>

Revision as of 20:17, 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