Skip to content

Commit 45d39ca

Browse files
committed
Added wevtutil command to help diagnose "Error 14001" errors
1 parent e603227 commit 45d39ca

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

MTADiag/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
#include <vector>
2323
#include "Log.h"
2424

25-
#define VERSION "2.3.2"
25+
#define VERSION "2.3.3"
2626

2727
#endif

MTADiag/Diag.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void Diag::Begin ( void )
7272
#endif
7373
DoSystemCommandWithOutput ( "tasklist >" );
7474
DoSystemCommandWithOutput ( "ipconfig /all >" );
75+
DoSystemCommandWithOutput ( "wevtutil qe Application /q:\"Event [System [(Level=2)] ] [EventData [(Data='Multi Theft Auto.exe')] ]\" /c:1 /f:text /rd:true >" );
7576

7677
Log::WriteFileToLog ( MTAPath + "\\MTA\\core.log", "core.log" );
7778
Log::WriteFileToLog ( MTAPath + "\\MTA\\logfile.txt", "logfile.txt" );
@@ -81,9 +82,9 @@ void Diag::Begin ( void )
8182
QueryWMIC ( "Path", "Win32_VideoController", "Get" );
8283

8384
ExportRegKeyToFile ( CompatModeRegKey1 );
84-
TrimCompatabilityExport ( files[1] );
85+
TrimCompatabilityExport();
8586
ExportRegKeyToFile ( CompatModeRegKey2 );
86-
TrimCompatabilityExport ( files[1] );
87+
TrimCompatabilityExport();
8788

8889
GetDir ( ( MTAPath + "\\MTA" ) );
8990
GetDir ( GTAPath );
@@ -115,7 +116,7 @@ void Diag::Cleanup ( void )
115116
{
116117
// clean up after ourselves
117118
// start at 1 since 0 is the generated log's path; we still need that
118-
for (int i = 1; i < ( signed ) files.size() - 1; i++)
119+
for (int i = 1; i < ( signed ) files.size() - 1; i++) // don't delete D3DX9_43.dll
119120
remove ( files[i].c_str() );
120121
}
121122

@@ -329,6 +330,7 @@ void Diag::UpdateMTA ( void )
329330
{
330331
std::cout << "Enjoy playing MTA!" << std::endl;
331332
Cleanup();
333+
remove ( Diag::files[0].c_str() ); // remove the generated MTADiag log
332334
system ( "pause" );
333335
exit ( EXIT_SUCCESS );
334336
}
@@ -346,10 +348,10 @@ void Diag::UpdateDirectX ( void )
346348
std::cout << "DirectX is not up-to-date." << std::endl;
347349
std::cout << "Downloading web updater..." << std::endl;
348350

349-
if ( Curl::DownloadFile( DXWebSetupURL.c_str(), DXWebSetupPath.c_str() ) )
351+
if ( Curl::DownloadFile ( DXWebSetupURL.c_str(), DXWebSetupPath.c_str() ) )
350352
{
351353
std::cout << std::endl << "Follow the instructions to update DirectX." << std::endl << std::endl;
352-
system( DXWebSetupPath.c_str() );
354+
system ( DXWebSetupPath.c_str() );
353355
}
354356
else
355357
{
@@ -422,12 +424,12 @@ void Diag::ExportRegKeyToFile ( std::string subkey )
422424
system ( ExportReg.c_str() );
423425
}
424426

425-
void Diag::TrimCompatabilityExport ( std::string filePath )
427+
void Diag::TrimCompatabilityExport ( void )
426428
{
427429
std::ifstream file;
428430
std::string line;
429431

430-
file.open ( filePath.c_str(), std::ios::in );
432+
file.open ( files[1].c_str(), std::ios::in );
431433

432434
if ( file )
433435
{

MTADiag/Diag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace Diag {
6868
void DoSystemCommandWithOutput ( std::string command );
6969
void GetDir ( std::string directory );
7070
void ExportRegKeyToFile ( std::string subkey );
71-
void TrimCompatabilityExport ( std::string filePath );
71+
void TrimCompatabilityExport ( void );
7272
void QueryWMIC ( std::string, std::string = "", std::string = "", std::string = "" );
7373

7474
// used for storing environment variables, current system time, files, and some paths

MTADiag/Log.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ bool Log::WriteFileToLog ( std::string filePath, std::string itemName )
3636
return false;
3737
}
3838

39+
if ( file.peek() == EOF ) { return false; }
40+
3941
// trim any trailing spaces or ">" from system command piping from the item name
4042
std::string garbage ( " >" );
4143
size_t found;

0 commit comments

Comments
 (0)