原来有个程序,需要使用DuplicateHandle,在xp下
if(DuplicateHandle(hProcess, toDuplicate, GetCurrentProcess(), &hObject, STANDARD_RIGHTS_REQUIRED, FALSE, 0) != FALSE) ......
只有好好研究文档了,看到最新的MSDN是这样写的:
https://msdn.microsoft.com/zh-cn/data/ms724251(v=vs.100)
Optional actions. This parameter can be zero, or any combination of the following values.
Value | Meaning |
---|---|
|
Closes the source handle. This occurs regardless of any error status returned. |
|
Ignores the dwDesiredAccess parameter. The duplicate handle has the same access as the source handle. |
老版的就不去找了,原来没有使用options,使用options
if(DuplicateHandle(hProcess, toDuplicate,
GetCurrentProcess(), &hObject, 0/*STANDARD_RIGHTS_REQUIRED*/, FALSE, DUPLICATE_SAME_ACCESS) != FALSE)
{
Build->Run,OK!