Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.

Commit eff4681

Browse files
author
Johnathon
committed
another big bag of changes
1 parent f463213 commit eff4681

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

NoCrash/NoCrash.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
<ItemGroup>
8282
<ClCompile Include="Source.cpp" />
8383
</ItemGroup>
84+
<ItemGroup>
85+
<ClInclude Include="stdafx.h" />
86+
</ItemGroup>
8487
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
8588
<ImportGroup Label="ExtensionTargets">
8689
</ImportGroup>

NoCrash/NoCrash.vcxproj.filters

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@
1919
<Filter>Source Files</Filter>
2020
</ClCompile>
2121
</ItemGroup>
22+
<ItemGroup>
23+
<ClInclude Include="stdafx.h">
24+
<Filter>Header Files</Filter>
25+
</ClInclude>
26+
</ItemGroup>
2227
</Project>

NoCrash/Source.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
#include <Windows.h>
2-
#include <fstream>
3-
#include <detours.h>
1+
#include "stdafx.h"
42

5-
LONG WINAPI UnhandledException(struct _EXCEPTION_POINTERS *ExceptionInfo);
6-
const char *ExceptionCodeToString(DWORD ExceptionCode);
3+
using namespace std;
74

85
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
96
{
107
switch (ul_reason_for_call)
118
{
129
case DLL_PROCESS_ATTACH:
13-
MessageBox(NULL, "Uh-Oh, Hi there?", "Uh-Oh!", 0);
10+
MessageBox(nullptr, "Hello! I Am The Crash Handler For The Wolf Project\nPlease, If Your Game Crashes Report This On The Discord!\nThere Is A Log In The Games Install Directory.", "Yu-Gi-Oh! Crash Handler", 0);
1411
SetUnhandledExceptionFilter(UnhandledException);
1512
break;
1613
case DLL_THREAD_ATTACH:
@@ -24,21 +21,20 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserve
2421

2522
LONG WINAPI UnhandledException(struct _EXCEPTION_POINTERS *ExceptionInfo)
2623
{
27-
char ErrorAddress[MAX_PATH];
28-
sprintf_s(ErrorAddress, "Exception Address: %p\n\n", ExceptionInfo->ExceptionRecord->ExceptionAddress);
29-
char ErrorCode[MAX_PATH];
30-
sprintf_s(ErrorCode, ExceptionCodeToString(ExceptionInfo->ExceptionRecord->ExceptionCode));
31-
3224
std::ofstream ErrorLogFile;
33-
ErrorLogFile.open("C:\\Log.txt");
25+
ErrorLogFile.open("Log.txt");
3426
if (!ErrorLogFile.is_open())
3527
{
36-
MessageBox(NULL, "Something Happened Creating Log File!", "Uh-Oh!", 0);
28+
stringstream ErrorMessage;
29+
ErrorMessage << "Something Happened Creating Log File! The Error Is At:\n" << ExceptionInfo->ExceptionRecord->ExceptionAddress << "\nThe Message Is: " << ExceptionCodeToString(ExceptionInfo->ExceptionRecord->ExceptionCode) << "\nPlease Take A Screen Shot And Report Me In The Discord!";
30+
string PrintableError = ErrorMessage.str();
31+
MessageBox(NULL, PrintableError.c_str(), "Uh-Oh!", 0);
3732
}
3833
ErrorLogFile << "Yu-Gi-Oh! Crashed. Here Is Some Information.\n";
39-
ErrorLogFile << ErrorAddress;
34+
ErrorLogFile << "Exception Address: ";
35+
ErrorLogFile << ExceptionInfo->ExceptionRecord->ExceptionAddress;
4036
ErrorLogFile << "Error Code: ";
41-
ErrorLogFile << ErrorCode;
37+
ErrorLogFile << ExceptionCodeToString(ExceptionInfo->ExceptionRecord->ExceptionCode);
4238
ErrorLogFile.close();
4339
return 1;
4440
}

NoCrash/stdafx.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include <Windows.h>
4+
#include <fstream>
5+
#include <string>
6+
#include <sstream>
7+
8+
LONG WINAPI UnhandledException(struct _EXCEPTION_POINTERS *ExceptionInfo);
9+
const char *ExceptionCodeToString(DWORD ExceptionCode);

bin/Debug/Plugins/NoCrash.dll

17.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)