From c068afb1710dfe9e2519979e8ef0d332a864594c Mon Sep 17 00:00:00 2001 From: explorer Date: Tue, 8 Oct 2024 04:41:25 +0300 Subject: [PATCH] optional intersection testing. mindamage is next --- Byte_Manager/Byte_Manager.hpp | 6 + Byte_Manager/Byte_Manager_Copy_Bytes.hpp | 22 +++ Byte_Manager/Byte_Manager_Find_Bytes.hpp | 24 ++++ Byte_Manager/Byte_Manager_Functions.hpp | 7 + Byte_Manager/Byte_Manager_Set_Bytes.hpp | 22 +++ Copy_Command.hpp | 8 +- Extended_Interface.hpp | 4 + Move.hpp | 30 +++-- Perform_Trace.hpp | 12 +- Process_Movement.hpp | 2 +- README.md | 2 +- Redirection_Manager/Redirection_Manager.hpp | 6 + .../Redirection_Manager_Copy_Table.hpp | 30 +++++ .../Redirection_Manager_Functions.hpp | 15 +++ .../Redirection_Manager_Redirect_Function.hpp | 125 ++++++++++++++++++ ...ion_Manager_Redirect_Function_In_Table.hpp | 18 +++ .../Redirection_Manager_Redirect_Table.hpp | 6 + .../Redirection_Manager_Restore_Function.hpp | 39 ++++++ ...edirection_Manager_Restore_Redirection.hpp | 42 ++++++ .../Redirection_Manager_Restore_Table.hpp | 11 ++ 20 files changed, 409 insertions(+), 22 deletions(-) create mode 100644 Byte_Manager/Byte_Manager.hpp create mode 100644 Byte_Manager/Byte_Manager_Copy_Bytes.hpp create mode 100644 Byte_Manager/Byte_Manager_Find_Bytes.hpp create mode 100644 Byte_Manager/Byte_Manager_Functions.hpp create mode 100644 Byte_Manager/Byte_Manager_Set_Bytes.hpp create mode 100644 Redirection_Manager/Redirection_Manager.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Copy_Table.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Functions.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Redirect_Function.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Redirect_Function_In_Table.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Redirect_Table.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Restore_Function.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Restore_Redirection.hpp create mode 100644 Redirection_Manager/Redirection_Manager_Restore_Table.hpp diff --git a/Byte_Manager/Byte_Manager.hpp b/Byte_Manager/Byte_Manager.hpp new file mode 100644 index 0000000..7c0eedc --- /dev/null +++ b/Byte_Manager/Byte_Manager.hpp @@ -0,0 +1,6 @@ +#pragma once + +namespace Byte_Manager +{ + #include "Byte_Manager_Functions.hpp" +}; \ No newline at end of file diff --git a/Byte_Manager/Byte_Manager_Copy_Bytes.hpp b/Byte_Manager/Byte_Manager_Copy_Bytes.hpp new file mode 100644 index 0000000..8aaaf78 --- /dev/null +++ b/Byte_Manager/Byte_Manager_Copy_Bytes.hpp @@ -0,0 +1,22 @@ +#pragma once + +#ifdef Bits_32 + void Copy_Bytes(__int8 Modify_Access_Rights, void* Starting_Location, unsigned __int32 Bytes_Amount, void* Bytes) +#else + void Copy_Bytes(__int8 Modify_Access_Rights, void* Starting_Location, unsigned __int64 Bytes_Amount, void* Bytes) +#endif + { + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Starting_Location, Bytes_Amount, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + } + + __builtin_memcpy(Starting_Location, Bytes, Bytes_Amount); + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Starting_Location, Bytes_Amount, Previous_Access_Rights, &Previous_Access_Rights); + } + } \ No newline at end of file diff --git a/Byte_Manager/Byte_Manager_Find_Bytes.hpp b/Byte_Manager/Byte_Manager_Find_Bytes.hpp new file mode 100644 index 0000000..ec63203 --- /dev/null +++ b/Byte_Manager/Byte_Manager_Find_Bytes.hpp @@ -0,0 +1,24 @@ +#pragma once + +#ifdef Bits_32 + void* Find_Bytes(void* Starting_Location, void* Bytes, unsigned __int32 Bytes_Amount) +#else + void* Find_Bytes(void* Starting_Location, void* Bytes, unsigned __int64 Bytes_Amount) +#endif + { + Compare_Bytes_Label: + { + if (__builtin_memcmp(Starting_Location, Bytes, Bytes_Amount) == 0) + { + return Starting_Location; + } + + #ifdef Bits_32 + Starting_Location = (void*)((unsigned __int32)Starting_Location + 1); + #else + Starting_Location = (void*)((unsigned __int64)Starting_Location + 1); + #endif + + goto Compare_Bytes_Label; + } + } \ No newline at end of file diff --git a/Byte_Manager/Byte_Manager_Functions.hpp b/Byte_Manager/Byte_Manager_Functions.hpp new file mode 100644 index 0000000..c405994 --- /dev/null +++ b/Byte_Manager/Byte_Manager_Functions.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "Byte_Manager_Find_Bytes.hpp" + +#include "Byte_Manager_Set_Bytes.hpp" + +#include "Byte_Manager_Copy_Bytes.hpp" \ No newline at end of file diff --git a/Byte_Manager/Byte_Manager_Set_Bytes.hpp b/Byte_Manager/Byte_Manager_Set_Bytes.hpp new file mode 100644 index 0000000..c25c939 --- /dev/null +++ b/Byte_Manager/Byte_Manager_Set_Bytes.hpp @@ -0,0 +1,22 @@ +#pragma once + +#ifdef Bits_32 + void Set_Bytes(__int8 Modify_Access_Rights, void* Starting_Location, unsigned __int32 Bytes_Amount, unsigned __int8 Byte) +#else + void Set_Bytes(__int8 Modify_Access_Rights, void* Starting_Location, unsigned __int64 Bytes_Amount, unsigned __int8 Byte) +#endif + { + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Starting_Location, Bytes_Amount, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + } + + __builtin_memset(Starting_Location, Byte, Bytes_Amount); + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Starting_Location, Bytes_Amount, Previous_Access_Rights, &Previous_Access_Rights); + } + } \ No newline at end of file diff --git a/Copy_Command.hpp b/Copy_Command.hpp index ba183a3..9ca293e 100644 --- a/Copy_Command.hpp +++ b/Copy_Command.hpp @@ -59,10 +59,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu if (*(__int8*)((unsigned __int32)Local_Player + 327) == 0) { - using Run_Prediction_Type = void(__cdecl*)(); - - Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)(); - float Move_Angles[3] = { Command->Angles[0], @@ -201,9 +197,9 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu { if ((*(float*)((unsigned __int32)Local_Player + 4604) + 800 * Global_Variables->Interval_Per_Tick >= 560) + (*(__int8*)((unsigned __int32)Local_Player + 8068) + *(__int8*)((unsigned __int32)Local_Player + 9708)) != 0) { - Sequence_Shift(2); + Command->Buttons &= ~10241; - Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)(); + Sequence_Shift(2); } else { diff --git a/Extended_Interface.hpp b/Extended_Interface.hpp index 57c6a5e..69662fd 100755 --- a/Extended_Interface.hpp +++ b/Extended_Interface.hpp @@ -23,6 +23,8 @@ Interface_Structure Interface_Riot_Deprioritize; Interface_Structure Interface_Penetrate_Teammates; +Interface_Structure Interface_Aim_Intersection; + Interface_Structure Interface_Equipment_Distance; Interface_Structure Interface_Storm_Rotation_Radius; @@ -60,6 +62,8 @@ void Implement_Extended_Interface() Create_Console_Interface(Pointer_Name(Interface_Penetrate_Teammates), (char*)"0", nullptr); + Create_Console_Interface(Pointer_Name(Interface_Aim_Intersection), (char*)"1", nullptr); + Create_Console_Interface(Pointer_Name(Interface_Equipment_Distance), (char*)"2048", nullptr); Create_Console_Interface(Pointer_Name(Interface_Storm_Rotation_Radius), (char*)"24", nullptr); diff --git a/Move.hpp b/Move.hpp index 8faf521..621c3a9 100644 --- a/Move.hpp +++ b/Move.hpp @@ -4,10 +4,26 @@ __int32 Extra_Commands; void Redirected_Move(float Unknown_Parameter, __int8 Final) { + using Run_Prediction_Type = void(__cdecl*)(); + if (*(void**)((unsigned __int32)Client_Module + 7498712) != nullptr) { Redirected_Read_Packets(Final); + Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)(); + + using Update_Animations_Type = void(__cdecl*)(); + + Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); + + Update_Animation_Time = (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Current_Time; + + Update_Animation_Type = 1; + + Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); + + Update_Animation_Type = 0; + using Fire_Events_Type = void(__cdecl*)(); Fire_Events_Type((unsigned __int32)Engine_Module + 521648)(); @@ -19,6 +35,8 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final) { (decltype(&Redirected_Move)(Original_Move_Caller))(Unknown_Parameter, Final); + Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)(); + if (Extra_Commands > 0) { Extra_Commands -= 1; @@ -26,16 +44,4 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final) goto Move_Label; } } - - using Update_Animations_Type = void(__cdecl*)(); - - Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); - - Update_Animation_Time = (*(Global_Variables_Structure**)((unsigned __int32)Client_Module + 7096744))->Current_Time; - - Update_Animation_Type = 1; - - Update_Animations_Type((unsigned __int32)Client_Module + 205296)(); - - Update_Animation_Type = 0; } \ No newline at end of file diff --git a/Perform_Trace.hpp b/Perform_Trace.hpp index 5fc6699..31bdf1c 100755 --- a/Perform_Trace.hpp +++ b/Perform_Trace.hpp @@ -26,16 +26,24 @@ void __thiscall Perform_Trace(void* Stack) if (*(__int32*)((unsigned __int32)Entity + 228) == *(__int32*)((unsigned __int32)Local_Player + 228)) { - Perform_Trace_Target = nullptr; + return; } } } if (Entity == (void*)((unsigned __int32)Perform_Trace_Target ^ 1)) { + if (Interface_Aim_Intersection.Integer == 0) + { + if (*(__int32*)((unsigned __int32)Stack + 304) != 1) + { + return; + } + } + void* Trace_Information = *(void**)((unsigned __int32)Stack + 36); - if ((*(__int32*)((unsigned int)Trace_Information + 36) & 255) + *(__int32*)((unsigned __int32)Entity + 52) == 17) + if ((*(__int32*)((unsigned __int32)Trace_Information + 36) & 255) + *(__int32*)((unsigned __int32)Entity + 52) == 17) { float Inflictor_Direction[3]; diff --git a/Process_Movement.hpp b/Process_Movement.hpp index 4e0db37..10dceda 100644 --- a/Process_Movement.hpp +++ b/Process_Movement.hpp @@ -14,7 +14,7 @@ void __thiscall Redirected_Process_Movement(void* Unknown_Parameter, void* Playe if (*(__int8*)((unsigned __int32)Player + 4636) == 1) { - *(__int32*)((unsigned __int32)Move_Data + 36) |= 4u; + *(__int32*)((unsigned __int32)Move_Data + 36) |= 4; } *(float*)((unsigned __int32)Move_Data + 44) = 0; diff --git a/README.md b/README.md index 89fb972..9e8c6be 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -to achieve least interpolation time `cl_updaterate -1;cl_interp_ratio 0;cl_interp 0` +to achieve least interpolation time: `cl_updaterate -1;cl_interp_ratio 0;cl_interp 0` ``` code: https://github.com/qwertyuiop3/Storm diff --git a/Redirection_Manager/Redirection_Manager.hpp b/Redirection_Manager/Redirection_Manager.hpp new file mode 100644 index 0000000..0299ed5 --- /dev/null +++ b/Redirection_Manager/Redirection_Manager.hpp @@ -0,0 +1,6 @@ +#pragma once + +namespace Redirection_Manager +{ + #include "Redirection_Manager_Functions.hpp" +}; \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Copy_Table.hpp b/Redirection_Manager/Redirection_Manager_Copy_Table.hpp new file mode 100644 index 0000000..dc2fad1 --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Copy_Table.hpp @@ -0,0 +1,30 @@ +#pragma once + +void* Copy_Table(void* Table_Location) +{ + #ifdef Bits_32 + unsigned __int32 Functions_Count = 0; + #else + unsigned __int64 Functions_Count = 0; + #endif + + Take_Function_Into_Account_Label: + { + #ifdef Bits_32 + if (*(void**)((unsigned __int32)Table_Location + Functions_Count) != nullptr) + #else + if (*(void**)((unsigned __int64)Table_Location + Functions_Count) != nullptr) + #endif + { + Functions_Count += sizeof(void*); + + goto Take_Function_Into_Account_Label; + } + } + + void* Copied_Table_Location = malloc(Functions_Count); + + __builtin_memcpy(Copied_Table_Location, Table_Location, Functions_Count); + + return Copied_Table_Location; +} \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Functions.hpp b/Redirection_Manager/Redirection_Manager_Functions.hpp new file mode 100644 index 0000000..989504e --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Functions.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "Redirection_Manager_Redirect_Function.hpp" + +#include "Redirection_Manager_Restore_Function.hpp" + +#include "Redirection_Manager_Restore_Redirection.hpp" + +#include "Redirection_Manager_Copy_Table.hpp" + +#include "Redirection_Manager_Redirect_Function_In_Table.hpp" + +#include "Redirection_Manager_Redirect_Table.hpp" + +#include "Redirection_Manager_Restore_Table.hpp" \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Redirect_Function.hpp b/Redirection_Manager/Redirection_Manager_Redirect_Function.hpp new file mode 100644 index 0000000..5d6d7ec --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Redirect_Function.hpp @@ -0,0 +1,125 @@ +#pragma once + +void Redirect_Function(__int8 Modify_Access_Rights, void* Original_Function_Location, void* Redirected_Function_Location) +{ + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #endif + } + + #ifdef Bits_32 + *(__int8*)Original_Function_Location = 104; + + *(void**)((unsigned __int32)Original_Function_Location + 1) = Redirected_Function_Location; + + *(unsigned __int8*)((unsigned __int32)Original_Function_Location + 5) = 195; + #else + *(__int8*)Original_Function_Location = 80; + + *(unsigned __int16*)((unsigned __int64)Original_Function_Location + 1) = 47176; + + *(void**)((unsigned __int64)Original_Function_Location + 3) = Redirected_Function_Location; + + *(__int32*)((unsigned __int64)Original_Function_Location + 11) = 604276552; + + *(unsigned __int8*)((unsigned __int64)Original_Function_Location + 15) = 195; + #endif + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, Previous_Access_Rights, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, Previous_Access_Rights, &Previous_Access_Rights); + #endif + } +} + +#ifdef Bits_32 + void Redirect_Function(void*& Original_Function_Caller_Location, unsigned __int32 Original_Function_Caller_Offset, void* Original_Function_Location, __int8 Modify_Access_Rights, void* Redirected_Function_Location) +#else + void Redirect_Function(void*& Original_Function_Caller_Location, unsigned __int64 Original_Function_Caller_Offset, void* Original_Function_Location, __int8 Modify_Access_Rights, void* Redirected_Function_Location) +#endif + { + unsigned long __int32 Previous_Access_Rights; + + #ifdef Bits_32 + Original_Function_Caller_Location = malloc(12 + Original_Function_Caller_Offset); + + *(void**)Original_Function_Caller_Location = *(void**)Original_Function_Location; + + *(unsigned __int16*)((unsigned __int32)Original_Function_Caller_Location + 4) = *(unsigned __int16*)((unsigned __int32)Original_Function_Location + 4); + + __builtin_memcpy((void*)((unsigned __int32)Original_Function_Caller_Location + 6), (void*)((unsigned __int32)Original_Function_Location + 6), Original_Function_Caller_Offset); + + *(__int8*)((unsigned __int32)Original_Function_Caller_Location + 6 + Original_Function_Caller_Offset) = 104; + + *(void**)((unsigned __int32)Original_Function_Caller_Location + 7 + Original_Function_Caller_Offset) = (void*)((unsigned __int32)Original_Function_Location + 6 + Original_Function_Caller_Offset); + + *(unsigned __int8*)((unsigned __int32)Original_Function_Caller_Location + 11 + Original_Function_Caller_Offset) = 195; + + VirtualProtect(Original_Function_Caller_Location, 12 + Original_Function_Caller_Offset, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #else + Original_Function_Caller_Location = malloc(32 + Original_Function_Caller_Offset); + + *(void**)Original_Function_Caller_Location = *(void**)Original_Function_Location; + + *(void**)((unsigned __int64)Original_Function_Caller_Location + 8) = *(void**)((unsigned __int64)Original_Function_Location + 8); + + __builtin_memcpy((void*)((unsigned __int64)Original_Function_Caller_Location + 16), (void*)((unsigned __int64)Original_Function_Location + 16), Original_Function_Caller_Offset); + + *(__int8*)((unsigned __int64)Original_Function_Caller_Location + 16 + Original_Function_Caller_Offset) = 80; + + *(unsigned __int16*)((unsigned __int64)Original_Function_Caller_Location + 17 + Original_Function_Caller_Offset) = 47176; + + *(void**)((unsigned __int64)Original_Function_Caller_Location + 19 + Original_Function_Caller_Offset) = (void*)((unsigned __int64)Original_Function_Location + 16 + Original_Function_Caller_Offset); + + *(__int32*)((unsigned __int64)Original_Function_Caller_Location + 27 + Original_Function_Caller_Offset) = 604276552; + + *(unsigned __int8*)((unsigned __int64)Original_Function_Caller_Location + 31 + Original_Function_Caller_Offset) = 195; + + VirtualProtect(Original_Function_Caller_Location, 32 + Original_Function_Caller_Offset, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #endif + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #endif + } + + #ifdef Bits_32 + *(__int8*)Original_Function_Location = 104; + + *(void**)((unsigned __int32)Original_Function_Location + 1) = Redirected_Function_Location; + + *(unsigned __int8*)((unsigned __int32)Original_Function_Location + 5) = 195; + #else + *(__int8*)Original_Function_Location = 80; + + *(unsigned __int16*)((unsigned __int64)Original_Function_Location + 1) = 47176; + + *(void**)((unsigned __int64)Original_Function_Location + 3) = Redirected_Function_Location; + + *(__int32*)((unsigned __int64)Original_Function_Location + 11) = 604276552; + + *(unsigned __int8*)((unsigned __int64)Original_Function_Location + 15) = 195; + #endif + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, Previous_Access_Rights, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, Previous_Access_Rights, &Previous_Access_Rights); + #endif + } + } \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Redirect_Function_In_Table.hpp b/Redirection_Manager/Redirection_Manager_Redirect_Function_In_Table.hpp new file mode 100644 index 0000000..3bc00db --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Redirect_Function_In_Table.hpp @@ -0,0 +1,18 @@ +#pragma once + +void Redirect_Function_In_Table(__int8 Modify_Access_Rights, void* Original_Function_In_Table_Location, void* Redirected_Function_Location) +{ + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Original_Function_In_Table_Location, sizeof(void*), PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + } + + *(void**)Original_Function_In_Table_Location = Redirected_Function_Location; + + if (Modify_Access_Rights == 1) + { + VirtualProtect(Original_Function_In_Table_Location, sizeof(void*), Previous_Access_Rights, &Previous_Access_Rights); + } +} \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Redirect_Table.hpp b/Redirection_Manager/Redirection_Manager_Redirect_Table.hpp new file mode 100644 index 0000000..4e1419e --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Redirect_Table.hpp @@ -0,0 +1,6 @@ +#pragma once + +void Redirect_Table(void* Original_Table_Container_Location, void* Redirected_Table_Location) +{ + *(void**)Original_Table_Container_Location = Redirected_Table_Location; +} \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Restore_Function.hpp b/Redirection_Manager/Redirection_Manager_Restore_Function.hpp new file mode 100644 index 0000000..44ac64d --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Restore_Function.hpp @@ -0,0 +1,39 @@ +#pragma once + +void Restore_Function(__int8 Modify_Access_Rights, void* Original_Function_Location, void* Original_Function_Caller_Location, __int8 Delete_Original_Function_Caller) +{ + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #endif + } + + #ifdef Bits_32 + *(void**)Original_Function_Location = *(void**)Original_Function_Caller_Location; + + *(unsigned __int16*)((unsigned __int32)Original_Function_Location + 4) = *(unsigned __int16*)((unsigned __int32)Original_Function_Caller_Location + 4); + #else + *(void**)Original_Function_Location = *(void**)Original_Function_Caller_Location; + + *(void**)((unsigned __int64)Original_Function_Location + 8) = *(void**)((unsigned __int64)Original_Function_Caller_Location + 8); + #endif + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, Previous_Access_Rights, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, Previous_Access_Rights, &Previous_Access_Rights); + #endif + } + + if (Delete_Original_Function_Caller == 1) + { + free(Original_Function_Caller_Location); + } +} \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Restore_Redirection.hpp b/Redirection_Manager/Redirection_Manager_Restore_Redirection.hpp new file mode 100644 index 0000000..2e12207 --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Restore_Redirection.hpp @@ -0,0 +1,42 @@ +#pragma once + +void Restore_Redirection(__int8 Modify_Access_Rights, void* Original_Function_Location, void* Redirected_Function_Location) +{ + unsigned long __int32 Previous_Access_Rights; + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights); + #endif + } + + #ifdef Bits_32 + *(__int8*)Original_Function_Location = 104; + + *(void**)((unsigned __int32)Original_Function_Location + 1) = Redirected_Function_Location; + + *(unsigned __int8*)((unsigned __int32)Original_Function_Location + 5) = 195; + #else + *(__int8*)Original_Function_Location = 80; + + *(unsigned __int16*)((unsigned __int64)Original_Function_Location + 1) = 47176; + + *(void**)((unsigned __int64)Original_Function_Location + 3) = Redirected_Function_Location; + + *(__int32*)((unsigned __int64)Original_Function_Location + 11) = 604276552; + + *(unsigned __int8*)((unsigned __int64)Original_Function_Location + 15) = 195; + #endif + + if (Modify_Access_Rights == 1) + { + #ifdef Bits_32 + VirtualProtect(Original_Function_Location, 6, Previous_Access_Rights, &Previous_Access_Rights); + #else + VirtualProtect(Original_Function_Location, 16, Previous_Access_Rights, &Previous_Access_Rights); + #endif + } +} \ No newline at end of file diff --git a/Redirection_Manager/Redirection_Manager_Restore_Table.hpp b/Redirection_Manager/Redirection_Manager_Restore_Table.hpp new file mode 100644 index 0000000..0078862 --- /dev/null +++ b/Redirection_Manager/Redirection_Manager_Restore_Table.hpp @@ -0,0 +1,11 @@ +#pragma once + +void Restore_Table(void* Original_Table_Container_Location, void* Original_Table_Location, __int8 Delete_Redirected_Table, void* Redirected_Table_Location) +{ + *(void**)Original_Table_Container_Location = Original_Table_Location; + + if (Delete_Redirected_Table == 1) + { + free(Redirected_Table_Location); + } +} \ No newline at end of file