Merge pull request #97 from diamante0018/develop

Removed hook inside com quit fs.
This commit is contained in:
Dss0 2021-07-19 01:48:06 +02:00 committed by GitHub
commit 04d5b0e6b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 23 deletions

View File

@ -380,14 +380,6 @@ namespace Components
}
}
template <typename T> std::function < T > ImportFunction(const std::string& dll, const std::string& function)
{
auto dllHandle = GetModuleHandleA(&dll[0]);
auto procAddr = GetProcAddress(dllHandle, &function[0]);
return std::function < T >(reinterpret_cast<T*>(procAddr));
}
QuickPatch::QuickPatch()
{
QuickPatch::FrameTime = 0;
@ -399,10 +391,10 @@ namespace Components
// quit_hard
Command::Add("quit_hard", [](Command::Params*)
{
int data = false;
const Utils::Library ntdll("ntdll.dll");
ntdll.invoke_pascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
int data = false;
const Utils::Library ntdll("ntdll.dll");
ntdll.invoke_pascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
});
// bounce dvar

View File

@ -844,7 +844,7 @@ namespace Components
Command::Add("quit", [](Command::Params*)
{
ZoneBuilder::Quit();
Game::Com_Quitf_t();
});
Command::Add("error", [](Command::Params*)
@ -921,12 +921,6 @@ namespace Components
return 0;
}
void ZoneBuilder::Quit()
{
//TerminateProcess(GetCurrentProcess(), 0);
ExitProcess(0);
}
void ZoneBuilder::HandleError(int level, const char* format, ...)
{
char buffer[256] = { 0 };
@ -1088,9 +1082,6 @@ namespace Components
// set new entry point
Utils::Hook(0x4513DA, ZoneBuilder::EntryPoint, HOOK_JUMP).install()->quick();
// set quit handler
Utils::Hook(0x4D4000, ZoneBuilder::Quit, HOOK_JUMP).install()->quick();
// handle com_error calls
Utils::Hook(0x4B22D0, ZoneBuilder::HandleError, HOOK_JUMP).install()->quick();

View File

@ -138,7 +138,6 @@ namespace Components
static std::string FindMaterialByTechnique(const std::string& name);
static int __stdcall EntryPoint(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/);
static void Quit();
static void HandleError(int level, const char* format, ...);
static void SoftErrorAssetOverflow();

View File

@ -65,6 +65,7 @@ namespace Game
Com_Parse_t Com_Parse = Com_Parse_t(0x474D60);
Com_MatchToken_t Com_MatchToken = Com_MatchToken_t(0x447130);
Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20);
Com_Quitf_t Com_Quit_f = Com_Quitf_t(0x4D4000);
Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30);
Con_DrawSolidConsole_t Con_DrawSolidConsole = Con_DrawSolidConsole_t(0x5A5040);

View File

@ -130,6 +130,9 @@ namespace Game
typedef void(__cdecl * Com_SetSlowMotion_t)(float start, float end, int duration);
extern Com_SetSlowMotion_t Com_SetSlowMotion;
typedef void(__cdecl * Com_Quitf_t)();
extern Com_Quitf_t Com_Quit_f;
typedef char* (__cdecl * Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha);
extern Con_DrawMiniConsole_t Con_DrawMiniConsole;