Solved Device for screenshot

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
Status
Not open for further replies.

MSubLty

Newbie
Full Member
Nov 23, 2014
5
82
0
Hi,

I know it's not directly related to game hacking, but it's related to hooking and hacking forums are pratically the only documentation i've found yet.
I'm trying to made my own video capture app, like fraps. I've made a simple capture class using GDI bitblt, and another using D3D9 frontbuffer.

GDI and D3D9 frontbuffer are bad capture method for this purpose : they're slow (av 20 fps) and they aren't able to capture a game using hardware overlay. Thus, i have to use a hook to capture the game window using its backbuffer.
Here's where problem began : i started to learn C++ a couple of months ago and I'm not able to write a code to hook the device pointer, nor clearly understand how the process works exactly.

As I understood so far, I have to get the device pointer provided by endscene method, but i have to hook the game first. When it's done, it seems that i have to do an additonal manipulation over the device pointer, due to memory issues, but i haven't any insight about this so far.

So, anybody can give me a kick to work on ? The only data i've got yet is the window handle. A short sample would definively help me alot.

Thanks for your help, and sorry if it seems like "hi, write my code in my stead", i promise that i've read many different source codes and related website, but it's clearly a hard point for me. Perhaps a little over my coding capacities, i guess.

PS : sorry if some parts of my message are unclear, i'm not a native speaker so i'm doing my best :p
 

MSubLty

Newbie
Full Member
Nov 23, 2014
5
82
0
Hi,
I started to read the links above, and i begin to understand how does it works. But both hook uses Detour; did you have a sample without it ?
Thanks for your help however :)

EDIT : additionally, i have some questions:
- As I understood so far, i have to replace the function's pointer of endScene from vTable with my own function's pointer, which do some stuff before calling endscene. Am i right ?
- Why some example creates a new vTable before switching vTable's pointer, instead switching endScene pointer only ?
- How to inject my dll without using a standalone injector ?
 
Last edited:

MSubLty

Newbie
Full Member
Nov 23, 2014
5
82
0
So you suggest to create a second device to get a kind of "map" of d3d9's functions, and use detour or something analog to hook the function using provided pointers, right ?
I understand then why i've seen ASM in codes which aren't using detours. Do you know where can I find some explanations about how to proceed ?

Regarding to standalone injector, that's because i've seen a tutorial which explain how to make a dll to hack a game, but providing the injector as a standalone. Thus, it requires to select the DLL and the process to inject the DLL and make the hack working (as far as I remember). At last, i don't know if i need to inject a DLL or if it's possible to bind a function from my standalone program to the game i'm trying to hook... I've studied a little fraps' basis principle and i've seen the injected DLL in a sample program : C:\Program Files (x86)\Fraps\FRAPS32.DLL (0x5A7F0000). That's why i'm talking about injection :D
 
Last edited:

squeenie

Hacker
Meme Tier VIP
Dank Tier Donator
Mar 6, 2013
677
5,478
37
You should watch the mid function hook videos that fleep made. I didn't understand the asm in the hooks until I watched it and trust me its way simpler than it appears. Good luck.
 

MSubLty

Newbie
Full Member
Nov 23, 2014
5
82
0
Hi,
I'm still trying to find a way to capture a screenshot using an injected DLL :)
I've found an interesting example which allow me to replace the CreateDevice function pointer from the vTable with my own MyCreateDevice pointer, and then creating the Device myself and keeping its pointer.
But I want to be able to catch the device at every time, not even at the initiation of the game, in order to call some Device's method like GetBackBuffer.

Superspinne, I saw your code and I began to understand it, but unfortunately i'm having troubles using detours. Moreover, i wanna avoid using detours due to its non-free licence... :(
Furthermore, I'm not sure that your sample provide me the Device created and used by the game, thus it doesn't allow me to call another method from this device. Perhaps am I wrong ?

Thanks for your precious help :)
 

MSubLty

Newbie
Full Member
Nov 23, 2014
5
82
0
Hi,
I finally managed to use your Detour Function, i'm using GCC and inline ASM is completely unbearable, anyway...

I'm currently looking into two different ways.
First, I tried to use your code (Superspinne) and i'm having some issues regarding to the device creation.

C++:
HRESULT DeviceCreateResult = Direct3DCreate9(D3D_SDK_VERSION)->CreateDevice(0, D3DDEVTYPE_HAL, ForegroundWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &D3D_Present_Param, &pDummy);
if (DeviceCreateResult == D3D_OK)
		Log << "Device created successfully" << std::endl;
	else Log << "Error while creating Device" << std::endl;
DLL seems to crash when creating the device; the code don't even reach the if statement. What could be the reason of this ? I remember that I had this issue some weeks ago but it was not related to this situation, and the CreateDevice method just failed, not crashing.

Thanks for your help :)
 
Last edited:
Status
Not open for further replies.
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.

Community Mods