Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- STARTUPINFO si;
- PROCESS_INFORMATION pi[2];
- char argline[50];
- memset(&si, 0, sizeof(si));
- memset(&pi, 0, sizeof(pi));
- si.cb = sizeof(si);
- int i,j,ret[2];
- for(i = 0; i < 2; i++) {
- sprintf(argline, "44545.so.lab03.exe %s", arg[i]);
- if(CreateProcessA(NULL,argline,NULL,NULL,0,0,NULL,NULL,&si,pi+i) == 0){
- printf( "CreateProcess #%d failed (%d).\n", i+1, GetLastError() );
- return 1;
- }
- }
- HANDLE children[2] = {pi[0].hProcess,pi[1].hProcess};
- WaitForMultipleObjects(2, children, 1, INFINITE);
- for(j = 0; j<2; j++) {
- GetExitCodeProcess(children[j],&ret[j]);
- printf("%d %d %s %c\n", GetCurrentProcessId(), pi[j].dwProcessId, arg[j],(char)ret[j]);
- CloseHandle( pi[j].hProcess );
- CloseHandle( pi[j].hThread );
- }
- return max(ret[0],ret[1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement