Skip to content

Instantly share code, notes, and snippets.

@kzkvv
Created April 1, 2018 09:57
Show Gist options
  • Save kzkvv/5ec9a77350b3f481109a538843fc6959 to your computer and use it in GitHub Desktop.
Save kzkvv/5ec9a77350b3f481109a538843fc6959 to your computer and use it in GitHub Desktop.
123
.486
.model flat, stdcall
option casemap :none ; чувствительность к регистру букв в идентификаторах
include C:\masm32\includes\windows.inc
include C:\masm32\includes\kernel32.inc
includelib C:\masm32\includes\kernel32.lib
.data
nextLine db 0ah ; \n
.data?
inputHandle dd ?
outputHandle dd ?
numberOfChars dd ?
str1 dd ?
str2 dd ?
str3 dd ?
str1Lenght dd ?
str2Lenght dd ?
str3Lenght dd ?
.code
start:
push STD_INPUT_HANDLE ; передача параметра в функцию
call GetStdHandle ; вызов системной функции
mov inputHandle, EAX ; сохранение результата функции
push STD_OUTPUT_HANDLE
call GetStdHandle
mov outputHandle, EAX ;получили указатель на входной и выходной поток
invoke ReadConsole, inputHandle, offset str1, 1000, offset str1Lenght, NULL
invoke ReadConsole, inputHandle, offset str2, 1000, offset str2Lenght, NULL
invoke ReadConsole, inputHandle, offset str3, 1000, offset str3Lenght, NULL
invoke WriteConsole, outputHandle, offset nextLine, 1, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset str1, 10, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset nextLine, 1, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset str2, 10, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset nextLine, 1, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset str3, 10, offset numberOfChars, NULL
invoke WriteConsole, outputHandle, offset nextLine, 1, offset numberOfChars, NULL
push 0
call ExitProcess
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment