From a49ac09c02e62e83e596bd4604d0581fad6bf790 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Fri, 18 Nov 2016 00:06:09 +0100 Subject: [PATCH] Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs. --- src/video/windows/SDL_windowswindow.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 5ce40e6ba..e079e292f 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -697,9 +697,15 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata; if (info->version.major <= SDL_MAJOR_VERSION) { + int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch); + info->subsystem = SDL_SYSWM_WINDOWS; info->info.win.window = data->hwnd; - info->info.win.hdc = data->hdc; + + if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) { + info->info.win.hdc = data->hdc; + } + return SDL_TRUE; } else { SDL_SetError("Application not compiled with SDL %d.%d\n",