Hook d3d9::reset

Статус
В этой теме нельзя размещать новые ответы.

Dark_Knight

Me, me and me.
Автор темы
Друг
4,062
2,077
Доброго времени суток граждане алкоголики, туниядцы и хулиганы. Есть ли у кого-то решение хукнуть ЧИСТО отдельный метод d3d9::reset? Акцент в плане вопроса сделан именно на том, чтобы хукнуть именно один метод.
 
Решение
хукер urshadow
C++:
#define __RwD3DDevice                0x00C97C28
#define DIRECTX_VT_FUNC(offset)        (reinterpret_cast<void**>(*reinterpret_cast<void***>(*reinterpret_cast<DWORD*>(__RwD3DDevice)))[offset])

HRESULT __stdcall hkReset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters) {
    HRESULT hres = hook_d3dReset.call<urmem::calling_convention::stdcall, HRESULT>(pDevice, pPresentationParameters);
    return hres;
}

hook_d3dReset.install(urmem::get_func_addr(DIRECTX_VT_FUNC(16)), urmem::get_func_addr(&hkReset));

kin4stat

mq-team
Всефорумный модератор
2,730
4,710
Доброго времени суток граждане алкоголики, туниядцы и хулиганы. Есть ли у кого-то решение хукнуть ЧИСТО отдельный метод d3d9::reset? Акцент в плане вопроса сделан именно на том, чтобы хукнуть именно один метод.
Так не ставь хук на пресент и все
 

loganhackerdff

Известный
868
517

Cake_

Известный
Проверенный
263
313
хукер urshadow
C++:
#define __RwD3DDevice                0x00C97C28
#define DIRECTX_VT_FUNC(offset)        (reinterpret_cast<void**>(*reinterpret_cast<void***>(*reinterpret_cast<DWORD*>(__RwD3DDevice)))[offset])

HRESULT __stdcall hkReset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters) {
    HRESULT hres = hook_d3dReset.call<urmem::calling_convention::stdcall, HRESULT>(pDevice, pPresentationParameters);
    return hres;
}

hook_d3dReset.install(urmem::get_func_addr(DIRECTX_VT_FUNC(16)), urmem::get_func_addr(&hkReset));
 

kin4stat

mq-team
Всефорумный модератор
2,730
4,710
Код:
#define __RwD3DDevice 0x00C97C28
#define DIRECTX_VT_FUNC(offset) (reinterpret_cast<void**>(*reinterpret_cast<void***>(*reinterpret_cast<DWORD*>(__RwD3DDevice)))[offset])
C++:
constexpr auto __RwD3DDevice = 0x00C97C28;
void* DIRECTX_VT_FUNC(unsigned int offset) {
    unsigned long Device = *reinterpret_cast<unsigned long*>(__RwD3DDevice);
    return *reinterpret_cast<void***>(Device)[offset];
}
UPD:
C++20:
C++:
constinit auto __RwD3DDevice = 0x00C97C28;
void* DIRECTX_VT_FUNC(unsigned int offset) {
    unsigned long Device = *reinterpret_cast<unsigned long*>(__RwD3DDevice);
    return *reinterpret_cast<void***>(Device)[offset];
}
 
Последнее редактирование:

SR_team

like pancake
BH Team
4,720
6,369
C++:
constexpr auto __RwD3DDevice = 0x00C97C28;
constexpr void* DIRECTX_VT_FUNC(unsigned int offset) {
    unsigned long Device = *reinterpret_cast<unsigned long*>(__RwD3DDevice);
    return *reinterpret_cast<void***>(Device)[offset];
}
UPD:
C++20:
C++:
constinit auto __RwD3DDevice = 0x00C97C28;
consteval void* DIRECTX_VT_FUNC(unsigned int offset) {
    unsigned long Device = *reinterpret_cast<unsigned long*>(__RwD3DDevice);
    return *reinterpret_cast<void***>(Device)[offset];
}
consteval - выполнение строго во время компиляции. Что оно у тебя во время компиляции из 0x00C97C28; прочитает?
 
  • Нравится
Реакции: kin4stat

Dark_Knight

Me, me and me.
Автор темы
Друг
4,062
2,077
хукер urshadow
C++:
#define __RwD3DDevice                0x00C97C28
#define DIRECTX_VT_FUNC(offset)        (reinterpret_cast<void**>(*reinterpret_cast<void***>(*reinterpret_cast<DWORD*>(__RwD3DDevice)))[offset])

HRESULT __stdcall hkReset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters) {
    HRESULT hres = hook_d3dReset.call<urmem::calling_convention::stdcall, HRESULT>(pDevice, pPresentationParameters);
    return hres;
}

hook_d3dReset.install(urmem::get_func_addr(DIRECTX_VT_FUNC(16)), urmem::get_func_addr(&hkReset));
Вот это прям то что я искал. Спасибо. Я просто пробовал хукнуть по адрессу 0x6FFE0 для р1 и ловил краши. Тему можно закрыть.
 
Статус
В этой теме нельзя размещать новые ответы.