Chuyu-Team/YY-Thunks

add "CreateDXGIFactory2" support for "dxgi.dll"

BH2WFR opened this issue · 0 comments

due to my limited ability, I try to type here

document:
https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-createdxgifactory2
image

file:
src/Thunks/dxgi.hpp

code:

#if (YY_Thunks_Target < __WindowsNT6_3)
    __DEFINE_THUNK(
    dxgi,
    8,
    HRESULT,
    STDAPICALLTYPE,
    CreateDXGIFactory2,
        REFIID riid,
        _COM_Outptr_ void** _ppFactory
        )
    {
        if (auto const _pfnCreateDXGIFactory2 = try_get_CreateDXGIFactory2())
        {
            return _pfnCreateDXGIFactory2(riid, _ppFactory);
        }

        if (_ppFactory)
            *_ppFactory = nullptr;
        return DXGI_ERROR_UNSUPPORTED;
    }
#endif
```