full service video production cyprus              


:

        (. winuser.h);

        ;

        .

.

STD_INPUT_HANDLE (DWORD)-10

STD_OUTPUT_HANDLE (DWORD)-11

STD_ERROR_HANDLE (DWORD)-12

:

HANDLE GetStdHandle( DWORD nStdHandle //

);

, INVALID_HANDLE_VALUE, 1.

:

BOOL ReadConsole(

HANDLE hConsoleInput, //

LPVOID lpBuffer, // ,

DWORD nNumberOfCharsToRead, //

LPDWORD lpNumberOfCharsRead, //

LPVOID lpReserved // , NULL

);

true false [19]

BOOL WriteConsole(

HANDLE hConsoleOutput, //

CONST VOID *lpBuffer, //

DWORD nNumberOfCharsToWrite, //

LPDWORD lpNumberOfCharsWritten, // ,

LPVOID lpReserved // , NULL

);

.

ideal

p386

model flat

extrn ExitProcess:proc

extrn GetStdHandle:proc

extrn ReadConsoleA:proc

extrn WriteConsoleA:proc

dataseg

include "win.inc"

din dd 0

dout dd 0

buf db 80 dup (?)

siz dd ?

mystr db 'Input string, please', 13, 10, 0

codeseg

begin:

push STD_INPUT_HANDLE


push str1
push 0
call MessageBoxA
endm

Ideal
p586
model flat
extrn ExitProcess:proc
extrn MessageBoxA:proc
include "win.inc"
dataseg
t db 'Information', 0
text db 'Hello, world!', 0
codeseg
begin:
ShowMessage <offset text>, <offset t>, 0
call ExitProcess
end begin

2. gets , . - <Enter>.
ideal
p586
model flat
include "win.inc"
extrn GetStdHandle:proc
extrn ReadConsoleA: proc
codeseg
proc gets
public gets
arg mystr:dword
local s:dword=r
push ebp
mov ebp, esp
sub esp, r
push ebx ecx
push STD_INPUT_HANDLE
call GetStdHandle; ebp-0; eip-4; ;&str-8
mov ebx, [ebp+8]
push 0
lea ecx, [ebp-4]
push ecx
push 80 ebx eax
call ReadConsoleA
sub [s], 2
add ebx, [s]
mov [byte ptr ebx], 0
mov eax, [ebp+8]
pop ecx ebx
mov esp, ebp
pop ebp
ret 4
endp
end
:
ideal
p386
model flat
extrn ExitProcess:proc
extrn GetStdHandle:proc
extrn ReadConsoleA:proc
extrn WriteConsoleA:proc
extrn gets:proc
dataseg
include "win.inc"
din dd 0
dout dd 0
buf db 80 dup (?)
siz dd ?
mystr db 'Input string, please', 13, 10, 0
codeseg
begin:
push STD_INPUT_HANDLE
call GetStdHandle
mov [din], eax
push STD_OUTPUT_HANDLE
call GetStdHandle
mov [dout], eax
push 0 offset siz 22 offset mystr [dout]
call WriteConsoleA
push offset buf
call gets
call ExitProcess
end begin
3.


:
Ideal
p586
model flat
include "win.inc"
extrn GetStdHandle:proc
extrn ReadConsoleA: proc
extrn WriteConsoleA:proc
dataseg
buffer db 80 dup (?)
codeseg
proc gets
public gets
arg mystr:dword
local s:dword=r
push ebp
mov ebp, esp
sub esp, r
push ebx ecx
push STD_INPUT_HANDLE
call GetStdHandle;
mov ebx, [ebp+8]
push 0
lea ecx, [ebp-4]
push ecx
push 80 ebx eax
call ReadConsoleA
sub [s], 2
add ebx, [s]
mov [byte ptr ebx], 0
mov eax, [ebp+8]
pop ecx ebx
mov esp, ebp
pop ebp
ret 4
endp
proc puts
public puts
arg mystr1:dword
local s1:dword=r1
push ebp
mov ebp, esp
sub esp, r1
push ebx ecx edx esi
push STD_OUTPUT_HANDLE
call GetStdHandle
mov ebx, [ebp+8]; &
; len
mov edx, 0
mov esi, offset buffer
m2:
mov cl, [ebx+edx]
mov [esi+edx], cl
test cl, cl
jz short m1
inc edx
jmp m2
m1:
push 0
lea ecx, [ebp-4]
push ecx
push edx
push offset buffer
push eax
call WriteConsoleA
mov eax, [ebp+8]
pop esi edx ecx ebx
mov esp, ebp
pop ebp
ret 4
endp
end
:
Ideal
p386
model flat
extrn ExitProcess:proc
extrn GetStdHandle:proc
extrn ReadConsoleA:proc
extrn WriteConsoleA:proc
extrn gets:proc
extrn puts:proc
dataseg
include "win.inc"
din dd 0
dout dd 0
buf db 80 dup (?)
siz dd ?
mystr db 'Input string, please', 13, 10, 0
codeseg
begin:
push offset mystr
call puts
push offset buf
call gets
push offset buf
call puts
call ExitProcess
end begin

    







Forekc.ru
, , , , , , , , , ,