mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2025-07-17 00:47:58 +08:00
optional intersection testing. mindamage is next
This commit is contained in:
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user