optional intersection testing. mindamage is next

This commit is contained in:
explorer
2024-10-08 04:41:25 +03:00
parent 932f00bf0e
commit c068afb171
20 changed files with 409 additions and 22 deletions

View File

@ -0,0 +1,6 @@
#pragma once
namespace Byte_Manager
{
#include "Byte_Manager_Functions.hpp"
};

View 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);
}
}

View 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;
}
}

View 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"

View 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);
}
}