mirror of
https://github.com/diamante0018/MW3ServerFreezer.git
synced 2025-04-19 19:52:53 +00:00
protobuf shutdown
This commit is contained in:
parent
1c9addee87
commit
83563c1980
@ -8,8 +8,6 @@
|
|||||||
#include "crypto_key.hpp"
|
#include "crypto_key.hpp"
|
||||||
#include "key_catcher.hpp"
|
#include "key_catcher.hpp"
|
||||||
|
|
||||||
#include <proto/rcon.pb.h>
|
|
||||||
|
|
||||||
namespace rcon {
|
namespace rcon {
|
||||||
namespace {
|
namespace {
|
||||||
utils::cryptography::ecc::key key;
|
utils::cryptography::ecc::key key;
|
||||||
|
@ -1,17 +1,66 @@
|
|||||||
#include "std_include.hpp"
|
#include "std_include.hpp"
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
LONG WINAPI exception_handler(PEXCEPTION_POINTERS exception_info) {
|
||||||
|
if (exception_info->ExceptionRecord->ExceptionCode == 0x406D1388) {
|
||||||
|
return EXCEPTION_CONTINUE_EXECUTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exception_info->ExceptionRecord->ExceptionCode < 0x80000000 ||
|
||||||
|
exception_info->ExceptionRecord->ExceptionCode == 0xE06D7363) {
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
MINIDUMP_EXCEPTION_INFORMATION exception_information = {
|
||||||
|
GetCurrentThreadId(), exception_info, FALSE};
|
||||||
|
const auto type = MiniDumpIgnoreInaccessibleMemory //
|
||||||
|
| MiniDumpWithHandleData //
|
||||||
|
| MiniDumpScanMemory //
|
||||||
|
| MiniDumpWithProcessThreadData //
|
||||||
|
| MiniDumpWithFullMemoryInfo //
|
||||||
|
| MiniDumpWithThreadInfo;
|
||||||
|
|
||||||
|
const auto file_name =
|
||||||
|
std::format("minidumps\\mw3-server-freezer_{}", game::Sys_Milliseconds());
|
||||||
|
const auto file_handle = CreateFileA(
|
||||||
|
file_name.data(), GENERIC_WRITE | GENERIC_READ,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, nullptr);
|
||||||
|
|
||||||
|
if (!MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
|
||||||
|
file_handle, static_cast<MINIDUMP_TYPE>(type),
|
||||||
|
&exception_information, nullptr, nullptr)) {
|
||||||
|
char buf[4096]{};
|
||||||
|
sprintf_s(buf, "An exception 0x%08X occurred at location 0x%p\n",
|
||||||
|
exception_info->ExceptionRecord->ExceptionCode,
|
||||||
|
exception_info->ExceptionRecord->ExceptionAddress);
|
||||||
|
MessageBoxA(nullptr, buf, "Fatal Error", MB_ICONERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle(file_handle);
|
||||||
|
TerminateProcess(GetCurrentProcess(),
|
||||||
|
exception_info->ExceptionRecord->ExceptionCode);
|
||||||
|
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call,
|
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call,
|
||||||
LPVOID /*lpReserved*/
|
LPVOID /*lpReserved*/
|
||||||
) {
|
) {
|
||||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
|
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
|
||||||
std::srand(uint32_t(time(nullptr)));
|
AddVectoredExceptionHandler(0, exception_handler);
|
||||||
|
|
||||||
|
std::srand(std::uint32_t(time(nullptr)));
|
||||||
|
|
||||||
component_loader::post_start();
|
component_loader::post_start();
|
||||||
component_loader::post_unpack();
|
component_loader::post_unpack();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
|
else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
|
||||||
component_loader::pre_destroy();
|
component_loader::pre_destroy();
|
||||||
|
google::protobuf::ShutdownProtobufLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -7,6 +7,8 @@ namespace game {
|
|||||||
WEAK symbol<void()> Sys_ShowConsole{0x515CD0};
|
WEAK symbol<void()> Sys_ShowConsole{0x515CD0};
|
||||||
WEAK symbol<void(HINSTANCE__*)> Sys_CreateConsole{0x51B770};
|
WEAK symbol<void(HINSTANCE__*)> Sys_CreateConsole{0x51B770};
|
||||||
WEAK symbol<void(const char* fmt, ...)> Sys_Error{0x434000};
|
WEAK symbol<void(const char* fmt, ...)> Sys_Error{0x434000};
|
||||||
|
WEAK symbol<int()> Sys_Milliseconds{0x4BB3E0};
|
||||||
|
|
||||||
WEAK symbol<void(const char* text)> Conbuf_AppendText{0x4F7300};
|
WEAK symbol<void(const char* text)> Conbuf_AppendText{0x4F7300};
|
||||||
WEAK symbol<void(errorParm_t, const char* fmt, ...)> Com_Error{0x4A6660};
|
WEAK symbol<void(errorParm_t, const char* fmt, ...)> Com_Error{0x4A6660};
|
||||||
WEAK symbol<const char*(int index)> ConcatArgs{0x539060};
|
WEAK symbol<const char*(int index)> ConcatArgs{0x539060};
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <corecrt_io.h>
|
#include <corecrt_io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <DbgHelp.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -20,12 +22,16 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <source_location>
|
#include <source_location>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
#pragma comment(lib, "ntdll.lib")
|
#pragma comment(lib, "ntdll.lib")
|
||||||
#pragma comment(lib, "ws2_32.lib")
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
|
#pragma comment(lib, "dbghelp.lib")
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
|
#include <proto/rcon.pb.h>
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#include "game/structs.hpp"
|
#include "game/structs.hpp"
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user