码迷,mamicode.com
首页 > 其他好文 > 详细

执行cmd命令

时间:2017-07-07 17:31:05      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:blog   security   block   out   错误   cmd命令   osc   检查   logs   

 


 

说明:主要代码是从 http://tieba.baidu.com/p/3214053453 抄录的

 


 


 

Demo下载:https://git.oschina.net/xieyimo9/zhixingcmdmingling.git

 


 

  • 主要思路:
  • {
        建立两条管道,一条负责从程序(进程)往新建立的cmd进程传信息,另一条则反过来,从cmd进程传信息给程序
        程序通过 WriteIn 写入,cmd进程 从 ReadIn 读到程序写入的信息
        cmd进程 的返回值或错误通过 WriteOut 写入,程序从 ReadOut 读到 cmd进程的返回信息
                                   ┌───────────────────────────────┐
                                   │                               │( 定时器定时检查这条线 )
                   Createpipe(ReadOut, WriteOut, @Security, 0);    │
                                          ∧                        │
          ┌───────────────────────────────┘                        ∨
        cmd进程                                                    程序
          ∧       Createpipe(ReadIn, WriteIn, @Security, 0);       │
          │                     │       ∧                          │
          └─────────────────────┘       └───────────────────────────┘
    }

     

 


 

执行cmd命令

标签:blog   security   block   out   错误   cmd命令   osc   检查   logs   

原文地址:http://www.cnblogs.com/xieyimo/p/7133042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!