Untitled

mail@pastecode.io avatar
unknown
assembly_x86
a year ago
1.3 kB
4
Indexable
Never
; hello - example of tiny (one section) Win32 program
 
format PE console 4.0
 
include 'includes\win32ax.inc'
ENABLE_PROCESSED_OUTPUT  = 00000001
 
    invoke  AllocConsole
    invoke  SetConsoleCP, 65001 
    invoke  SetConsoleOutputCP, 65001
    invoke  GetStdHandle, STD_INPUT_HANDLE
        push    eax
        push    eax
    invoke  GetStdHandle, STD_OUTPUT_HANDLE
        push    eax
    invoke  SetConsoleMode, eax, ENABLE_PROCESSED_OUTPUT
    pop eax
    invoke  WriteConsole, eax, hello, msgsz, NULL, NULL
;   pop eax
    invoke  FlushConsoleInputBuffer
    pop eax
    invoke  ReadConsole, eax, buf, bufsz, cnt, NULL
;exit:
    invoke  FreeConsole
    invoke  ExitProcess,0
 
cnt dd  ?
buf db  10 dup(?)
bufsz   =   $ - buf
hello   db  ' Привет из консоли!',0
msgsz   =   $ - hello
; import data in the same section
 
data import
 
 library kernel32,'KERNEL32.DLL'
 
 import kernel32,\
    ExitProcess,'ExitProcess',\
    SetConsoleCP,'SetConsoleCP',\
    SetConsoleOutputCP,'SetConsoleOutputCP',\
    GetStdHandle,'GetStdHandle',\
    SetConsoleMode,'SetConsoleMode',\
    ReadConsole,'ReadFile',\
    WriteConsole,'WriteConsoleA',\
    FreeConsole,'FreeConsole',\
    FlushConsoleInputBuffer,'FlushConsoleInputBuffer',\
    AllocConsole,'AllocConsole'
end data