Skip to content

Commit

Permalink
Add files to demo Issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lake committed Jun 14, 2017
1 parent 7601ccc commit c8dd81c
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
17 changes: 17 additions & 0 deletions issues/issue_1/issue1.sln
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions issues/issue_1/issue1.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{98F558E5-0CA9-4F20-AC75-23F7358BD525}</ProjectGuid>
<RootNamespace>issue1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
47 changes: 47 additions & 0 deletions issues/issue_1/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <windows.h>
#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 );
}

0 comments on commit c8dd81c

Please sign in to comment.