diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index f54f0d7c5..66659ea6a 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -149,7 +149,14 @@ int main(int argc, char **argv) ) #endif { - LoadLibraryA("exchndl.dll"); + // XP and Vista users can't use the newest exchndl.dll + // and older exchndl.dll won't work with release builds >= 2.1.21 + // Check for >= Version 6.1 (>= Win7) + DWORD winversion = GetVersion(); + DWORD major = (DWORD)(LOBYTE(LOWORD(winversion))); + DWORD minor = (DWORD)(HIBYTE(LOWORD(winversion))); + if (major > 6 || (major == 6 && minor > 0)) + LoadLibraryA("exchndl.dll"); } } #ifndef __MINGW32__ diff --git a/src/sdl12/i_main.c b/src/sdl12/i_main.c index 1c438e083..8737c5755 100644 --- a/src/sdl12/i_main.c +++ b/src/sdl12/i_main.c @@ -218,7 +218,14 @@ int main(int argc, char **argv) #endif ) { - LoadLibraryA("exchndl.dll"); + // XP and Vista users can't use the newest exchndl.dll + // and older exchndl.dll won't work with release builds >= 2.1.21 + // Check for >= Version 6.1 (>= Win7) + DWORD winversion = GetVersion(); + DWORD major = (DWORD)(LOBYTE(LOWORD(winversion))); + DWORD minor = (DWORD)(HIBYTE(LOWORD(winversion))); + if (major > 6 || (major == 6 && minor > 0)) + LoadLibraryA("exchndl.dll"); } } #endif diff --git a/src/win32/win_main.c b/src/win32/win_main.c index bfe620a43..1e5c3fc46 100644 --- a/src/win32/win_main.c +++ b/src/win32/win_main.c @@ -663,8 +663,19 @@ int WINAPI WinMain (HINSTANCE hInstance, #endif // Try Dr MinGW's exception handler. if (!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) + { +#endif + // XP and Vista users can't use the newest exchndl.dll + // and older exchndl.dll won't work with release builds >= 2.1.21 + // Check for >= Version 6.1 (Win7) + DWORD winversion = GetVersion(); + DWORD major = (DWORD)(LOBYTE(LOWORD(winversion))); + DWORD minor = (DWORD)(HIBYTE(LOWORD(winversion))); + if (major > 6 || (major == 6 && minor > 0)) + LoadLibraryA("exchndl.dll"); +#if 0 + } #endif - LoadLibraryA("exchndl.dll"); #ifndef __MINGW32__ prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);