HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > Общие вопросы программирования
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

  #1  
Старый 12.11.2024, 21:17
vmprotect
Постоянный
Регистрация: 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

 
Ответить с цитированием

  #2  
Старый 12.11.2024, 21:24
AdCKuY_DpO4uLa
Постоянный
Регистрация: 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
(
)
;
}
 
Ответить с цитированием

  #3  
Старый 12.11.2024, 21:30
vmprotect
Постоянный
Регистрация: 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)
 
Ответить с цитированием

  #4  
Старый 12.11.2024, 21:38
AdCKuY_DpO4uLa
Постоянный
Регистрация: 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
(
)
;
}
 
Ответить с цитированием

  #5  
Старый 13.11.2024, 00:24
Musaigen
Познавший АНТИЧАТ
Регистрация: 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)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.