Results 1 to 12 of 12
  1. #1
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted

    [source]D3D9: Finding the VirtualTable without signatures

    A little function that searches your applications memory for the VirtualTable of the DevicePointer.

    This function finds the device pointer's vtable by scanning for the following logic:

    Code:
    Vtable.DWORD1 > Vtable.DWORD2 & Vtable.DWORD3
    Vtable.DWORD2 > Vtable.DWORD3
    Vtable.DWORD1 < Vtable.DWORD4
    Vtable.DWORD5 > Vtable.DWORD4
    etc...etc... &&
    Vtable[0x3] == Vtable[0x7] == Vtable[0x..] == ... etc... etc
    This method is not 100% successful all the time. However I've tested it on 7 games and only in 1 game it returned a wrong pointer (DragonAge 2)
    You should check the pointer that is returned though. You could do this by checking if the vtable function pointers point to functions(see if they begin with the standard windows prologue code: mov ebp, esp)

    This function is also slow, it may take up to 5 seconds for it to return (depending on how high a memory location the Vtable is located)

    Code:
    #include <windows.h>
    #include <iostream>
    #include <string.h>
    
    #pragma comment(lib, "VtableScan.lib")
    
    extern "C"{
    	DWORD _stdcall ScanTable();
    }
    int MainThread();
    
    BOOL APIENTRY DllMain( HANDLE hModule, DWORD  fdwReason, LPVOID lpReserved ){
    
    	if( fdwReason == DLL_PROCESS_ATTACH){
           CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&MainThread, NULL, NULL, NULL);
    	   return TRUE;
    	}
    
        return TRUE;
    }
    
    int MainThread(){
    
    	while(!GetModuleHandle("d3d9.dll")){
             Sleep(1000);
    	}
    
    	DWORD Vtable = ScanTable();    // returns the vtable (or something that looks like it)
    
    	char buffer[10] = "";
    	std::string OutString = "Vtable Location: 0x";
        sprintf(&buffer[0],"%x",Vtable);
        OutString += buffer;
    	
    	MessageBox(NULL, OutString.c_str(), "SCHiM", MB_OK);   // output 
        
    
    return 0;
    }



    Virs:

    Jotti
    Virscan

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  2. The Following 5 Users Say Thank You to .::SCHiM::. For This Useful Post:

    ♪~ ᕕ(ᐛ)ᕗ (05-19-2011),kirao (05-20-2011),Stephen (05-20-2011),waitedfor (12-13-2012),whit (05-19-2011)

  3. #2
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    This is pretty neat, ill give it a look
    Good job

  4. #3
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Epic shit dude! Thanks a lot!
    Are u a mathematical genius or something?

  5. #4
    crex's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    leaf village
    Posts
    11,667
    Reputation
    1365
    Thanks
    2,572
    Well done!!!

  6. #5
    proman98's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    Achel
    Posts
    1,024
    Reputation
    47
    Thanks
    81
    My Mood
    Fine
    Nice work very usefull

  7. #6
    melih52's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    İSTANBUL
    Posts
    3
    Reputation
    7
    Thanks
    0
    Thank you for it.

  8. #7
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Thanks for all the responses, post back if it works. If it doesn't I'll see what I can do

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  9. #8
    VirtualDUDE's Avatar
    Join Date
    May 2011
    Gender
    male
    Location
    In my basement
    Posts
    665
    Reputation
    -172
    Thanks
    20
    My Mood
    Relaxed
    Makes everything I've made, look ridiculously easy :P

  10. #9
    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
    any reason for using this over a sigscan? <:
    Ah we-a blaze the fyah, make it bun dem!

  11. #10
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Quote Originally Posted by Hell_Demon View Post
    any reason for using this over a sigscan? <:
    Not in particular, but signature scans have to be updated every once in a while. This wont need an update, and even if it will need one in the future, it can be done in 5/10 minutes

    EDIT: Now that I think about it, you could make an automatic updater. So this won't need to be updated manually
    Last edited by .::SCHiM::.; 05-20-2011 at 05:46 AM.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  12. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Fuck off Cookie. Stop ruining good threads.

    @schim, looks fantastic mate.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  13. The Following User Says Thank You to Jason For This Useful Post:

    .::SCHiM::. (05-20-2011)

  14. #12
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,689
    Reputation
    184
    Thanks
    1,149
    My Mood
    Aggressive
    Amazing Job.