/////////////匿名管道
CreatePipe(
&hReadPipe,
&hWritePipe,
&PipeAttributes,
0
);
/////////////控制台进程,输入重定向
STARTUPINFO ert;
PROCESS_INFORMATION wdf;
GetStartupInfo(&ert);
ert.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
ert.wShowWindow = SW_SHOW;
ert.hStdInput = hReadPipe;
CreateProcess(
NULL,
"openssl.exe",
NULL,
NULL,
true,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&ert,
&wdf
);
CloseHandle(hReadPipe);
char * write="genrsa -des3 -out server.key 1024\r\n";
DWORD gg;char read[1024];
WriteFile(
hWritePipe,
write,
strlen(write),
&gg,
NULL
);
//// 此时屏幕显示 Enter pass phrase for server.key:然后输入密码123456
write="123456\r\n";
WriteFile(
hWritePipe,
write,
strlen(write),
&gg ,
NULL
);
但是123456输不进去,为什么?
谢谢!!!