Rebzzel / kiero

Universal graphical hook for a D3D9-D3D12, OpenGL and Vulkan based games.
MIT License
1.03k stars 219 forks source link

Having an issue with CreateDXGIFactory #12

Closed machsleep closed 4 years ago

machsleep commented 4 years ago

I added a few debug logging to get the actual HRESULT when attempting to call CreateDXGIFactory during initialization. The modules are found perfectly fine, and apparently the function is CreateDXGIFactory is also found correctly.

However, when attempting to call in this block:

IDXGIFactory* factory;  
HRESULT result = ((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory);
if (result < 0)
{
    ::DestroyWindow(window);
    ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
    return Status::IDXGIFactoryFailed;
}

I found it was returning the following error:

DXGI_ERROR_INVALID_CALL 0x887A0001 The application provided invalid parameter data; this must be debugged and fixed before the application is released.

I have done a bit of searching, but for some reason I can't determine the root cause. Any help or tips would be appreciated?

machsleep commented 4 years ago

A bit more context: https://github.com/Rebzzel/kiero/blob/cdc11314f21de21dfc22461a67c2f8e384c4a78a/kiero.cpp#L386

machsleep commented 4 years ago

Figured it out. It was a dumb mistake on my part.

For those who find this issue as well: Do not use dllmain to perform your hooking.