[GME-commit] GMESRC/GME/Gme CrashTest.cpp, NONE, 1.1 CrashTest.h, NONE, 1.1 ExceptionHandler.cpp, NONE, 1.1 ExceptionHandler.h, NONE, 1.1 GME.rc, 1.167, 1.168 GME.vcproj, 1.7, 1.8 GMEApp.cpp, 1.150, 1.151 GMEApp.h, 1.40, 1.41 MainFrm.cpp, 1.41, 1.42 MainFrm.h, 1.31, 1.32 resource.h, 1.78, 1.79

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Tue Apr 8 16:30:47 CDT 2008


Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv25064/Gme

Modified Files:
	GME.rc GME.vcproj GMEApp.cpp GMEApp.h MainFrm.cpp MainFrm.h 
	resource.h 
Added Files:
	CrashTest.cpp CrashTest.h ExceptionHandler.cpp 
	ExceptionHandler.h 
Log Message:
Foundations of Exception handling code and MiniDump writing.
Currently disabled.


CVS User:  (csaba)

Index: GMEApp.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEApp.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** GMEApp.h	7 Feb 2008 22:54:48 -0000	1.40
--- GMEApp.h	8 Apr 2008 21:30:45 -0000	1.41
***************
*** 72,76 ****
  	virtual int Run();
  	static void EmergencyTerminate();
! 	void EmergencySave();
  	bool proj_type_is_mga;
  	bool proj_type_is_xmlbackend;
--- 72,76 ----
  	virtual int Run();
  	static void EmergencyTerminate();
! 	bool EmergencySave();
  	bool proj_type_is_mga;
  	bool proj_type_is_xmlbackend;

Index: MainFrm.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MainFrm.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** MainFrm.cpp	13 Feb 2008 19:00:15 -0000	1.41
--- MainFrm.cpp	8 Apr 2008 21:30:45 -0000	1.42
***************
*** 12,15 ****
--- 12,16 ----
  #include "..\XmlBackEnd\svauto.h"
  #include ".\mainfrm.h"
+ #include "CrashTest.h"
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 89,92 ****
--- 90,98 ----
  	ON_COMMAND(ID_VIEW_CLEARCONSOLE, OnViewClearConsole)
  	ON_UPDATE_COMMAND_UI(ID_VIEW_CLEARCONSOLE, OnUpdateViewClearConsole)
+ 	ON_COMMAND(ID_CRASHTEST_ILLEGALWRITE, OnCrashTestIllegalWrite)
+ 	ON_COMMAND(ID_CRASHTEST_ILLEGALREAD, OnCrashTestIllegalRead)
+ 	ON_COMMAND(ID_CRASHTEST_ILLEGALREADINCRUNTIME, OnCrashTestIllegalReadInCRuntime)
+ 	ON_COMMAND(ID_CRASHTEST_ILLEGALCODEREAD, OnCrashTestIllegalCodeRead)
+ 	ON_COMMAND(ID_CRASHTEST_DIVIDEBYZERO, OnCrashTestDivideByZero)
  	ON_WM_CLOSE()
  	ON_WM_DROPFILES()
***************
*** 995,998 ****
--- 1001,1029 ----
  {
  	pCmdUI->Enable();
+ }
+ 
+ void CMainFrame::OnCrashTestIllegalWrite(void) 
+ {
+ 	CrashTest::IllegalWrite();
+ }
+ 
+ void CMainFrame::OnCrashTestIllegalRead(void) 
+ {
+ 	CrashTest::IllegalRead();
+ }
+ 
+ void CMainFrame::OnCrashTestIllegalReadInCRuntime(void) 
+ {
+ 	CrashTest::IllegalReadInCRuntime();
+ }
+ 
+ void CMainFrame::OnCrashTestIllegalCodeRead(void) 
+ {
+ 	CrashTest::IllegalCodeRead();
+ }
+ 
+ void CMainFrame::OnCrashTestDivideByZero(void) 
+ {
+ 	CrashTest::DivideByZero();
  }
  

Index: MainFrm.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MainFrm.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** MainFrm.h	13 Feb 2008 21:23:58 -0000	1.31
--- MainFrm.h	8 Apr 2008 21:30:45 -0000	1.32
***************
*** 136,139 ****
--- 136,144 ----
  	afx_msg void OnViewClearConsole();
  	afx_msg void OnUpdateViewClearConsole( CCmdUI* pCmdUI);
