Vector35 / Vector35/binaryninja-api

Type information for functions in IDirect3D9VTable are missing `__stdcall`

Open
#5,801 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Type Libraries Effort: Low Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

This is the info in our type library:


struct __base(IUnknownVTable, 0) IDirect3D9VTable
{
    __inherited HRESULT (* `IUnknownVTable::QueryInterface`)(struct IUnknown* `this`, GUID* riid, void** ppvObject);
    __inherited uint32_t (* `IUnknownVTable::AddRef`)(struct IUnknown* `this`);
    uint32_t (* Release)(struct IUnknown* `this`);
    HRESULT (* RegisterSoftwareDevice)(struct IDirect3D9* `this`, void* pInitializeFunction);
    uint32_t (* GetAdapterCount)(struct IDirect3D9* `this`);
    HRESULT (* GetAdapterIdentifier)(struct IDirect3D9* `this`, uint32_t Adapter, uint32_t Flags, struct D3DADAPTER_IDENTIFIER9* pIdentifier);
    uint32_t (* GetAdapterModeCount)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DFORMAT Format);
    HRESULT (* EnumAdapterModes)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DFORMAT Format, uint32_t Mode, struct D3DDISPLAYMODE* pMode);
    HRESULT (* GetAdapterDisplayMode)(struct IDirect3D9* `this`, uint32_t Adapter, struct D3DDISPLAYMODE* pMode);
    HRESULT (* CheckDeviceType)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DevType, enum D3DFORMAT AdapterFormat, enum D3DFORMAT BackBufferFormat, BOOL bWindowed);
    HRESULT (* CheckDeviceFormat)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, enum D3DFORMAT AdapterFormat, uint32_t Usage, enum D3DRESOURCETYPE RType, enum D3DFORMAT CheckFormat);
    HRESULT (* CheckDeviceMultiSampleType)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, enum D3DFORMAT SurfaceFormat, BOOL Windowed, enum D3DMULTISAMPLE_TYPE MultiSampleType, uint32_t* pQualityLevels);
    HRESULT (* CheckDepthStencilMatch)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, enum D3DFORMAT AdapterFormat, enum D3DFORMAT RenderTargetFormat, enum D3DFORMAT DepthStencilFormat);
    HRESULT (* CheckDeviceFormatConversion)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, enum D3DFORMAT SourceFormat, enum D3DFORMAT TargetFormat);
    HRESULT (* GetDeviceCaps)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, struct D3DCAPS9* pCaps);
    HMONITOR (* GetAdapterMonitor)(struct IDirect3D9* `this`, uint32_t Adapter);
    HRESULT (* CreateDevice)(struct IDirect3D9* `this`, uint32_t Adapter, enum D3DDEVTYPE DeviceType, HWND hFocusWindow, uint32_t BehaviorFlags, struct D3DPRESENT_PARAMETERS* pPresentationParameters, struct IDirect3DDevice9* ppReturnedDeviceInterface);
};

These functions miss __stdcall attibute

Binary: https://github.com/user-attachments/files/16398713/CrackME.exe.zip

Related to https://github.com/Vector35/binaryninja-api/issues/5800

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached CrackME.exe and the related issue #5800, then inspect how the type library represents IDirect3D9VTable function pointers. Verify the generated declarations against the expected __stdcall calling convention; done means the affected functions expose that attribute in the type information.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.