Question D3D drawing...

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
hello. I have created d3d drawing class which works good and it draws rectagles etc in my exe. I wanted to draw in my exe but from dll. I hooked endscene by vtable (working) and draw a rectangle with my function. It crashes..

This is code which works:

C++:
HRESULT WINAPI mojeEndScene(LPDIRECT3DDEVICE9 q){
    q->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
    return realEndScene(q);
}

This cdode does not work:
HRESULT WINAPI mojeEndScene(LPDIRECT3DDEVICE9 q){
    draw.Rect(200,200,200,200,D3DCOLOR_XRGB(123,123,123),q);
    return realEndScene(q);
}

Function is written good (i can call it from exe) and it looks like that in debugger:

002B159B  |.  68 000000FF   PUSH FF000000                            ; /Arg5 = FF000000
002B15A0  |.  6A 14         PUSH 14                                  ; |Arg4 = 00000014
002B15A2  |.  6A 02         PUSH 2                                   ; |Arg3 = 00000002
002B15A4  |.  6A 0A         PUSH 0A                                  ; |Arg2 = 0000000A
002B15A6  |.  68 62020000   PUSH 262                                 ; |Arg1 = 00000262
002B15AB  |.  E8 50FAFFFF   CALL D3D.MALARNIA::Rect                  ; \MALARNIA::Rect

 but when i call it from my hook it looks like this:

6EFC10A0    55              PUSH EBP
6EFC10A1    8BEC            MOV EBP,ESP
6EFC10A3    E8 58FFFFFF     CALL 6EFC1000 // WHY THE FUCK THERE ARE NO PARAMS????
6EFC10A8    5D              POP EBP
6EFC10A9  - FF25 5833FC6E   JMP DWORD PTR DS:[6EFC3358]              ; d3d9.5527279F // this is ump to rest of EndScene
If i NOP the CALL 6EFC1000 everything runs fine. So question : why compiler doesnt add parameters??
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Really strange that the function isn't called normally. Don't think it will matter but try defining the function globally instead of in a class and manually add __cdecl to it. I don't have many ideas regarding your issue really..
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
Why this simple thing does not work?

C++:
HRESULT (WINAPI* realDrawIndexedPrimitive)(LPDIRECT3DDEVICE9,D3DPRIMITIVETYPE,INT,UINT,UINT,UINT,UINT);
HRESULT mojeDrawIndexedPrimitive(LPDIRECT3DDEVICE9 device,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinIndex,UINT NumVertices,UINT StartIndex,UINT PrimitiveCount){
return realDrawIndexedPrimitive(device, Type, BaseVertexIndex, MinIndex, NumVertices, StartIndex, PrimitiveCount);
}
Code which does nothing but just empty hook. I looked in asm and everything works fine. But after around 10 calls to it it crashes the app....
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Log the return address of the trampoline, is it valid when you crash?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods