[Win32/CrashHandlerChild] Crashlog and log now open in the player's default text editor. Also, the Show Log button works again, including for people using Portable.ini.

This commit is contained in:
AJ Kelly
2011-07-20 23:37:00 -05:00
parent 3502a3c29b
commit bc8d340801
2 changed files with 23 additions and 33 deletions
+6
View File
@@ -8,6 +8,12 @@ ________________________________________________________________________________
StepMania 5.0 ????????? | 20110??? StepMania 5.0 ????????? | 20110???
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2011/07/20
----------
* [Win32/CrashHandlerChild] Crashlog and log now open in the player's default
text editor. Also, the Show Log button works again, including for people using
Portable.ini. [AJ]
2011/07/19 2011/07/19
---------- ----------
* [LoadingWindow] Added the ability for themes to have custom splash banners. * [LoadingWindow] Added the ability for themes to have custom splash banners.
+16 -32
View File
@@ -8,6 +8,7 @@
#include "archutils/Win32/ddk/dbghelp.h" #include "archutils/Win32/ddk/dbghelp.h"
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <shellapi.h>
#include "arch/ArchHooks/ArchHooks.h" #include "arch/ArchHooks/ArchHooks.h"
#include "archutils/Win32/WindowsResources.h" #include "archutils/Win32/WindowsResources.h"
@@ -17,6 +18,7 @@
#include "archutils/Win32/RestartProgram.h" #include "archutils/Win32/RestartProgram.h"
#include "archutils/Win32/CrashHandlerNetworking.h" #include "archutils/Win32/CrashHandlerNetworking.h"
#include "archutils/Win32/WindowsDialogBox.h" #include "archutils/Win32/WindowsDialogBox.h"
#include "archutils/Win32/SpecialDirs.h"
#include "ProductInfo.h" #include "ProductInfo.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "XmlFile.h" #include "XmlFile.h"
@@ -80,7 +82,6 @@ namespace VDDebugInfo
pctx->sRawBlock = sBufOut; pctx->sRawBlock = sBufOut;
} }
const unsigned char *src = (const unsigned char *) pctx->sRawBlock.data(); const unsigned char *src = (const unsigned char *) pctx->sRawBlock.data();
pctx->pRVAHeap = NULL; pctx->pRVAHeap = NULL;
@@ -252,7 +253,6 @@ bool ReadFromParent( int fd, void *p, int size )
return true; return true;
} }
// General symbol lookup; uses VDDebugInfo for detailed information within the // General symbol lookup; uses VDDebugInfo for detailed information within the
// process, and DbgHelp for simpler information about loaded DLLs. // process, and DbgHelp for simpler information about loaded DLLs.
namespace SymbolLookup namespace SymbolLookup
@@ -356,7 +356,6 @@ namespace SymbolLookup
return; return;
} }
RString sName = CrashChildGetModuleBaseName( (HMODULE)meminfo.AllocationBase ); RString sName = CrashChildGetModuleBaseName( (HMODULE)meminfo.AllocationBase );
DWORD64 disp; DWORD64 disp;
@@ -491,33 +490,6 @@ static void DoSave( const RString &sReport )
SetFileAttributes( sName, FILE_ATTRIBUTE_READONLY ); SetFileAttributes( sName, FILE_ATTRIBUTE_READONLY );
} }
void ViewWithNotepad(const char *str)
{
char buf[256] = "";
strcat( buf, "notepad.exe " );
strcat( buf, str );
RString cwd = SpliceProgramPath( "" );
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
CreateProcess(
NULL, // pointer to name of executable module
buf, // pointer to command line string
NULL, // process security attributes
NULL, // thread security attributes
false, // handle inheritance flag
0, // creation flags
NULL, // pointer to new environment block
cwd, // pointer to current directory name
&si, // pointer to STARTUPINFO
&pi // pointer to PROCESS_INFORMATION
);
}
bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data ) bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
{ {
_setmode( _fileno(stdin), O_BINARY ); _setmode( _fileno(stdin), O_BINARY );
@@ -723,10 +695,22 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
// EndDialog(hDlg, TRUE); // don't always exit on ENTER // EndDialog(hDlg, TRUE); // don't always exit on ENTER
return TRUE; return TRUE;
case IDC_VIEW_LOG: case IDC_VIEW_LOG:
ViewWithNotepad("../log.txt"); {
RString sLogPath;
FILE *pFile = fopen( SpliceProgramPath("../Portable.ini"), "r" );
if(pFile != NULL)
{
sLogPath = SpliceProgramPath("../Logs/log.txt");
fclose( pFile );
}
else
sLogPath = SpecialDirs::GetAppDataDir() + PRODUCT_ID +"/Logs/log.txt";
ShellExecute( NULL, "open", sLogPath, "", "", SW_SHOWNORMAL );
}
break; break;
case IDC_CRASH_SAVE: case IDC_CRASH_SAVE:
ViewWithNotepad("../crashinfo.txt"); ShellExecute( NULL, "open", SpliceProgramPath("../crashinfo.txt"), "", "", SW_SHOWNORMAL );
return TRUE; return TRUE;
case IDC_BUTTON_RESTART: case IDC_BUTTON_RESTART:
Win32RestartProgram(); Win32RestartProgram();