mirror of https://github.com/PCSX2/pcsx2.git
windows: Workaround weird LoadLibraryEx failures
For some reason some Windows 7 systems (most are unaffected) cannot cope with LoadLibraryEx and return error code 87 - "The parameter is incorrect". Switch to using LoadLibrary instead for any case where Windows 7 is expected to successfully load the requested dll. Potentially Windows Vista is also affected.
This commit is contained in:
parent
da9577076c
commit
e16b367e6e
|
@ -57,7 +57,9 @@ bool GSDeviceDX::LoadD3DCompiler()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsWindows8Point1OrGreater())
|
if (!IsWindows8Point1OrGreater())
|
||||||
s_d3d_compiler_dll = LoadLibraryEx("D3DCompiler_43.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
// Use LoadLibrary instead of LoadLibraryEx, some Windows 7 systems
|
||||||
|
// have issues with it.
|
||||||
|
s_d3d_compiler_dll = LoadLibrary("D3DCompiler_43.dll");
|
||||||
|
|
||||||
if (s_d3d_compiler_dll == nullptr)
|
if (s_d3d_compiler_dll == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -255,13 +255,13 @@ void EnumXInputDevices() {
|
||||||
// don't repeatedly try to load it.
|
// don't repeatedly try to load it.
|
||||||
if (pXInputEnable) return;
|
if (pXInputEnable) return;
|
||||||
|
|
||||||
const DWORD flags = LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32;
|
|
||||||
|
|
||||||
// Prefer XInput 1.3 since SCP only has an XInput 1.3 wrapper right now.
|
// Prefer XInput 1.3 since SCP only has an XInput 1.3 wrapper right now.
|
||||||
|
// Also use LoadLibrary and not LoadLibraryEx for XInput 1.3, since some
|
||||||
|
// Windows 7 systems have issues with it.
|
||||||
// FIXME: Missing FreeLibrary call.
|
// FIXME: Missing FreeLibrary call.
|
||||||
HMODULE hMod = LoadLibraryEx(L"xinput1_3.dll", nullptr, flags);
|
HMODULE hMod = LoadLibrary(L"xinput1_3.dll");
|
||||||
if (hMod == nullptr && IsWindows8OrGreater()) {
|
if (hMod == nullptr && IsWindows8OrGreater()) {
|
||||||
hMod = LoadLibraryEx(L"XInput1_4.dll", nullptr, flags);
|
hMod = LoadLibraryEx(L"XInput1_4.dll", nullptr, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hMod) {
|
if (hMod) {
|
||||||
|
|
|
@ -643,12 +643,13 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
EXPORT_C_(UINT32) PADinit(UINT32 flags)
|
EXPORT_C_(UINT32) PADinit(UINT32 flags)
|
||||||
{
|
{
|
||||||
DWORD loadFlags = LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32;
|
// Use LoadLibrary and not LoadLibraryEx for XInput 1.3, since some
|
||||||
|
// Windows 7 systems have issues with it.
|
||||||
s_xInputDll = LoadLibraryEx(L"xinput1_3.dll", nullptr, loadFlags);
|
// TODO: Only load XInput 1.4 for Windows 8+? Or implement the SCP extension?
|
||||||
|
s_xInputDll = LoadLibrary(L"xinput1_3.dll");
|
||||||
if (s_xInputDll == nullptr && IsWindows8OrGreater())
|
if (s_xInputDll == nullptr && IsWindows8OrGreater())
|
||||||
{
|
{
|
||||||
s_xInputDll = LoadLibraryEx(L"XInput1_4.dll", nullptr, loadFlags);
|
s_xInputDll = LoadLibraryEx(L"XInput1_4.dll", nullptr, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||||
}
|
}
|
||||||
if (s_xInputDll == nullptr)
|
if (s_xInputDll == nullptr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue