diff --git a/issues/issue_1/issue1.sln b/issues/issue_1/issue1.sln new file mode 100644 index 0000000..799b2ee --- /dev/null +++ b/issues/issue_1/issue1.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "issue1", "issue1.vcxproj", "{98F558E5-0CA9-4F20-AC75-23F7358BD525}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98F558E5-0CA9-4F20-AC75-23F7358BD525}.All|x64.ActiveCfg = All|x64 + {98F558E5-0CA9-4F20-AC75-23F7358BD525}.All|x64.Build.0 = All|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/issues/issue_1/issue1.vcxproj b/issues/issue_1/issue1.vcxproj new file mode 100644 index 0000000..872f135 --- /dev/null +++ b/issues/issue_1/issue1.vcxproj @@ -0,0 +1,48 @@ + + + + + Release + x64 + + + + {98F558E5-0CA9-4F20-AC75-23F7358BD525} + issue1 + + + + Application + false + Unicode + true + + + + + + + + + + + + Level3 + MaxSpeed + true + true + + + false + true + true + Windows + + + + + + + + + \ No newline at end of file diff --git a/issues/issue_1/main.cpp b/issues/issue_1/main.cpp new file mode 100644 index 0000000..49f3a4f --- /dev/null +++ b/issues/issue_1/main.cpp @@ -0,0 +1,47 @@ +#include +#pragma comment( lib, "C:/WinDDK/7600.16385.1/lib/Crt/amd64/msvcrt.lib" ) + +void ReportException( PEXCEPTION_RECORD rec ) +{ + MessageBoxA( NULL, "ReportException Called", "ReportException", MB_OK|MB_ICONINFORMATION ); // Never shown! + ExitProcess( ERRC_EXCEPTION ); // When this line is commented out, the two message boxes are shown correctly +} + +extern "C" WINBASEAPI __out PVOID WINAPI AddVectoredExceptionHandler(__in ULONG First,__in PVECTORED_EXCEPTION_HANDLER Handler); +extern "C" WINBASEAPI ULONG WINAPI RemoveVectoredExceptionHandler(__in PVOID Handle); + +class CCustomExceptions +{ +public: + CCustomExceptions(); + ~CCustomExceptions(); + static LONG WINAPI ExceptionHandler( LPEXCEPTION_POINTERS pExection ); +}; + +static CCustomExceptions __cef; + +CCustomExceptions::CCustomExceptions() +{ + AddVectoredExceptionHandler( 0, ExceptionHandler ); + MessageBoxA( NULL, "AddVectoredExceptionHandler Successful", "CCustomExceptions::CCustomExceptions", MB_OK|MB_ICONINFORMATION ); +} +CCustomExceptions::~CCustomExceptions() +{ + RemoveVectoredExceptionHandler( ExceptionHandler ); + MessageBoxA( NULL, "RemoveVectoredExceptionHandler Successful", "CCustomExceptions::~CCustomExceptions", MB_OK|MB_ICONINFORMATION ); +} + +LONG WINAPI CCustomExceptions::ExceptionHandler( LPEXCEPTION_POINTERS pException ) +{ + MessageBoxA( NULL, "ExceptionHandler Called", "CCustomExceptions::ExceptionHandler", MB_OK|MB_ICONINFORMATION ); // Never shown! + ReportException( pException->ExceptionRecord ); + return NULL; +} + +int APIENTRY WinMain( HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) +{ + MessageBoxA( NULL, "WinMain Called", "WinMain", MB_OK|MB_ICONINFORMATION ); +} +