Description:
updated box for windows to prevent error modal dialog
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r131:d5c4e1d8daa2 - - 1 file changed: 3 inserted, 0 deleted

@@ -280,48 +280,51
280 FILETIME kernel_time;
280 FILETIME kernel_time;
281 FILETIME user_time;
281 FILETIME user_time;
282 GetProcessTimes(hProcess,
282 GetProcessTimes(hProcess,
283 &creation_time,
283 &creation_time,
284 &exit_time,
284 &exit_time,
285 &kernel_time,
285 &kernel_time,
286 &user_time);
286 &user_time);
287
287
288 SYSTEMTIME sys_kernel_time;
288 SYSTEMTIME sys_kernel_time;
289 SYSTEMTIME sys_user_time;
289 SYSTEMTIME sys_user_time;
290 FileTimeToSystemTime(&kernel_time, &sys_kernel_time);
290 FileTimeToSystemTime(&kernel_time, &sys_kernel_time);
291 FileTimeToSystemTime(&user_time, &sys_user_time);
291 FileTimeToSystemTime(&user_time, &sys_user_time);
292
292
293 double time_used =
293 double time_used =
294 ((sys_kernel_time.wSecond + sys_kernel_time.wMilliseconds/1000.0) +
294 ((sys_kernel_time.wSecond + sys_kernel_time.wMilliseconds/1000.0) +
295 (sys_user_time.wSecond + sys_user_time.wMilliseconds/1000.0));
295 (sys_user_time.wSecond + sys_user_time.wMilliseconds/1000.0));
296 return time_used;
296 return time_used;
297 }
297 }
298
298
299 int execute(char *exname, char *inname, char *outname, double t, int max_mem)
299 int execute(char *exname, char *inname, char *outname, double t, int max_mem)
300 {
300 {
301 STARTUPINFO si;
301 STARTUPINFO si;
302 PROCESS_INFORMATION pi;
302 PROCESS_INFORMATION pi;
303 int ifsuccess = EXE_RESULT_OK;
303 int ifsuccess = EXE_RESULT_OK;
304 +
305 + SetErrorMode(SEM_FAILCRITICALERRORS);
306 + SetErrorMode(SEM_NOGPFAULTERRORBOX);
304
307
305 ZeroMemory(&si, sizeof(si));
308 ZeroMemory(&si, sizeof(si));
306 si.cb = sizeof(si);
309 si.cb = sizeof(si);
307 ZeroMemory(&pi, sizeof(pi));
310 ZeroMemory(&pi, sizeof(pi));
308
311
309 setstartupinfo(&si, inname, outname);
312 setstartupinfo(&si, inname, outname);
310
313
311 if(!CreateProcess( NULL, // No module name (use command line).
314 if(!CreateProcess( NULL, // No module name (use command line).
312 TEXT(exname), // Command line.
315 TEXT(exname), // Command line.
313 NULL, // Process handle not inheritable.
316 NULL, // Process handle not inheritable.
314 NULL, // Thread handle not inheritable.
317 NULL, // Thread handle not inheritable.
315 TRUE, // Set handle inheritance to FALSE.
318 TRUE, // Set handle inheritance to FALSE.
316 0, // No creation flags.
319 0, // No creation flags.
317 NULL, // Use parent's environment block.
320 NULL, // Use parent's environment block.
318 NULL, // Use parent's starting directory.
321 NULL, // Use parent's starting directory.
319 &si, // Pointer to STARTUPINFO structure.
322 &si, // Pointer to STARTUPINFO structure.
320 &pi)) // Pointer to PROCESS_INFORMATION structure.
323 &pi)) // Pointer to PROCESS_INFORMATION structure.
321 {
324 {
322 //printf( "CreateProcess failed (%d).\n", GetLastError() );
325 //printf( "CreateProcess failed (%d).\n", GetLastError() );
323 fprintf(stderr, "Process creation error.\n");
326 fprintf(stderr, "Process creation error.\n");
324 report_stat(0,0);
327 report_stat(0,0);
325 return EXE_RESULT_ERROR;
328 return EXE_RESULT_ERROR;
326 }
329 }
327 //fprintf(stderr,"Process ID: %ld\n",pi.dwProcessId);
330 //fprintf(stderr,"Process ID: %ld\n",pi.dwProcessId);
You need to be logged in to leave comments. Login now