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

  #6  
Старый 09.06.2022, 19:41
Чёрный вурдалак
Новичок
Регистрация: 10.10.2021
Сообщений: 15
С нами: 2418048

Репутация: 8
По умолчанию

Цитата:
Сообщение от !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++:





Код:
#include "llmo/include/rwe.hpp"
llmo
::
rwe
::
Copy
(
0x53C136
,
"\xE8\x65\x04\x1C\x00"
,
5
)
;
llmo
::
rwe
::
Set
(
0xC1BFD0
,
0x01
,
1
)
;


GitHub - devCarrentine/llmo: Library for low-level memory operations and hooking.

Library for low-level memory operations and hooking. - GitHub - devCarrentine/llmo: Library for low-level memory operations and hooking.

github.com


Цитата:
Сообщение от kin4stat  

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
Исправился, 🐞 аннулирую
 
Ответить с цитированием