Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .386
- .MODEL FLAT, STDCALL
- STD_OUTPUT_HANDLE equ -11
- STD_INPUT_HANDLE equ -10
- GetStdHandle PROTO :DWORD
- WriteConsoleA PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
- ReadConsoleA PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
- ScanInt PROTO
- ExitProcess PROTO :DWORD
- fillRegister PROTO
- wsprintfA PROTO C :VARARG
- .data
- buffor DWORD 255 dup(0)
- Pliczbe BYTE "Podaj liczbe: "
- suma DWORD 0
- wynik BYTE "Wynik: %i"
- hout DWORD 0 ;out wypisanie MACRO
- hin DWORD 0 ;inp wpisanie MACRO
- rout DWORD 0 ;dl znakow
- rinp DWORD 0 ;dl znakow wsprintfA
- .code
- ReturnDecryptor MACRO handleConstantIn :REQ, handleOut :REQ
- invoke GetStdHandle, handleConstantIn
- mov handleOut, eax
- ENDM
- main proc
- invoke fillRegister
- ReturnDecryptor STD_OUTPUT_HANDLE, hout
- ReturnDecryptor STD_INPUT_HANDLE, hin
- mov ecx,4
- petla:
- push ecx
- invoke WriteConsoleA,hout,offset Pliczbe,lengthof Pliczbe,offset rout,0
- invoke ReadConsoleA,hin,offset buffor,255,offset rinp,0
- mov ebx, OFFSET buffor
- add ebx, rinp
- mov [ebx-2], BYTE PTR 0
- push OFFSET buffor
- call ScanInt
- add suma, eax
- pop ecx
- loop petla
- invoke wsprintfA,offset buffor,offset wynik,suma
- invoke WriteConsoleA, hout,offset buffor,lengthof wynik,offset rout,0
- invoke ExitProcess,0
- main endp
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement