From d13a57db67d288682351f4939fd92313b81f866b Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 1 Jul 2021 00:13:59 +0300 Subject: [PATCH] Use plain "LoadLibrary". --- win_directx_helper/win_directx_helper.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/win_directx_helper/win_directx_helper.cpp b/win_directx_helper/win_directx_helper.cpp index 42a4024..d987a32 100644 --- a/win_directx_helper/win_directx_helper.cpp +++ b/win_directx_helper/win_directx_helper.cpp @@ -48,11 +48,6 @@ HRESULT (__stdcall *CreateDXGIFactory1)( REFIID riid, _COM_Outptr_ void **ppFactory); -Handle SafeLoadLibrary(const wchar_t *name) { - SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); - return LoadLibrary(name); -} - template inline bool LoadSymbol(Handle handle, const char *name, Function &func) { func = handle @@ -63,7 +58,7 @@ inline bool LoadSymbol(Handle handle, const char *name, Function &func) { bool ResolveD3D9() { static const auto loaded = [] { - const auto d3d9 = SafeLoadLibrary(L"d3d9.dll"); + const auto d3d9 = LoadLibrary(L"d3d9.dll"); LOAD_SYMBOL(d3d9, D3DPERF_BeginEvent); LOAD_SYMBOL(d3d9, D3DPERF_EndEvent); LOAD_SYMBOL(d3d9, D3DPERF_SetMarker); @@ -76,7 +71,7 @@ bool ResolveD3D9() { bool ResolveD3D11() { static const auto loaded = [] { - const auto d3d11 = SafeLoadLibrary(L"d3d11.dll"); + const auto d3d11 = LoadLibrary(L"d3d11.dll"); return true && LOAD_SYMBOL(d3d11, D3D11CreateDevice); }(); @@ -85,7 +80,7 @@ bool ResolveD3D11() { bool ResolveDXGI() { static const auto loaded = [&] { - const auto dxgi = SafeLoadLibrary(L"dxgi.dll"); + const auto dxgi = LoadLibrary(L"dxgi.dll"); LOAD_SYMBOL(dxgi, CreateDXGIFactory1); return true && LOAD_SYMBOL(dxgi, CreateDXGIFactory);