Guest User

Untitled

a guest
Nov 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. static DWORD WINAPI RunningTests(test_s *test)
  2. {
  3. PROCESS_INFORMATION procinfo;
  4. DWORD waitcode;
  5. DWORD exitcode;
  6. int status = 0, crashed = 0;
  7. char cmdLineString[MAX_NUMBER_OF_CHARS_IN_CMD_LINE]="";
  8. char *cmdLineStringPtr = cmdLineString;
  9.  
  10. (test)->isCrashed = 0;
  11. CreateCmdLine((*test).testExePath, &cmdLineStringPtr);
  12. status = CreateProcessSimple(_T(cmdLineString), &procinfo);
  13. if (status == -1)
  14. {
  15. return 1;
  16. }
  17. waitcode = WaitForSingleObject(procinfo.hProcess,
  18. TIME_UNTIL_TIMED_OUT_IN_MILLISEC);
  19. if (waitcode == WAIT_TIMEOUT) /* Process is still alive */
  20. {
  21. strcpy((*test).status, "Timed Out");
  22. CloseHandle(procinfo.hProcess);
  23. CloseHandle(procinfo.hThread);
  24. return 0;
  25. }
  26. crashed = GetExitCodeProcess(procinfo.hProcess, &exitcode);
  27. if (crashed == 0) /* Process is crashed */
  28. {
  29. strcpy((*test).status, "Crashed");
  30. (*test).isCrashed = 1;
  31. (*test).returnedCrashedValue = exitcode;
  32. CloseHandle(procinfo.hProcess);
  33. CloseHandle(procinfo.hThread);
  34. return 0;
  35. }
  36. //strcpy((*test).status, "nadavosh");
  37. CloseHandle(procinfo.hProcess);
  38. CloseHandle(procinfo.hThread);
  39. return CompareFiles(&test);
  40. }
Add Comment
Please, Sign In to add comment