Добрый день. Перехоже на fasm. Хотел перенаправить вывод консольной утили в файл _rez.txt На masm - е было так ... Код (Text): .data tmp db 'Hello world!!!',0 ; буфер командной строки lf db 13,10,0 .code start: invoke StdOut,ADDR tmp invoke StdOut,ADDR lf invoke ExitProcess,0 end start Запускаем ... Код (Text): c:\ _m.exe > rez.txt rez.txt Hello world!!! Теперь в fasm Код (Text): format PE console include 'C:\fasmw\INCLUDE\win32a.inc' entry start section '.data' data readable writeable ;-------------------------------------------------------- tmp db 'Hello world!!!',0 lf db 13,10,0 hout dd 0 ns dd ? ;-------------------------------------------------------- section '.code' code readable writeable executable start: push STD_OUTPUT_HANDLE call [GetStdHandle] mov [hout],eax lea ebx, [tmp] push ebx call [lstrlen] push 0 push [ns] push eax lea ebx, [tmp] push ebx push [hout] call [WriteConsole] push 0 push [ns] push 2 lea ebx, [lf] push ebx push [hout] call [WriteConsole] call [ExitProcess] ;----------------------------------------------------------------------------------------- section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' include 'C:\fasmw\INCLUDE\APIA\kernel32.inc' include 'C:\fasmw\INCLUDE\APIA\user32.inc' Код (Text): c:\ _f.exe > rez.txt rez.txt [ПУСТО] <----!!!! Вопрос - как в fasm - е организовать перенаправление в файл результатов работы консольного приложения?
попробуй вместо WriteConsole использовать WriteFile и это надо писать push ns, а не push [ns], и у тебя перед вызовом ExitProcess ему параметр не передается
нету, а StdOut реализован в masm32.lib и там используется WriteFile =)) Код (Text): .text:00000000 _StdOut@4 proc near ; DATA XREF: StdOut(x)+1Bo .text:00000000 .text:00000000 nNumberOfBytesToWrite= dword ptr -0Ch .text:00000000 NumberOfBytesWritten= dword ptr -8 .text:00000000 hFile = dword ptr -4 .text:00000000 lpBuffer = dword ptr 8 .text:00000000 .text:00000000 push ebp .text:00000001 mov ebp, esp .text:00000003 add esp, 0FFFFFFF4h .text:00000006 push 0FFFFFFF5h ; nStdHandle .text:00000008 call _GetStdHandle@4 ; GetStdHandle(x) .text:0000000D mov [ebp+hFile], eax .text:00000010 push [ebp+lpBuffer] .text:00000013 call _StrLen@4 ; StrLen(x) .text:00000018 mov [ebp+nNumberOfBytesToWrite], eax .text:0000001B push offset _StdOut@4 ; lpOverlapped .text:0000001D lea eax, [ebp+NumberOfBytesWritten] .text:00000020 push eax ; lpNumberOfBytesWritten .text:00000021 push [ebp+nNumberOfBytesToWrite] ; nNumberOfBytesToWrite .text:00000024 push [ebp+lpBuffer] ; lpBuffer .text:00000027 push [ebp+hFile] ; hFile .text:0000002A call _WriteFile@20 ; WriteFile(x,x,x,x,x) .text:0000002F mov eax, [ebp+NumberOfBytesWritten] .text:00000032 leave .text:00000033 retn 4 .text:00000033 _StdOut@4 endp