Storm/Byte_Manager/Byte_Manager.hpp
explorer bdf8f51f29 nothing
merged from seg
2024-11-09 15:31:28 +03:00

38 lines
884 B
C++

namespace Byte_Manager
{
void Set_Bytes(__int8 Writeable, void* Address, unsigned __int32 Size, unsigned __int8 Byte)
{
if (Writeable == 0)
{
DWORD Previous_Access_Rights;
VirtualProtect(Address, Size, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights);
__builtin_memset(Address, Byte, Size);
VirtualProtect(Address, Size, Previous_Access_Rights, &Previous_Access_Rights);
}
else
{
__builtin_memset(Address, Byte, Size);
}
}
void Copy_Bytes(__int8 Writeable, void* Address, unsigned __int32 Size, void* Bytes)
{
if (Writeable == 0)
{
DWORD Previous_Access_Rights;
VirtualProtect(Address, Size, PAGE_EXECUTE_READWRITE, &Previous_Access_Rights);
__builtin_memcpy(Address, Bytes, Size);
VirtualProtect(Address, Size, Previous_Access_Rights, &Previous_Access_Rights);
}
else
{
__builtin_memcpy(Address, Bytes, Size);
}
}
};