35 path <<
_T(
"\\cb-crash-recover");
40 path << now.
Format(_T(
"\\%Y%m%d-%H%M%S"));
45 bool AnyFileSaved =
false;
54 wxString fnpath = path + _T(
"/") + fn.GetFullName();
73 buf <<
_(
"The currently opened files have been saved to the directory\n");
75 buf <<
_(
"\nHopefully, this will prevent you from losing recent modifications.\n\n");
85 static bool EditorFilesNotSaved =
true;
86 DWORD code = ExceptionInfo->ExceptionRecord->ExceptionCode;
88 if (code != EXCEPTION_ACCESS_VIOLATION && code != EXCEPTION_ILLEGAL_INSTRUCTION)
89 return EXCEPTION_CONTINUE_SEARCH;
93 buf.
Printf(
_(
"The application encountered a crash at address %u.\n\n"),
94 (
unsigned int) ExceptionInfo->ContextRecord->Eip);
97 if (EditorFilesNotSaved)
100 EditorFilesNotSaved =
false;
103 buf <<
_(
"Now you have three options:\n" 104 "1. Press 'Abort' to pass control back to the system. This will normally display the standard 'application error' message and kill the program.\n" 105 "2. Press 'Ignore' to step over the offending instruction. You may run into another access violation, but if you are lucky enough, you might get to save your work and close the program gracefully.\n" 106 "3. Press 'Retry' to return to the offending instruction (this is almost certain to fail again, but might nevertheless work in rare cases).");
109 switch(MessageBox(0, buf.
c_str(),
_T(
"Woah!"), MB_ABORTRETRYIGNORE))
112 return EXCEPTION_CONTINUE_SEARCH;
117 ExceptionInfo->ContextRecord->Eip += 2;
119 return EXCEPTION_CONTINUE_EXECUTION;
123 return EXCEPTION_CONTINUE_EXECUTION;
128 return EXCEPTION_CONTINUE_SEARCH;
bool wxRmdir(const wxString &dir, int flags=0)
wxFontEncoding GetEncoding() const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
bool wxFileExists(const wxString &filename)
bool wxDirExists(const wxString &dirname)
CrashHandler(bool bDisabled)
bool wxMkdir(const wxString &dir, int perm=wxS_DIR_DEFAULT)
EditorManager * GetEditorManager() const
virtual const wxString & GetFilename() const
Get the editor's filename (if applicable).
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
void CrashHandlerSaveEditorFiles(wxString &buf)
unsigned long(* RemoveHandler_t)(void *)
const wxString & _(const wxString &string)
EditorBase * GetEditor(int index)
cbEditor * GetBuiltinEditor(EditorBase *eb)
LONG WINAPI CrashHandlerFunc(PEXCEPTION_POINTERS ExceptionInfo)
static wxString GetHomeFolder()
DLLIMPORT bool cbSaveToFile(const wxString &filename, const wxString &contents, wxFontEncoding encoding=wxFONTENCODING_SYSTEM, bool bom=false)
Writes a wxString to a file.
void *(* AddHandler_t)(unsigned long, PVECTORED_EXCEPTION_HANDLER)
wxString GetText() const
Retrieve all the text in the document.
int Printf(const wxString &pszFormat,...)
wxString Format(const wxString &format=wxDefaultDateTimeFormat, const TimeZone &tz=Local) const
static wxString Format(const wxString &format,...)