@@ -161,7 +161,12 @@ void Diag::Begin ( void )
161
161
162
162
// gather the most useful system information first
163
163
#ifndef SKIPDXDIAG
164
- DoSystemCommandWithOutput ( std::string ( " dxdiag /t " ) + files[FILE_TEMP], OUTPUT_NONE );
164
+ if ( DoSystemCommandWithOutput ( std::string ( " dxdiag /dontskip /whql:off /t " ) + files[FILE_TEMP], OUTPUT_NONE, 120000 ) == WAIT_TIMEOUT )
165
+ {
166
+ // If timed out, try again but allow dxdiag to skip problem area
167
+ ProgressBar ( 5 );
168
+ DoSystemCommandWithOutput ( std::string ( " dxdiag /whql:off /t " ) + files[FILE_TEMP], OUTPUT_NONE, 120000 );
169
+ }
165
170
ProgressBar ( 10 );
166
171
#endif
167
172
DoSystemCommandWithOutput ( " tasklist" , OUTPUT_ANSI, 120000 );
@@ -589,7 +594,7 @@ void Diag::GetDir ( std::string directory )
589
594
Log::WriteFileToLog ( files[FILE_TEMP].c_str (), ( directory + " directory listing" ) ); // write the result to the log file with a description
590
595
}
591
596
592
- void Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWORD maxTimeMs )
597
+ DWORD Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWORD maxTimeMs )
593
598
{
594
599
Log::WriteDividerToLog ();
595
600
time_t startTime = time ( NULL );
@@ -631,6 +636,7 @@ void Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWOR
631
636
632
637
ret = CreateProcess ( NULL , (LPSTR)command.c_str (), NULL , NULL , TRUE , flags, NULL , NULL , &si, &pi );
633
638
639
+ DWORD status = ERROR_INVALID_FUNCTION;
634
640
std::stringstream ss;
635
641
if ( ret == 0 )
636
642
{
@@ -640,7 +646,6 @@ void Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWOR
640
646
else
641
647
{
642
648
// Apply time limit for command to complete
643
- DWORD status = 1 ;
644
649
for ( unsigned int i = 0 ; i < maxTimeMs ; i += 100 )
645
650
{
646
651
status = WaitForSingleObject ( pi.hProcess , 100 );
@@ -652,6 +657,7 @@ void Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWOR
652
657
{
653
658
TerminateProcess ( pi.hProcess , 1 );
654
659
ss << command << " - ERROR: Unable to complete - timed out after " << maxTimeMs << " ms" ;
660
+ Sleep ( 1000 );
655
661
}
656
662
else
657
663
if ( status != ERROR_SUCCESS )
@@ -681,4 +687,6 @@ void Diag::DoSystemCommandWithOutput ( std::string command, int outputType, DWOR
681
687
Log::WriteFileToLog ( files[FILE_WMIC_UNI], ss.str () );
682
688
remove ( files[FILE_WMIC_UNI].c_str () );
683
689
}
690
+
691
+ return status;
684
692
}
0 commit comments