mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2024-12-22 14:47:24 +08:00
optional intersection testing. mindamage is next
This commit is contained in:
parent
932f00bf0e
commit
c068afb171
6
Byte_Manager/Byte_Manager.hpp
Normal file
6
Byte_Manager/Byte_Manager.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Byte_Manager
|
||||||
|
{
|
||||||
|
#include "Byte_Manager_Functions.hpp"
|
||||||
|
};
|
22
Byte_Manager/Byte_Manager_Copy_Bytes.hpp
Normal file
22
Byte_Manager/Byte_Manager_Copy_Bytes.hpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
24
Byte_Manager/Byte_Manager_Find_Bytes.hpp
Normal file
24
Byte_Manager/Byte_Manager_Find_Bytes.hpp
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
7
Byte_Manager/Byte_Manager_Functions.hpp
Normal file
7
Byte_Manager/Byte_Manager_Functions.hpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Byte_Manager_Find_Bytes.hpp"
|
||||||
|
|
||||||
|
#include "Byte_Manager_Set_Bytes.hpp"
|
||||||
|
|
||||||
|
#include "Byte_Manager_Copy_Bytes.hpp"
|
22
Byte_Manager/Byte_Manager_Set_Bytes.hpp
Normal file
22
Byte_Manager/Byte_Manager_Set_Bytes.hpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -59,10 +59,6 @@ void __thiscall Redirected_Copy_Command(void* Unknown_Parameter, Command_Structu
|
|||||||
|
|
||||||
if (*(__int8*)((unsigned __int32)Local_Player + 327) == 0)
|
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] =
|
float Move_Angles[3] =
|
||||||
{
|
{
|
||||||
Command->Angles[0],
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,8 @@ Interface_Structure Interface_Riot_Deprioritize;
|
|||||||
|
|
||||||
Interface_Structure Interface_Penetrate_Teammates;
|
Interface_Structure Interface_Penetrate_Teammates;
|
||||||
|
|
||||||
|
Interface_Structure Interface_Aim_Intersection;
|
||||||
|
|
||||||
Interface_Structure Interface_Equipment_Distance;
|
Interface_Structure Interface_Equipment_Distance;
|
||||||
|
|
||||||
Interface_Structure Interface_Storm_Rotation_Radius;
|
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_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_Equipment_Distance), (char*)"2048", nullptr);
|
||||||
|
|
||||||
Create_Console_Interface(Pointer_Name(Interface_Storm_Rotation_Radius), (char*)"24", nullptr);
|
Create_Console_Interface(Pointer_Name(Interface_Storm_Rotation_Radius), (char*)"24", nullptr);
|
||||||
|
30
Move.hpp
30
Move.hpp
@ -4,10 +4,26 @@ __int32 Extra_Commands;
|
|||||||
|
|
||||||
void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
||||||
{
|
{
|
||||||
|
using Run_Prediction_Type = void(__cdecl*)();
|
||||||
|
|
||||||
if (*(void**)((unsigned __int32)Client_Module + 7498712) != nullptr)
|
if (*(void**)((unsigned __int32)Client_Module + 7498712) != nullptr)
|
||||||
{
|
{
|
||||||
Redirected_Read_Packets(Final);
|
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*)();
|
using Fire_Events_Type = void(__cdecl*)();
|
||||||
|
|
||||||
Fire_Events_Type((unsigned __int32)Engine_Module + 521648)();
|
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);
|
(decltype(&Redirected_Move)(Original_Move_Caller))(Unknown_Parameter, Final);
|
||||||
|
|
||||||
|
Run_Prediction_Type((unsigned __int32)Engine_Module + 527776)();
|
||||||
|
|
||||||
if (Extra_Commands > 0)
|
if (Extra_Commands > 0)
|
||||||
{
|
{
|
||||||
Extra_Commands -= 1;
|
Extra_Commands -= 1;
|
||||||
@ -26,16 +44,4 @@ void Redirected_Move(float Unknown_Parameter, __int8 Final)
|
|||||||
goto Move_Label;
|
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;
|
|
||||||
}
|
}
|
@ -26,16 +26,24 @@ void __thiscall Perform_Trace(void* Stack)
|
|||||||
|
|
||||||
if (*(__int32*)((unsigned __int32)Entity + 228) == *(__int32*)((unsigned __int32)Local_Player + 228))
|
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 (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);
|
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];
|
float Inflictor_Direction[3];
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ void __thiscall Redirected_Process_Movement(void* Unknown_Parameter, void* Playe
|
|||||||
|
|
||||||
if (*(__int8*)((unsigned __int32)Player + 4636) == 1)
|
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;
|
*(float*)((unsigned __int32)Move_Data + 44) = 0;
|
||||||
|
@ -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
|
code: https://github.com/qwertyuiop3/Storm
|
||||||
|
|
||||||
|
6
Redirection_Manager/Redirection_Manager.hpp
Normal file
6
Redirection_Manager/Redirection_Manager.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Redirection_Manager
|
||||||
|
{
|
||||||
|
#include "Redirection_Manager_Functions.hpp"
|
||||||
|
};
|
30
Redirection_Manager/Redirection_Manager_Copy_Table.hpp
Normal file
30
Redirection_Manager/Redirection_Manager_Copy_Table.hpp
Normal file
@ -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;
|
||||||
|
}
|
15
Redirection_Manager/Redirection_Manager_Functions.hpp
Normal file
15
Redirection_Manager/Redirection_Manager_Functions.hpp
Normal file
@ -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"
|
125
Redirection_Manager/Redirection_Manager_Redirect_Function.hpp
Normal file
125
Redirection_Manager/Redirection_Manager_Redirect_Function.hpp
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
39
Redirection_Manager/Redirection_Manager_Restore_Function.hpp
Normal file
39
Redirection_Manager/Redirection_Manager_Restore_Function.hpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
11
Redirection_Manager/Redirection_Manager_Restore_Table.hpp
Normal file
11
Redirection_Manager/Redirection_Manager_Restore_Table.hpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user