惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 廖勇军

关于c++的头文件依赖 增强资源管理器右键功能,含源代码 VC中结构体的内存布局 SocanCode连接Oracle的方法 SocanCode7之模板编写 不用再纠结反射影响效率了 javascript总结 IIS7.0中使用MVC3,静态页正常,其它404 ashx的使用 一起来灭掉IE6! iis express感觉还不错 关于sqlite使用entity framework的布署问题 - 廖勇军 - 博客园 负margin实现div的左右排版 原来Jquery.load的方法可以一直load下去 错误1067进程意外终止 关于省市联动的问题想法 javac编译多个带package文件 远程服务器返回了错误 NOTFOUND Java程序放到Linux上出现的问题
进程间共享句柄三种方式
廖勇军 · 2014-08-07 · via 博客园 - 廖勇军

windows核心编程第三章中,句柄的共享讲了三种方式

1、在创建句柄的时候,设置可继承,在创建进程时,让子进程继承句柄,
然后通过各种途径(如命令行参数、环境变量、发送消息)让子进程知道即可。
2、复制句柄,得先知道目的进程,然后在目标进程中复制句柄,
最后通过各种途径(如发送消息)通知目标进程
3、给句柄命名,进程间相互知道名字即可。

第3种在使用Mutex限制只运行一个实例时已使用,前2种没有例子,因此自己写了个实例。

运行后,点击创建进程,会创建一个文件句柄,并置为可继承,然后创建一个环境变量,
把句柄值保存进去,最后创建进程,创建时把句柄值做为命令行参数传入

第2个实例便启动了,可以使用三种方式得到共享的句柄,通过点击执行句柄,
分别给文件 test.txt 中写入不同的值,以验证句柄有效。

源代码下载:https://files.cnblogs.com/yvesliao/03_HandleInherit.rar