SHARE
TWEET

Untitled

a guest Dec 8th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. STARTUPINFO si;
  2.         PROCESS_INFORMATION pi[2];
  3.         char argline[50];
  4.         memset(&si, 0, sizeof(si));
  5.         memset(&pi, 0, sizeof(pi));
  6.         si.cb = sizeof(si);
  7.         int i,j,ret[2];
  8.        
  9.         for(i = 0; i < 2; i++) {
  10.             sprintf(argline, "44545.so.lab03.exe %s", arg[i]);
  11.             if(CreateProcessA(NULL,argline,NULL,NULL,0,0,NULL,NULL,&si,pi+i) == 0){
  12.                 printf( "CreateProcess #%d failed (%d).\n", i+1, GetLastError() );  
  13.                 return 1;
  14.             }
  15.         }
  16.        
  17.         HANDLE children[2] = {pi[0].hProcess,pi[1].hProcess};
  18.         WaitForMultipleObjects(2, children, 1, INFINITE);
  19.  
  20.         for(j = 0; j<2; j++) {
  21.             GetExitCodeProcess(children[j],&ret[j]);   
  22.             printf("%d %d %s %c\n", GetCurrentProcessId(), pi[j].dwProcessId, arg[j],(char)ret[j]);    
  23.             CloseHandle( pi[j].hProcess );
  24.             CloseHandle( pi[j].hThread );
  25.         }  
  26.         return max(ret[0],ret[1]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top