
08.10.2024, 22:09
|
|
Флудер
Регистрация: 02.02.2019
Сообщений: 5,070
С нами:
3831395
Репутация:
183
|
|
Сообщение от nonelike
код че:
Код:
using
CChat__AddEntry
=
void
(
__thiscall
*
)
(
void
*
,
void
*
,
int
,
const
char
*
,
const
char
*
,
unsigned
long
,
unsigned
long
)
;
CChat__AddEntry pOriginalFunction
=
nullptr
;
void
*
SetCallHook
(
uintptr_t HookAddress
,
void
*
DetourFunction
)
{
uintptr_t OriginalFunction
=
*
reinterpret_cast
(
HookAddress
+
1
)
+
HookAddress
+
5
;
DWORD oldProt
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
PAGE_READWRITE
,
&
oldProt
)
;
*
reinterpret_cast
(
HookAddress
+
1
)
=
reinterpret_cast
(
DetourFunction
)
-
HookAddress
-
5
;
VirtualProtect
(
reinterpret_cast
(
HookAddress
+
1
)
,
sizeof
(
uintptr_t
)
,
oldProt
,
&
oldProt
)
;
return
reinterpret_cast
(
OriginalFunction
)
;
}
void
__fastcall
HOOK_AddEntry
(
void
*
pChat
,
void
*
EDX
,
int
nType
,
const
char
*
szText
,
const
char
*
szPrefix
,
unsigned
long
textColor
,
unsigned
long
prefixColor
)
{
pOriginalFunction
(
pChat
,
EDX
,
nType
,
szText
,
szPrefix
,
textColor
,
prefixColor
)
;
}
if
(
uintptr_t dwSAMP
=
reinterpret_cast
(
GetModuleHandleA
(
"samp.dll"
)
)
;
dwSAMP
!=
0
)
{
pOriginalFunction
=
reinterpret_cast
(
SetCallHook
(
dwSAMP
+
0x67460
,
&
HOOK_AddEntry
)
)
;
}
пытаюсь хукнуть CChat__AddEntry, чтоб сменить текст samp started бла бла бла, но игра после запуска просто крашится
Потому что ты установил __thiscall но почему-то указываешь void* EDX. Или убери параметр EDX, или поставь соглашение о вызове __fastcall
|
|
|