From 129e820c195d558c8d0292dfd1232d5d640c87f1 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 26 Nov 2014 16:49:31 +0000 Subject: [PATCH] * Sync up to trunk head (r65491). svn path=/branches/shell-experiments/; revision=65492 --- base/shell/explorer/globals.h | 2 +- base/shell/explorer/taskbar/desktopbar.cpp | 8 +- base/system/lsass/lsass.c | 4 + base/system/services/services.c | 3 + base/system/winlogon/winlogon.c | 4 + .../freeldr/include/arch/pc/x86common.h | 2 +- drivers/filesystems/ntfs/mft.c | 2 +- win32ss/gdi/eng/floatobj.h | 50 +++- win32ss/gdi/ntgdi/freetype.c | 15 +- win32ss/gdi/ntgdi/xformobj.c | 222 ++++++++++++++---- win32ss/user/ntuser/msgqueue.c | 5 +- win32ss/user/ntuser/winpos.c | 34 ++- 12 files changed, 274 insertions(+), 77 deletions(-) diff --git a/base/shell/explorer/globals.h b/base/shell/explorer/globals.h index 1776c9b8aab..dd69058eef3 100644 --- a/base/shell/explorer/globals.h +++ b/base/shell/explorer/globals.h @@ -235,7 +235,7 @@ typedef Desktop DesktopRef; #endif -#define DESKTOP_COUNT 2 +#define DESKTOP_COUNT 4 struct Desktops : public vector { diff --git a/base/shell/explorer/taskbar/desktopbar.cpp b/base/shell/explorer/taskbar/desktopbar.cpp index 4353b060933..e1411d38105 100644 --- a/base/shell/explorer/taskbar/desktopbar.cpp +++ b/base/shell/explorer/taskbar/desktopbar.cpp @@ -145,8 +145,8 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs) TCHAR QuickLaunchBand[] = _T("Quicklaunch"); rbBand.lpText = QuickLaunchBand; rbBand.hwndChild = _hwndQuickLaunch; - rbBand.cx = 100; - rbBand.cxMinChild = 100; + rbBand.cx = 150; + rbBand.cxMinChild = 150; rbBand.wID = IDW_QUICKLAUNCHBAR; SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); @@ -451,7 +451,9 @@ int DesktopBar::Command(int id, int code) break; case ID_SWITCH_DESKTOP_1: - case ID_SWITCH_DESKTOP_1+1: { + case ID_SWITCH_DESKTOP_1+1: + case ID_SWITCH_DESKTOP_1+2: + case ID_SWITCH_DESKTOP_1+3: { int desktop_idx = id - ID_SWITCH_DESKTOP_1; g_Globals._desktops.SwitchToDesktop(desktop_idx); diff --git a/base/system/lsass/lsass.c b/base/system/lsass/lsass.c index 301e2774779..9fffd8e1412 100644 --- a/base/system/lsass/lsass.c +++ b/base/system/lsass/lsass.c @@ -28,6 +28,7 @@ #define NTOS_MODE_USER #include +#include #include #include @@ -46,6 +47,9 @@ wWinMain(IN HINSTANCE hInstance, DPRINT("Local Security Authority Subsystem\n"); DPRINT(" Initializing...\n"); + /* Make us critical */ + RtlSetProcessIsCritical(TRUE, NULL, TRUE); + /* Initialize the LSA server DLL. */ Status = LsapInitLsa(); if (!NT_SUCCESS(Status)) diff --git a/base/system/services/services.c b/base/system/services/services.c index 9290c5901ef..2ff729ad424 100644 --- a/base/system/services/services.c +++ b/base/system/services/services.c @@ -316,6 +316,9 @@ wWinMain(HINSTANCE hInstance, DPRINT("SERVICES: Service Control Manager\n"); + /* Make us critical */ + RtlSetProcessIsCritical(TRUE, NULL, TRUE); + /* We are initializing ourselves */ ScmInitialize = TRUE; diff --git a/base/system/winlogon/winlogon.c b/base/system/winlogon/winlogon.c index 4bc48215239..7570710df14 100644 --- a/base/system/winlogon/winlogon.c +++ b/base/system/winlogon/winlogon.c @@ -318,6 +318,10 @@ WinMain( hAppInstance = hInstance; + /* Make us critical */ + RtlSetProcessIsCritical(TRUE, NULL, FALSE); + RtlSetThreadIsCritical(TRUE, NULL, FALSE); + if (!RegisterLogonProcess(GetCurrentProcessId(), TRUE)) { ERR("WL: Could not register logon process\n"); diff --git a/boot/freeldr/freeldr/include/arch/pc/x86common.h b/boot/freeldr/freeldr/include/arch/pc/x86common.h index ffccba3e544..089debf0066 100644 --- a/boot/freeldr/freeldr/include/arch/pc/x86common.h +++ b/boot/freeldr/freeldr/include/arch/pc/x86common.h @@ -17,7 +17,7 @@ #define FREELDR_BASE HEX(F800) #define FREELDR_PE_BASE HEX(10000) #define DISKREADBUFFER HEX(8E000) /* Buffer to store data read in from the disk via the BIOS */ -#define MEMORY_MARGIN HEX(9C000) /* Highest usable address */ +#define MEMORY_MARGIN HEX(9A000) /* Highest usable address */ /* 9F000- 9FFFF is reserved for the EBDA */ #define BIOSCALLBUFSEGMENT (BIOSCALLBUFFER/16) /* Buffer to store temporary data for any Int386() call */ diff --git a/drivers/filesystems/ntfs/mft.c b/drivers/filesystems/ntfs/mft.c index acecf2dd583..9b658c62e0e 100644 --- a/drivers/filesystems/ntfs/mft.c +++ b/drivers/filesystems/ntfs/mft.c @@ -558,7 +558,7 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb, IndexRoot = (PINDEX_ROOT_ATTRIBUTE)IndexRecord; IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)((PCHAR)&IndexRoot->Header + IndexRoot->Header.FirstEntryOffset); /* Index root is always resident. */ - IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexRootCtx->Record.Resident.ValueLength); + IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexRoot->Header.TotalSizeOfEntries); ReleaseAttributeContext(IndexRootCtx); DPRINT("IndexRecordSize: %x IndexBlockSize: %x\n", Vcb->NtfsInfo.BytesPerIndexRecord, IndexRoot->SizeOfEntry); diff --git a/win32ss/gdi/eng/floatobj.h b/win32ss/gdi/eng/floatobj.h index 5c61c6c4b42..c8341482cd7 100644 --- a/win32ss/gdi/eng/floatobj.h +++ b/win32ss/gdi/eng/floatobj.h @@ -1,5 +1,9 @@ #pragma once +C_ASSERT(sizeof(FIX) == sizeof(LONG)); +#define FIX2LONG(x) (((x) + 8) >> 4) +#define LONG2FIX(x) ((x) << 4) + #if defined(_M_IX86) FORCEINLINE @@ -10,6 +14,7 @@ _FLOATOBJ_Equal(FLOATOBJ *pf1, FLOATOBJ *pf2) EFLOAT_S *pef2 = (EFLOAT_S*)pf2; return (pef1->lMant == pef2->lMant && pef1->lExp == pef2->lExp); } +#define FLOATOBJ_Equal _FLOATOBJ_Equal FORCEINLINE LONG @@ -18,10 +23,36 @@ _FLOATOBJ_GetLong(FLOATOBJ *pf) EFLOAT_S *pef = (EFLOAT_S*)pf; return pef->lMant >> (32 - pef->lExp); } +#define FLOATOBJ_GetLong _FLOATOBJ_GetLong + +/*! + * \brief Converts a FLOATOBJ into a LONG by truncating the value to integer + * + * \param pf - Pointer to a FLOATOBJ containing the value to convert + * + * \param pl - Pointer to a variable that receives the result + * + * \return TRUE if the function succeeded, FALSE if the result would overflow + * a LONG. + */ +FORCEINLINE +BOOL +FASTCALL +FLOATOBJ_bConvertToLong(FLOATOBJ *pf, PLONG pl) +{ + EFLOAT_S *pef = (EFLOAT_S*)pf; + LONG lShift = 32 - pef->lExp; + if (lShift < 0) + { + return FALSE; + } + *pl = pef->lMant >> lShift; + return TRUE; +} FORCEINLINE LONG -_FLOATOBJ_GetFix(FLOATOBJ *pf) +FLOATOBJ_GetFix(FLOATOBJ *pf) { EFLOAT_S *pef = (EFLOAT_S*)pf; LONG Shift = (28 - pef->lExp); @@ -30,7 +61,7 @@ _FLOATOBJ_GetFix(FLOATOBJ *pf) FORCEINLINE BOOL -_FLOATOBJ_IsLong(FLOATOBJ *pf) +FLOATOBJ_IsLong(FLOATOBJ *pf) { EFLOAT_S *pef = (EFLOAT_S*)pf; ULONG ulShift = pef->lExp; @@ -42,7 +73,7 @@ _FLOATOBJ_IsLong(FLOATOBJ *pf) FORCEINLINE BOOL -_FLOATOBJ_Equal0(FLOATOBJ *pf) +FLOATOBJ_Equal0(FLOATOBJ *pf) { EFLOAT_S *pef = (EFLOAT_S*)pf; return (pef->lMant == 0 && pef->lExp == 0); @@ -50,7 +81,7 @@ _FLOATOBJ_Equal0(FLOATOBJ *pf) FORCEINLINE BOOL -_FLOATOBJ_Equal1(FLOATOBJ *pf) +FLOATOBJ_Equal1(FLOATOBJ *pf) { EFLOAT_S *pef = (EFLOAT_S*)pf; return (pef->lMant == 0x40000000 && pef->lExp == 2); @@ -70,12 +101,11 @@ extern const FLOATOBJ gef16; #else -#define _FLOATOBJ_Equal(pf,pf1) (*(pf) == *(pf1)) -#define _FLOATOBJ_GetLong(pf) ((LONG)*(pf)) -#define _FLOATOBJ_IsLong(pf) ((FLOAT)((LONG)*(pf)) == *(pf)) -#define _FLOATOBJ_Equal0(pf) (*(pf) == 0.) -#define _FLOATOBJ_Equal1(pf) (*(pf) == 1.) -#define _FLOATOBJ_GetFix(pf) ((LONG)(*(pf) * 16.)) +#define FLOATOBJ_bConvertToLong(pf, pl) (*pl = (LONG)*pf, TRUE) +#define FLOATOBJ_IsLong(pf) ((FLOAT)((LONG)*(pf)) == *(pf)) +#define FLOATOBJ_Equal0(pf) (*(pf) == 0.) +#define FLOATOBJ_Equal1(pf) (*(pf) == 1.) +#define FLOATOBJ_GetFix(pf) ((LONG)(*(pf) * 16.)) #define FLOATOBJ_0 0. #define FLOATOBJ_1 1. diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 9d8e0dfa707..4b0893877ea 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -1105,7 +1105,7 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI) } if (fs.fsCsb[0] == 0) { /* Let's see if we can find any interesting cmaps */ - for (i = 0; i < FontGDI->face->num_charmaps; i++) + for (i = 0; i < (UINT)FontGDI->face->num_charmaps; i++) { switch (FontGDI->face->charmaps[i]->encoding) { @@ -1501,7 +1501,7 @@ static unsigned int get_native_glyph_outline(FT_Outline *outline, unsigned int b { TTPOLYGONHEADER *pph; TTPOLYCURVE *ppc; - unsigned int needed = 0, point = 0, contour, first_pt; + int needed = 0, point = 0, contour, first_pt; unsigned int pph_start, cpfx; DWORD type; @@ -2073,7 +2073,7 @@ ftGdiGetGlyphOutline( INT x; while (h--) { - for (x = 0; x < pitch; x++) + for (x = 0; (UINT)x < pitch; x++) { if (x < ft_face->glyph->bitmap.width) dst[x] = (src[x / 8] & (1 << ( (7 - (x % 8))))) ? 0xff : 0; @@ -2346,7 +2346,8 @@ ftGdiGetTextCharsetInfo( DWORD dwFlags) { PDC_ATTR pdcattr; - UINT Ret = DEFAULT_CHARSET, i; + UINT Ret = DEFAULT_CHARSET; + INT i; HFONT hFont; PTEXTOBJ TextObj; PFONTGDI FontGdi; @@ -3752,7 +3753,7 @@ GreExtTextOutW( { // FIXME this should probably be a matrix transform with TextTop as well. Scale = pdcattr->mxWorldToDevice.efM11; - if (_FLOATOBJ_Equal0(&Scale)) + if (FLOATOBJ_Equal0(&Scale)) FLOATOBJ_Set1(&Scale); FLOATOBJ_MulLong(&Scale, Dx[i<face; if (face->charmap == NULL) { - for (i = 0; i < face->num_charmaps; i++) + for (i = 0; i < (UINT)face->num_charmaps; i++) { charmap = face->charmaps[i]; if (charmap->encoding != 0) @@ -4227,7 +4228,7 @@ NtGdiGetCharWidthW( face = FontGDI->face; if (face->charmap == NULL) { - for (i = 0; i < face->num_charmaps; i++) + for (i = 0; i < (UINT)face->num_charmaps; i++) { charmap = face->charmaps[i]; if (charmap->encoding != 0) diff --git a/win32ss/gdi/ntgdi/xformobj.c b/win32ss/gdi/ntgdi/xformobj.c index fb6deb6d02c..8bc9d65ef7d 100644 --- a/win32ss/gdi/ntgdi/xformobj.c +++ b/win32ss/gdi/ntgdi/xformobj.c @@ -12,16 +12,8 @@ #define NDEBUG #include -C_ASSERT(sizeof(FIX) == sizeof(LONG)); -#define FIX2LONG(x) (((x) + 8) >> 4) -#define LONG2FIX(x) ((x) << 4) - -#define FLOATOBJ_Equal _FLOATOBJ_Equal -#define FLOATOBJ_GetLong _FLOATOBJ_GetLong -#define FLOATOBJ_GetFix _FLOATOBJ_GetFix -#define FLOATOBJ_IsLong _FLOATOBJ_IsLong -#define FLOATOBJ_Equal0 _FLOATOBJ_Equal0 -#define FLOATOBJ_Equal1 _FLOATOBJ_Equal1 +#define DOES_VALUE_OVERFLOW_LONG(x) \ + (((__int64)((long)(x))) != (x)) /** Inline helper functions ***************************************************/ @@ -297,76 +289,153 @@ XFORMOBJ_iInverse( return XFORMOBJ_UpdateAccel(pxoDst); } + +/*! + * \brief Transforms fix-point coordinates in an array of POINTL structures using + * the transformation matrix from the XFORMOBJ. + * + * \param pxo - Pointer to the XFORMOBJ + * + * \param cPoints - Number of coordinates to transform + * + * \param pptIn - Pointer to an array of POINTL structures containing the + * source coordinates. + * + * \param pptOut - Pointer to an array of POINTL structures, receiving the + * transformed coordinates. Can be the same as pptIn. + * + * \return TRUE if the operation was successful, FALSE if any of the calculations + * caused an integer overflow. + * + * \note If the function returns FALSE, it might still have written to the + * output buffer. If pptIn and pptOut are equal, the source coordinates + * might have been partly overwritten! + */ static -VOID +BOOL NTAPI -XFORMOBJ_vXformFixPoints( - IN XFORMOBJ *pxo, - IN ULONG cPoints, - IN PPOINTL pptIn, - OUT PPOINTL pptOut) +XFORMOBJ_bXformFixPoints( + _In_ XFORMOBJ *pxo, + _In_ ULONG cPoints, + _In_reads_(cPoints) PPOINTL pptIn, + _Out_writes_(cPoints) PPOINTL pptOut) { PMATRIX pmx; INT i; FLOATOBJ fo1, fo2; FLONG flAccel; + LONG lM11, lM12, lM21, lM22, lTemp; + register LONGLONG llx, lly; pmx = XFORMOBJ_pmx(pxo); flAccel = pmx->flAccel; if ((flAccel & (XFORM_SCALE|XFORM_UNITY)) == (XFORM_SCALE|XFORM_UNITY)) { - /* Identity transformation, nothing todo */ + /* Identity transformation, nothing to do */ } else if (flAccel & XFORM_INTEGER) { if (flAccel & XFORM_UNITY) { - /* 1-scale integer transform */ - LONG lM12 = FLOATOBJ_GetLong(&pmx->efM12); - LONG lM21 = FLOATOBJ_GetLong(&pmx->efM21); + /* 1-scale integer transform, get the off-diagonal elements */ + if (!FLOATOBJ_bConvertToLong(&pmx->efM12, &lM12) || + !FLOATOBJ_bConvertToLong(&pmx->efM21, &lM21)) + { + NT_ASSERT(FALSE); + return FALSE; + } i = cPoints - 1; do { - LONG x = pptIn[i].x + pptIn[i].y * lM21; - LONG y = pptIn[i].y + pptIn[i].x * lM12; - pptOut[i].y = y; - pptOut[i].x = x; + /* Calculate x in 64 bit and check for overflow */ + llx = Int32x32To64(pptIn[i].y, lM21) + pptIn[i].x; + if (DOES_VALUE_OVERFLOW_LONG(llx)) + { + return FALSE; + } + + /* Calculate y in 64 bit and check for overflow */ + lly = Int32x32To64(pptIn[i].x, lM12) + pptIn[i].y; + if (DOES_VALUE_OVERFLOW_LONG(lly)) + { + return FALSE; + } + + /* Write back the results */ + pptOut[i].x = (LONG)llx; + pptOut[i].y = (LONG)lly; } while (--i >= 0); } else if (flAccel & XFORM_SCALE) { - /* Diagonal integer transform */ - LONG lM11 = FLOATOBJ_GetLong(&pmx->efM11); - LONG lM22 = FLOATOBJ_GetLong(&pmx->efM22); + /* Diagonal integer transform, get the diagonal elements */ + if (!FLOATOBJ_bConvertToLong(&pmx->efM11, &lM11) || + !FLOATOBJ_bConvertToLong(&pmx->efM22, &lM22)) + { + NT_ASSERT(FALSE); + return FALSE; + } i = cPoints - 1; do { - pptOut[i].x = pptIn[i].x * lM11; - pptOut[i].y = pptIn[i].y * lM22; + /* Calculate x in 64 bit and check for overflow */ + llx = Int32x32To64(pptIn[i].x, lM11); + if (DOES_VALUE_OVERFLOW_LONG(llx)) + { + return FALSE; + } + + /* Calculate y in 64 bit and check for overflow */ + lly = Int32x32To64(pptIn[i].y, lM22); + if (DOES_VALUE_OVERFLOW_LONG(lly)) + { + return FALSE; + } + + /* Write back the results */ + pptOut[i].x = (LONG)llx; + pptOut[i].y = (LONG)lly; } while (--i >= 0); } else { /* Full integer transform */ - LONG lM11 = FLOATOBJ_GetLong(&pmx->efM11); - LONG lM12 = FLOATOBJ_GetLong(&pmx->efM12); - LONG lM21 = FLOATOBJ_GetLong(&pmx->efM21); - LONG lM22 = FLOATOBJ_GetLong(&pmx->efM22); + if (!FLOATOBJ_bConvertToLong(&pmx->efM11, &lM11) || + !FLOATOBJ_bConvertToLong(&pmx->efM12, &lM12) || + !FLOATOBJ_bConvertToLong(&pmx->efM21, &lM21) || + !FLOATOBJ_bConvertToLong(&pmx->efM22, &lM22)) + { + NT_ASSERT(FALSE); + return FALSE; + } i = cPoints - 1; do { - LONG x; - x = pptIn[i].x * lM11; - x += pptIn[i].y * lM21; - pptOut[i].y = pptIn[i].y * lM22; - pptOut[i].y += pptIn[i].x * lM12; - pptOut[i].x = x; + /* Calculate x in 64 bit and check for overflow */ + llx = Int32x32To64(pptIn[i].x, lM11); + llx += Int32x32To64(pptIn[i].y, lM21); + if (DOES_VALUE_OVERFLOW_LONG(llx)) + { + return FALSE; + } + + /* Calculate y in 64 bit and check for overflow */ + lly = Int32x32To64(pptIn[i].y, lM22); + lly += Int32x32To64(pptIn[i].x, lM12); + if (DOES_VALUE_OVERFLOW_LONG(lly)) + { + return FALSE; + } + + /* Write back the results */ + pptOut[i].x = (LONG)llx; + pptOut[i].y = (LONG)lly; } while (--i >= 0); } @@ -377,12 +446,35 @@ XFORMOBJ_vXformFixPoints( i = cPoints - 1; do { + /* Calculate x in 64 bit and check for overflow */ fo1 = pmx->efM21; FLOATOBJ_MulLong(&fo1, pptIn[i].y); + if (!FLOATOBJ_bConvertToLong(&fo1, &lTemp)) + { + return FALSE; + } + llx = (LONGLONG)pptIn[i].x + lTemp; + if (DOES_VALUE_OVERFLOW_LONG(llx)) + { + return FALSE; + } + + /* Calculate y in 64 bit and check for overflow */ fo2 = pmx->efM12; FLOATOBJ_MulLong(&fo2, pptIn[i].x); - pptOut[i].x = pptIn[i].x + FLOATOBJ_GetLong(&fo1); - pptOut[i].y = pptIn[i].y + FLOATOBJ_GetLong(&fo2); + if (!FLOATOBJ_bConvertToLong(&fo2, &lTemp)) + { + return FALSE; + } + lly = (LONGLONG)pptIn[i].y + lTemp; + if (DOES_VALUE_OVERFLOW_LONG(lly)) + { + return FALSE; + } + + /* Write back the results */ + pptOut[i].x = (LONG)llx; + pptOut[i].y = (LONG)lly; } while (--i >= 0); } @@ -394,10 +486,17 @@ XFORMOBJ_vXformFixPoints( { fo1 = pmx->efM11; FLOATOBJ_MulLong(&fo1, pptIn[i].x); - pptOut[i].x = FLOATOBJ_GetLong(&fo1); + if (!FLOATOBJ_bConvertToLong(&fo1, &pptOut[i].x)) + { + return FALSE; + } + fo2 = pmx->efM22; FLOATOBJ_MulLong(&fo2, pptIn[i].y); - pptOut[i].y = FLOATOBJ_GetLong(&fo2); + if (!FLOATOBJ_bConvertToLong(&fo2, &pptOut[i].y)) + { + return FALSE; + } } while (--i >= 0); } @@ -407,10 +506,21 @@ XFORMOBJ_vXformFixPoints( i = cPoints - 1; do { + /* Calculate x as FLOATOBJ */ MulAddLong(&fo1, &pmx->efM11, pptIn[i].x, &pmx->efM21, pptIn[i].y); + + /* Calculate y as FLOATOBJ */ MulAddLong(&fo2, &pmx->efM12, pptIn[i].x, &pmx->efM22, pptIn[i].y); - pptOut[i].x = FLOATOBJ_GetLong(&fo1); - pptOut[i].y = FLOATOBJ_GetLong(&fo2); + + if (!FLOATOBJ_bConvertToLong(&fo1, &pptOut[i].x)) + { + return FALSE; + } + + if (!FLOATOBJ_bConvertToLong(&fo2, &pptOut[i].y)) + { + return FALSE; + } } while (--i >= 0); } @@ -421,11 +531,24 @@ XFORMOBJ_vXformFixPoints( i = cPoints - 1; do { - pptOut[i].x += pmx->fxDx; - pptOut[i].y += pmx->fxDy; + llx = (LONGLONG)pptOut[i].x + pmx->fxDx; + if (DOES_VALUE_OVERFLOW_LONG(llx)) + { + return FALSE; + } + pptOut[i].x = (LONG)llx; + + lly = (LONGLONG)pptOut[i].y + pmx->fxDy; + if (DOES_VALUE_OVERFLOW_LONG(lly)) + { + return FALSE; + } + pptOut[i].y = (LONG)lly; } while (--i >= 0); } + + return TRUE; } /** Public functions **********************************************************/ @@ -534,7 +657,10 @@ XFORMOBJ_bApplyXform( } /* Do the actual fixpoint transformation */ - XFORMOBJ_vXformFixPoints(pxo, cPoints, pvIn, pvOut); + if (!XFORMOBJ_bXformFixPoints(pxo, cPoints, pvIn, pvOut)) + { + return FALSE; + } /* Convert POINTFIX to POINTL? */ if (iMode == XF_INV_FXTOL || iMode == XF_INV_LTOL || iMode == XF_LTOL) diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index f40c02f1e46..93fdbd7a071 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -1450,7 +1450,10 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT } else { - pwndMsg = co_WinPosWindowFromPoint(pwndMsg, &msg->pt, &hittest, FALSE); + /* + Start with null window. See wine win.c:test_mouse_input:WM_COMMAND tests. + */ + pwndMsg = co_WinPosWindowFromPoint( NULL, &msg->pt, &hittest, FALSE); } TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest); diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c index 248da12dcb0..5a821906382 100644 --- a/win32ss/user/ntuser/winpos.c +++ b/win32ss/user/ntuser/winpos.c @@ -327,6 +327,7 @@ co_WinPosActivateOtherWindow(PWND Wnd) /* If this is popup window, try to activate the owner first. */ if ((Wnd->style & WS_POPUP) && (WndTo = Wnd->spwndOwner)) { + ERR("WPAOW Popup with Owner\n"); WndTo = UserGetAncestor( WndTo, GA_ROOT ); if (can_activate_window(WndTo)) goto done; } @@ -336,18 +337,41 @@ co_WinPosActivateOtherWindow(PWND Wnd) WndTo = Wnd; for (;;) { - if (!(WndTo = WndTo->spwndNext)) break; - if (can_activate_window( WndTo )) break; + if (!(WndTo = WndTo->spwndNext)) break; + if (can_activate_window( WndTo )) goto done; + } + + /* + Fixes wine win.c:test_SetParent last ShowWindow test after popup dies. + Check for previous active window to bring to top. + */ + if (Wnd) + { + WndTo = Wnd->head.pti->MessageQueue->spwndActivePrev; + if (can_activate_window( WndTo )) goto done; + } + + // Find any window to bring to top. Works Okay for wine. + WndTo = UserGetDesktopWindow(); + WndTo = WndTo->spwndChild; + for (;;) + { + if (WndTo == Wnd) + { + WndTo = NULL; + break; + } + if (can_activate_window( WndTo )) goto done; + if (!(WndTo = WndTo->spwndNext)) break; } done: - if (WndTo) UserRefObjectCo(WndTo, &Ref); - if (!gpqForeground || Wnd == gpqForeground->spwndActive) + if ((gpqForeground && !gpqForeground->spwndActive) || Wnd == gpqForeground->spwndActive) { /* ReactOS can pass WndTo = NULL to co_IntSetForegroundWindow and returns FALSE. */ - //ERR("WinPosActivateOtherWindow Set FG 0x%p\n",WndTo); + //ERR("WinPosActivateOtherWindow Set FG 0x%p hWnd %p\n",WndTo, WndTo ? WndTo->head.h : 0); if (co_IntSetForegroundWindow(WndTo)) { if (WndTo) UserDerefObjectCo(WndTo);