From 8ac2f8b03664bbb9aa2ca51a2105290444ccb905 Mon Sep 17 00:00:00 2001 From: vincents Date: Mon, 26 Mar 2007 19:02:29 +0000 Subject: [PATCH] win32 interface: fixed several range errors * create app window without caption, so that GetWindowSize doesn't return a negative size * prevent usage of uninitialized array similar to r10798 #eaf391320b git-svn-id: trunk@10810 - --- lcl/interfaces/win32/win32callback.inc | 2 +- lcl/interfaces/win32/win32object.inc | 8 ++++++-- lcl/interfaces/win32/win32winapi.inc | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 6431dab916..e6b5c82e21 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -448,7 +448,7 @@ Var // send through message to allow message override //lWinControl.EraseBackground(PaintMsg.DC); Include(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground); - lWinControl.Perform(LM_ERASEBKGND, PaintMsg.DC, 0); + lWinControl.Perform(LM_ERASEBKGND, Windows.WPARAM(PaintMsg.DC), 0); Exclude(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground); end; if ParentPaintWindow <> 0 then diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 7cfa8349bb..f22a817260 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -175,7 +175,7 @@ begin // Create parent of all windows, `button on taskbar' FAppHandle := CreateWindow(@ClsName, PChar(Application.Title), WS_POPUP or - WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX, + WS_CLIPSIBLINGS or WS_SYSMENU or WS_MINIMIZEBOX, 0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,} 0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,} 0, 0, HWND(nil), HMENU(nil), HInstance, nil); @@ -400,6 +400,7 @@ end; procedure TWin32WidgetSet.AppWaitMessage; var timeout: dword; + pHandles: Windows.LPHANDLE; begin RedrawMenus; Assert(False, 'Trace:TWin32WidgetSet.WaitMessage - Start'); @@ -407,7 +408,10 @@ begin timeout := 100 else timeout := INFINITE; - Windows.MsgWaitForMultipleObjects(FWaitHandleCount, FWaitHandles[0], + pHandles := nil; + if FWaitHandleCount > 0 then + pHandles := @FWaitHandles[0]; + Windows.MsgWaitForMultipleObjects(FWaitHandleCount, pHandles, false, timeout, QS_ALLINPUT); Assert(False,'Trace:Leave wait message'); End; diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index 6018578b5f..6b7afd5a9f 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -145,7 +145,7 @@ var MoveWindowOrgEx(PaintMsg.DC,-ClientBoundRect.Left,-ClientBoundRect.Top); try // call win32 paint handler - CallDefaultWindowProc(Handle, WM_PAINT, PaintMsg.DC, 0); + CallDefaultWindowProc(Handle, WM_PAINT, WPARAM(PaintMsg.DC), 0); finally // restore DC origin MoveWindowOrgEx(PaintMsg.DC, ClientBoundRect.Left, ClientBoundRect.Top);