mirror of
https://github.com/qwertyuiop3/Storm.git
synced 2024-12-22 14:47:24 +08:00
bdf8f51f29
merged from seg
38 lines
884 B
C++
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);
|
|
}
|
|
}
|
|
}; |