
10.07.2022, 11:33
|
|
Участник форума
Регистрация: 03.08.2019
Сообщений: 168
С нами:
3568604
Репутация:
48
|
|
Сталкнулся с вопросом. Я смог хукнуть функцию DrawIndexedPrimitive, однако все отрисовки видны в OBS. Возможно ли как-то обойти это?
C++:
Код:
HRESULT __stdcall CD3DHook
::
hkDrawIndexedPrimitive
(
LPDIRECT3DDEVICE9 pDevice
,
D3DPRIMITIVETYPE PrimitiveType
,
INT BaseVertexIndex
,
UINT MinVertexIndex
,
UINT NumVertices
,
UINT startIndex
,
UINT primCount
)
{
if
(
pD3DHook
->
bInit
)
{
if
(
pWallhack
->
ChamsStatus
)
{
LPDIRECT3DVERTEXBUFFER9 Stream_Data
;
UINT offset
=
0
;
UINT stride
=
0
;
D3DMATRIX matTrans
;
if
(
pD3DHook
->
pD3DDevice
->
GetStreamSource
(
0
,
&
Stream_Data
,
&
offset
,
&
stride
)
==
S_OK
)
Stream_Data
->
Release
(
)
;
if
(
stride
==
40
||
stride
==
44
||
stride
==
36
)
{
pD3DHook
->
pD3DDevice
->
SetRenderState
(
D3DRS_ZENABLE
,
false
)
;
pD3DHook
->
pD3DDevice
->
SetRenderState
(
D3DRS_FILLMODE
,
D3DFILL_SOLID
)
;
pD3DHook
->
pD3DDevice
->
SetTexture
(
0
,
pTextures
->
Red
)
;
pD3DHook
->
oDrawIndexedPrimitive
(
pDevice
,
PrimitiveType
,
BaseVertexIndex
,
MinVertexIndex
,
NumVertices
,
startIndex
,
primCount
)
;
pD3DHook
->
pD3DDevice
->
SetRenderState
(
D3DRS_ZENABLE
,
true
)
;
pD3DHook
->
pD3DDevice
->
SetRenderState
(
D3DRS_FILLMODE
,
D3DFILL_SOLID
)
;
pD3DHook
->
pD3DDevice
->
SetTexture
(
0
,
pTextures
->
Green
)
;
pD3DHook
->
pD3DDevice
->
GetTransform
(
D3DTRANSFORMSTATETYPE
::
D3DTS_VIEW
,
&
matTrans
)
;
printf_s
(
"%d %d %d %d %d %d\n"
,
PrimitiveType
,
BaseVertexIndex
,
MinVertexIndex
,
NumVertices
,
startIndex
,
primCount
)
;
}
}
}
return
pD3DHook
->
oDrawIndexedPrimitive
(
pDevice
,
PrimitiveType
,
BaseVertexIndex
,
MinVertexIndex
,
NumVertices
,
startIndex
,
primCount
)
;
}
C++:
[CODE]
class
CD3DHook
{
public
:
CD3DHook
(
)
{
bInit
=
false
;
oPresent
=
(
tPresent
)
GetDeviceAddress
(
17
)
;
oReset
=
(
tReset
)
GetDeviceAddress
(
16
)
;
oDrawIndexedPrimitive
=
(
tDrawIndexedPrimitive
)
GetDeviceAddress
(
82
)
;
DetourRestoreAfterWith
(
)
;
DetourTransactionBegin
(
)
;
DetourUpdateThread
(
GetCurrentThread
(
)
)
;
pSecure
->
SDetourAttach
(
&
(
PVOID
&
)
oPresent
,
hkPresent
)
;
pSecure
->
SDetourAttach
(
&
(
PVOID
&
)
oReset
,
hkReset
)
;
pSecure
->
SDetourAttach
(
&
(
PVOID
&
)
oDrawIndexedPrimitive
,
hkDrawIndexedPrimitive
)
;
DetourTransactionCommit
(
)
;
}
;
~
CD3DHook
(
)
{
DetourRestoreAfterWith
(
)
;
DetourTransactionBegin
(
)
;
DetourUpdateThread
(
GetCurrentThread
(
)
)
;
DetourDetach
(
&
(
PVOID
&
)
oPresent
,
hkPresent
)
;
DetourDetach
(
&
(
PVOID
&
)
oReset
,
hkReset
)
;
DetourDetach
(
&
(
PVOID
&
)
oDrawIndexedPrimitive
,
hkDrawIndexedPrimitive
)
;
DetourTransactionCommit
(
)
;
}
;
bool
bInit
;
IDirect3DDevice9
*
pD3DDevice
;
private
:
DWORD
FindDevice
(
DWORD dwLen
)
{
DWORD dwObjBase
=
0
;
char
infoBuf
[
MAX_PATH
]
;
GetSystemDirectoryA
(
infoBuf
,
MAX_PATH
)
;
strcat_s
(
infoBuf
,
MAX_PATH
,
"\\d3d9.dll"
)
;
dwObjBase
=
(
DWORD
)
LoadLibraryA
(
infoBuf
)
;
while
(
dwObjBase
++
Просто например Функция present спокойно отрисовывает и не виден в OBS
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|