Results 1 to 14 of 14
  1. #1
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28

    Finding Direct3D Device Pointer

    No one better not try linking me to this tutorial: https://www.mpgh.net/forum/279-call-d...e-pointer.html

    I have been there, I have searched for days, and I have asked people and no one will f*cking help me, at least the little help they attempt to give is completely useless. I am on the brink of snapping, and all I want to do is find the Direct3D Device Pointer in Left 4 Dead 2. Now, I have attempted Void's tutorial with Olly, well, I don't get past step 1 because there is absolutely no calls to "Direct3DCreate9", I tried something HD told me using c++ and doing Direct3DCreate9 then taking the IDirect3D handle or whatever and adding 0x40 to it. Not quite sure what he was telling me to do, but it obviously didn't work. And at this point I have searched my ass off in olly for any sign of it. I asked one of my friends about finding it, and he lol'd then copy/pasted a section of ASM into our conversation
    Code:
    .text:00490045                 call    D3DXMatrixPerspectiveFovLH
    .text:0049004A                 mov     ecx, dword_7E4CE0 ;  D3D device pointer 
    .text:00490050                 mov     eax, [ecx]
    .text:00490052                 mov     edx, [eax]
    then stopped replying. I can see in that code that they put the pointer in ecx. But, that's not from l4d2, and he wont explain how the hell he found it. Now I would absolutely love it if someone just came out and posted the pointer, but I would like it more if someone could actually help me find it, so I can find future pointers.
    Thanks in advance
    ~lilneo

  2. #2
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    DirectX 9 device pointer will also be resolved using the following scan:

    [php]
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
    for( ; *szMask; ++szMask, ++pData, ++bMask)
    if(*szMask == 'x' && *pData != *bMask)
    return false;
    return (*szMask) == NULL;
    }


    DWORD FindPattern(DWORD dValor,DWORD dLer,BYTE *bMaskara,char * szMaskara)
    {
    for (DWORD i=0; i < dLer; i++)
    if (bCompare((PBYTE)(dValor + i), bMaskara, szMaskara))
    return (DWORD)(dValor + i);
    return false;
    }

    DWORD dwDXDevice = FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x 00\x00\x89\x86", "xx????xx????xx");

    [/php]
    The virtual table function listing can be found by adding 2 to the device pointer (ie, (dwDXDevice + 2))

    Not sure who made the bCompare and FindPattern functions, but credits to them.

  3. The Following User Says Thank You to freedompeace For This Useful Post:

    lilneo (10-23-2010)

  4. #3
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28
    The pointer is stored in dwDXDevice?
    And yeah I've seen this code before. I had trouble making it work, maybe I'll try again

    Edit: Okay I think I got the pointer, that code returned an address. Any sure fire way of checking if it works? I tried using Void's hook, then returning false in the endscene hook. HD said it should fuck my
    drawing, but it just crashes.

    Edit2: So I put the pointer into Void's code... And well it just crashes the game, it doesn't even work. So something is wrong, the pointer seems right, and the code seems fine...
    ~lilneo

  5. #4
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by lilneo View Post
    The pointer is stored in dwDXDevice?
    And yeah I've seen this code before. I had trouble making it work, maybe I'll try again

    Edit: Okay I think I got the pointer, that code returned an address. Any sure fire way of checking if it works? I tried using Void's hook, then returning false in the endscene hook. HD said it should fuck my drawing, but it just crashes.
    ~lilneo
    Not really... Only way to test it is if it fails, and if there is one, I'm sure it really elaborate.

    PS: Also if your having problems you can just post here. I haven't seen you post here once. You shouldn't wait till your frustrated to do so.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  6. #5
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28
    That's because I have HD on steam. I haven't been here for a while anyways, school and stuff. But yeah, so I used the code, injected, moved the returned value in dwDXDevice into a buffer, and then MessageBox'd that buffer and got 627D3939. So I pop that into Void's code, (0x in front) and I inject his thing, (nothing changed in it) and it says "Hooked" like it should... Then a few seconds later it crashes l4d2.

    Edit: actually I had some stuff changed, so I completely copy pasted void's code. Compiled, injected with my addy in place of his and it just crashes. Not even a messagebox.
    ~lilneo

  7. #6
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by lilneo View Post
    That's because I have HD on steam. I haven't been here for a while anyways, school and stuff. But yeah, so I used the code, injected, moved the returned value in dwDXDevice into a buffer, and then MessageBox'd that buffer and got 627D3939. So I pop that into Void's code, (0x in front) and I inject his thing, (nothing changed in it) and it says "Hooked" like it should... Then a few seconds later it crashes l4d2.

    Edit: actually I had some stuff changed, so I completely copy pasted void's code. Compiled, injected with my addy in place of his and it just crashes. Not even a messagebox.
    ~lilneo
    What's Void's code?
    And what's this HD on Steam thing?

  8. #7
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28
    https://www.mpgh.net/forum/31-c-c/125...3ddevice9.html
    That is void's code. And HD on steam is Hell_Demon, on Steam. Steam = basically chat.
    ~lilneo

  9. #8
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Well, there's a myriad of reasons it could be crashing. Like all good experiment we'll need a control. Try testing the same technique in a test environment. Then if it does not work in the game we know the game is doing something different.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  10. #9
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28
    What do you mean by test environment, like a directX game I have compiled myself? To be honest I know close to shitall DirectX programming. I tried learning but got super bored so I want to learn it with a hook on a game, to make it more fun. Also, I am considering my 'control' to be the message box coming up saying "Loaded" and then nothing happening because I haven't done anything. Then after that, once I do things the control will be the message box and whatever I have done. The message box isn't coming up, and the game is directly crashing. So...
    ~lilneo

  11. #10
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    No look up DirectX9 Test Enviroment. There are applications made to test menu, and D3d code in before we put it in games. Just testing your code in a game would be silly and hard as hell to debug.

    https://www.mpgh.net/forum/31-c-c/115...ml#post1535040

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  12. #11
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by lilneo View Post
    What do you mean by test environment, like a directX game I have compiled myself? To be honest I know close to shitall DirectX programming. I tried learning but got super bored so I want to learn it with a hook on a game, to make it more fun. Also, I am considering my 'control' to be the message box coming up saying "Loaded" and then nothing happening because I haven't done anything. Then after that, once I do things the control will be the message box and whatever I have done. The message box isn't coming up, and the game is directly crashing. So...
    ~lilneo
    A control being an app that does nothing to prevent anti-hacking, doesn't do any calculations. It's a neutral control, that removes all other possible variables that may affect your code.

    Here is the one I use.

    https://goo[DOT]gl/arcQ

    On mobile so yeah, had that link copied on my clip already. Dun ban me D:

  13. #12
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    May be worth adding that you're doing it for left 4 dead 2
    * modified source engine(no code available besides a reverse engineered SDK that isn't even close to completion)
    * Valve Anti Cheat(external AC that resides inside steam, doesn't prevent you from doing things as far as i'm aware)

    The thing I was refering to on steam was "Direct3DCreate9", the return value of that is the direct3d object pointer. CreateDevice is the 16th virtual function, thus 16*0x4 = 0x40.
    So you look for something along the lines of
    mov ECX, addy
    call [ECX+0x40]

    Then see where EAX is mov'd into and voila, you have your device pointer.
    This is the method I used for CoD:MW2 btw.

    L4D2 is special as in they don't load d3d9 lib directly, but rather through a dll of theirs.
    I believe what they do is load up launcher.dll, then call launchermain.
    launchermain will load up all other DLL's and starts up their factories.
    The key dll to find is vgui2.dll, which does all the gui related stuff. I asume they either load d3d9 from vgui dll OR they load it from the matsystem(material system) dll.

    If you're unable to figure it out lemme know on steam and i'll see what I can do.
    Ah we-a blaze the fyah, make it bun dem!

  14. The Following 3 Users Say Thank You to Hell_Demon For This Useful Post:

    lilneo (10-24-2010),qwerty01 (09-12-2011),why06 (10-24-2010)

  15. #13
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    wow, i am not going to ask how you even found that out. lol.

  16. #14
    lilneo's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Canada
    Posts
    217
    Reputation
    8
    Thanks
    28
    Okay, so, I have tried it with the d3d9 test environment. I used the Pointer Retrieving code and found 6F443939, I put that into void's hook and then injected into the d3d9 test environment and it just crashed. So it must be an incorrect pointer.
    ~lilneo

Similar Threads

  1. [Help] Finding crossfire D3D device pointer
    By lauwy in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 3
    Last Post: 12-20-2010, 10:22 PM
  2. How to find the D3D device pointer?
    By Mr.Magicman in forum Combat Arms Help
    Replies: 0
    Last Post: 05-24-2010, 09:56 AM
  3. [Released]How to find Device Pointer
    By TheBigBoy in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 2
    Last Post: 04-06-2010, 12:19 AM
  4. Direct3D Device pointer
    By Void in forum Programming Tutorial Requests
    Replies: 1
    Last Post: 03-20-2010, 01:52 AM
  5. [TUT]finding the device pointer
    By RedThunder in forum C++/C Programming
    Replies: 8
    Last Post: 03-16-2010, 03:04 AM