aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-15 07:34:07 +0000
committermarha <marha@users.sourceforge.net>2009-09-15 07:34:07 +0000
commit8bfa2f879ea38340a633c29120758a390b63667e (patch)
tree72b528920637f8995463a76e52fe26a079b08101
parented731e80d18618e26cd27b6373dea40856f1db0e (diff)
downloadvcxsrv-8bfa2f879ea38340a633c29120758a390b63667e.tar.gz
vcxsrv-8bfa2f879ea38340a633c29120758a390b63667e.tar.bz2
vcxsrv-8bfa2f879ea38340a633c29120758a390b63667e.zip
Solved stack corruption in QueryMonitor.
Make use of multimon.h (from windows sdk)
-rw-r--r--xorg-server/hw/xwin/winprocarg.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index 305a82118..2c4999884 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -39,7 +39,8 @@ from The Open Group.
#include "winconfig.h"
#include "winprefs.h"
#include "winmsg.h"
-
+#define COMPILE_MULTIMON_STUBS
+#include <multimon.h>
/*
* References to external symbols
*/
@@ -77,30 +78,10 @@ struct GetMonitorInfoData {
int monitorWidth;
};
-typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
-ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
-
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
static Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
{
- /* Load EnumDisplayMonitors from DLL */
- HMODULE user32;
- FARPROC func;
- user32 = LoadLibrary("user32.dll");
- if (user32 == NULL)
- {
- winW32Error(2, "Could not open user32.dll");
- return FALSE;
- }
- func = GetProcAddress(user32, "EnumDisplayMonitors");
- if (func == NULL)
- {
- winW32Error(2, "Could not resolve EnumDisplayMonitors: ");
- return FALSE;
- }
- _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func;
-
/* prepare data */
if (data == NULL)
return FALSE;
@@ -108,10 +89,8 @@ static Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
data->requestedMonitor = index;
/* query information */
- _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+ xEnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
- /* cleanup */
- FreeLibrary(user32);
return TRUE;
}