From faafbb2d3f57d8d099f249cb635f47ea409bf3c3 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 31 May 2016 17:02:07 -1000 Subject: [PATCH] Add check for missing Windows 7 Platform Update --- lib/win/ApplicationWin32.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index 82a4e6a..06e6f40 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -194,13 +194,20 @@ public: if (FAILED(MyD3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_FLAGS, &level, 1, D3D11_SDK_VERSION, &tempDev, nullptr, &tempCtx))) Log.report(logvisor::Fatal, "unable to create D3D11 device"); - tempDev.As(&m_3dCtx.m_ctx11.m_dev); - tempCtx.As(&m_3dCtx.m_ctx11.m_devCtx); + + ComPtr device; + if (FAILED(tempDev.As(&m_3dCtx.m_ctx11.m_dev)) || !m_3dCtx.m_ctx11.m_dev || + FAILED(tempCtx.As(&m_3dCtx.m_ctx11.m_devCtx)) || !m_3dCtx.m_ctx11.m_devCtx || + FAILED(m_3dCtx.m_ctx11.m_dev.As(&device)) || !device) + { + MessageBoxW(nullptr, L"Windows 7 users should install 'Platform Update for Windows 7':\n" + L"https://www.microsoft.com/en-us/download/details.aspx?id=36805", + L"IDXGIDevice2 interface error", MB_OK | MB_ICONERROR); + exit(1); + } /* Obtain DXGI Factory */ - ComPtr device; ComPtr adapter; - m_3dCtx.m_ctx11.m_dev.As(&device); device->GetParent(__uuidof(IDXGIAdapter), &adapter); adapter->GetParent(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx11.m_dxFactory);