Jump to content

D3D9 Windows 8/7/xp Endscene/reset [Source Code]


ThriNity

Recommended Posts

a hook I created, fairly simple and works for Win 8/7/XP, you can get it to work for Windows Vista, just find the correct offset/address to add to the entrypoint.
 

Code:
void Hook()
{
    MODULEINFO mInfo;

    DWORD dwD3D9 = NULL;

    OSVERSIONINFO WindowsVersion;
    WindowsVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&WindowsVersion);

    while(!dwD3D9)
    {
        dwD3D9 = (DWORD)GetModuleHandle("d3d9.dll");
    }

    GetModuleInformation(GetCurrentProcess(), (HMODULE)dwD3D9, &mInfo, sizeof(MODULEINFO));

    if(WindowsVersion.dwMajorVersion < 5 && WindowsVersion.dwMinorVersion >= 3)
    {
        MessageBoxA(NULL, "Your Operating System isn't supported!", "Attention!", NULL);
        exit(EXIT_SUCCESS);
    }    

    if(WindowsVersion.dwMajorVersion == 6 && WindowsVersion.dwMinorVersion == 2)//Windows 8
    {
        Main->D3D->Settings->dwEndScene = (int)mInfo.EntryPoint + 0xFFFFFFFFFFFDF736;
        Main->D3D->Settings->dwReset = 0x72452A8F;
    }
    else if(WindowsVersion.dwMajorVersion == 6 && WindowsVersion.dwMinorVersion == 1)//Windows 7    
    {
        Main->D3D->Settings->dwEndScene = (int)mInfo.EntryPoint + 0x20D5A;
        Main->D3D->Settings->dwReset = 0x6B9DF251;
    }
    else if(WindowsVersion.dwMajorVersion == 5 && WindowsVersion.dwMinorVersion == 1)//Windows XP
    {
        Main->D3D->Settings->dwEndScene = 0x4FE571B0;
        Main->D3D->Settings->dwReset = 0x4FE136B0;
    }    

    pEndScene = (oEndScene)DetourFunction((PBYTE)Main->D3D->Settings->dwEndScene, (PBYTE)&EndScene);
    pReset = (oReset)DetourFunction((PBYTE)Main->D3D->Settings->dwReset, (PBYTE)&Reset);    
}

EndScene and Reset only, shouldn't be hard to hook Present either, btw, addresses are static according to the OS.

Enjoy

Link to comment
Share on other sites

  • 2 weeks later...
  • 11 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.

 

AdBlock Extension Detected!

depositphotos_220325684-stock-illustration-hand-holding-mobile-with-ad.jpg

 

Our website is made possible by displaying online Advertisements to our members.

Please disable AdBlock browser Extension first, to be able to use our Community.

You won't be able to access this page.

I've Disabled AdBlock