Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text:00401510 ; Attributes: bp-based frame fuzzy-sp
- .text:00401510
- .text:00401510 ; int __cdecl main(int argc, const char **argv, const char **envp)
- .text:00401510 public _main
- .text:00401510 _main proc near ; CODE XREF: ___tmainCRTStartup+236↑p
- .text:00401510
- .text:00401510 Destination = byte ptr -0Fh
- .text:00401510 argc = dword ptr 8
- .text:00401510 argv = dword ptr 0Ch
- .text:00401510 envp = dword ptr 10h
- .text:00401510
- .text:00401510 push ebp
- .text:00401511 mov ebp, esp
- .text:00401513 and esp, 0FFFFFFF0h
- .text:00401516 sub esp, 40h
- .text:00401519 call ___main
- .text:0040151E mov dword ptr [esp+2Bh], 35706635h
- .text:00401526 mov word ptr [esp+2Fh], 73h ; 's'
- .text:0040152D mov dword ptr [esp+1Fh], 6866234Ah
- .text:00401535 mov dword ptr [esp+23h], 7667236Fh
- .text:0040153D mov dword ptr [esp+27h], 776C21h
- .text:00401545 mov dword ptr [esp+1Ah], 37333331h
- .text:0040154D mov byte ptr [esp+1Eh], 0
- .text:00401552 mov dword ptr [esp], offset VarName ; "GREENIE"
- .text:00401559 call _getenv
- .text:0040155E mov [esp+38h], eax
- .text:00401562 cmp [ebp+argc], 1
- .text:00401566 jle short loc_40156F
- .text:00401568 cmp dword ptr [esp+38h], 0
- .text:0040156D jnz short loc_401587
- .text:0040156F
- .text:0040156F loc_40156F: ; CODE XREF: _main+56↑j
- .text:0040156F mov dword ptr [esp], offset Buffer ; "An error occurred"
- .text:00401576 call _puts
- .text:0040157B mov dword ptr [esp], 0 ; Code
- .text:00401582 call _exit
- .text:00401587 ; ---------------------------------------------------------------------------
- .text:00401587
- .text:00401587 loc_401587: ; CODE XREF: _main+5D↑j
- .text:00401587 mov eax, [ebp+argv]
- .text:0040158A add eax, 4
- .text:0040158D mov eax, [eax]
- .text:0040158F mov dword ptr [esp+8], 5 ; Count
- .text:00401597 mov [esp+4], eax ; Source
- .text:0040159B lea eax, [esp+40h+Destination]
- .text:0040159F mov [esp], eax ; Destination
- .text:004015A2 call _strncpy
- .text:004015A7 mov dword ptr [esp+3Ch], 0
- .text:004015AF jmp short loc_4015FD
- .text:004015B1 ; ---------------------------------------------------------------------------
- .text:004015B1
- .text:004015B1 loc_4015B1: ; CODE XREF: _main+F2↓j
- .text:004015B1 lea edx, [esp+31h]
- .text:004015B5 mov eax, [esp+3Ch]
- .text:004015B9 add eax, edx
- .text:004015BB movzx eax, byte ptr [eax]
- .text:004015BE mov edx, eax
- .text:004015C0 mov eax, [esp+3Ch]
- .text:004015C4 add eax, edx
- .text:004015C6 add eax, 1
- .text:004015C9 mov [esp+36h], al
- .text:004015CD lea edx, [esp+2Bh]
- .text:004015D1 mov eax, [esp+3Ch]
- .text:004015D5 add eax, edx
- .text:004015D7 movzx eax, byte ptr [eax]
- .text:004015DA cmp [esp+36h], al
- .text:004015DE jz short loc_4015F8
- .text:004015E0 mov dword ptr [esp], offset aWrong ; "wrong"
- .text:004015E7 call _puts
- .text:004015EC mov dword ptr [esp], 0 ; Code
- .text:004015F3 call _exit
- .text:004015F8 ; ---------------------------------------------------------------------------
- .text:004015F8
- .text:004015F8 loc_4015F8: ; CODE XREF: _main+CE↑j
- .text:004015F8 add dword ptr [esp+3Ch], 1
- .text:004015FD
- .text:004015FD loc_4015FD: ; CODE XREF: _main+9F↑j
- .text:004015FD cmp dword ptr [esp+3Ch], 4
- .text:00401602 jle short loc_4015B1
- .text:00401604 mov dword ptr [esp+3Ch], 0
- .text:0040160C jmp short loc_401671
- .text:0040160E ; ---------------------------------------------------------------------------
- .text:0040160E
- .text:0040160E loc_40160E: ; CODE XREF: _main+166↓j
- .text:0040160E mov eax, [esp+3Ch]
- .text:00401612 cdq
- .text:00401613 shr edx, 1Eh
- .text:00401616 add eax, edx
- .text:00401618 and eax, 3
- .text:0040161B sub eax, edx
- .text:0040161D movzx eax, byte ptr [esp+eax+1Ah]
- .text:00401622 mov [esp+37h], al
- .text:00401626 movsx eax, byte ptr [esp+37h]
- .text:0040162B lea ecx, [eax-30h]
- .text:0040162E mov edx, [esp+3Ch]
- .text:00401632 mov eax, [esp+38h]
- .text:00401636 add eax, edx
- .text:00401638 movzx eax, byte ptr [eax]
- .text:0040163B movsx eax, al
- .text:0040163E add ecx, eax
- .text:00401640 lea edx, [esp+1Fh]
- .text:00401644 mov eax, [esp+3Ch]
- .text:00401648 add eax, edx
- .text:0040164A movzx eax, byte ptr [eax]
- .text:0040164D movsx eax, al
- .text:00401650 cmp ecx, eax
- .text:00401652 jz short loc_40166C
- .text:00401654 mov dword ptr [esp], offset aWrong ; "wrong"
- .text:0040165B call _puts
- .text:00401660 mov dword ptr [esp], 0 ; Code
- .text:00401667 call _exit
- .text:0040166C ; ---------------------------------------------------------------------------
- .text:0040166C
- .text:0040166C loc_40166C: ; CODE XREF: _main+142↑j
- .text:0040166C add dword ptr [esp+3Ch], 1
- .text:00401671
- .text:00401671 loc_401671: ; CODE XREF: _main+FC↑j
- .text:00401671 cmp dword ptr [esp+3Ch], 0Ah
- .text:00401676 jle short loc_40160E
- .text:00401678 mov eax, [esp+38h]
- .text:0040167C movzx eax, byte ptr [eax]
- .text:0040167F movsx eax, al
- .text:00401682 add eax, 1Dh
- .text:00401685 mov [esp], eax ; Character
- .text:00401688 call _putchar
- .text:0040168D mov eax, [esp+38h]
- .text:00401691 add eax, 1
- .text:00401694 movzx eax, byte ptr [eax]
- .text:00401697 movsx eax, al
- .text:0040169A add eax, 4Ch ; 'L'
- .text:0040169D mov [esp], eax ; Character
- .text:004016A0 call _putchar
- .text:004016A5 mov eax, [esp+38h]
- .text:004016A9 add eax, 2
- .text:004016AC movzx eax, byte ptr [eax]
- .text:004016AF movsx eax, al
- .text:004016B2 sub eax, 2
- .text:004016B5 mov [esp], eax ; Character
- .text:004016B8 call _putchar
- .text:004016BD mov eax, [esp+38h]
- .text:004016C1 add eax, 3
- .text:004016C4 movzx eax, byte ptr [eax]
- .text:004016C7 movsx eax, al
- .text:004016CA add eax, 6
- .text:004016CD mov [esp], eax ; Character
- .text:004016D0 call _putchar
- .text:004016D5 mov eax, [esp+38h]
- .text:004016D9 add eax, 4
- .text:004016DC movzx eax, byte ptr [eax]
- .text:004016DF movsx eax, al
- .text:004016E2 add eax, 0Dh
- .text:004016E5 mov [esp], eax ; Character
- .text:004016E8 call _putchar
- .text:004016ED mov eax, [esp+38h]
- .text:004016F1 add eax, 5
- .text:004016F4 movzx eax, byte ptr [eax]
- .text:004016F7 movsx eax, al
- .text:004016FA add eax, 23h ; '#'
- .text:004016FD mov [esp], eax ; Character
- .text:00401700 call _putchar
- .text:00401705 mov eax, [esp+38h]
- .text:00401709 add eax, 6
- .text:0040170C movzx eax, byte ptr [eax]
- .text:0040170F movsx eax, al
- .text:00401712 add eax, 15h
- .text:00401715 mov [esp], eax ; Character
- .text:00401718 call _putchar
- .text:0040171D mov eax, [esp+38h]
- .text:00401721 add eax, 7
- .text:00401724 movzx eax, byte ptr [eax]
- .text:00401727 movsx eax, al
- .text:0040172A sub eax, 0Dh
- .text:0040172D mov [esp], eax ; Character
- .text:00401730 call _putchar
- .text:00401735 mov eax, [esp+38h]
- .text:00401739 add eax, 8
- .text:0040173C movzx eax, byte ptr [eax]
- .text:0040173F movsx eax, al
- .text:00401742 add eax, 13h
- .text:00401745 mov [esp], eax ; Character
- .text:00401748 call _putchar
- .text:0040174D mov eax, [esp+38h]
- .text:00401751 add eax, 9
- .text:00401754 movzx eax, byte ptr [eax]
- .text:00401757 movsx eax, al
- .text:0040175A add eax, 9
- .text:0040175D mov [esp], eax ; Character
- .text:00401760 call _putchar
- .text:00401765 mov eax, [esp+38h]
- .text:00401769 add eax, 0Ah
- .text:0040176C movzx eax, byte ptr [eax]
- .text:0040176F movsx eax, al
- .text:00401772 add eax, 9
- .text:00401775 mov [esp+4], eax
- .text:00401779 mov dword ptr [esp], offset Format ; "%c\n"
- .text:00401780 call _printf
- .text:00401785 mov eax, 0
- .text:0040178A leave
- .text:0040178B retn
- .text:0040178B _main endp
- .text:0040178B
Add Comment
Please, Sign In to add comment