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:
If i NOP the CALL 6EFC1000 everything runs fine. So question : why compiler doesnt add parameters??
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