1. 程式人生 > >Windows核心程式設計--程序建立與程序退出

Windows核心程式設計--程序建立與程序退出

VOID ProcessInherit( VOID )
{
STARTUPINFO si = { sizeof(si) };
SECURITY_ATTRIBUTES saProcess, saThread;
PROCESS_INFORMATION piThreadB, piThreadC;
TCHAR szPath[MAX_PATH];
saProcess.nLength = sizeof(saProcess);
saProcess.lpSecurityDescriptor = NULL;
saProcess.bInheritHandle = TRUE;


saThread.nLength = sizeof(saThread);
saThread.lpSecurityDescriptor = NULL;
saThread.bInheritHandle = FALSE;


//Spawn Process B
_tcscpy_s(szPath, _countof(szPath), _T("ProcessB"));
CreateProcess(NULL, szPath, &saProcess, &saThread, FALSE, 0, NULL, NULL, &si, &piThreadB);