 |

12.11.2024, 21:17
|
|
Постоянный
Регистрация: 15.09.2021
Сообщений: 396
С нами:
2453766
Репутация:
68
|
|
Всем привет пытаюсь изменить текст диалога который открывается через F1, но в игре возникает ошибка. Возможно, я что-то упускаю или делаю неправильно. Буду благодарен за любую помощь и советы.
hook:
Код:
using
CDialog__Show
=
void
(
__thiscall
*
)
(
void
*
,
void
*
,
int
,
int
,
int
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
bool
)
;
kthook
::
kthook_simple
CDialog__Show_Hook
;
void
customhook
(
)
{
SampDLL
=
reinterpret_cast
(
GetModuleHandle
(
"samp.dll"
)
)
;
CDialog__Show_Hook
.
set_dest
(
SampDLL
+
0x6B3E7
)
;
CDialog__Show_Hook
.
set_cb
(
[
]
(
const
decltype
(
CDialog__Show_Hook
)
&
hook
,
void
*
pDialog
,
void
*
EDX
,
int
a2
,
int
nId
,
int
nType
,
const
char
*
Source
,
const
char
*
szText
,
const
char
*
szLeftButton
,
const
char
*
szRightButton
,
bool
bServerside
)
{
Source
=
"custom text"
;
return
hook
.
get_trampoline
(
)
(
pDialog
,
EDX
,
a2
,
nId
,
nType
,
Source
,
szText
,
szLeftButton
,
szRightButton
,
bServerside
)
;
}
)
;
CDialog__Show_Hook
.
install
(
)
;
}
ставлю хук на call ShowDialog внутри функции CHelpDialog::Show

|
|
|

12.11.2024, 21:24
|
|
Постоянный
Регистрация: 05.08.2018
Сообщений: 372
С нами:
4091290
Репутация:
213
|
|
C++:
Код:
using
CDialogShow_t
=
void
(
__thiscall
*
)
(
void
*
,
int
,
int
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
BOOL
)
;
kthook
::
kthook_simple
CDialogShowHook
;
void
customhook
(
)
{
std
::
uintptr_t SampBase
=
reinterpret_cast
(
GetModuleHandle
(
"samp.dll"
)
)
;
CDialogShowHook
.
set_dest
(
SampBase
+
0x6B3E7
)
;
CDialogShowHook
.
set_cb
(
[
]
(
const
decltype
(
CDialogShowHook
)
&
hook
,
void
*
pDialog
,
void
*
edx86
,
int
nId
,
int
nType
,
const
char
*
szCaption
,
const
char
*
szText
,
const
char
*
szLeftButton
,
const
char
*
szRightButton
,
BOOL bServerside
)
{
std
::
string NewMessage
{
"test message"
}
;
return
hook
.
get_trampoline
(
)
(
pDialog
,
nId
,
nType
,
NewMessage
.
c_str
(
)
,
szText
,
szLeftButton
,
szRightButton
,
bServerside
)
;
}
)
;
CDialogShowHook
.
install
(
)
;
}
|
|
|

12.11.2024, 21:30
|
|
Постоянный
Регистрация: 15.09.2021
Сообщений: 396
С нами:
2453766
Репутация:
68
|
|
Сообщение от AdCKuY_DpO4uLa
C++:
Код:
using
CDialogShow_t
=
void
(
__thiscall
*
)
(
void
*
,
int
,
int
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
BOOL
)
;
kthook
::
kthook_simple
CDialogShowHook
;
void
customhook
(
)
{
std
::
uintptr_t SampBase
=
reinterpret_cast
(
GetModuleHandle
(
"samp.dll"
)
)
;
CDialogShowHook
.
set_dest
(
SampBase
+
0x6B3E7
)
;
CDialogShowHook
.
set_cb
(
[
]
(
const
decltype
(
CDialogShowHook
)
&
hook
,
void
*
pDialog
,
void
*
edx86
,
int
nId
,
int
nType
,
const
char
*
szCaption
,
const
char
*
szText
,
const
char
*
szLeftButton
,
const
char
*
szRightButton
,
BOOL bServerside
)
{
std
::
string NewMessage
{
"test message"
}
;
return
hook
.
get_trampoline
(
)
(
pDialog
,
nId
,
nType
,
NewMessage
.
c_str
(
)
,
szText
,
szLeftButton
,
szRightButton
,
bServerside
)
;
}
)
;
CDialogShowHook
.
install
(
)
;
}
я изначально пытался таким методом делать, но у меня бьет эрроры на лямбду
ERROR:
Код:
no suitable user-defined conversion from "lambda [](const kthook::kthook_simple &hook, void *pDialog, void *edx86, int nId, int nType, const char *szCaption, const char *szText, const char *szLeftButton, const char *szRightButton, BOOL bServerside)->void" to "kthook::kthook_simple::cb_type" (aka "std::function &, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t)>") existsC/C++(312)
|
|
|

12.11.2024, 21:38
|
|
Постоянный
Регистрация: 05.08.2018
Сообщений: 372
С нами:
4091290
Репутация:
213
|
|
Ну сделай без лямбды. Вообще никогда лямбды не использовал для хуков
C++:
Код:
using
CDialogShow_t
=
void
(
__thiscall
*
)
(
void
*
,
int
,
int
,
const
char
*
,
const
char
*
,
const
char
*
,
const
char
*
,
BOOL
)
;
kthook
::
kthook_simple
CDialogShowHook
;
void
CDialogShow_HOOKED
(
const
decltype
(
CDialogShowHook
)
&
hook
,
void
*
pDialog
,
void
*
edx86
,
int
nId
,
int
nType
,
const
char
*
szCaption
,
const
char
*
szText
,
const
char
*
szLeftButton
,
const
char
*
szRightButton
,
BOOL bServerside
)
{
std
::
string NewMessage
{
"test message"
}
;
return
hook
.
get_trampoline
(
)
(
pDialog
,
nId
,
nType
,
NewMessage
.
c_str
(
)
,
szText
,
szLeftButton
,
szRightButton
,
bServerside
)
;
}
void
customhook
(
)
{
std
::
uintptr_t SampBase
=
reinterpret_cast
(
GetModuleHandle
(
"samp.dll"
)
)
;
CDialogShowHook
.
set_dest
(
SampBase
+
0x6B3E7
)
;
CDialogShowHook
.
set_cb
(
&
CDialogShow_HOOKED
)
;
CDialogShowHook
.
install
(
)
;
}
|
|
|

13.11.2024, 00:24
|
|
Познавший АНТИЧАТ
Регистрация: 01.04.2018
Сообщений: 1,710
С нами:
4272230
Репутация:
183
|
|
Сообщение от vmprotect
я изначально пытался таким методом делать, но у меня бьет эрроры на лямбду
ERROR:
Код:
no suitable user-defined conversion from "lambda [](const kthook::kthook_simple &hook, void *pDialog, void *edx86, int nId, int nType, const char *szCaption, const char *szText, const char *szLeftButton, const char *szRightButton, BOOL bServerside)->void" to "kthook::kthook_simple::cb_type" (aka "std::function &, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t, std::add_lvalue_reference_t)>") existsC/C++(312)
Ну понятное дело бьет ошибку, в ктхуках добавлять параметр edx86 не нужно + нужно добавить всем параметрам lval reference
|
|
|
|
 |
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|