+ 	afx_msg void OnCrashTestIllegalWrite();
+ 	afx_msg void OnCrashTestIllegalRead();
+ 	afx_msg void OnCrashTestIllegalReadInCRuntime();
+ 	afx_msg void OnCrashTestIllegalCodeRead();
+ 	afx_msg void OnCrashTestDivideByZero();
  	afx_msg void CMainFrame::OnClose();
  	afx_msg void OnDropFiles(HDROP);

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/resource.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** resource.h	27 Mar 2008 21:43:08 -0000	1.78
--- resource.h	8 Apr 2008 21:30:45 -0000	1.79
***************
*** 424,427 ****
--- 424,433 ----
  #define ID_PORTCNTX_REVERSECONNECTION   33071
  #define ID_PORTCNTX_FOLLOWCONNECTION    33072
+ #define ID_DEBUG_CRASHTEST              33080
+ #define ID_CRASHTEST_ILLEGALWRITE       33081
+ #define ID_CRASHTEST_ILLEGALREAD        33082
+ #define ID_CRASHTEST_ILLEGALREADINCRUNTIME 33083
+ #define ID_CRASHTEST_ILLEGALCODEREAD    33084
+ #define ID_CRASHTEST_DIVIDEBYZERO       33085
  #define IDW_TOOLBAR_MAIN                0xE820
  #define IDW_TOOLBAR_WINS                0xE821
***************
*** 436,440 ****
  #define _APS_3D_CONTROLS                     1
  #define _APS_NEXT_RESOURCE_VALUE        218
! #define _APS_NEXT_COMMAND_VALUE         33073
  #define _APS_NEXT_CONTROL_VALUE         1125
  #define _APS_NEXT_SYMED_VALUE           115
--- 442,446 ----
  #define _APS_3D_CONTROLS                     1
  #define _APS_NEXT_RESOURCE_VALUE        218
! #define _APS_NEXT_COMMAND_VALUE         33086
  #define _APS_NEXT_CONTROL_VALUE         1125
  #define _APS_NEXT_SYMED_VALUE           115

--- NEW FILE: ExceptionHandler.h ---
/////////////////////////////////////////////////////////////////////////////
//
// ExceptionHandler.h : Exception handler filter,
//						minidump and XML crash dump writer
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(EXCEPTION_HANDLER_INCLUDED)
#define EXCEPTION_HANDLER_INCLUDED

//////////////////////////////////////////////////////////////////////////////
// Includes
//////////////////////////////////////////////////////////////////////////////

#include <Windows.h>
#include <DbgHelp.h>
#include <vector>


//////////////////////////////////////////////////////////////////////////////
// Types
//////////////////////////////////////////////////////////////////////////////

enum BasicType {	// Stolen from CVCONST.H in the DIA 2.0 SDK
	btNoType	= 0,
	btVoid		= 1,
	btChar		= 2,
	btWChar		= 3,
	btInt		= 6,
	btUInt		= 7,
	btFloat		= 8,
	btBCD		= 9,
	btBool		= 10,
	btLong		= 13,
	btULong		= 14,
	btCurrency	= 25,
	btDate		= 26,
	btVariant	= 27,
	btComplex	= 28,
	btBit		= 29,
	btBSTR		= 30,
	btHresult	= 31
};


//============================================================
// XMLTag
// Helper function for writing the XML format data
//============================================================
class XMLTag
{
	std::vector<CString>&	m_openedXmlTags;
	CString&				m_UserCrashData;
	bool					m_closed;

	void AddTabs(void);
	void AddTabs(DWORD tabCount);
	void AddRawText(CString text);
	void PrintTag(const TCHAR* tagString, bool open, bool withTabs, bool nl);

public:
	XMLTag(const TCHAR* tagString, std::vector<CString>& openedXmlTags, CString& userCrashData);
	XMLTag(const TCHAR* tagString, const TCHAR* text, std::vector<CString>& openedXmlTags, CString& userCrashData);
	XMLTag(const TCHAR* tagString, const WCHAR* text, std::vector<CString>& openedXmlTags, CString& userCrashData);
	XMLTag(const TCHAR* tagString, DWORD value, const TCHAR* formatString, std::vector<CString>& openedXmlTags,
		   CString& userCrashData);
	XMLTag(const TCHAR* tagString, std::vector<CString>& openedXmlTags, CString& userCrashData,
		   DWORD64 value, const TCHAR* formatString);
	XMLTag(const TCHAR* tagString, DWORD value, std::vector<CString>& openedXmlTags, CString& userCrashData);
	~XMLTag();

