major refactor: auth v3
This commit is contained in:
parent
8a8b4b2573
commit
179d21d7b6
18 changed files with 376 additions and 166 deletions
|
|
@ -1296,6 +1296,34 @@ static Minecraft* InitialiseMinecraftRuntime()
|
|||
return pMinecraft;
|
||||
}
|
||||
|
||||
static LONG WINAPI CrashHandler(EXCEPTION_POINTERS *ep)
|
||||
{
|
||||
auto *record = ep->ExceptionRecord;
|
||||
auto *ctx = ep->ContextRecord;
|
||||
HMODULE hMod = GetModuleHandleA(nullptr);
|
||||
|
||||
wchar_t buf[1024];
|
||||
swprintf(buf, 1024,
|
||||
L"Unhandled exception!\n\nCode: 0x%08X\nAddress: 0x%p\nBase: 0x%p\nRVA: 0x%llX\n\nPlease report this crash info.",
|
||||
record->ExceptionCode, record->ExceptionAddress, hMod,
|
||||
(unsigned long long)((char *)record->ExceptionAddress - (char *)hMod));
|
||||
|
||||
FILE *clog = nullptr;
|
||||
if (fopen_s(&clog, "crash.log", "w") == 0 && clog)
|
||||
{
|
||||
fprintf(clog, "[CRASH] Code=0x%08X Addr=0x%p Base=0x%p RVA=0x%llX\n",
|
||||
record->ExceptionCode, record->ExceptionAddress, hMod,
|
||||
(unsigned long long)((char *)record->ExceptionAddress - (char *)hMod));
|
||||
fprintf(clog, " RIP=0x%llX RSP=0x%llX RBP=0x%llX\n", ctx->Rip, ctx->Rsp, ctx->Rbp);
|
||||
fprintf(clog, " RAX=0x%llX RBX=0x%llX RCX=0x%llX\n", ctx->Rax, ctx->Rbx, ctx->Rcx);
|
||||
fprintf(clog, " RDX=0x%llX RSI=0x%llX RDI=0x%llX\n", ctx->Rdx, ctx->Rsi, ctx->Rdi);
|
||||
fclose(clog);
|
||||
}
|
||||
|
||||
MessageBoxW(nullptr, buf, L"MinecraftConsoles Crash", MB_OK | MB_ICONERROR);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPTSTR lpCmdLine,
|
||||
|
|
@ -1304,6 +1332,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
SetUnhandledExceptionFilter(CrashHandler);
|
||||
|
||||
// 4J-Win64: set CWD to exe dir so asset paths resolve correctly
|
||||
{
|
||||
char szExeDir[MAX_PATH] = {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue