dimanche 21 juillet 2019

getting the address at point in function

I am Hooking a function with detours.

I am trying to detect if the function is called form another function of mine

Both of my returnAdd are diffetent i was expecting them to be the same.

bool Get(LPDIRECT3DDEVICE9 pDevice)
{
    bool bRet = false;
    IDirect3DSurface9* backBuf;
    if (SUCCEEDED(pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuf))) {
        if (SUCCEEDED(pDevice->GetRenderTargetData(backBuf, pCleanSurface)))
        {
            DWORD returnAdd = (DWORD)GetAddressOfThisFunction();
            bRet = true;
        }
    }
    backBuf->Release();

    return bRet;
}

HRESULT __stdcall GetRenderTargetData(LPDIRECT3DDEVICE9 pDevice, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface)
{
    DWORD returnAdd = (DWORD)_ReturnAddress();
    return oGetRenderTargetData(pDevice, pRenderTarget, pDestSurface);
}

Aucun commentaire:

Enregistrer un commentaire