Показать сообщение отдельно

  #6129  
Старый 09.06.2022, 02:21
kin4stat
Флудер
Регистрация: 06.11.2017
Сообщений: 2,759
С нами: 4483143

Репутация: 183


По умолчанию

Цитата:
Сообщение от !Sam#0235  

How I can write this values in c++? I took it from one .lua script.

Lua:





Код:
memory
.
hex2bin
(
"E865041C00"
,
0x53C136
,
5
)
memory
.
write
(
12697552
,
1
,
1
,
false
)
--

C++:





Код:
void
set_raw
(
std
::
uintptr_t address
,
const
char
*
RawData
,
std
::
size_t size
,
bool
protect
)
{
DWORD oldProt
;
if
(
protect
)
VirtualProtect
(
reinterpret_cast

(
address
)
,
size
,
PAGE_READWRITE
,
&
oldProt
)
;
memcpy
(
reinterpret_cast

(
address
)
,
RawData
,
size
)
;
if
(
protect
)
VirtualProtect
(
reinterpret_cast

(
address
)
,
size
,
oldProt
,
&
oldProt
)
;
}
template

inline
void
write_memory
(
std
::
uintptr_t address
,
T value
,
bool
protect
=
true
)
{
unsigned
long
oldProt
;
if
(
protect
)
VirtualProtect
(
reinterpret_cast

(
address
)
,
sizeof
(
T
)
,
PAGE_READWRITE
,
&
oldProt
)
;
*
reinterpret_cast

(
address
)
=
value
;
if
(
protect
)
VirtualProtect
(
reinterpret_cast

(
address
)
,
sizeof
(
T
)
,
oldProt
,
&
oldProt
)
;
}
set_raw
(
0x53C136
,
"\xE8\x65\x04\x1C\x00"
,
5
,
true
)
;
set_raw
(
0xC1BFD0
,
"\x01"
,
1
,
true
)
;
// or WriteMemory(0xC1BFD0, char(1), true);


It is also bad form to write addresses not in hex
 
Ответить с цитированием