	void OpenTag(const TCHAR* tagString, bool withTabs = true, bool nl = true);
	void Print(const TCHAR* text);
	void Println(const TCHAR* text);
	void Append(const TCHAR* text);
	void Appendln(const TCHAR* text);
	void CloseTag(bool withTabs = true, bool nl = true);
};


//============================================================
// ExceptionHandler
// UnhandledExceptionFilter and helper functions and members
//============================================================
class ExceptionHandler
{
	static LPTOP_LEVEL_EXCEPTION_FILTER	m_previousFilter;
	static bool							m_FirstUnhandledExceptionFilterFired;
	static SYSTEMTIME					m_sessionStart;
	static OSVERSIONINFO				m_osVers;
	static BOOL							m_gotVersionInfo;
	static BOOL							m_wow64Process;
	static HANDLE						m_hProcess;
	static CRITICAL_SECTION				m_crashDumpLock;
	static bool							m_createMinidump;
	static TCHAR						m_szMinidumpDir[MAX_PATH];
	static MINIDUMP_TYPE				m_minidumpType;

	static HMODULE						m_hDbgHelpDll;
	static CString						m_UserCrashData;
	static CString						m_FaultingModuleName;
	static std::vector<CString>			m_openedXmlTags;
	static UINT							m_maxStackDepth;
	static UINT							m_maxTypeDumpDepth;

public:
	ExceptionHandler(void);
	~ExceptionHandler(void);

	static LONG WINAPI		UnhandledExceptionFilterOfMain(unsigned long xcptnum, PEXCEPTION_POINTERS pExp);
	static LONG WINAPI		UnhandledExceptionFilter(PEXCEPTION_POINTERS pExp);

private:
	static void				UnhandledExceptionFilterCore (const char* msg, PEXCEPTION_POINTERS pExp);

	static void				LoadDbgHelpDll(void);
	static void				GenerateFileName(TCHAR* pGeneratedFilePath);
	static void				GenerateMiniDump(PEXCEPTION_POINTERS pExceptionInfo, TCHAR* miniDumpPath);
	static void				GenerateUserStreamData(const char* msg, PEXCEPTION_POINTERS pExceptionInfo);

//	static void				LogComputerInfo(void);
	static void				LogProgramInfo(void);
//	static void				LogSystemTime(SYSTEMTIME sysTime, const TCHAR* timeName);
	static void				LogOSInfo(void);
	static void				LogExceptionInfo(const char* msg, PEXCEPTION_RECORD pExceptionRecord);
	static void				LogRegisters(PCONTEXT pContextRecord);
	static void				LogFloatRegisters(PCONTEXT pContextRecord, DWORD exceptionCode);
	static void				LogCallStack(PCONTEXT pContextRecord, bool bWriteVariables);

	static LPCTSTR			GetExceptionString(DWORD exceptionCode);
	static BOOL				GetLogicalAddress(PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD& offset);
	static BOOL				GetVersionString(HINSTANCE hModul, char* versionString);

	static BOOL CALLBACK	EnumerateSymbolsCallback(PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext);
	static bool				FormatSymbolValue(PSYMBOL_INFO pSym, STACKFRAME* sf);
	static bool				DumpTypeIndex(DWORD64 modBase, DWORD dwTypeIndex, DWORD_PTR offset, UINT level);
	static void				FormatOutputValue(BasicType basicType, DWORD64 length, PVOID pAddress);
	static BasicType		GetBasicType(DWORD typeIndex, DWORD64 modBase);
};

#endif // !defined(EXCEPTION_HANDLER_INCLUDED)

