Results 1 to 1 of 1
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    [C++] D3D Device Pointer Finder

    A function to find d3d8/d3d9 device pointer
    DWORD_PTR * FindDevice(VOID)
    {
    DWORD Base = (DWORD)LoadLibraryW(L"d3d8.dll");

    for(DWORD i = 0; i < 0x128000; i++ )
    {
    if ( (*(BYTE *)(Base+i+0x00))==0xC7
    && (*(BYTE *)(Base+i+0x01))==0x06
    && (*(BYTE *)(Base+i+0x06))==0x89
    && (*(BYTE *)(Base+i+0x07))==0x86
    && (*(BYTE *)(Base+i+0x0C))==0x89
    && (*(BYTE *)(Base+i+0x0D))==0x86 )
    return (DWORD_PTR *)(Base + i + 2);
    }
    return NULL;
    }

    How To Use
    DWORD_PTR * VtablePtr = FindDevice();

    if (VtablePtr = NULL )
    {
    MessageBoxW(L"Device Not Found !",0,0,0);
    ExitProcess(0); //or it will crash anyway
    }

    DWORD_PTR * VTable ;
    *(DWORD_PTR *)&VTable = *(DWORD_PTR *)VtablePtr;

    //and then
    Vtable[35];//endscene
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •