MASM32 控制台输入输出

来源:互联网 发布:淘宝突然不能提前收款 编辑:程序博客网 时间:2024/05/20 07:36

=。=crt_printf MASM CUI的确有点坑


.386.model flat, stdcalloption casemap : noneinclude windows.incinclude kernel32.incincludelib kernel32.libinclude masm32.incincludelib masm32.libinclude user32.incincludelib user32.libinclude msvcrt.incincludelib msvcrt.lib  .dataPassword BYTE '1234567', 0PasswordLength BYTE $ - PasswordWelcome BYTE 'Please input password', 0Ah, 0Dh, 0format  BYTE '%s', 0OKBYTE 'OK!', 0WRONG   BYTE 'NO!', 0.codemain PROClocal @valid_flag : dwordlocal @buffer[1024] : bytelocal @authenticated : dword local @small_buffer[8] : bytemov @valid_flag, 0.while 1push OFFSET Welcomecall crt_printfadd  esp, 4lea  eax, @bufferpush eaxpush OFFSET formatcall crt_scanf    add  esp, 8    jmp checkbegin:.if eax == 0push OFFSET OKcall crt_printfadd  esp, 4jmp  exit.else push OFFSET WRONGcall crt_printfadd  esp, 4.endif.endwcheck:lea   eax, @bufferpush  eaxpush  OFFSET Passwordcall  crt_strcmpadd   esp, 8jmp   begin  exit:invoke ExitProcess, 0main ENDPEND main


0 0
原创粉丝点击