Index: GMEApp.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEApp.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -C2 -d -r1.150 -r1.151
*** GMEApp.cpp	20 Feb 2008 22:07:40 -0000	1.150
--- GMEApp.cpp	8 Apr 2008 21:30:45 -0000	1.151
***************
*** 28,31 ****
--- 28,32 ----
  #include "GMEEventLogger.h"
  #include "GMEPrintDialog.h"
+ #include "ExceptionHandler.h"
  
  #ifdef _DEBUG
***************
*** 386,415 ****
  // CGMEApp emergency
  
! void CGMEApp::EmergencyTerminate() {
  	theApp.EmergencySave();
  }
  
! void CGMEApp::EmergencySave() {
! 	
  	CGMEEventLogger::LogGMEEvent("EMERGENCY EVENT\r\n");
! 	if(mgaProject && (proj_type_is_mga||proj_type_is_xmlbackend)) {
  		CString embackupname = currentConnection;
  		int p = embackupname.ReverseFind('.');
! 		if((p == -1) || embackupname.Find('\\',p) != -1) p = embackupname.GetLength();
  		CString emcode("-emergency");
  		static emnum;
  		char emfield[10];
! 		sprintf(emfield,"%d",++emnum);
  		emcode += emfield;
! 		embackupname.Insert(p,emcode);
  #pragma warning(disable: 4310) // cast truncates constant value
  		HRESULT hr = mgaProject->Save(PutInBstr(embackupname), VARIANT_TRUE);
  #pragma warning(default: 4310) // cast truncates constant value
! 		if( proj_type_is_xmlbackend) 
! 		{
  			AfxMessageBox("Emergency event. Please, restart GME. Your current work is found in the local checkout directory.");
! 		}
! 		else 
! 		{
  			char buf[200];
  			sprintf(buf, "Emergency event. Your current work %s been saved to %s.\nThe original project file has not been modified.\nWe apologize for the inconvenience.", (hr == S_OK)? "has" : "may have", embackupname);
--- 387,415 ----
  // CGMEApp emergency
  
! void CGMEApp::EmergencyTerminate()
! {
  	theApp.EmergencySave();
  }
  
! bool CGMEApp::EmergencySave()
! {	
  	CGMEEventLogger::LogGMEEvent("EMERGENCY EVENT\r\n");
! 	if (mgaProject && (proj_type_is_mga || proj_type_is_xmlbackend)) {
  		CString embackupname = currentConnection;
  		int p = embackupname.ReverseFind('.');
! 		if ((p == -1) || embackupname.Find('\\', p) != -1)
! 			p = embackupname.GetLength();
  		CString emcode("-emergency");
  		static emnum;
  		char emfield[10];
! 		sprintf(emfield, "%d", ++emnum);
  		emcode += emfield;
! 		embackupname.Insert(p, emcode);
  #pragma warning(disable: 4310) // cast truncates constant value
  		HRESULT hr = mgaProject->Save(PutInBstr(embackupname), VARIANT_TRUE);
  #pragma warning(default: 4310) // cast truncates constant value
! 		if (proj_type_is_xmlbackend) {
  			AfxMessageBox("Emergency event. Please, restart GME. Your current work is found in the local checkout directory.");
! 		} else {
  			char buf[200];
  			sprintf(buf, "Emergency event. Your current work %s been saved to %s.\nThe original project file has not been modified.\nWe apologize for the inconvenience.", (hr == S_OK)? "has" : "may have", embackupname);
***************
*** 419,434 ****
  			m_RecentProjectList.WriteList();
  		}
  	}
! 	else AfxMessageBox("Emergency event. Please, restart GME.");
  }
  
! int CGMEApp::Run() {
! 	if(bNoProtect) return CWinApp::Run();
! 	else while(true) {
! 		try {
  			return CWinApp::Run();
! 		} catch(...) {
  			EmergencySave();
! 			
  			// Modified by Peter:let's exit after emergency event
  			abort_on_close = true;
--- 419,441 ----
  			m_RecentProjectList.WriteList();
  		}
+ 	} else {
+ 		AfxMessageBox("Emergency event. Please, restart GME.");
  	}
! 	return true;
  }
  
! int CGMEApp::Run()
! {
! 	if(bNoProtect) {
! 		return CWinApp::Run();
! 	} else {
! 		__try {
! 			OutputDebugString("CWinApp::Run\n");
  			return CWinApp::Run();
! 		}
! 		__except(ExceptionHandler::UnhandledExceptionFilterOfMain(GetExceptionCode(), GetExceptionInformation())) {
  			EmergencySave();
! 
! 
  			// Modified by Peter:let's exit after emergency event
  			abort_on_close = true;

Index: GME.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GME.vcproj,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** GME.vcproj	18 Mar 2008 19:20:29 -0000	1.7
--- GME.vcproj	8 Apr 2008 21:30:45 -0000	1.8
***************
*** 48,53 ****
  				SuppressStartupBanner="TRUE"
  				AdditionalLibraryDirectories="..\lib"
! 				GenerateDebugInformation="FALSE"
! 				ProgramDatabaseFile=""
  				GenerateMapFile="TRUE"
  				MapFileName=".\Release/GME.map"
--- 48,53 ----
  				SuppressStartupBanner="TRUE"
  				AdditionalLibraryDirectories="..\lib"
! 				GenerateDebugInformation="TRUE"
! 				ProgramDatabaseFile=".\Release/GME.pdb"
  				GenerateMapFile="TRUE"
  				MapFileName=".\Release/GME.map"
***************
*** 412,415 ****
--- 412,418 ----
  			</File>
  			<File
+ 				RelativePath=".\CrashTest.cpp">
+ 			</File>
+ 			<File
  				RelativePath="DynMenu.cpp">
  				<FileConfiguration
***************
*** 456,459 ****
--- 459,465 ----
  			</File>
  			<File
+ 				RelativePath=".\ExceptionHandler.cpp">
+ 			</File>
+ 			<File
  				RelativePath="GME.rc">
  				<FileConfiguration
***************
*** 1469,1476 ****
--- 1475,1491 ----
  			</File>
  			<File
+ 				RelativePath=".\CrashTest.h">
+ 			</File>
+ 			<File
  				RelativePath=".\DynMenu.h">
  			</File>
  			<File
  				RelativePath="EnumVar.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\ExceptionHandler.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\ExceptionXMLTags.h">
  			</File>
  			<File

--- NEW FILE: CrashTest.h ---
/////////////////////////////////////////////////////////////////////////////
//
// CrashTest.h : Nasty functions which cause various crashes
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(CRASH_TEST_INCLUDED)
#define CRASH_TEST_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CrashTest
{
public:
	CrashTest();
	~CrashTest();

	static void IllegalWrite(void);
	static void IllegalRead(void);
	static void IllegalReadInCRuntime(void);
	static void IllegalCodeRead(void);
	static void DivideByZero(void);
};

#endif // !defined(CRASH_TEST_INCLUDED)
--- NEW FILE: ExceptionHandler.cpp ---
/////////////////////////////////////////////////////////////////////////////
//
// ExceptionHandler.cpp : Exception handler filter,
//						  minidump and XML crash dump writer
//
// Thanks to:
// Johen Kalbach:
//	Walking the callstack
//	http://www.codeproject.com/KB/threads/StackWalker.aspx
//	http://blog.kalmbach-software.de/
//
// Matt Pietrek's various Exception Handling Courses on MSJ (MS Journal) and MSDN Magazine:
//	A Crash Course on the Depths of Win32 Structured Exception Handling, January 1997
//	http://www.microsoft.com/msj/0197/Exception/Exception.aspx
//	Under The Hood April 1997
//	http://www.microsoft.com/msj/0497/hood/hood0497.aspx
//	Under The Hood May 1997
//	http://www.microsoft.com/msj/0597/hood0597.aspx
//	March 2002 issue of MSDN Magazine: Improved Error Reporting with DBGHELP 5.1 APIs
[...1386 lines suppressed...]
}


BasicType ExceptionHandler::GetBasicType(DWORD typeIndex, DWORD64 modBase)
{
	BasicType basicType;
	if (pSymGetTypeInfo(m_hProcess, modBase, typeIndex, TI_GET_BASETYPE, &basicType))
		return basicType;

	// Get the real "TypeId" of the child.  We need this for the
	// SymGetTypeInfo( TI_GET_TYPEID ) call below.
	DWORD typeId;
	if (pSymGetTypeInfo(m_hProcess,modBase, typeIndex, TI_GET_TYPEID, &typeId)) {
		if (pSymGetTypeInfo(m_hProcess, modBase, typeId, TI_GET_BASETYPE, &basicType))
			return basicType;
	}

	return btNoType;
}


Index: GME.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GME.rc,v
retrieving revision 1.167
retrieving revision 1.168
diff -C2 -d -r1.167 -r1.168
*** GME.rc	27 Mar 2008 21:43:08 -0000	1.167
--- GME.rc	8 Apr 2008 21:30:45 -0000	1.168
***************
*** 243,246 ****
--- 243,264 ----
          MENUITEM "&About GME...",               ID_APP_ABOUT
      END
+ #ifdef _DEBUG
+     POPUP "&Debug"
+     BEGIN
+         POPUP "Crash Test"
+         BEGIN
+             MENUITEM "Illegal write",               ID_CRASHTEST_ILLEGALWRITE
+ 
+             MENUITEM "Illegal Read",                ID_CRASHTEST_ILLEGALREAD
+             MENUITEM "Illegal Read in C runtime",   ID_CRASHTEST_ILLEGALREADINCRUNTIME
+ 
+             MENUITEM "Illegal code read (jump to zero address)", 
+                                                     ID_CRASHTEST_ILLEGALCODEREAD
+ 
+             MENUITEM "Divide by zero",              ID_CRASHTEST_DIVIDEBYZERO
+ 
+         END
+     END
+ #endif
  END
  
***************
*** 362,365 ****
--- 380,401 ----
          MENUITEM "&Arrange Icons",              ID_WINDOW_ARRANGE
      END
+ #ifdef _DEBUG
+     POPUP "&Debug"
+     BEGIN
+         POPUP "Crash Test"
+         BEGIN
+             MENUITEM "Illegal write",               ID_CRASHTEST_ILLEGALWRITE
+ 
+             MENUITEM "Illegal Read",                ID_CRASHTEST_ILLEGALREAD
+             MENUITEM "Illegal Read in C runtime",   ID_CRASHTEST_ILLEGALREADINCRUNTIME
+ 
+             MENUITEM "Illegal code read (jump to zero address)", 
+                                                     ID_CRASHTEST_ILLEGALCODEREAD
+ 
+             MENUITEM "Divide by zero",              ID_CRASHTEST_DIVIDEBYZERO
+ 
+         END
+     END
+ #endif
      POPUP "&Help"
      BEGIN
***************
*** 1645,1651 ****
  STRINGTABLE 
  BEGIN
!     ID_FILE_PRINTSEL        "Print the selected models\\Print Selected"
      ID_FILE_PRINTALL        "Print all models in the document\nPrint All"
!     IDC_PRINT_METAFILE      "Print the active document to a Metafile\nPrint to Metafile"
      ID_VIEW_PANNWIN         "Toggle Panning Window\nPanning Window"
  END
--- 1681,1687 ----
  STRINGTABLE 
  BEGIN
!     ID_FILE_PRINTSEL        "Print the selected models\nPrint Selected"
      ID_FILE_PRINTALL        "Print all models in the document\nPrint All"
!     ID_PRINT_METAFILE       "Print the active document to a Metafile\nPrint to Metafile"
      ID_VIEW_PANNWIN         "Toggle Panning Window\nPanning Window"
  END

--- NEW FILE: CrashTest.cpp ---
/////////////////////////////////////////////////////////////////////////////
//
// CrashTest.cpp : Nasty functions which cause various crashes
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "CrashTest.h"

static	CrashTest	g_CrashTester;	// Global instance of CrashTest

CrashTest::CrashTest()
{
}

CrashTest::~CrashTest()
{
}

void CrashTest::IllegalWrite(void)
{
	char *p = 0;	// Null pointer.
	char x = 0;

	*p = x;
}

void CrashTest::IllegalRead(void)
{
	char *p = 0;	// Null pointer.
	char x = 0;

	x = *p;
}

void CrashTest::IllegalReadInCRuntime(void)
{
	strcpy(0, 0);
}

typedef void (*tBogusFunction)();

void CrashTest::IllegalCodeRead(void)
{
	tBogusFunction BadFunc = (tBogusFunction) 0;
	BadFunc();
}

void CrashTest::DivideByZero(void)
{
	int y = 0;

	y = y / y;
}




More information about the GME-commit mailing list