D3D Causing Crash menu

User Tag List

Results 1 to 9 of 9
  1. #1
    WgetProgramer's Avatar Member
    Reputation
    1
    Join Date
    Nov 2013
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    D3D Causing Crash

    I'm doing d3d menu for wow 3.3.5a , however to inject the dll is causing error in wow .


    PHP Code:
    BOOL WINAPI DllMain(HMODULE hDllDWORD dwReasonLPVOID lpReserved)
    {
        if (
    dwReason != DLL_PROCESS_ATTACH)
            return 
    FALSE;

        
    DisableThreadLibraryCalls(hDll);
        
    LoadLibrary("d3d9.dll");
        
    CreateThread(nullptr0reinterpret_cast<LPTHREAD_START_ROUTINE>(D3Dinit), nullptr0nullptr);

        return 
    TRUE;

    PHP Code:
    int D3Dinit(void)
    {
        
    DWORD hD3Dadr, *vtbl;
        
    hD3D 0;
        do
        {
            
    hD3D = (DWORD)GetModuleHandle("d3d9.dll");
            
    Sleep(10);
        } while (!
    hD3D);
        
    adr FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86""xx????xx????xx");
        if (
    adr)
        {
            
    memcpy(&vtbl, (void *)(adr 2), 4);
            
    pReset = (oReset)DetourFunction((PBYTE)vtbl[16], (PBYTE)Reset5);
            
    pEndScene = (oEndScene)DetourFunction((PBYTE)vtbl[42], (PBYTE)EndScene5);
        }
        return 
    0;

    Last edited by WgetProgramer; 11-01-2014 at 10:06 AM.

    D3D Causing Crash
  2. #2
    Jadd's Avatar 🐸 Premium Seller
    Reputation
    1511
    Join Date
    May 2008
    Posts
    2,432
    Thanks G/R
    81/333
    Trade Feedback
    1 (100%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Could be anything from a wrong pattern signature to wrong function definition to an error in the detour method. Be more specific: provide your Reset and EndScene detour functions and a crash message from WoW.

    Also, why is this necessary?

    Originally Posted by WgetProgramer View Post
    PHP Code:
    LoadLibrary("d3d9.dll"); 

  3. #3
    WgetProgramer's Avatar Member
    Reputation
    1
    Join Date
    Nov 2013
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://puu.sh/cAi0n/3cc82626c3.png
    Attached Thumbnails Attached Thumbnails D3D Causing Crash-3cc82626c3-png  

  4. #4
    Midi12's Avatar Contributor
    Reputation
    90
    Join Date
    Sep 2012
    Posts
    182
    Thanks G/R
    6/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe try to elevate memory privileges with VirtualProtect function (Windows).

    Are you detouring by modifying the vtable or by writting a jump instruction at the beginning of EndScene ?

    Oh btw look at this source, if I remember right his D3D hook was working well for 3.3.5 : http://www.ownedcore.com/forums/worl...n-scanner.html (EverScan - An Open Source Warden Scanner)
    Last edited by Midi12; 11-02-2014 at 01:41 PM.
    92izii !

  5. #5
    WgetProgramer's Avatar Member
    Reputation
    1
    Join Date
    Nov 2013
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mid12, yes I am using VirtualProtect

    PHP Code:
    void *DetourFunction (BYTE *src, const BYTE *dst, const int len)
    {
            
    BYTE *jmp = (BYTE*)malloc(len+5);
            
    DWORD dwBack;

            
    VirtualProtect(srclenPAGE_EXECUTE_READWRITE, &dwBack);
            
    memcpy(jmpsrclen);  
            
    jmp += len;
            
    jmp[0] = 0xE9;
            *(
    DWORD*)(jmp+1) = (DWORD)(src+len jmp) - 5;
            
    src[0] = 0xE9;
            *(
    DWORD*)(src+1) = (DWORD)(dst src) - 5;
            for (
    int i=5i<leni++)  src[i]=0x90;
            
    VirtualProtect(srclendwBack, &dwBack);
            return (
    jmp-len);


  6. #6
    Midi12's Avatar Contributor
    Reputation
    90
    Join Date
    Sep 2012
    Posts
    182
    Thanks G/R
    6/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Firstly I suggest you to wrap your VirtualProtect function calls inside some "If" statements, just to be sure accessing this memory section is ok.
    On a second step, EndScene prototype should be
    Code:
    HRESULT WINAPI EndScene(IDirect3DDevice9 *pDevice)
    and Reset should be
    Code:
    HRESULT WINAPI Reset(IDirect3DDevice9 *pDevice, D3DPRESENT_PARAMETERS *pPresentationParameters)
    .

    Also you can improve a bit by doing this :
    Code:
    FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
    .
    Btw, your detour function looks ok.
    92izii !

  7. #7
    WgetProgramer's Avatar Member
    Reputation
    1
    Join Date
    Nov 2013
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I resolved the error
    using VirtualProtect in FindPattern

    PHP Code:
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char szMask)
    {
            
    DWORD dwBack;

            
    VirtualProtect((LPVOID)dwAddressdwLenPAGE_EXECUTE_READWRITE, &dwBack);
            for (
    DWORD i 0dwLeni++)
            {
                if (
    bCompare((BYTE*)(dwAddress i), bMaskszMask))
                {
                    
    VirtualProtect((LPVOID)dwAddressdwLendwBack, &dwBack);
                    return (
    DWORD)(dwAddress i);
                }
            }
            
    VirtualProtect((LPVOID)dwAddressdwLendwBack, &dwBack);
            return 
    0;

    porem agora está causando crash

    http://puu.sh/cASBT/62ba84f186.jpg

    Reset
    PHP Code:
    HRESULT WINAPI Reset(IDirect3DDevice9pDeviceD3DPRESENT_PARAMETERSpPresentationParameters)
    {
        
    dMenu.pFont->OnLostDevice();

        
    HRESULT hRet pReset(pDevicepPresentationParameters);

        
    dMenu.pFont->OnResetDevice();

        return 
    hRet;

    EndScene
    PHP Code:
    HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        
    ReFont(pDevice);
        
    dMenu.BuildMenu("~ WgetProgramer ~"1007002000YELLOWBLACKREDpDevice);
        
    WoWThread();
        return 
    pEndScene(pDevice);

    D3DHook
    PHP Code:
    int D3Dinit(void)
    {
        
    DWORD hD3Dadr, *vtbl;
        
    hD3D 0;
        do
        {
            
    hD3D = (DWORD)GetModuleHandle("d3d9.dll");
            
    Sleep(10);
        } while (!
    hD3D);
        
    adr FindPattern((DWORD)GetModuleHandle("d3d9.dll"), 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86""xx????xx????xx");
        if (
    adr)
        {
            
    memcpy(&vtbl, (void *)(adr 2), 4);
            
    pReset = (oReset)DetourFunction((PBYTE)vtbl[16], (PBYTE)Reset5);
            
    pEndScene = (oEndScene)DetourFunction((PBYTE)vtbl[42], (PBYTE)EndScene5);
        }
        return 
    0;


  8. #8
    Midi12's Avatar Contributor
    Reputation
    90
    Join Date
    Sep 2012
    Posts
    182
    Thanks G/R
    6/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should try to check if your detour is working before trying your menu.
    Code:
    HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        MessageBox(nullptr, L"test", L"test", MB_OK);
        return pEndScene(pDevice);
    }
    92izii !

  9. #9
    WgetProgramer's Avatar Member
    Reputation
    1
    Join Date
    Nov 2013
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Midi12 View Post
    You should try to check if your detour is working before trying your menu.
    Code:
    HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        MessageBox(nullptr, L"test", L"test", MB_OK);
        return pEndScene(pDevice);
    }
    gave crash

    Entry.cpp
    PHP Code:
    #include <Windows.h>
    #include "MenuD3D.h"

    BOOL WINAPI DllMain(HMODULE hDllDWORD dwReasonLPVOID lpReserved)
    {
        if (
    dwReason != DLL_PROCESS_ATTACH)
            return 
    FALSE;

        
    DisableThreadLibraryCalls(hDll);
        
    CreateThread(nullptr0reinterpret_cast<LPTHREAD_START_ROUTINE>(D3Dinit), nullptr0nullptr);

        return 
    TRUE;


Similar Threads

  1. [ArcEmu] Lua taxi causing crash
    By kerovi in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 05-24-2011, 04:30 PM
  2. 2.43 custom dbc causes crashe of the client
    By zimbb in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 03-13-2011, 08:15 AM
  3. Spell swap causing crash 3.3.3 works 3.3.2
    By Kagekongen in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 06-29-2010, 01:48 PM
  4. Nofalldmg Detour causes wow to crash
    By Xarg0 in forum WoW Memory Editing
    Replies: 42
    Last Post: 09-21-2008, 11:18 AM
  5. Ascent Gameobjects causes server to crash
    By Tomatsuppen in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 06-12-2008, 12:26 AM
All times are GMT -5. The time now is 06:24 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search