哪位指教一下
利用管道往telnet里写命令:open 192.168.0.2不能成功,请指教
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comdlg32.lib
;=================================================数据定义
.data
commandline db "C:\WINDOWS\system32\telnet.exe",0
sat SECURITY_ATTRIBUTES <?>
pinfo PROCESS_INFORMATION <?>
startupinfo STARTUPINFO <0>
hwrite DWORD 0
hread DWORD 0
prochandle DWORD 0
dupwrite DWORD 0
buf2 db "open 168.192.0.2",10,13
read DWORD 0
.data?
hInstance DWORD ?
cmdline DWORD ?
;=======主程序段
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
mov cmdline,eax
mov sat.nLength,sizeof SECURITY_ATTRIBUTES
mov sat.lpSecurityDescriptor,NULL
mov sat.bInheritHandle,TRUE
;============建管道
invoke CreatePipe,addr hread,addr hwrite,addr sat,NULL
invoke GetCurrentProcess
mov prochandle,eax
;invoke DuplicateHandle,prochandle,hwrite,prochandle,addr dupwrite,0,FALSE,DUPLICATE_SAME_ACCESS
;重定向子程序输入端
push hread
pop startupinfo.hStdInput
;invoke CloseHandle,hwrite
invoke CreateProcess,NULL,addr commandline,NULL,NULL,TRUE,NULL,NULL,NULL,addr startupinfo,addr pinfo
invoke CloseHandle,hread
invoke WriteFile,hwrite,addr buf2,20,addr read,NULL
invoke ExitProcess,-1
end start