ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2010
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
435 discussions
Start a n
N
ew thread
[fireball] 46715: - Sync up to Wine-1.1.42.
by fireball@svn.reactos.org
Author: fireball Date: Sun Apr 4 15:19:10 2010 New Revision: 46715 URL:
http://svn.reactos.org/svn/reactos?rev=46715&view=rev
Log: - Sync up to Wine-1.1.42. Modified: branches/arwinss/reactos/dll/win32/gdi32/ (props changed) branches/arwinss/reactos/dll/win32/gdi32/driver.c branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c branches/arwinss/reactos/dll/win32/gdi32/freetype.c branches/arwinss/reactos/dll/win32/gdi32/region.c branches/arwinss/reactos/dll/win32/user32/ (props changed) branches/arwinss/reactos/dll/win32/user32/cursoricon.c branches/arwinss/reactos/dll/win32/user32/menu.c branches/arwinss/reactos/dll/win32/user32/message.c branches/arwinss/reactos/dll/win32/user32/scroll.c branches/arwinss/reactos/dll/win32/user32/user_private.h branches/arwinss/reactos/dll/win32/user32/win.c branches/arwinss/reactos/include/reactos/wine/server_protocol.h branches/arwinss/reactos/subsystems/win32/win32k/include/request.h branches/arwinss/reactos/subsystems/win32/win32k/wine/ (props changed) branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c Propchange: branches/arwinss/reactos/dll/win32/gdi32/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Apr 4 15:19:10 2010 @@ -1,3 +1,3 @@ /branches/ros-amd64-bringup/reactos/dll/win32/gdi32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080 /trunk/reactos/dll/win32/gdi32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688 -/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314 +/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696 Modified: branches/arwinss/reactos/dll/win32/gdi32/driver.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -757,6 +757,9 @@ */ ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID) { - FIXME("stub\n"); + static int warn_once; + + if (!warn_once++) + FIXME("stub\n"); return 0; } Modified: branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -1077,7 +1077,7 @@ /* NB POINTS array doesn't start at pPolyPoly->apts it's actually pPolyPoly->aPolyCounts + pPolyPoly->nPolys */ - POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys); + const POINTS *pts = (const POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys); POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) ); DWORD i; for(i = 0; i < pPolyPoly->cpts; i++) @@ -1085,7 +1085,7 @@ pt[i].x = pts[i].x; pt[i].y = pts[i].y; } - PolyPolygon(hdc, pt, (INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys); + PolyPolygon(hdc, pt, (const INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys); HeapFree( GetProcessHeap(), 0, pt ); break; } @@ -1095,7 +1095,7 @@ /* NB POINTS array doesn't start at pPolyPoly->apts it's actually pPolyPoly->aPolyCounts + pPolyPoly->nPolys */ - POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys); + const POINTS *pts = (const POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys); POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT) ); DWORD i; for(i = 0; i < pPolyPoly->cpts; i++) @@ -1218,7 +1218,7 @@ HRGN hRgn = 0; if (mr->nSize >= sizeof(*lpRgn) + sizeof(RGNDATAHEADER)) - hRgn = ExtCreateRegion( &info->init_transform, 0, (RGNDATA *)lpRgn->RgnData ); + hRgn = ExtCreateRegion( &info->init_transform, 0, (const RGNDATA *)lpRgn->RgnData ); ExtSelectClipRgn(hdc, hRgn, (INT)(lpRgn->iMode)); /* ExtSelectClipRgn created a copy of the region */ @@ -1281,7 +1281,7 @@ const EMRPOLYPOLYLINE *pPolyPolyline = (const EMRPOLYPOLYLINE *)mr; /* NB Points at pPolyPolyline->aPolyCounts + pPolyPolyline->nPolys */ - PolyPolyline(hdc, (LPPOINT)(pPolyPolyline->aPolyCounts + + PolyPolyline(hdc, (const POINT*)(pPolyPolyline->aPolyCounts + pPolyPolyline->nPolys), pPolyPolyline->aPolyCounts, pPolyPolyline->nPolys ); @@ -1295,9 +1295,9 @@ /* NB Points at pPolyPolygon->aPolyCounts + pPolyPolygon->nPolys */ - PolyPolygon(hdc, (LPPOINT)(pPolyPolygon->aPolyCounts + + PolyPolygon(hdc, (const POINT*)(pPolyPolygon->aPolyCounts + pPolyPolygon->nPolys), - (INT*)pPolyPolygon->aPolyCounts, pPolyPolygon->nPolys ); + (const INT*)pPolyPolygon->aPolyCounts, pPolyPolygon->nPolys ); break; } @@ -2113,7 +2113,7 @@ case EMR_FILLRGN: { const EMRFILLRGN *pFillRgn = (const EMRFILLRGN *)mr; - HRGN hRgn = ExtCreateRegion(NULL, pFillRgn->cbRgnData, (RGNDATA *)pFillRgn->RgnData); + HRGN hRgn = ExtCreateRegion(NULL, pFillRgn->cbRgnData, (const RGNDATA *)pFillRgn->RgnData); FillRgn(hdc, hRgn, (handletable->objectHandle)[pFillRgn->ihBrush]); @@ -2124,7 +2124,7 @@ case EMR_FRAMERGN: { const EMRFRAMERGN *pFrameRgn = (const EMRFRAMERGN *)mr; - HRGN hRgn = ExtCreateRegion(NULL, pFrameRgn->cbRgnData, (RGNDATA *)pFrameRgn->RgnData); + HRGN hRgn = ExtCreateRegion(NULL, pFrameRgn->cbRgnData, (const RGNDATA *)pFrameRgn->RgnData); FrameRgn(hdc, hRgn, (handletable->objectHandle)[pFrameRgn->ihBrush], @@ -2137,7 +2137,7 @@ case EMR_INVERTRGN: { const EMRINVERTRGN *pInvertRgn = (const EMRINVERTRGN *)mr; - HRGN hRgn = ExtCreateRegion(NULL, pInvertRgn->cbRgnData, (RGNDATA *)pInvertRgn->RgnData); + HRGN hRgn = ExtCreateRegion(NULL, pInvertRgn->cbRgnData, (const RGNDATA *)pInvertRgn->RgnData); InvertRgn(hdc, hRgn); DeleteObject(hRgn); break; @@ -2146,7 +2146,7 @@ case EMR_PAINTRGN: { const EMRPAINTRGN *pPaintRgn = (const EMRPAINTRGN *)mr; - HRGN hRgn = ExtCreateRegion(NULL, pPaintRgn->cbRgnData, (RGNDATA *)pPaintRgn->RgnData); + HRGN hRgn = ExtCreateRegion(NULL, pPaintRgn->cbRgnData, (const RGNDATA *)pPaintRgn->RgnData); PaintRgn(hdc, hRgn); DeleteObject(hRgn); break; Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -4330,7 +4330,7 @@ const GSUB_CoverageFormat2* cf2; int i; int count; - cf2 = (GSUB_CoverageFormat2*)cf1; + cf2 = (const GSUB_CoverageFormat2*)cf1; count = GET_BE_WORD(cf2->RangeCount); TRACE("Coverage Format 2, %i ranges\n",count); @@ -4358,7 +4358,7 @@ const GSUB_ScriptList *script; const GSUB_Script *deflt = NULL; int i; - script = (GSUB_ScriptList*)((LPBYTE)header + GET_BE_WORD(header->ScriptList)); + script = (const GSUB_ScriptList*)((const BYTE*)header + GET_BE_WORD(header->ScriptList)); TRACE("%i scripts in this font\n",GET_BE_WORD(script->ScriptCount)); for (i = 0; i < GET_BE_WORD(script->ScriptCount); i++) @@ -4367,7 +4367,7 @@ int offset; offset = GET_BE_WORD(script->ScriptRecord[i].Script); - scr = (GSUB_Script*)((LPBYTE)script + offset); + scr = (const GSUB_Script*)((const BYTE*)script + offset); if (strncmp(script->ScriptRecord[i].ScriptTag, tag,4)==0) return scr; @@ -4388,7 +4388,7 @@ for (i = 0; i < GET_BE_WORD(script->LangSysCount) ; i++) { offset = GET_BE_WORD(script->LangSysRecord[i].LangSys); - Lang = (GSUB_LangSys*)((LPBYTE)script + offset); + Lang = (const GSUB_LangSys*)((const BYTE*)script + offset); if ( strncmp(script->LangSysRecord[i].LangSysTag,tag,4)==0) return Lang; @@ -4396,7 +4396,7 @@ offset = GET_BE_WORD(script->DefaultLangSys); if (offset) { - Lang = (GSUB_LangSys*)((LPBYTE)script + offset); + Lang = (const GSUB_LangSys*)((const BYTE*)script + offset); return Lang; } return NULL; @@ -4406,7 +4406,7 @@ { int i; const GSUB_FeatureList *feature; - feature = (GSUB_FeatureList*)((LPBYTE)header + GET_BE_WORD(header->FeatureList)); + feature = (const GSUB_FeatureList*)((const BYTE*)header + GET_BE_WORD(header->FeatureList)); TRACE("%i features\n",GET_BE_WORD(lang->FeatureCount)); for (i = 0; i < GET_BE_WORD(lang->FeatureCount); i++) @@ -4415,7 +4415,7 @@ if (strncmp(feature->FeatureRecord[index].FeatureTag,tag,4)==0) { const GSUB_Feature *feat; - feat = (GSUB_Feature*)((LPBYTE)feature + GET_BE_WORD(feature->FeatureRecord[index].Feature)); + feat = (const GSUB_Feature*)((const BYTE*)feature + GET_BE_WORD(feature->FeatureRecord[index].Feature)); return feat; } } @@ -4427,14 +4427,14 @@ int i; int offset; const GSUB_LookupList *lookup; - lookup = (GSUB_LookupList*)((LPBYTE)header + GET_BE_WORD(header->LookupList)); + lookup = (const GSUB_LookupList*)((const BYTE*)header + GET_BE_WORD(header->LookupList)); TRACE("%i lookups\n", GET_BE_WORD(feature->LookupCount)); for (i = 0; i < GET_BE_WORD(feature->LookupCount); i++) { const GSUB_LookupTable *look; offset = GET_BE_WORD(lookup->Lookup[GET_BE_WORD(feature->LookupListIndex[i])]); - look = (GSUB_LookupTable*)((LPBYTE)lookup + offset); + look = (const GSUB_LookupTable*)((const BYTE*)lookup + offset); TRACE("type %i, flag %x, subtables %i\n",GET_BE_WORD(look->LookupType),GET_BE_WORD(look->LookupFlag),GET_BE_WORD(look->SubTableCount)); if (GET_BE_WORD(look->LookupType) != 1) FIXME("We only handle SubType 1\n"); @@ -4446,12 +4446,12 @@ { const GSUB_SingleSubstFormat1 *ssf1; offset = GET_BE_WORD(look->SubTable[j]); - ssf1 = (GSUB_SingleSubstFormat1*)((LPBYTE)look+offset); + ssf1 = (const GSUB_SingleSubstFormat1*)((const BYTE*)look+offset); if (GET_BE_WORD(ssf1->SubstFormat) == 1) { int offset = GET_BE_WORD(ssf1->Coverage); TRACE(" subtype 1, delta %i\n", GET_BE_WORD(ssf1->DeltaGlyphID)); - if (GSUB_is_glyph_covered((LPBYTE)ssf1+offset, glyph) != -1) + if (GSUB_is_glyph_covered((const BYTE*)ssf1+offset, glyph) != -1) { TRACE(" Glyph 0x%x ->",glyph); glyph += GET_BE_WORD(ssf1->DeltaGlyphID); @@ -4464,10 +4464,10 @@ INT index; INT offset; - ssf2 = (GSUB_SingleSubstFormat2 *)ssf1; + ssf2 = (const GSUB_SingleSubstFormat2 *)ssf1; offset = GET_BE_WORD(ssf1->Coverage); TRACE(" subtype 2, glyph count %i\n", GET_BE_WORD(ssf2->GlyphCount)); - index = GSUB_is_glyph_covered((LPBYTE)ssf2+offset, glyph); + index = GSUB_is_glyph_covered((const BYTE*)ssf2+offset, glyph); TRACE(" Coverage index %i\n",index); if (index != -1) { Modified: branches/arwinss/reactos/dll/win32/gdi32/region.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/region.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/region.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -1031,12 +1031,12 @@ if (lpXform) { - RECT *pCurRect, *pEndRect; + const RECT *pCurRect, *pEndRect; hrgn = CreateRectRgn( 0, 0, 0, 0 ); - pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount; - for (pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++) + pEndRect = (const RECT *)rgndata->Buffer + rgndata->rdh.nCount; + for (pCurRect = (const RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++) { static const INT count = 4; HRGN poly_hrgn; @@ -1063,10 +1063,10 @@ if (init_region( &obj->rgn, rgndata->rdh.nCount )) { - RECT *pCurRect, *pEndRect; - - pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount; - for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++) + const RECT *pCurRect, *pEndRect; + + pEndRect = (const RECT *)rgndata->Buffer + rgndata->rdh.nCount; + for(pCurRect = (const RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++) { if (pCurRect->left < pCurRect->right && pCurRect->top < pCurRect->bottom) { Propchange: branches/arwinss/reactos/dll/win32/user32/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Apr 4 15:19:10 2010 @@ -1,3 +1,3 @@ /branches/ros-amd64-bringup/reactos/dll/win32/user32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080 /trunk/reactos/dll/win32/user32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688 -/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314 +/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696 Modified: branches/arwinss/reactos/dll/win32/user32/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -54,9 +54,10 @@ #include "wine/winbase16.h" #include "wine/winuser16.h" #include "wine/exception.h" -#include "wine/debug.h" #include "controls.h" #include "user_private.h" +#include "wine/server.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(cursor); WINE_DECLARE_DEBUG_CHANNEL(icon); @@ -1037,11 +1038,11 @@ while (ptr < end) { - if ((!chunk_type && *(DWORD *)ptr == chunk_id ) - || (chunk_type && *(DWORD *)ptr == chunk_type && *((DWORD *)ptr + 2) == chunk_id )) + if ((!chunk_type && *(const DWORD *)ptr == chunk_id ) + || (chunk_type && *(const DWORD *)ptr == chunk_type && *((const DWORD *)ptr + 2) == chunk_id )) { ptr += sizeof(DWORD); - chunk->data_size = (*(DWORD *)ptr + 1) & ~1; + chunk->data_size = (*(const DWORD *)ptr + 1) & ~1; ptr += sizeof(DWORD); if (chunk_type == ANI_LIST_ID || chunk_type == ANI_RIFF_ID) ptr += sizeof(DWORD); chunk->data = ptr; @@ -1050,7 +1051,7 @@ } ptr += sizeof(DWORD); - ptr += (*(DWORD *)ptr + 1) & ~1; + ptr += (*(const DWORD *)ptr + 1) & ~1; ptr += sizeof(DWORD); } } @@ -1587,7 +1588,7 @@ */ BOOL WINAPI DestroyCursor( HCURSOR hCursor ) { - if (get_user_thread_info()->cursor == hCursor) + if (GetCursor() == hCursor) { WARN_(cursor)("Destroying active cursor!\n" ); return FALSE; @@ -1762,15 +1763,28 @@ */ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ ) { - struct user_thread_info *thread_info = get_user_thread_info(); HCURSOR hOldCursor; - - if (hCursor == thread_info->cursor) return hCursor; /* No change */ + int show_count; + BOOL ret; + TRACE("%p\n", hCursor); - hOldCursor = thread_info->cursor; - thread_info->cursor = hCursor; + + SERVER_START_REQ( set_cursor ) + { + req->flags = SET_CURSOR_HANDLE; + req->handle = wine_server_user_handle( hCursor ); + if ((ret = !wine_server_call_err( req ))) + { + hOldCursor = wine_server_ptr_handle( reply->prev_handle ); + show_count = reply->prev_count; + } + } + SERVER_END_REQ; + + if (!ret) return 0; + /* Change the cursor shape only if it is visible */ - if (thread_info->cursor_count >= 0) + if (show_count >= 0) { CURSORICONINFO *info = get_icon_ptr( hCursor ); /* release before calling driver (FIXME) */ @@ -1785,26 +1799,34 @@ */ INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow ) { - struct user_thread_info *thread_info = get_user_thread_info(); - - TRACE("%d, count=%d\n", bShow, thread_info->cursor_count ); - - if (bShow) - { - if (++thread_info->cursor_count == 0) /* Show it */ - { - CURSORICONINFO *info = get_icon_ptr( thread_info->cursor ); + HCURSOR cursor; + int increment = bShow ? 1 : -1; + int prev_count; + + SERVER_START_REQ( set_cursor ) + { + req->flags = SET_CURSOR_COUNT; + req->show_count = increment; + wine_server_call( req ); + cursor = wine_server_ptr_handle( reply->prev_handle ); + prev_count = reply->prev_count; + } + SERVER_END_REQ; + + TRACE("%d, count=%d\n", bShow, prev_count + increment ); + + if (!prev_count) + { + if (bShow) + { + CURSORICONINFO *info = get_icon_ptr( cursor ); /* release before calling driver (FIXME) */ - if (info) release_icon_ptr( thread_info->cursor, info ); + if (info) release_icon_ptr( cursor, info ); USER_Driver->pSetCursor( info ); } - } - else - { - if (--thread_info->cursor_count == -1) /* Hide it */ - USER_Driver->pSetCursor( NULL ); - } - return thread_info->cursor_count; + else USER_Driver->pSetCursor( NULL ); + } + return prev_count + increment; } /*********************************************************************** @@ -1812,7 +1834,16 @@ */ HCURSOR WINAPI GetCursor(void) { - return get_user_thread_info()->cursor; + HCURSOR ret; + + SERVER_START_REQ( set_cursor ) + { + req->flags = 0; + wine_server_call( req ); + ret = wine_server_ptr_handle( reply->prev_handle ); + } + SERVER_END_REQ; + return ret; } Modified: branches/arwinss/reactos/dll/win32/user32/menu.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -4729,7 +4729,7 @@ TRACE("hmenu %p, item %u, by pos %d, info %p\n", hmenu, item, bypos, lpmii); - if (!MENU_NormalizeMenuItemInfoStruct( (MENUITEMINFOW *)lpmii, &mii )) return FALSE; + if (!MENU_NormalizeMenuItemInfoStruct( (const MENUITEMINFOW *)lpmii, &mii )) return FALSE; return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0), &mii, FALSE); @@ -4852,7 +4852,7 @@ TRACE("hmenu %p, item %04x, by pos %d, info %p\n", hMenu, uItem, bypos, lpmii); - if (!MENU_NormalizeMenuItemInfoStruct( (MENUITEMINFOW *)lpmii, &mii )) return FALSE; + if (!MENU_NormalizeMenuItemInfoStruct( (const MENUITEMINFOW *)lpmii, &mii )) return FALSE; item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 ); return SetMenuItemInfo_common(item, &mii, FALSE); Modified: branches/arwinss/reactos/dll/win32/user32/message.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -57,12 +57,204 @@ #define SYS_TIMER_RATE 55 /* min. timer rate in ms (actually 54.925)*/ +/* the various structures that can be sent in messages, in platform-independent layout */ +struct packed_CREATESTRUCTW +{ + ULONGLONG lpCreateParams; + ULONGLONG hInstance; + user_handle_t hMenu; + DWORD __pad1; + user_handle_t hwndParent; + DWORD __pad2; + INT cy; + INT cx; + INT y; + INT x; + LONG style; + ULONGLONG lpszName; + ULONGLONG lpszClass; + DWORD dwExStyle; + DWORD __pad3; +}; + +struct packed_DRAWITEMSTRUCT +{ + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemAction; + UINT itemState; + user_handle_t hwndItem; + DWORD __pad1; + user_handle_t hDC; + DWORD __pad2; + RECT rcItem; + ULONGLONG itemData; +}; + +struct packed_MEASUREITEMSTRUCT +{ + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemWidth; + UINT itemHeight; + ULONGLONG itemData; +}; + +struct packed_DELETEITEMSTRUCT +{ + UINT CtlType; + UINT CtlID; + UINT itemID; + user_handle_t hwndItem; + DWORD __pad; + ULONGLONG itemData; +}; + +struct packed_COMPAREITEMSTRUCT +{ + UINT CtlType; + UINT CtlID; + user_handle_t hwndItem; + DWORD __pad1; + UINT itemID1; + ULONGLONG itemData1; + UINT itemID2; + ULONGLONG itemData2; + DWORD dwLocaleId; + DWORD __pad2; +}; + +struct packed_WINDOWPOS +{ + user_handle_t hwnd; + DWORD __pad1; + user_handle_t hwndInsertAfter; + DWORD __pad2; + INT x; + INT y; + INT cx; + INT cy; + UINT flags; + DWORD __pad3; +}; + +struct packed_COPYDATASTRUCT +{ + ULONGLONG dwData; + DWORD cbData; + ULONGLONG lpData; +}; + +struct packed_HELPINFO +{ + UINT cbSize; + INT iContextType; + INT iCtrlId; + user_handle_t hItemHandle; + DWORD __pad; + ULONGLONG dwContextId; + POINT MousePos; +}; + +struct packed_NCCALCSIZE_PARAMS +{ + RECT rgrc[3]; + ULONGLONG __pad1; + user_handle_t hwnd; + DWORD __pad2; + user_handle_t hwndInsertAfter; + DWORD __pad3; + INT x; + INT y; + INT cx; + INT cy; + UINT flags; + DWORD __pad4; +}; + +struct packed_MSG +{ + user_handle_t hwnd; + DWORD __pad1; + UINT message; + ULONGLONG wParam; + ULONGLONG lParam; + DWORD time; + POINT pt; + DWORD __pad2; +}; + +struct packed_MDINEXTMENU +{ + user_handle_t hmenuIn; + DWORD __pad1; + user_handle_t hmenuNext; + DWORD __pad2; + user_handle_t hwndNext; + DWORD __pad3; +}; + +struct packed_MDICREATESTRUCTW +{ + ULONGLONG szClass; + ULONGLONG szTitle; + ULONGLONG hOwner; + INT x; + INT y; + INT cx; + INT cy; + DWORD style; + ULONGLONG lParam; +}; + +struct packed_hook_extra_info +{ + user_handle_t handle; + DWORD __pad; + ULONGLONG lparam; +}; + +/* the structures are unpacked on top of the packed ones, so make sure they fit */ +C_ASSERT( sizeof(struct packed_CREATESTRUCTW) >= sizeof(CREATESTRUCTW) ); +C_ASSERT( sizeof(struct packed_DRAWITEMSTRUCT) >= sizeof(DRAWITEMSTRUCT) ); +C_ASSERT( sizeof(struct packed_MEASUREITEMSTRUCT) >= sizeof(MEASUREITEMSTRUCT) ); +C_ASSERT( sizeof(struct packed_DELETEITEMSTRUCT) >= sizeof(DELETEITEMSTRUCT) ); +C_ASSERT( sizeof(struct packed_COMPAREITEMSTRUCT) >= sizeof(COMPAREITEMSTRUCT) ); +C_ASSERT( sizeof(struct packed_WINDOWPOS) >= sizeof(WINDOWPOS) ); +C_ASSERT( sizeof(struct packed_COPYDATASTRUCT) >= sizeof(COPYDATASTRUCT) ); +C_ASSERT( sizeof(struct packed_HELPINFO) >= sizeof(HELPINFO) ); +C_ASSERT( sizeof(struct packed_NCCALCSIZE_PARAMS) >= sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS) ); +C_ASSERT( sizeof(struct packed_MSG) >= sizeof(MSG) ); +C_ASSERT( sizeof(struct packed_MDINEXTMENU) >= sizeof(MDINEXTMENU) ); +C_ASSERT( sizeof(struct packed_MDICREATESTRUCTW) >= sizeof(MDICREATESTRUCTW) ); +C_ASSERT( sizeof(struct packed_hook_extra_info) >= sizeof(struct hook_extra_info) ); + +union packed_structs +{ + struct packed_CREATESTRUCTW cs; + struct packed_DRAWITEMSTRUCT dis; + struct packed_MEASUREITEMSTRUCT mis; + struct packed_DELETEITEMSTRUCT dls; + struct packed_COMPAREITEMSTRUCT cis; + struct packed_WINDOWPOS wp; + struct packed_COPYDATASTRUCT cds; + struct packed_HELPINFO hi; + struct packed_NCCALCSIZE_PARAMS ncp; + struct packed_MSG msg; + struct packed_MDINEXTMENU mnm; + struct packed_MDICREATESTRUCTW mcs; + struct packed_hook_extra_info hook; +}; + /* description of the data fields that need to be packed along with a sent message */ struct packed_message { - int count; - const void *data[MAX_PACK_COUNT]; - size_t size[MAX_PACK_COUNT]; + union packed_structs ps; + int count; + const void *data[MAX_PACK_COUNT]; + size_t size[MAX_PACK_COUNT]; }; /* info about the message currently being received by the current thread */ @@ -268,6 +460,19 @@ return FALSE; } +/* pack a pointer into a 32/64 portable format */ +static inline ULONGLONG pack_ptr( const void *ptr ) +{ + return (ULONG_PTR)ptr; +} + +/* unpack a potentially 64-bit pointer, returning 0 when truncated */ +static inline void *unpack_ptr( ULONGLONG ptr64 ) +{ + if ((ULONG_PTR)ptr64 != ptr64) return 0; + return (void *)(ULONG_PTR)ptr64; +} + /* make sure that there is space for 'size' bytes in buffer, growing it if needed */ static inline void *get_buffer_space( void **buffer, size_t size ) { @@ -545,10 +750,22 @@ case WM_CREATE: { CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam; - push_data( data, cs, sizeof(*cs) ); + data->ps.cs.lpCreateParams = pack_ptr( cs->lpCreateParams ); + data->ps.cs.hInstance = pack_ptr( cs->hInstance ); + data->ps.cs.hMenu = wine_server_user_handle( cs->hMenu ); + data->ps.cs.hwndParent = wine_server_user_handle( cs->hwndParent ); + data->ps.cs.cy = cs->cy; + data->ps.cs.cx = cs->cx; + data->ps.cs.y = cs->y; + data->ps.cs.x = cs->x; + data->ps.cs.style = cs->style; + data->ps.cs.dwExStyle = cs->dwExStyle; + data->ps.cs.lpszName = pack_ptr( cs->lpszName ); + data->ps.cs.lpszClass = pack_ptr( cs->lpszClass ); + push_data( data, &data->ps.cs, sizeof(data->ps.cs) ); if (!IS_INTRESOURCE(cs->lpszName)) push_string( data, cs->lpszName ); if (!IS_INTRESOURCE(cs->lpszClass)) push_string( data, cs->lpszClass ); - return sizeof(*cs); + return sizeof(data->ps.cs); } case WM_GETTEXT: case WM_ASKCBFORMATNAME: @@ -568,26 +785,79 @@ push_data( data, (MINMAXINFO *)lparam, sizeof(MINMAXINFO) ); return sizeof(MINMAXINFO); case WM_DRAWITEM: - push_data( data, (DRAWITEMSTRUCT *)lparam, sizeof(DRAWITEMSTRUCT) ); + { + DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam; + data->ps.dis.CtlType = dis->CtlType; + data->ps.dis.CtlID = dis->CtlID; + data->ps.dis.itemID = dis->itemID; + data->ps.dis.itemAction = dis->itemAction; + data->ps.dis.itemState = dis->itemState; + data->ps.dis.hwndItem = wine_server_user_handle( dis->hwndItem ); + data->ps.dis.hDC = wine_server_user_handle( dis->hDC ); /* FIXME */ + data->ps.dis.rcItem = dis->rcItem; + data->ps.dis.itemData = dis->itemData; + push_data( data, &data->ps.dis, sizeof(data->ps.dis) ); return 0; + } case WM_MEASUREITEM: - push_data( data, (MEASUREITEMSTRUCT *)lparam, sizeof(MEASUREITEMSTRUCT) ); - return sizeof(MEASUREITEMSTRUCT); + { + MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam; + data->ps.mis.CtlType = mis->CtlType; + data->ps.mis.CtlID = mis->CtlID; + data->ps.mis.itemID = mis->itemID; + data->ps.mis.itemWidth = mis->itemWidth; + data->ps.mis.itemHeight = mis->itemHeight; + data->ps.mis.itemData = mis->itemData; + push_data( data, &data->ps.mis, sizeof(data->ps.mis) ); + return sizeof(data->ps.mis); + } case WM_DELETEITEM: - push_data( data, (DELETEITEMSTRUCT *)lparam, sizeof(DELETEITEMSTRUCT) ); + { + DELETEITEMSTRUCT *dls = (DELETEITEMSTRUCT *)lparam; + data->ps.dls.CtlType = dls->CtlType; + data->ps.dls.CtlID = dls->CtlID; + data->ps.dls.itemID = dls->itemID; + data->ps.dls.hwndItem = wine_server_user_handle( dls->hwndItem ); + data->ps.dls.itemData = dls->itemData; + push_data( data, &data->ps.dls, sizeof(data->ps.dls) ); return 0; + } case WM_COMPAREITEM: - push_data( data, (COMPAREITEMSTRUCT *)lparam, sizeof(COMPAREITEMSTRUCT) ); + { + COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *)lparam; + data->ps.cis.CtlType = cis->CtlType; + data->ps.cis.CtlID = cis->CtlID; + data->ps.cis.hwndItem = wine_server_user_handle( cis->hwndItem ); + data->ps.cis.itemID1 = cis->itemID1; + data->ps.cis.itemData1 = cis->itemData1; + data->ps.cis.itemID2 = cis->itemID2; + data->ps.cis.itemData2 = cis->itemData2; + data->ps.cis.dwLocaleId = cis->dwLocaleId; + push_data( data, &data->ps.cis, sizeof(data->ps.cis) ); return 0; + } case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: - push_data( data, (WINDOWPOS *)lparam, sizeof(WINDOWPOS) ); - return sizeof(WINDOWPOS); + { + WINDOWPOS *wp = (WINDOWPOS *)lparam; + data->ps.wp.hwnd = wine_server_user_handle( wp->hwnd ); + data->ps.wp.hwndInsertAfter = wine_server_user_handle( wp->hwndInsertAfter ); + data->ps.wp.x = wp->x; + data->ps.wp.y = wp->y; + data->ps.wp.cx = wp->cx; + data->ps.wp.cy = wp->cy; + data->ps.wp.flags = wp->flags; + push_data( data, &data->ps.wp, sizeof(data->ps.wp) ); + return sizeof(data->ps.wp); + } case WM_COPYDATA: { - COPYDATASTRUCT *cp = (COPYDATASTRUCT *)lparam; - push_data( data, cp, sizeof(*cp) ); - if (cp->lpData) push_data( data, cp->lpData, cp->cbData ); + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lparam; + data->ps.cds.cbData = cds->cbData; + data->ps.cds.dwData = cds->dwData; + data->ps.cds.lpData = pack_ptr( cds->lpData ); + push_data( data, &data->ps.cds, sizeof(data->ps.cds) ); + if (cds->lpData) push_data( data, cds->lpData, cds->cbData ); return 0; } case WM_NOTIFY: @@ -595,8 +865,16 @@ data->count = -1; return 0; case WM_HELP: - push_data( data, (HELPINFO *)lparam, sizeof(HELPINFO) ); + { + HELPINFO *hi = (HELPINFO *)lparam; + data->ps.hi.iContextType = hi->iContextType; + data->ps.hi.iCtrlId = hi->iCtrlId; + data->ps.hi.hItemHandle = wine_server_user_handle( hi->hItemHandle ); + data->ps.hi.dwContextId = hi->dwContextId; + data->ps.hi.MousePos = hi->MousePos; + push_data( data, &data->ps.hi, sizeof(data->ps.hi) ); return 0; + } case WM_STYLECHANGING: case WM_STYLECHANGED: push_data( data, (STYLESTRUCT *)lparam, sizeof(STYLESTRUCT) ); @@ -609,14 +887,34 @@ } else { - NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam; - push_data( data, nc, sizeof(*nc) ); - push_data( data, nc->lppos, sizeof(*nc->lppos) ); - return sizeof(*nc) + sizeof(*nc->lppos); + NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam; + data->ps.ncp.rgrc[0] = ncp->rgrc[0]; + data->ps.ncp.rgrc[1] = ncp->rgrc[1]; + data->ps.ncp.rgrc[2] = ncp->rgrc[2]; + data->ps.ncp.hwnd = wine_server_user_handle( ncp->lppos->hwnd ); + data->ps.ncp.hwndInsertAfter = wine_server_user_handle( ncp->lppos->hwndInsertAfter ); + data->ps.ncp.x = ncp->lppos->x; + data->ps.ncp.y = ncp->lppos->y; + data->ps.ncp.cx = ncp->lppos->cx; + data->ps.ncp.cy = ncp->lppos->cy; + data->ps.ncp.flags = ncp->lppos->flags; + push_data( data, &data->ps.ncp, sizeof(data->ps.ncp) ); + return sizeof(data->ps.ncp); } case WM_GETDLGCODE: - if (lparam) push_data( data, (MSG *)lparam, sizeof(MSG) ); - return sizeof(MSG); + if (lparam) + { + MSG *msg = (MSG *)lparam; + data->ps.msg.hwnd = wine_server_user_handle( msg->hwnd ); + data->ps.msg.message = msg->message; + data->ps.msg.wParam = msg->wParam; + data->ps.msg.lParam = msg->lParam; + data->ps.msg.time = msg->time; + data->ps.msg.pt = msg->pt; + push_data( data, &data->ps.msg, sizeof(data->ps.msg) ); + return sizeof(data->ps.msg); + } + return 0; case SBM_SETSCROLLINFO: push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); return 0; @@ -680,19 +978,34 @@ case LB_GETSELITEMS: return wparam * sizeof(UINT); case WM_NEXTMENU: - push_data( data, (MDINEXTMENU *)lparam, sizeof(MDINEXTMENU) ); - return sizeof(MDINEXTMENU); + { + MDINEXTMENU *mnm = (MDINEXTMENU *)lparam; + data->ps.mnm.hmenuIn = wine_server_user_handle( mnm->hmenuIn ); + data->ps.mnm.hmenuNext = wine_server_user_handle( mnm->hmenuNext ); + data->ps.mnm.hwndNext = wine_server_user_handle( mnm->hwndNext ); + push_data( data, &data->ps.mnm, sizeof(data->ps.mnm) ); + return sizeof(data->ps.mnm); + } case WM_SIZING: case WM_MOVING: push_data( data, (RECT *)lparam, sizeof(RECT) ); return sizeof(RECT); case WM_MDICREATE: { - MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lparam; - push_data( data, cs, sizeof(*cs) ); - if (!IS_INTRESOURCE(cs->szTitle)) push_string( data, cs->szTitle ); - if (!IS_INTRESOURCE(cs->szClass)) push_string( data, cs->szClass ); - return sizeof(*cs); + MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam; + data->ps.mcs.szClass = pack_ptr( mcs->szClass ); + data->ps.mcs.szTitle = pack_ptr( mcs->szTitle ); + data->ps.mcs.hOwner = pack_ptr( mcs->hOwner ); + data->ps.mcs.x = mcs->x; + data->ps.mcs.y = mcs->y; + data->ps.mcs.cx = mcs->cx; + data->ps.mcs.cy = mcs->cy; + data->ps.mcs.style = mcs->style; + data->ps.mcs.lParam = mcs->lParam; + push_data( data, &data->ps.mcs, sizeof(data->ps.mcs) ); + if (!IS_INTRESOURCE(mcs->szClass)) push_string( data, mcs->szClass ); + if (!IS_INTRESOURCE(mcs->szTitle)) push_string( data, mcs->szTitle ); + return sizeof(data->ps.mcs); } case WM_MDIGETACTIVE: if (lparam) return sizeof(BOOL); @@ -709,14 +1022,16 @@ case WM_WINE_KEYBOARD_LL_HOOK: { struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam; - push_data( data, h_extra, sizeof(*h_extra) ); + data->ps.hook.handle = wine_server_user_handle( h_extra->handle ); + push_data( data, &data->ps.hook, sizeof(data->ps.hook) ); push_data( data, (LPVOID)h_extra->lparam, sizeof(KBDLLHOOKSTRUCT) ); return 0; } case WM_WINE_MOUSE_LL_HOOK: { struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam; - push_data( data, h_extra, sizeof(*h_extra) ); + data->ps.hook.handle = wine_server_user_handle( h_extra->handle ); + push_data( data, &data->ps.hook, sizeof(data->ps.hook) ); push_data( data, (LPVOID)h_extra->lparam, sizeof(MSLLHOOKSTRUCT) ); return 0; } @@ -775,28 +1090,42 @@ void **buffer, size_t size ) { size_t minsize = 0; + union packed_structs *ps = *buffer; switch(message) { case WM_NCCREATE: case WM_CREATE: { - CREATESTRUCTW *cs = *buffer; - WCHAR *str = (WCHAR *)(cs + 1); - if (size < sizeof(*cs)) return FALSE; - size -= sizeof(*cs); - if (!IS_INTRESOURCE(cs->lpszName)) + CREATESTRUCTW cs; + WCHAR *str = (WCHAR *)(&ps->cs + 1); + if (size < sizeof(ps->cs)) return FALSE; + size -= sizeof(ps->cs); + cs.lpCreateParams = unpack_ptr( ps->cs.lpCreateParams ); + cs.hInstance = unpack_ptr( ps->cs.hInstance ); + cs.hMenu = wine_server_ptr_handle( ps->cs.hMenu ); + cs.hwndParent = wine_server_ptr_handle( ps->cs.hwndParent ); + cs.cy = ps->cs.cy; + cs.cx = ps->cs.cx; + cs.y = ps->cs.y; + cs.x = ps->cs.x; + cs.style = ps->cs.style; + cs.dwExStyle = ps->cs.dwExStyle; + cs.lpszName = unpack_ptr( ps->cs.lpszName ); + cs.lpszClass = unpack_ptr( ps->cs.lpszClass ); + if (ps->cs.lpszName >> 16) { if (!check_string( str, size )) return FALSE; - cs->lpszName = str; + cs.lpszName = str; size -= (strlenW(str) + 1) * sizeof(WCHAR); str += strlenW(str) + 1; } - if (!IS_INTRESOURCE(cs->lpszClass)) + if (ps->cs.lpszClass >> 16) { if (!check_string( str, size )) return FALSE; - cs->lpszClass = str; - } + cs.lpszClass = str; + } + memcpy( &ps->cs, &cs, sizeof(cs) ); break; } case WM_GETTEXT: @@ -818,39 +1147,112 @@ minsize = sizeof(MINMAXINFO); break; case WM_DRAWITEM: - minsize = sizeof(DRAWITEMSTRUCT); - break; + { + DRAWITEMSTRUCT dis; + if (size < sizeof(ps->dis)) return FALSE; + dis.CtlType = ps->dis.CtlType; + dis.CtlID = ps->dis.CtlID; + dis.itemID = ps->dis.itemID; + dis.itemAction = ps->dis.itemAction; + dis.itemState = ps->dis.itemState; + dis.hwndItem = wine_server_ptr_handle( ps->dis.hwndItem ); + dis.hDC = wine_server_ptr_handle( ps->dis.hDC ); + dis.rcItem = ps->dis.rcItem; + dis.itemData = (ULONG_PTR)unpack_ptr( ps->dis.itemData ); + memcpy( &ps->dis, &dis, sizeof(dis) ); + break; + } case WM_MEASUREITEM: - minsize = sizeof(MEASUREITEMSTRUCT); - break; + { + MEASUREITEMSTRUCT mis; + if (size < sizeof(ps->mis)) return FALSE; + mis.CtlType = ps->mis.CtlType; + mis.CtlID = ps->mis.CtlID; + mis.itemID = ps->mis.itemID; + mis.itemWidth = ps->mis.itemWidth; + mis.itemHeight = ps->mis.itemHeight; + mis.itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData ); + memcpy( &ps->mis, &mis, sizeof(mis) ); + break; + } case WM_DELETEITEM: - minsize = sizeof(DELETEITEMSTRUCT); - break; + { + DELETEITEMSTRUCT dls; + if (size < sizeof(ps->dls)) return FALSE; + dls.CtlType = ps->dls.CtlType; + dls.CtlID = ps->dls.CtlID; + dls.itemID = ps->dls.itemID; + dls.hwndItem = wine_server_ptr_handle( ps->dls.hwndItem ); + dls.itemData = (ULONG_PTR)unpack_ptr( ps->dls.itemData ); + memcpy( &ps->dls, &dls, sizeof(dls) ); + break; + } case WM_COMPAREITEM: - minsize = sizeof(COMPAREITEMSTRUCT); - break; + { + COMPAREITEMSTRUCT cis; + if (size < sizeof(ps->cis)) return FALSE; + cis.CtlType = ps->cis.CtlType; + cis.CtlID = ps->cis.CtlID; + cis.hwndItem = wine_server_ptr_handle( ps->cis.hwndItem ); + cis.itemID1 = ps->cis.itemID1; + cis.itemData1 = (ULONG_PTR)unpack_ptr( ps->cis.itemData1 ); + cis.itemID2 = ps->cis.itemID2; + cis.itemData2 = (ULONG_PTR)unpack_ptr( ps->cis.itemData2 ); + cis.dwLocaleId = ps->cis.dwLocaleId; + memcpy( &ps->cis, &cis, sizeof(cis) ); + break; + } case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: case WM_WINE_SETWINDOWPOS: - minsize = sizeof(WINDOWPOS); - break; + { + WINDOWPOS wp; + if (size < sizeof(ps->wp)) return FALSE; + wp.hwnd = wine_server_ptr_handle( ps->wp.hwnd ); + wp.hwndInsertAfter = wine_server_ptr_handle( ps->wp.hwndInsertAfter ); + wp.x = ps->wp.x; + wp.y = ps->wp.y; + wp.cx = ps->wp.cx; + wp.cy = ps->wp.cy; + wp.flags = ps->wp.flags; + memcpy( &ps->wp, &wp, sizeof(wp) ); + break; + } case WM_COPYDATA: { - COPYDATASTRUCT *cp = *buffer; - if (size < sizeof(*cp)) return FALSE; - if (cp->lpData) - { - minsize = sizeof(*cp) + cp->cbData; - cp->lpData = cp + 1; - } + COPYDATASTRUCT cds; + if (size < sizeof(ps->cds)) return FALSE; + cds.dwData = (ULONG_PTR)unpack_ptr( ps->cds.dwData ); + if (ps->cds.lpData) + { + cds.cbData = ps->cds.cbData; + cds.lpData = &ps->cds + 1; + minsize = sizeof(ps->cds) + cds.cbData; + } + else + { + cds.cbData = 0; + cds.lpData = 0; + } + memcpy( &ps->cds, &cds, sizeof(cds) ); break; } case WM_NOTIFY: /* WM_NOTIFY cannot be sent across processes (MSDN) */ return FALSE; case WM_HELP: - minsize = sizeof(HELPINFO); - break; + { + HELPINFO hi; + if (size < sizeof(ps->hi)) return FALSE; + hi.cbSize = sizeof(hi); + hi.iContextType = ps->hi.iContextType; + hi.iCtrlId = ps->hi.iCtrlId; + hi.hItemHandle = wine_server_ptr_handle( ps->hi.hItemHandle ); + hi.dwContextId = (ULONG_PTR)unpack_ptr( ps->hi.dwContextId ); + hi.MousePos = ps->hi.MousePos; + memcpy( &ps->hi, &hi, sizeof(hi) ); + break; + } case WM_STYLECHANGING: case WM_STYLECHANGED: minsize = sizeof(STYLESTRUCT); @@ -859,15 +1261,39 @@ if (!*wparam) minsize = sizeof(RECT); else { - NCCALCSIZE_PARAMS *nc = *buffer; - if (size < sizeof(*nc) + sizeof(*nc->lppos)) return FALSE; - nc->lppos = (WINDOWPOS *)(nc + 1); + NCCALCSIZE_PARAMS ncp; + WINDOWPOS wp; + if (size < sizeof(ps->ncp)) return FALSE; + ncp.rgrc[0] = ps->ncp.rgrc[0]; + ncp.rgrc[1] = ps->ncp.rgrc[1]; + ncp.rgrc[2] = ps->ncp.rgrc[2]; + wp.hwnd = wine_server_ptr_handle( ps->ncp.hwnd ); + wp.hwndInsertAfter = wine_server_ptr_handle( ps->ncp.hwndInsertAfter ); + wp.x = ps->ncp.x; + wp.y = ps->ncp.y; + wp.cx = ps->ncp.cx; + wp.cy = ps->ncp.cy; + wp.flags = ps->ncp.flags; + ncp.lppos = (WINDOWPOS *)((NCCALCSIZE_PARAMS *)&ps->ncp + 1); + memcpy( &ps->ncp, &ncp, sizeof(ncp) ); + *ncp.lppos = wp; } break; case WM_GETDLGCODE: - if (!*lparam) return TRUE; - minsize = sizeof(MSG); - break; + if (*lparam) + { + MSG msg; + if (size < sizeof(ps->msg)) return FALSE; + msg.hwnd = wine_server_ptr_handle( ps->msg.hwnd ); + msg.message = ps->msg.message; + msg.wParam = (ULONG_PTR)unpack_ptr( ps->msg.wParam ); + msg.lParam = (ULONG_PTR)unpack_ptr( ps->msg.lParam ); + msg.time = ps->msg.time; + msg.pt = ps->msg.pt; + memcpy( &ps->msg, &msg, sizeof(msg) ); + break; + } + return TRUE; case SBM_SETSCROLLINFO: minsize = sizeof(SCROLLINFO); break; @@ -943,9 +1369,15 @@ if (!get_buffer_space( buffer, *wparam * sizeof(UINT) )) return FALSE; break; case WM_NEXTMENU: - minsize = sizeof(MDINEXTMENU); - if (!get_buffer_space( buffer, sizeof(MDINEXTMENU) )) return FALSE; - break; + { + MDINEXTMENU mnm; + if (size < sizeof(ps->mnm)) return FALSE; + mnm.hmenuIn = wine_server_ptr_handle( ps->mnm.hmenuIn ); + mnm.hmenuNext = wine_server_ptr_handle( ps->mnm.hmenuNext ); + mnm.hwndNext = wine_server_ptr_handle( ps->mnm.hwndNext ); + memcpy( &ps->mnm, &mnm, sizeof(mnm) ); + break; + } case WM_SIZING: case WM_MOVING: minsize = sizeof(RECT); @@ -953,22 +1385,33 @@ break; case WM_MDICREATE: { - MDICREATESTRUCTW *cs = *buffer; - WCHAR *str = (WCHAR *)(cs + 1); - if (size < sizeof(*cs)) return FALSE; - size -= sizeof(*cs); - if (!IS_INTRESOURCE(cs->szTitle)) + MDICREATESTRUCTW mcs; + WCHAR *str = (WCHAR *)(&ps->mcs + 1); + if (size < sizeof(ps->mcs)) return FALSE; + size -= sizeof(ps->mcs); + + mcs.szClass = unpack_ptr( ps->mcs.szClass ); + mcs.szTitle = unpack_ptr( ps->mcs.szTitle ); + mcs.hOwner = unpack_ptr( ps->mcs.hOwner ); + mcs.x = ps->mcs.x; + mcs.y = ps->mcs.y; + mcs.cx = ps->mcs.cx; + mcs.cy = ps->mcs.cy; + mcs.style = ps->mcs.style; + mcs.lParam = (LPARAM)unpack_ptr( ps->mcs.lParam ); + if (ps->mcs.szClass >> 16) { if (!check_string( str, size )) return FALSE; - cs->szTitle = str; + mcs.szClass = str; size -= (strlenW(str) + 1) * sizeof(WCHAR); str += strlenW(str) + 1; } - if (!IS_INTRESOURCE(cs->szClass)) + if (ps->mcs.szTitle >> 16) { if (!check_string( str, size )) return FALSE; - cs->szClass = str; - } + mcs.szTitle = str; + } + memcpy( &ps->mcs, &mcs, sizeof(mcs) ); break; } case WM_MDIGETACTIVE: @@ -981,13 +1424,14 @@ case WM_WINE_KEYBOARD_LL_HOOK: case WM_WINE_MOUSE_LL_HOOK: { - struct hook_extra_info *h_extra = *buffer; - - minsize = sizeof(struct hook_extra_info) + + struct hook_extra_info h_extra; + minsize = sizeof(ps->hook) + (message == WM_WINE_KEYBOARD_LL_HOOK ? sizeof(KBDLLHOOKSTRUCT) : sizeof(MSLLHOOKSTRUCT)); if (size < minsize) return FALSE; - h_extra->lparam = (LPARAM)(h_extra + 1); + h_extra.handle = wine_server_ptr_handle( ps->hook.handle ); + h_extra.lparam = (LPARAM)(&ps->hook + 1); + memcpy( &ps->hook, &h_extra, sizeof(h_extra) ); break; } case WM_NCPAINT: @@ -1054,8 +1498,23 @@ { case WM_NCCREATE: case WM_CREATE: - push_data( data, (CREATESTRUCTW *)lparam, sizeof(CREATESTRUCTW) ); - break; + { + CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam; + data->ps.cs.lpCreateParams = (ULONG_PTR)cs->lpCreateParams; + data->ps.cs.hInstance = (ULONG_PTR)cs->hInstance; + data->ps.cs.hMenu = wine_server_user_handle( cs->hMenu ); + data->ps.cs.hwndParent = wine_server_user_handle( cs->hwndParent ); + data->ps.cs.cy = cs->cy; + data->ps.cs.cx = cs->cx; + data->ps.cs.y = cs->y; + data->ps.cs.x = cs->x; + data->ps.cs.style = cs->style; + data->ps.cs.dwExStyle = cs->dwExStyle; + data->ps.cs.lpszName = (ULONG_PTR)cs->lpszName; + data->ps.cs.lpszClass = (ULONG_PTR)cs->lpszClass; + push_data( data, &data->ps.cs, sizeof(data->ps.cs) ); + break; + } case WM_GETTEXT: case CB_GETLBTEXT: case LB_GETTEXT: @@ -1065,14 +1524,43 @@ push_data( data, (MINMAXINFO *)lparam, sizeof(MINMAXINFO) ); break; case WM_MEASUREITEM: - push_data( data, (MEASUREITEMSTRUCT *)lparam, sizeof(MEASUREITEMSTRUCT) ); - break; + { + MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam; + data->ps.mis.CtlType = mis->CtlType; + data->ps.mis.CtlID = mis->CtlID; + data->ps.mis.itemID = mis->itemID; + data->ps.mis.itemWidth = mis->itemWidth; + data->ps.mis.itemHeight = mis->itemHeight; + data->ps.mis.itemData = mis->itemData; + push_data( data, &data->ps.mis, sizeof(data->ps.mis) ); + break; + } case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: - push_data( data, (WINDOWPOS *)lparam, sizeof(WINDOWPOS) ); - break; + { + WINDOWPOS *wp = (WINDOWPOS *)lparam; + data->ps.wp.hwnd = wine_server_user_handle( wp->hwnd ); + data->ps.wp.hwndInsertAfter = wine_server_user_handle( wp->hwndInsertAfter ); + data->ps.wp.x = wp->x; + data->ps.wp.y = wp->y; + data->ps.wp.cx = wp->cx; + data->ps.wp.cy = wp->cy; + data->ps.wp.flags = wp->flags; + push_data( data, &data->ps.wp, sizeof(data->ps.wp) ); + break; + } case WM_GETDLGCODE: - if (lparam) push_data( data, (MSG *)lparam, sizeof(MSG) ); + if (lparam) + { + MSG *msg = (MSG *)lparam; + data->ps.msg.hwnd = wine_server_user_handle( msg->hwnd ); + data->ps.msg.message = msg->message; + data->ps.msg.wParam = msg->wParam; + data->ps.msg.lParam = msg->lParam; + data->ps.msg.time = msg->time; + data->ps.msg.pt = msg->pt; + push_data( data, &data->ps.msg, sizeof(data->ps.msg) ); + } break; case SBM_GETSCROLLINFO: push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) ); @@ -1101,9 +1589,18 @@ push_data( data, (RECT *)lparam, sizeof(RECT) ); else { - NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam; - push_data( data, nc, sizeof(*nc) ); - push_data( data, nc->lppos, sizeof(*nc->lppos) ); + NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam; + data->ps.ncp.rgrc[0] = ncp->rgrc[0]; + data->ps.ncp.rgrc[1] = ncp->rgrc[1]; + data->ps.ncp.rgrc[2] = ncp->rgrc[2]; + data->ps.ncp.hwnd = wine_server_user_handle( ncp->lppos->hwnd ); + data->ps.ncp.hwndInsertAfter = wine_server_user_handle( ncp->lppos->hwndInsertAfter ); + data->ps.ncp.x = ncp->lppos->x; + data->ps.ncp.y = ncp->lppos->y; + data->ps.ncp.cx = ncp->lppos->cx; + data->ps.ncp.cy = ncp->lppos->cy; + data->ps.ncp.flags = ncp->lppos->flags; + push_data( data, &data->ps.ncp, sizeof(data->ps.ncp) ); } break; case EM_GETSEL: @@ -1113,11 +1610,29 @@ if (lparam) push_data( data, (DWORD *)lparam, sizeof(DWORD) ); break; case WM_NEXTMENU: - push_data( data, (MDINEXTMENU *)lparam, sizeof(MDINEXTMENU) ); - break; + { + MDINEXTMENU *mnm = (MDINEXTMENU *)lparam; + data->ps.mnm.hmenuIn = wine_server_user_handle( mnm->hmenuIn ); + data->ps.mnm.hmenuNext = wine_server_user_handle( mnm->hmenuNext ); + data->ps.mnm.hwndNext = wine_server_user_handle( mnm->hwndNext ); + push_data( data, &data->ps.mnm, sizeof(data->ps.mnm) ); + break; + } case WM_MDICREATE: - push_data( data, (MDICREATESTRUCTW *)lparam, sizeof(MDICREATESTRUCTW) ); - break; + { + MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam; + data->ps.mcs.szClass = pack_ptr( mcs->szClass ); + data->ps.mcs.szTitle = pack_ptr( mcs->szTitle ); + data->ps.mcs.hOwner = pack_ptr( mcs->hOwner ); + data->ps.mcs.x = mcs->x; + data->ps.mcs.y = mcs->y; + data->ps.mcs.cx = mcs->cx; + data->ps.mcs.cy = mcs->cy; + data->ps.mcs.style = mcs->style; + data->ps.mcs.lParam = mcs->lParam; + push_data( data, &data->ps.mcs, sizeof(data->ps.mcs) ); + break; + } case WM_ASKCBFORMATNAME: push_data( data, (WCHAR *)lparam, (strlenW((WCHAR *)lparam) + 1) * sizeof(WCHAR) ); break; @@ -1133,18 +1648,28 @@ static void unpack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, void *buffer, size_t size ) { + union packed_structs *ps = buffer; + switch(message) { case WM_NCCREATE: case WM_CREATE: - { - CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam; - LPCWSTR name = cs->lpszName, class = cs->lpszClass; - memcpy( cs, buffer, min( sizeof(*cs), size )); - cs->lpszName = name; /* restore the original pointers */ - cs->lpszClass = class; - break; - } + if (size >= sizeof(ps->cs)) + { + CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam; + cs->lpCreateParams = unpack_ptr( ps->cs.lpCreateParams ); + cs->hInstance = unpack_ptr( ps->cs.hInstance ); + cs->hMenu = wine_server_ptr_handle( ps->cs.hMenu ); + cs->hwndParent = wine_server_ptr_handle( ps->cs.hwndParent ); + cs->cy = ps->cs.cy; + cs->cx = ps->cs.cx; + cs->y = ps->cs.y; + cs->x = ps->cs.x; + cs->style = ps->cs.style; + cs->dwExStyle = ps->cs.dwExStyle; + /* don't allow changing name and class pointers */ + } + break; case WM_GETTEXT: case WM_ASKCBFORMATNAME: memcpy( (WCHAR *)lparam, buffer, min( wparam*sizeof(WCHAR), size )); @@ -1153,14 +1678,42 @@ memcpy( (MINMAXINFO *)lparam, buffer, min( sizeof(MINMAXINFO), size )); break; case WM_MEASUREITEM: - memcpy( (MEASUREITEMSTRUCT *)lparam, buffer, min( sizeof(MEASUREITEMSTRUCT), size )); + if (size >= sizeof(ps->mis)) + { + MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam; + mis->CtlType = ps->mis.CtlType; + mis->CtlID = ps->mis.CtlID; + mis->itemID = ps->mis.itemID; + mis->itemWidth = ps->mis.itemWidth; + mis->itemHeight = ps->mis.itemHeight; + mis->itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData ); + } break; case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGED: - memcpy( (WINDOWPOS *)lparam, buffer, min( sizeof(WINDOWPOS), size )); + if (size >= sizeof(ps->wp)) + { + WINDOWPOS *wp = (WINDOWPOS *)lparam; + wp->hwnd = wine_server_ptr_handle( ps->wp.hwnd ); + wp->hwndInsertAfter = wine_server_ptr_handle( ps->wp.hwndInsertAfter ); + wp->x = ps->wp.x; + wp->y = ps->wp.y; + wp->cx = ps->wp.cx; + wp->cy = ps->wp.cy; + wp->flags = ps->wp.flags; + } break; case WM_GETDLGCODE: - if (lparam) memcpy( (MSG *)lparam, buffer, min( sizeof(MSG), size )); + if (lparam && size >= sizeof(ps->msg)) + { + MSG *msg = (MSG *)lparam; + msg->hwnd = wine_server_ptr_handle( ps->msg.hwnd ); + msg->message = ps->msg.message; + msg->wParam = (ULONG_PTR)unpack_ptr( ps->msg.wParam ); + msg->lParam = (ULONG_PTR)unpack_ptr( ps->msg.lParam ); + msg->time = ps->msg.time; + msg->pt = ps->msg.pt; + } break; case SBM_GETSCROLLINFO: memcpy( (SCROLLINFO *)lparam, buffer, min( sizeof(SCROLLINFO), size )); @@ -1187,7 +1740,13 @@ memcpy( (WCHAR *)lparam, buffer, size ); break; case WM_NEXTMENU: - memcpy( (MDINEXTMENU *)lparam, buffer, min( sizeof(MDINEXTMENU), size )); + if (size >= sizeof(ps->mnm)) + { + MDINEXTMENU *mnm = (MDINEXTMENU *)lparam; + mnm->hmenuIn = wine_server_ptr_handle( ps->mnm.hmenuIn ); + mnm->hmenuNext = wine_server_ptr_handle( ps->mnm.hmenuNext ); + mnm->hwndNext = wine_server_ptr_handle( ps->mnm.hwndNext ); + } break; case WM_MDIGETACTIVE: if (lparam) memcpy( (BOOL *)lparam, buffer, min( sizeof(BOOL), size )); @@ -1195,17 +1754,19 @@ case WM_NCCALCSIZE: if (!wparam) memcpy( (RECT *)lparam, buffer, min( sizeof(RECT), size )); - else - { - NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam; - WINDOWPOS *wp = nc->lppos; - memcpy( nc, buffer, min( sizeof(*nc), size )); - if (size > sizeof(*nc)) - { - size -= sizeof(*nc); - memcpy( wp, (NCCALCSIZE_PARAMS*)buffer + 1, min( sizeof(*wp), size )); - } - nc->lppos = wp; /* restore the original pointer */ + else if (size >= sizeof(ps->ncp)) + { + NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam; + ncp->rgrc[0] = ps->ncp.rgrc[0]; + ncp->rgrc[1] = ps->ncp.rgrc[1]; + ncp->rgrc[2] = ps->ncp.rgrc[2]; + ncp->lppos->hwnd = wine_server_ptr_handle( ps->ncp.hwnd ); + ncp->lppos->hwndInsertAfter = wine_server_ptr_handle( ps->ncp.hwndInsertAfter ); + ncp->lppos->x = ps->ncp.x; + ncp->lppos->y = ps->ncp.y; + ncp->lppos->cx = ps->ncp.cx; + ncp->lppos->cy = ps->ncp.cy; + ncp->lppos->flags = ps->ncp.flags; } break; case EM_GETSEL: @@ -1221,14 +1782,19 @@ if (lparam) memcpy( (DWORD *)lparam, buffer, min( sizeof(DWORD), size )); break; case WM_MDICREATE: - { - MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lparam; - LPCWSTR title = cs->szTitle, class = cs->szClass; - memcpy( cs, buffer, min( sizeof(*cs), size )); - cs->szTitle = title; /* restore the original pointers */ - cs->szClass = class; - break; - } + if (size >= sizeof(ps->mcs)) + { + MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam; + mcs->hOwner = unpack_ptr( ps->mcs.hOwner ); + mcs->x = ps->mcs.x; + mcs->y = ps->mcs.y; + mcs->cx = ps->mcs.cx; + mcs->cy = ps->mcs.cy; + mcs->style = ps->mcs.style; + mcs->lParam = (LPARAM)unpack_ptr( ps->mcs.lParam ); + /* don't allow changing class and title pointers */ + } + break; default: ERR( "should not happen: unexpected message %x\n", message ); break; @@ -1249,7 +1815,7 @@ if (info->flags & ISMEX_NOTIFY) return; /* notify messages don't get replies */ if (!remove && replied) return; /* replied already */ - data.count = 0; + memset( &data, 0, sizeof(data) ); info->flags |= ISMEX_REPLIED; if (info->type == MSG_OTHER_PROCESS && !replied) @@ -1435,8 +2001,9 @@ HGLOBAL h = dde_get_pair( (HANDLE)uiHi ); if (h) { + ULONGLONG hpack = pack_ptr( h ); /* send back the value of h on the other side */ - push_data( data, &h, sizeof(HGLOBAL) ); + push_data( data, &hpack, sizeof(hpack) ); lp = uiLo; TRACE( "send dde-ack %lx %08lx => %p\n", uiLo, uiHi, h ); } @@ -1537,11 +2104,13 @@ case WM_DDE_ACK: if (size) { + ULONGLONG hpack; /* hMem is being passed */ - if (size != sizeof(HGLOBAL)) return FALSE; + if (size != sizeof(hpack)) return FALSE; if (!buffer || !*buffer) return FALSE; uiLo = *lparam; - memcpy( &hMem, *buffer, size ); + memcpy( &hpack, *buffer, size ); + hMem = unpack_ptr( hpack ); uiHi = (UINT_PTR)hMem; TRACE("recv dde-ack %lx mem=%lx[%lx]\n", uiLo, uiHi, GlobalSize( hMem )); } @@ -2316,7 +2885,7 @@ timeout = (timeout_t)max( 0, (int)info->timeout ) * -10000; } - data.count = 0; + memset( &data, 0, sizeof(data) ); if (info->type == MSG_OTHER_PROCESS) { *reply_size = pack_message( info->hwnd, info->msg, info->wparam, info->lparam, &data ); Modified: branches/arwinss/reactos/dll/win32/user32/scroll.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/scroll.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/scroll.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -1129,7 +1129,7 @@ ReleaseCapture(); break; } - } while (msg.message != WM_LBUTTONUP); + } while (msg.message != WM_LBUTTONUP && GetCapture() == hwnd); } Modified: branches/arwinss/reactos/dll/win32/user32/user_private.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/user_private.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/user_private.h [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -177,13 +177,11 @@ DWORD GetMessageTimeVal; /* Value for GetMessageTime */ DWORD GetMessagePosVal; /* Value for GetMessagePos */ ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */ - HCURSOR cursor; /* Current cursor */ - INT cursor_count; /* Cursor show count */ UINT active_hooks; /* Bitmap of active hooks */ HWND top_window; /* Desktop window */ HWND msg_window; /* HWND_MESSAGE parent window */ - ULONG pad[9]; /* Available for more data */ + ULONG pad[11]; /* Available for more data */ }; struct hook_extra_info Modified: branches/arwinss/reactos/dll/win32/user32/win.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
============================================================================== --- branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -1786,6 +1786,7 @@ WCHAR windir[MAX_PATH]; WCHAR app[MAX_PATH + sizeof(explorer)/sizeof(WCHAR)]; WCHAR cmdline[MAX_PATH + (sizeof(explorer) + sizeof(args))/sizeof(WCHAR)]; + void *redir; memset( &si, 0, sizeof(si) ); si.cb = sizeof(si); @@ -1794,11 +1795,13 @@ si.hStdOutput = 0; si.hStdError = GetStdHandle( STD_ERROR_HANDLE ); - GetWindowsDirectoryW( windir, MAX_PATH ); + GetSystemDirectoryW( windir, MAX_PATH ); strcpyW( app, windir ); strcatW( app, explorer ); strcpyW( cmdline, app ); strcatW( cmdline, args ); + + Wow64DisableWow64FsRedirection( &redir ); if (CreateProcessW( app, cmdline, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, windir, &si, &pi )) { @@ -1808,6 +1811,7 @@ CloseHandle( pi.hProcess ); } else WARN( "failed to start explorer, err %d\n", GetLastError() ); + Wow64RevertWow64FsRedirection( redir ); } else TRACE( "not starting explorer since winstation is not visible\n" ); Modified: branches/arwinss/reactos/include/reactos/wine/server_protocol.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
============================================================================== --- branches/arwinss/reactos/include/reactos/wine/server_protocol.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/wine/server_protocol.h [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -139,10 +139,10 @@ { struct { unsigned int eip, ebp, esp, eflags, cs, ss; } i386_regs; struct { unsigned __int64 rip, rbp, rsp; - unsigned int cs, ss, flags; } x86_64_regs; + unsigned int cs, ss, flags, __pad; } x86_64_regs; struct { unsigned __int64 fir; - unsigned int psr; } alpha_regs; - struct { unsigned int iar, msr, ctr, lr, dar, dsisr, trap; } powerpc_regs; + unsigned int psr, __pad; } alpha_regs; + struct { unsigned int iar, msr, ctr, lr, dar, dsisr, trap, __pad; } powerpc_regs; struct { unsigned int psr, pc, npc, y, wim, tbr; } sparc_regs; } ctl; union @@ -722,7 +722,7 @@ int exit_code; int priority; cpu_type_t cpu; - char __pad_60[4]; + int debugger_present; }; @@ -4653,6 +4653,24 @@ { struct reply_header __header; }; + + + +struct set_cursor_request +{ + struct request_header __header; + unsigned int flags; + user_handle_t handle; + int show_count; +}; +struct set_cursor_reply +{ + struct reply_header __header; + user_handle_t prev_handle; + int prev_count; +}; +#define SET_CURSOR_HANDLE 0x01 +#define SET_CURSOR_COUNT 0x02 enum request @@ -4898,6 +4916,7 @@ REQ_set_window_layered_info, REQ_alloc_user_handle, REQ_free_user_handle, + REQ_set_cursor, REQ_NB_REQUESTS }; @@ -5146,6 +5165,7 @@ struct set_window_layered_info_request set_window_layered_info_request; struct alloc_user_handle_request alloc_user_handle_request; struct free_user_handle_request free_user_handle_request; + struct set_cursor_request set_cursor_request; }; union generic_reply { @@ -5392,8 +5412,9 @@ struct set_window_layered_info_reply set_window_layered_info_reply; struct alloc_user_handle_reply alloc_user_handle_reply; struct free_user_handle_reply free_user_handle_reply; -}; - -#define SERVER_PROTOCOL_VERSION 395 + struct set_cursor_reply set_cursor_reply; +}; + +#define SERVER_PROTOCOL_VERSION 398 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/request.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/request.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/request.h [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -33,7 +33,7 @@ extern PVOID RequestData; /* get the request vararg data */ -static inline const void *get_req_data() +static inline const void *get_req_data(void) { return RequestData; } @@ -313,6 +313,7 @@ DECL_HANDLER(set_window_layered_info); DECL_HANDLER(alloc_user_handle); DECL_HANDLER(free_user_handle); +DECL_HANDLER(set_cursor); #ifdef WANT_REQUEST_HANDLERS @@ -560,6 +561,7 @@ (req_handler)req_set_window_layered_info, (req_handler)req_alloc_user_handle, (req_handler)req_free_user_handle, + (req_handler)req_set_cursor, }; #if 0 @@ -659,6 +661,7 @@ C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, exit_code) == 48 ); C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, priority) == 52 ); C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, cpu) == 56 ); +C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, debugger_present) == 60 ); C_ASSERT( sizeof(struct get_process_info_reply) == 64 ); C_ASSERT( FIELD_OFFSET(struct set_process_info_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct set_process_info_request, mask) == 16 ); @@ -1869,6 +1872,12 @@ C_ASSERT( sizeof(struct alloc_user_handle_reply) == 16 ); C_ASSERT( FIELD_OFFSET(struct free_user_handle_request, handle) == 12 ); C_ASSERT( sizeof(struct free_user_handle_request) == 16 ); +C_ASSERT( FIELD_OFFSET(struct set_cursor_request, flags) == 12 ); +C_ASSERT( FIELD_OFFSET(struct set_cursor_request, handle) == 16 ); +C_ASSERT( FIELD_OFFSET(struct set_cursor_request, show_count) == 20 ); +C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_handle) == 8 ); +C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_count) == 12 ); +C_ASSERT( sizeof(struct set_cursor_reply) == 16 ); #endif #endif /* WANT_REQUEST_HANDLERS */ Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Apr 4 15:19:10 2010 @@ -1,3 +1,3 @@ /branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/wine:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080 /trunk/reactos/subsystems/win32/win32k/wine:42000-43126,43669-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688 -/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314 +/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314,46696 Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -609,7 +609,7 @@ DECL_HANDLER(set_security_object) { data_size_t sd_size = get_req_data_size((void*)req); - const struct security_descriptor *sd = get_req_data((void*)req); + const struct security_descriptor *sd = get_req_data(); struct object *obj; unsigned int access = 0; Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -92,6 +92,8 @@ rectangle_t caret_rect; /* caret rectangle */ int caret_hide; /* caret hide count */ int caret_state; /* caret on/off state */ + user_handle_t cursor; /* current cursor */ + int cursor_count; /* cursor show count */ struct list msg_list; /* list of hardware messages */ unsigned char keystate[256]; /* state of each key */ }; @@ -109,6 +111,7 @@ int paint_count; /* pending paint messages count */ int quit_message; /* is there a pending quit message? */ int exit_code; /* exit code of pending quit message */ + int cursor_count; /* per-queue cursor show count */ struct list msg_list[NB_MSG_KINDS]; /* lists of messages */ struct list send_result; /* stack of sent messages waiting for result */ struct list callback_result; /* list of callback messages waiting for result */ @@ -215,11 +218,13 @@ if ((input = alloc_object( &thread_input_ops ))) { - input->focus = 0; - input->capture = 0; - input->active = 0; - input->menu_owner = 0; - input->move_size = 0; + input->focus = 0; + input->capture = 0; + input->active = 0; + input->menu_owner = 0; + input->move_size = 0; + input->cursor = 0; + input->cursor_count = 0; list_init( &input->msg_list ); set_caret_window( input, 0 ); memset( input->keystate, 0, sizeof(input->keystate) ); @@ -233,23 +238,19 @@ return input; } -/* release the thread input data of a given thread */ -static inline void release_thread_input( PTHREADINFO thread ) -{ - struct thread_input *input = thread->queue->input; - - if (!input) return; - release_object( input ); - thread->queue->input = NULL; -} - /* create a message queue object */ static struct msg_queue *create_msg_queue( PTHREADINFO thread, struct thread_input *input ) { + struct thread_input *new_input = NULL; struct msg_queue *queue; int i; - if (!input && !(input = create_thread_input( thread ))) return NULL; + if (!input) + { + if (!(new_input = create_thread_input( thread ))) return NULL; + input = new_input; + } + if ((queue = alloc_object( &msg_queue_ops ))) { queue->fd = NULL; @@ -267,6 +268,7 @@ queue->changed_mask = 0; queue->paint_count = 0; queue->quit_message = 0; + queue->cursor_count = 0; queue->recv_result = NULL; queue->next_timer_id = 0x7fff; queue->timeout = NULL; @@ -281,7 +283,7 @@ thread->queue = queue; } - release_object( input ); + if (new_input) release_object( new_input ); return queue; } @@ -292,6 +294,26 @@ if (!thread->queue) return; release_object( thread->queue ); thread->queue = NULL; +} + +/* change the thread input data of a given thread */ +static int assign_thread_input( PTHREADINFO thread, struct thread_input *new_input ) +{ + struct msg_queue *queue = thread->queue; + + if (!queue) + { + thread->queue = create_msg_queue( thread, new_input ); + return thread->queue != NULL; + } + if (queue->input) + { + queue->input->cursor_count -= queue->cursor_count; + release_object( queue->input ); + } + queue->input = (struct thread_input *)grab_object( new_input ); + new_input->cursor_count += queue->cursor_count; + return 1; } /* get the hook table for a given thread */ @@ -874,7 +896,11 @@ ExFreePool( timer ); } if (queue->timeout) remove_timeout_user( queue->timeout ); - if (queue->input) release_object( queue->input ); + if (queue->input) + { + queue->input->cursor_count -= queue->cursor_count; + release_object( queue->input ); + } if (queue->hooks) release_object( queue->hooks ); if (queue->fd) release_object( queue->fd ); } @@ -949,6 +975,7 @@ { struct desktop *desktop; struct thread_input *input; + int ret; if (!thread_to->queue && !(thread_to->queue = create_msg_queue( thread_to, NULL ))) return 0; if (!(desktop = get_thread_desktop( thread_from, 0 ))) return 0; @@ -962,17 +989,10 @@ } release_object( desktop ); - if (thread_from->queue) - { - release_thread_input( thread_from ); - thread_from->queue->input = input; - } - else - { - if (!(thread_from->queue = create_msg_queue( thread_from, input ))) return 0; - } - memset( input->keystate, 0, sizeof(input->keystate) ); - return 1; + ret = assign_thread_input( thread_from, input ); + if (ret) memset( input->keystate, 0, sizeof(input->keystate) ); + release_object( input ); + return ret; } /* detach two thread input data structures */ @@ -982,8 +1002,8 @@ if ((input = create_thread_input( thread_from ))) { - release_thread_input( thread_from ); - thread_from->queue->input = input; + assign_thread_input( thread_from, input ); + release_object( input ); } } @@ -1723,7 +1743,7 @@ msg->data = NULL; msg->data_size = get_req_data_size((void*)req); - if (msg->data_size && !(msg->data = memdup( get_req_data((void*)req), msg->data_size ))) + if (msg->data_size && !(msg->data = memdup( get_req_data(), msg->data_size ))) { ExFreePool( msg ); ObDereferenceObject(thread->peThread); @@ -1926,7 +1946,7 @@ if (!current->queue) set_error( STATUS_ACCESS_DENIED ); else if (current->queue->recv_result) reply_message( current->queue, req->result, 0, req->remove, - get_req_data((void*)req), get_req_data_size((void*)req) ); + get_req_data(), get_req_data_size((void*)req) ); } @@ -2217,7 +2237,7 @@ if (input) { data_size_t size = min( sizeof(input->keystate), get_req_data_size((void*)req) ); - if (size) memcpy( input->keystate, get_req_data((void*)req), size ); + if (size) memcpy( input->keystate, get_req_data(), size ); } ObDereferenceObject(thread->peThread); } @@ -2366,3 +2386,32 @@ { reply->time = last_input_time; } + +/* set/get the current cursor */ +DECL_HANDLER(set_cursor) +{ + struct msg_queue *queue = get_current_queue(); + struct thread_input *input; + + if (!queue) return; + input = queue->input; + + reply->prev_handle = input->cursor; + reply->prev_count = input->cursor_count; + + if (req->flags & SET_CURSOR_HANDLE) + { + if (req->handle && !get_user_object( req->handle, USER_CLIENT )) + { + set_win32_error( ERROR_INVALID_CURSOR_HANDLE ); + return; + } + input->cursor = req->handle; + } + + if (req->flags & SET_CURSOR_COUNT) + { + queue->cursor_count += req->show_count; + input->cursor_count += req->show_count; + } +} Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] Sun Apr 4 15:19:10 2010 @@ -2086,7 +2086,7 @@ return; } - if (get_req_data_size((void*)req) >= sizeof(rectangle_t)) visible_rect = get_req_data((void*)req); + if (get_req_data_size((void*)req) >= sizeof(rectangle_t)) visible_rect = get_req_data(); if (get_req_data_size((void*)req) >= 3 * sizeof(rectangle_t)) valid_rects = visible_rect + 1; if (!visible_rect) visible_rect = &req->window; @@ -2136,7 +2136,7 @@ if (len) { if (!(text = mem_alloc( (len+1) * sizeof(WCHAR) ))) return; - memcpy( text, get_req_data((void*)req), len * sizeof(WCHAR) ); + memcpy( text, get_req_data(), len * sizeof(WCHAR) ); text[len] = 0; } if (win->text) ExFreePool( win->text ); @@ -2234,7 +2234,7 @@ if (get_req_data_size((void*)req)) /* no data means remove the region completely */ { - if (!(region = create_region_from_req_data( get_req_data((void*)req), get_req_data_size((void*)req) ))) + if (!(region = create_region_from_req_data( get_req_data(), get_req_data_size((void*)req) ))) return; } set_window_region( win, region, req->redraw ); @@ -2354,7 +2354,7 @@ { if (get_req_data_size((void*)req)) /* no data means whole rectangle */ { - if (!(region = create_region_from_req_data( get_req_data((void*)req), get_req_data_size((void*)req) ))) + if (!(region = create_region_from_req_data( get_req_data(), get_req_data_size((void*)req) ))) return; } }
14 years, 7 months
1
0
0
0
[ekohl] 46714: [NTOSKRNL] Ignore inherit only ACEs in a DACL.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 4 14:34:53 2010 New Revision: 46714 URL:
http://svn.reactos.org/svn/reactos?rev=46714&view=rev
Log: [NTOSKRNL] Ignore inherit only ACEs in a DACL. Modified: trunk/reactos/ntoskrnl/se/semgr.c Modified: trunk/reactos/ntoskrnl/se/semgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/semgr.c?rev=46…
============================================================================== --- trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] Sun Apr 4 14:34:53 2010 @@ -485,7 +485,7 @@ { *GrantedAccess = DesiredAccess | PreviouslyGrantedAccess; } - + *AccessStatus = STATUS_SUCCESS; return TRUE; } @@ -546,6 +546,72 @@ { CurrentAce = (PACE)(Dacl + 1); for (i = 0; i < Dacl->AceCount; i++) + { + if (!(CurrentAce->Header.AceFlags & INHERIT_ONLY_ACE)) + { + Sid = (PSID)(CurrentAce + 1); + if (CurrentAce->Header.AceType == ACCESS_DENIED_ACE_TYPE) + { + if (SepSidInToken(Token, Sid)) + { + /* Map access rights from the ACE */ + TempAccess = CurrentAce->AccessMask; + RtlMapGenericMask(&TempAccess, GenericMapping); + + /* Deny access rights that have not been granted yet */ + TempDeniedAccess |= (TempAccess & ~TempGrantedAccess); + } + } + else if (CurrentAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE) + { + if (SepSidInToken(Token, Sid)) + { + /* Map access rights from the ACE */ + TempAccess = CurrentAce->AccessMask; + RtlMapGenericMask(&TempAccess, GenericMapping); + + /* Grant access rights that have not been denied yet */ + TempGrantedAccess |= (TempAccess & ~TempDeniedAccess); + } + } + else + { + DPRINT1("Unsupported ACE type 0x%lx\n", CurrentAce->Header.AceType); + } + } + + /* Get the next ACE */ + CurrentAce = (PACE)((ULONG_PTR)CurrentAce + CurrentAce->Header.AceSize); + } + + /* Fail if some rights have not been granted */ + RemainingAccess &= ~(MAXIMUM_ALLOWED | TempGrantedAccess); + if (RemainingAccess != 0) + { + *GrantedAccess = 0; + *AccessStatus = STATUS_ACCESS_DENIED; + return FALSE; + } + + /* Set granted access right and access status */ + *GrantedAccess = TempGrantedAccess | PreviouslyGrantedAccess; + if (*GrantedAccess != 0) + { + *AccessStatus = STATUS_SUCCESS; + return TRUE; + } + else + { + *AccessStatus = STATUS_ACCESS_DENIED; + return FALSE; + } + } + + /* RULE 4: Grant rights according to the DACL */ + CurrentAce = (PACE)(Dacl + 1); + for (i = 0; i < Dacl->AceCount; i++) + { + if (!(CurrentAce->Header.AceFlags & INHERIT_ONLY_ACE)) { Sid = (PSID)(CurrentAce + 1); if (CurrentAce->Header.AceType == ACCESS_DENIED_ACE_TYPE) @@ -556,8 +622,9 @@ TempAccess = CurrentAce->AccessMask; RtlMapGenericMask(&TempAccess, GenericMapping); - /* Deny access rights that have not been granted yet */ - TempDeniedAccess |= (TempAccess & ~TempGrantedAccess); + /* Leave if a remaining right must be denied */ + if (RemainingAccess & TempAccess) + break; } } else if (CurrentAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE) @@ -568,75 +635,14 @@ TempAccess = CurrentAce->AccessMask; RtlMapGenericMask(&TempAccess, GenericMapping); - /* Grant access rights that have not been denied yet */ - TempGrantedAccess |= (TempAccess & ~TempDeniedAccess); + /* Remove granted rights */ + RemainingAccess &= ~TempAccess; } } else { DPRINT1("Unsupported ACE type 0x%lx\n", CurrentAce->Header.AceType); } - - /* Get the next ACE */ - CurrentAce = (PACE)((ULONG_PTR)CurrentAce + CurrentAce->Header.AceSize); - } - - /* Fail if some rights have not been granted */ - RemainingAccess &= ~(MAXIMUM_ALLOWED | TempGrantedAccess); - if (RemainingAccess != 0) - { - *GrantedAccess = 0; - *AccessStatus = STATUS_ACCESS_DENIED; - return FALSE; - } - - /* Set granted access right and access status */ - *GrantedAccess = TempGrantedAccess | PreviouslyGrantedAccess; - if (*GrantedAccess != 0) - { - *AccessStatus = STATUS_SUCCESS; - return TRUE; - } - else - { - *AccessStatus = STATUS_ACCESS_DENIED; - return FALSE; - } - } - - /* RULE 4: Grant rights according to the DACL */ - CurrentAce = (PACE)(Dacl + 1); - for (i = 0; i < Dacl->AceCount; i++) - { - Sid = (PSID)(CurrentAce + 1); - if (CurrentAce->Header.AceType == ACCESS_DENIED_ACE_TYPE) - { - if (SepSidInToken(Token, Sid)) - { - /* Map access rights from the ACE */ - TempAccess = CurrentAce->AccessMask; - RtlMapGenericMask(&TempAccess, GenericMapping); - - /* Leave if a remaining right must be denied */ - if (RemainingAccess & TempAccess) - break; - } - } - else if (CurrentAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE) - { - if (SepSidInToken(Token, Sid)) - { - /* Map access rights from the ACE */ - TempAccess = CurrentAce->AccessMask; - RtlMapGenericMask(&TempAccess, GenericMapping); - - /* Remove granted rights */ - RemainingAccess &= ~TempAccess; - } - } - else - { - DPRINT1("Unsupported ACE type 0x%lx\n", CurrentAce->Header.AceType); } /* Get the next ACE */
14 years, 7 months
1
0
0
0
[jgardou] 46713: Fix build
by jgardou@svn.reactos.org
Author: jgardou Date: Sun Apr 4 11:42:26 2010 New Revision: 46713 URL:
http://svn.reactos.org/svn/reactos?rev=46713&view=rev
Log: Fix build Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Sun Apr 4 11:42:26 2010 @@ -751,12 +751,14 @@ /* Shall we apply the settings? */ if (!(flags & CDS_NORESET)) { + ULONG ulResult; + if (!PDEVOBJ_bSwitchMode(ppdev, pdm)) { DPRINT1("failed to set mode\n"); lResult = (lResult == DISP_CHANGE_NOTUPDATED) ? DISP_CHANGE_FAILED : DISP_CHANGE_RESTART; - + goto leave; } @@ -852,10 +854,10 @@ { /* Probe the size field of the structure */ ProbeForRead(lpDevMode, sizeof(dmLocal.dmSize), 1); - + /* Calculate usable size */ dmLocal.dmSize = min(sizeof(dmLocal), lpDevMode->dmSize); - + /* Probe and copy the full DEVMODE */ ProbeForRead(lpDevMode, dmLocal.dmSize, 1); RtlCopyMemory(&dmLocal, lpDevMode, dmLocal.dmSize); @@ -876,7 +878,7 @@ DPRINT1("lpDevMode->dmDriverExtra is IGNORED!\n"); dmLocal.dmDriverExtra = 0; } - + /* Use the local structure */ lpDevMode = &dmLocal; }
14 years, 7 months
1
0
0
0
[cgutman] 46712: [NTOSKRNL] - Fix the type passed to ZwSetValueKey
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 07:17:29 2010 New Revision: 46712 URL:
http://svn.reactos.org/svn/reactos?rev=46712&view=rev
Log: [NTOSKRNL] - Fix the type passed to ZwSetValueKey Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun Apr 4 07:17:29 2010 @@ -3316,7 +3316,7 @@ BootResourcesLength); /* Save boot resources to 'LogConf\BootConfig' */ - Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_FULL_RESOURCE_DESCRIPTOR, CmResourceList, BootResourcesLength + sizeof(ULONG)); + Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_RESOURCE_LIST, CmResourceList, BootResourcesLength + sizeof(ULONG)); if (!NT_SUCCESS(Status)) { DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
14 years, 7 months
1
0
0
0
[cgutman] 46711: [NTOSKRNL] - Don't manually write a device description for detected devices - Instead, let PnpRoot report it in response to IRP_MN_QUERY_DEVICE_TEXT
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 06:39:56 2010 New Revision: 46711 URL:
http://svn.reactos.org/svn/reactos?rev=46711&view=rev
Log: [NTOSKRNL] - Don't manually write a device description for detected devices - Instead, let PnpRoot report it in response to IRP_MN_QUERY_DEVICE_TEXT Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun Apr 4 06:39:56 2010 @@ -2913,7 +2913,6 @@ IN ULONG ParentBootResourcesLength) { UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier"); - UNICODE_STRING DeviceDescU = RTL_CONSTANT_STRING(L"DeviceDesc"); UNICODE_STRING HardwareIDU = RTL_CONSTANT_STRING(L"HardwareID"); UNICODE_STRING ConfigurationDataU = RTL_CONSTANT_STRING(L"Configuration Data"); UNICODE_STRING BootConfigU = RTL_CONSTANT_STRING(L"BootConfig"); @@ -2960,7 +2959,6 @@ UNICODE_STRING HardwareIdKey; PUNICODE_STRING pHardwareId; ULONG DeviceIndex = 0; - BOOLEAN IsDeviceDesc; PUCHAR CmResourceList; ULONG ListCount; @@ -3189,31 +3187,26 @@ { pHardwareId = &HardwareIdSerial; DeviceIndex = DeviceIndexSerial++; - IsDeviceDesc = TRUE; } else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierKeyboard, FALSE) == 0) { pHardwareId = &HardwareIdKeyboard; DeviceIndex = DeviceIndexKeyboard++; - IsDeviceDesc = FALSE; } else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierMouse, FALSE) == 0) { pHardwareId = &HardwareIdMouse; DeviceIndex = DeviceIndexMouse++; - IsDeviceDesc = FALSE; } else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierParallel, FALSE) == 0) { pHardwareId = &HardwareIdParallel; DeviceIndex = DeviceIndexParallel++; - IsDeviceDesc = FALSE; } else if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierFloppy, FALSE) == 0) { pHardwareId = &HardwareIdFloppy; DeviceIndex = DeviceIndexFloppy++; - IsDeviceDesc = FALSE; } else if (NT_SUCCESS(Status)) { @@ -3222,13 +3215,11 @@ { pHardwareId = &HardwareIdPci; DeviceIndex = DeviceIndexPci++; - IsDeviceDesc = FALSE; } else if (RtlCompareUnicodeString(&ValueName, &IdentifierIsa, FALSE) == 0) { pHardwareId = &HardwareIdIsa; DeviceIndex = DeviceIndexIsa++; - IsDeviceDesc = FALSE; } else { @@ -3280,16 +3271,6 @@ goto nextdevice; } DPRINT("Found %wZ #%lu (%wZ)\n", &ValueName, DeviceIndex, &HardwareIdKey); - if (IsDeviceDesc) - { - Status = ZwSetValueKey(hLevel2Key, &DeviceDescU, 0, REG_SZ, ValueName.Buffer, ValueName.MaximumLength); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status); - ZwDeleteKey(hLevel2Key); - goto nextdevice; - } - } Status = ZwSetValueKey(hLevel2Key, &HardwareIDU, 0, REG_MULTI_SZ, pHardwareId->Buffer, pHardwareId->MaximumLength); if (!NT_SUCCESS(Status)) {
14 years, 7 months
1
0
0
0
[cgutman] 46710: [NTOSKRNL] - Remove an unused member from PNPROOT_DEVICE - Don't build a bogus resource list if no resources are required - Fixes a crash during resource arbitration because the created resource requirements list was malformed
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 04:59:31 2010 New Revision: 46710 URL:
http://svn.reactos.org/svn/reactos?rev=46710&view=rev
Log: [NTOSKRNL] - Remove an unused member from PNPROOT_DEVICE - Don't build a bogus resource list if no resources are required - Fixes a crash during resource arbitration because the created resource requirements list was malformed Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Sun Apr 4 04:59:31 2010 @@ -33,7 +33,6 @@ UNICODE_STRING DeviceDescription; // Resource requirement list PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList; - ULONG ResourceRequirementsListSize; // Associated resource list PCM_RESOURCE_LIST ResourceList; ULONG ResourceListSize; @@ -766,18 +765,7 @@ DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - if (DeviceExtension->DeviceInfo->ResourceList == NULL) - { - /* Create an empty resource list */ - ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST)); - if (!ResourceList) - return STATUS_NO_MEMORY; - - ResourceList->Count = 0; - - Irp->IoStatus.Information = (ULONG_PTR)ResourceList; - } - else + if (DeviceExtension->DeviceInfo->ResourceList) { /* Copy existing resource requirement list */ ResourceList = ExAllocatePool( @@ -792,9 +780,14 @@ DeviceExtension->DeviceInfo->ResourceListSize); Irp->IoStatus.Information = (ULONG_PTR)ResourceList; - } - - return STATUS_SUCCESS; + + return STATUS_SUCCESS; + } + else + { + /* No resources so just return without changing the status */ + return Irp->IoStatus.Status; + } } static NTSTATUS @@ -805,23 +798,10 @@ { PPNPROOT_PDO_DEVICE_EXTENSION DeviceExtension; PIO_RESOURCE_REQUIREMENTS_LIST ResourceList; - ULONG ResourceListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List); DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - if (DeviceExtension->DeviceInfo->ResourceRequirementsList == NULL) - { - /* Create an empty resource list */ - ResourceList = ExAllocatePool(PagedPool, ResourceListSize); - if (!ResourceList) - return STATUS_NO_MEMORY; - - RtlZeroMemory(ResourceList, ResourceListSize); - ResourceList->ListSize = ResourceListSize; - - Irp->IoStatus.Information = (ULONG_PTR)ResourceList; - } - else + if (DeviceExtension->DeviceInfo->ResourceRequirementsList) { /* Copy existing resource requirement list */ ResourceList = ExAllocatePool(PagedPool, DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize); @@ -832,10 +812,16 @@ ResourceList, DeviceExtension->DeviceInfo->ResourceRequirementsList, DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize); - Irp->IoStatus.Information = (ULONG_PTR)ResourceList; - } - - return STATUS_SUCCESS; + + Irp->IoStatus.Information = (ULONG_PTR)ResourceList; + + return STATUS_SUCCESS; + } + else + { + /* No resource requirements so just return without changing the status */ + return Irp->IoStatus.Status; + } } static NTSTATUS
14 years, 7 months
1
0
0
0
[cgutman] 46709: - Remove a leftover debug print
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 03:34:33 2010 New Revision: 46709 URL:
http://svn.reactos.org/svn/reactos?rev=46709&view=rev
Log: - Remove a leftover debug print Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun Apr 4 03:34:33 2010 @@ -1574,7 +1574,6 @@ + ResList->Count * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); } - DPRINT1("Allocating resource list: %d\n", Size); *ResourceList = ExAllocatePool(PagedPool, Size); if (!*ResourceList) return STATUS_INSUFFICIENT_RESOURCES;
14 years, 7 months
1
0
0
0
[cgutman] 46708: [NTOSKRNL] - Revert part of r46707 - Remove a hack in PnpRoot that assembled a CM_RESOURCE_LIST from a CM_PARTIAL_RESOURCE_DESCRIPTOR but also corrupted proper resource lists (such as from detected devices in IoReportDetectedDevice) - Add a simple resource arbiter that finds an unused resource in the range provided in the resource requirements list. It's not perfect but it's a start. - Start enforcing resource conflicts - Fix incorrect code that was writing a CM_PARTIAL_RESOURCE
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 03:18:41 2010 New Revision: 46708 URL:
http://svn.reactos.org/svn/reactos?rev=46708&view=rev
Log: [NTOSKRNL] - Revert part of r46707 - Remove a hack in PnpRoot that assembled a CM_RESOURCE_LIST from a CM_PARTIAL_RESOURCE_DESCRIPTOR but also corrupted proper resource lists (such as from detected devices in IoReportDetectedDevice) - Add a simple resource arbiter that finds an unused resource in the range provided in the resource requirements list. It's not perfect but it's a start. - Start enforcing resource conflicts - Fix incorrect code that was writing a CM_PARTIAL_RESOURCE_DESCRIPTOR instead of a CM_RESOURCE_LIST (the hack above was compensating for this) which result in BootConfig being a REG_PARTIAL_RESOURCE_DESCRIPTOR type on certain devices and a REG_RESOURCE_LIST on others - Fix a broken check for no partial resource descriptors Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun Apr 4 03:18:41 2010 @@ -1005,137 +1005,183 @@ } BOOLEAN +IopCheckResourceDescriptor( + IN PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc, + IN PCM_RESOURCE_LIST ResourceList, + IN BOOLEAN Silent, + OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) +{ + ULONG i, ii; + BOOLEAN Result = FALSE; + + if (ResDesc->ShareDisposition == CmResourceShareShared) + return FALSE; + + for (i = 0; i < ResourceList->Count; i++) + { + PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList; + for (ii = 0; ii < ResList->Count; ii++) + { + PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc2 = &ResList->PartialDescriptors[ii]; + + /* We don't care about shared resources */ + if (ResDesc->ShareDisposition == CmResourceShareShared && + ResDesc2->ShareDisposition == CmResourceShareShared) + continue; + + /* Make sure we're comparing the same types */ + if (ResDesc->Type != ResDesc2->Type) + continue; + + switch (ResDesc->Type) + { + case CmResourceTypeMemory: + if ((ResDesc->u.Memory.Start.QuadPart < ResDesc2->u.Memory.Start.QuadPart && + ResDesc->u.Memory.Start.QuadPart + ResDesc->u.Memory.Length > + ResDesc2->u.Memory.Start.QuadPart) || (ResDesc2->u.Memory.Start.QuadPart < + ResDesc->u.Memory.Start.QuadPart && ResDesc2->u.Memory.Start.QuadPart + + ResDesc2->u.Memory.Length > ResDesc->u.Memory.Start.QuadPart)) + { + if (!Silent) + { + DPRINT1("Resource conflict: Memory (0x%x to 0x%x vs. 0x%x to 0x%x)\n", + ResDesc->u.Memory.Start.QuadPart, ResDesc->u.Memory.Start.QuadPart + + ResDesc->u.Memory.Length, ResDesc2->u.Memory.Start.QuadPart, + ResDesc2->u.Memory.Start.QuadPart + ResDesc2->u.Memory.Length); + } + + Result = TRUE; + + goto ByeBye; + } + break; + + case CmResourceTypePort: + if ((ResDesc->u.Port.Start.QuadPart < ResDesc2->u.Port.Start.QuadPart && + ResDesc->u.Port.Start.QuadPart + ResDesc->u.Port.Length > + ResDesc2->u.Port.Start.QuadPart) || (ResDesc2->u.Port.Start.QuadPart < + ResDesc->u.Port.Start.QuadPart && ResDesc2->u.Port.Start.QuadPart + + ResDesc2->u.Port.Length > ResDesc->u.Port.Start.QuadPart)) + { + if (!Silent) + { + DPRINT1("Resource conflict: Port (0x%x to 0x%x vs. 0x%x to 0x%x)\n", + ResDesc->u.Port.Start.QuadPart, ResDesc->u.Port.Start.QuadPart + + ResDesc->u.Port.Length, ResDesc2->u.Port.Start.QuadPart, + ResDesc2->u.Port.Start.QuadPart + ResDesc2->u.Port.Length); + } + + Result = TRUE; + + goto ByeBye; + } + break; + + case CmResourceTypeInterrupt: + if (ResDesc->u.Interrupt.Vector == ResDesc2->u.Interrupt.Vector) + { + if (!Silent) + { + DPRINT1("Resource conflict: IRQ (0x%x 0x%x vs. 0x%x 0x%x)\n", + ResDesc->u.Interrupt.Vector, ResDesc->u.Interrupt.Level, + ResDesc2->u.Interrupt.Vector, ResDesc2->u.Interrupt.Level); + } + + Result = TRUE; + + goto ByeBye; + } + break; + + case CmResourceTypeBusNumber: + if ((ResDesc->u.BusNumber.Start < ResDesc2->u.BusNumber.Start && + ResDesc->u.BusNumber.Start + ResDesc->u.BusNumber.Length > + ResDesc2->u.BusNumber.Start) || (ResDesc2->u.BusNumber.Start < + ResDesc->u.BusNumber.Start && ResDesc2->u.BusNumber.Start + + ResDesc2->u.BusNumber.Length > ResDesc->u.BusNumber.Start)) + { + if (!Silent) + { + DPRINT1("Resource conflict: Bus number (0x%x to 0x%x vs. 0x%x to 0x%x)\n", + ResDesc->u.BusNumber.Start, ResDesc->u.BusNumber.Start + + ResDesc->u.BusNumber.Length, ResDesc2->u.BusNumber.Start, + ResDesc2->u.BusNumber.Start + ResDesc2->u.BusNumber.Length); + } + + Result = TRUE; + + goto ByeBye; + } + break; + + case CmResourceTypeDma: + if (ResDesc->u.Dma.Channel == ResDesc2->u.Dma.Channel) + { + if (!Silent) + { + DPRINT1("Resource conflict: Dma (0x%x 0x%x vs. 0x%x 0x%x)\n", + ResDesc->u.Dma.Channel, ResDesc->u.Dma.Port, + ResDesc2->u.Dma.Channel, ResDesc2->u.Dma.Port); + } + + Result = TRUE; + + goto ByeBye; + } + break; + } + } + } + +ByeBye: + + if (Result && ConflictingDescriptor) + { + RtlCopyMemory(ConflictingDescriptor, + ResDesc, + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)); + } + + return Result; +} + + +BOOLEAN IopCheckForResourceConflict( IN PCM_RESOURCE_LIST ResourceList1, - IN PCM_RESOURCE_LIST ResourceList2) -{ - ULONG i1, i2, ii1, ii2; + IN PCM_RESOURCE_LIST ResourceList2, + IN BOOLEAN Silent, + OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) +{ + ULONG i, ii; BOOLEAN Result = FALSE; - for (i1 = 0; i1 < ResourceList1->Count; i1++) - { - PCM_PARTIAL_RESOURCE_LIST ResList1 = &ResourceList1->List[i1].PartialResourceList; - for (i2 = 0; i2 < ResourceList2->Count; i2++) - { - PCM_PARTIAL_RESOURCE_LIST ResList2 = &ResourceList2->List[i2].PartialResourceList; - for (ii1 = 0; ii1 < ResList1->Count; ii1++) - { - PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc1 = &ResList1->PartialDescriptors[ii1]; - - if (ResDesc1->ShareDisposition == CmResourceShareShared) - continue; - - for (ii2 = 0; ii2 < ResList2->Count; ii2++) - { - PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc2 = &ResList2->PartialDescriptors[ii2]; - - /* We don't care about shared resources */ - if (ResDesc2->ShareDisposition == CmResourceShareShared) - continue; - - /* Make sure we're comparing the same types */ - if (ResDesc1->Type != ResDesc2->Type) - continue; - - switch (ResDesc1->Type) - { - case CmResourceTypeMemory: - if ((ResDesc1->u.Memory.Start.QuadPart < ResDesc2->u.Memory.Start.QuadPart && - ResDesc1->u.Memory.Start.QuadPart + ResDesc1->u.Memory.Length > - ResDesc2->u.Memory.Start.QuadPart) || (ResDesc2->u.Memory.Start.QuadPart < - ResDesc1->u.Memory.Start.QuadPart && ResDesc2->u.Memory.Start.QuadPart + - ResDesc2->u.Memory.Length > ResDesc1->u.Memory.Start.QuadPart)) - { - DPRINT1("Resource conflict: Memory (0x%x to 0x%x vs. 0x%x to 0x%x)\n", - ResDesc1->u.Memory.Start.QuadPart, ResDesc1->u.Memory.Start.QuadPart + - ResDesc1->u.Memory.Length, ResDesc2->u.Memory.Start.QuadPart, - ResDesc2->u.Memory.Start.QuadPart + ResDesc2->u.Memory.Length); - - Result = TRUE; - - goto ByeBye; - } - break; - - case CmResourceTypePort: - if ((ResDesc1->u.Port.Start.QuadPart < ResDesc2->u.Port.Start.QuadPart && - ResDesc1->u.Port.Start.QuadPart + ResDesc1->u.Port.Length > - ResDesc2->u.Port.Start.QuadPart) || (ResDesc2->u.Port.Start.QuadPart < - ResDesc1->u.Port.Start.QuadPart && ResDesc2->u.Port.Start.QuadPart + - ResDesc2->u.Port.Length > ResDesc1->u.Port.Start.QuadPart)) - { - DPRINT1("Resource conflict: Port (0x%x to 0x%x vs. 0x%x to 0x%x)\n", - ResDesc1->u.Port.Start.QuadPart, ResDesc1->u.Port.Start.QuadPart + - ResDesc1->u.Port.Length, ResDesc2->u.Port.Start.QuadPart, - ResDesc2->u.Port.Start.QuadPart + ResDesc2->u.Port.Length); - - Result = TRUE; - - goto ByeBye; - } - break; - - case CmResourceTypeInterrupt: - if (ResDesc1->u.Interrupt.Vector == ResDesc2->u.Interrupt.Vector) - { - DPRINT1("Resource conflict: IRQ (0x%x 0x%x vs. 0x%x 0x%x)\n", - ResDesc1->u.Interrupt.Vector, ResDesc1->u.Interrupt.Level, - ResDesc2->u.Interrupt.Vector, ResDesc2->u.Interrupt.Level); - - Result = TRUE; - - goto ByeBye; - } - break; - - case CmResourceTypeBusNumber: - if ((ResDesc1->u.BusNumber.Start < ResDesc2->u.BusNumber.Start && - ResDesc1->u.BusNumber.Start + ResDesc1->u.BusNumber.Length > - ResDesc2->u.BusNumber.Start) || (ResDesc2->u.BusNumber.Start < - ResDesc1->u.BusNumber.Start && ResDesc2->u.BusNumber.Start + - ResDesc2->u.BusNumber.Length > ResDesc1->u.BusNumber.Start)) - { - DPRINT1("Resource conflict: Bus number (0x%x to 0x%x vs. 0x%x to 0x%x)\n", - ResDesc1->u.BusNumber.Start, ResDesc1->u.BusNumber.Start + - ResDesc1->u.BusNumber.Length, ResDesc2->u.BusNumber.Start, - ResDesc2->u.BusNumber.Start + ResDesc2->u.BusNumber.Length); - - Result = TRUE; - - goto ByeBye; - } - break; - - case CmResourceTypeDma: - if (ResDesc1->u.Dma.Channel == ResDesc2->u.Dma.Channel) - { - DPRINT1("Resource conflict: Dma (0x%x 0x%x vs. 0x%x 0x%x)\n", - ResDesc1->u.Dma.Channel, ResDesc1->u.Dma.Port, - ResDesc2->u.Dma.Channel, ResDesc2->u.Dma.Port); - - Result = TRUE; - - goto ByeBye; - } - break; - } - } - } - } - } - + for (i = 0; i < ResourceList1->Count; i++) + { + PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList1->List[i].PartialResourceList; + for (ii = 0; ii < ResList->Count; ii++) + { + PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc = &ResList->PartialDescriptors[ii]; + + Result = IopCheckResourceDescriptor(ResDesc, + ResourceList2, + Silent, + ConflictingDescriptor); + if (Result) goto ByeBye; + } + } + + ByeBye: -#ifdef ENABLE_RESOURCE_CONFLICT_DETECTION return Result; -#else - return FALSE; -#endif } NTSTATUS IopDetectResourceConflict( - IN PCM_RESOURCE_LIST ResourceList) + IN PCM_RESOURCE_LIST ResourceList, + IN BOOLEAN Silent, + OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; @@ -1321,7 +1367,9 @@ ExFreePool(KeyNameInformation); if (IopCheckForResourceConflict(ResourceList, - (PCM_RESOURCE_LIST)KeyValueInformation->Data)) + (PCM_RESOURCE_LIST)KeyValueInformation->Data, + Silent, + ConflictingDescriptor)) { ExFreePool(KeyValueInformation); Status = STATUS_CONFLICTING_ADDRESSES; @@ -1346,19 +1394,312 @@ return Status; } - + +BOOLEAN +IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) +{ + CM_RESOURCE_LIST CmList; + NTSTATUS Status; + + CmList.Count = 1; + CmList.List[0].InterfaceType = InterfaceTypeUndefined; + CmList.List[0].BusNumber = 0; + CmList.List[0].PartialResourceList.Version = 1; + CmList.List[0].PartialResourceList.Revision = 1; + CmList.List[0].PartialResourceList.Count = 1; + CmList.List[0].PartialResourceList.PartialDescriptors[0] = *CmDesc; + + Status = IopDetectResourceConflict(&CmList, TRUE, ConflictingDescriptor); + if (Status == STATUS_CONFLICTING_ADDRESSES) + return TRUE; + + return FALSE; +} + +BOOLEAN +IopFindBusNumberResource( + IN PIO_RESOURCE_DESCRIPTOR IoDesc, + OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc) +{ + ULONG Start; + CM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDesc; + + ASSERT(IoDesc->Type == CmDesc->Type); + ASSERT(IoDesc->Type == CmResourceTypeBusNumber); + + for (Start = IoDesc->u.BusNumber.MinBusNumber; + Start < IoDesc->u.BusNumber.MaxBusNumber; + Start++) + { + CmDesc->u.BusNumber.Length = IoDesc->u.BusNumber.Length; + CmDesc->u.BusNumber.Start = Start; + + if (IopCheckDescriptorForConflict(CmDesc, &ConflictingDesc)) + { + Start += ConflictingDesc.u.BusNumber.Start + ConflictingDesc.u.BusNumber.Length; + } + else + { + return TRUE; + } + } + + return FALSE; +} + +BOOLEAN +IopFindMemoryResource( + IN PIO_RESOURCE_DESCRIPTOR IoDesc, + OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc) +{ + ULONGLONG Start; + CM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDesc; + + ASSERT(IoDesc->Type == CmDesc->Type); + ASSERT(IoDesc->Type == CmResourceTypeMemory); + + for (Start = IoDesc->u.Memory.MinimumAddress.QuadPart; + Start < IoDesc->u.Memory.MaximumAddress.QuadPart; + Start++) + { + CmDesc->u.Memory.Length = IoDesc->u.Memory.Length; + CmDesc->u.Memory.Start.QuadPart = Start; + + if (IopCheckDescriptorForConflict(CmDesc, &ConflictingDesc)) + { + Start += ConflictingDesc.u.Memory.Start.QuadPart + ConflictingDesc.u.Memory.Length; + } + else + { + return TRUE; + } + } + + return FALSE; +} + +BOOLEAN +IopFindPortResource( + IN PIO_RESOURCE_DESCRIPTOR IoDesc, + OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc) +{ + ULONGLONG Start; + CM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDesc; + + ASSERT(IoDesc->Type == CmDesc->Type); + ASSERT(IoDesc->Type == CmResourceTypePort); + + for (Start = IoDesc->u.Port.MinimumAddress.QuadPart; + Start < IoDesc->u.Port.MaximumAddress.QuadPart; + Start++) + { + CmDesc->u.Port.Length = IoDesc->u.Port.Length; + CmDesc->u.Port.Start.QuadPart = Start; + + if (IopCheckDescriptorForConflict(CmDesc, &ConflictingDesc)) + { + Start += ConflictingDesc.u.Port.Start.QuadPart + ConflictingDesc.u.Port.Length; + } + else + { + return TRUE; + } + } + + return FALSE; +} + +BOOLEAN +IopFindDmaResource( + IN PIO_RESOURCE_DESCRIPTOR IoDesc, + OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc) +{ + ULONG Channel; + + ASSERT(IoDesc->Type == CmDesc->Type); + ASSERT(IoDesc->Type == CmResourceTypeDma); + + for (Channel = IoDesc->u.Dma.MinimumChannel; + Channel < IoDesc->u.Dma.MaximumChannel; + Channel++) + { + CmDesc->u.Dma.Channel = Channel; + CmDesc->u.Dma.Port = 0; + + if (!IopCheckDescriptorForConflict(CmDesc, NULL)) + return TRUE; + } + + return FALSE; +} + +BOOLEAN +IopFindInterruptResource( + IN PIO_RESOURCE_DESCRIPTOR IoDesc, + OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc) +{ + ULONG Vector; + + ASSERT(IoDesc->Type == CmDesc->Type); + ASSERT(IoDesc->Type == CmResourceTypeInterrupt); + + for (Vector = IoDesc->u.Interrupt.MinimumVector; + Vector < IoDesc->u.Interrupt.MaximumVector; + Vector++) + { + CmDesc->u.Interrupt.Vector = Vector; + CmDesc->u.Interrupt.Level = Vector; + CmDesc->u.Interrupt.Affinity = (KAFFINITY)-1; + + if (!IopCheckDescriptorForConflict(CmDesc, NULL)) + return TRUE; + } + + return FALSE; +} + +NTSTATUS +IopCreateResourceListFromRequirements( + IN PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList, + OUT PCM_RESOURCE_LIST *ResourceList) +{ + ULONG i, ii, Size; + PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc; + + Size = FIELD_OFFSET(CM_RESOURCE_LIST, List); + for (i = 0; i < RequirementsList->AlternativeLists; i++) + { + PIO_RESOURCE_LIST ResList = &RequirementsList->List[i]; + Size += FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList.PartialDescriptors) + + ResList->Count * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + } + + DPRINT1("Allocating resource list: %d\n", Size); + *ResourceList = ExAllocatePool(PagedPool, Size); + if (!*ResourceList) + return STATUS_INSUFFICIENT_RESOURCES; + + (*ResourceList)->Count = 1; + (*ResourceList)->List[0].BusNumber = RequirementsList->BusNumber; + (*ResourceList)->List[0].InterfaceType = RequirementsList->InterfaceType; + (*ResourceList)->List[0].PartialResourceList.Version = 1; + (*ResourceList)->List[0].PartialResourceList.Revision = 1; + (*ResourceList)->List[0].PartialResourceList.Count = 0; + + ResDesc = &(*ResourceList)->List[0].PartialResourceList.PartialDescriptors[0]; + + for (i = 0; i < RequirementsList->AlternativeLists; i++) + { + PIO_RESOURCE_LIST ResList = &RequirementsList->List[i]; + for (ii = 0; ii < ResList->Count; ii++) + { + PIO_RESOURCE_DESCRIPTOR ReqDesc = &ResList->Descriptors[ii]; + + /* FIXME: Handle alternate ranges */ + if (ReqDesc->Option == IO_RESOURCE_ALTERNATIVE) + continue; + + ResDesc->Type = ReqDesc->Type; + ResDesc->Flags = ReqDesc->Flags; + ResDesc->ShareDisposition = ReqDesc->ShareDisposition; + + switch (ReqDesc->Type) + { + case CmResourceTypeInterrupt: + if (!IopFindInterruptResource(ReqDesc, ResDesc)) + { + DPRINT1("Failed to find an available interrupt resource (0x%x to 0x%x)\n", + ReqDesc->u.Interrupt.MinimumVector, ReqDesc->u.Interrupt.MaximumVector); + + if (ReqDesc->Option == 0) + { + ExFreePool(*ResourceList); + return STATUS_CONFLICTING_ADDRESSES; + } + } + break; + + case CmResourceTypePort: + if (!IopFindPortResource(ReqDesc, ResDesc)) + { + DPRINT1("Failed to find an available port resource (0x%x to 0x%x length: 0x%x)\n", + ReqDesc->u.Port.MinimumAddress.QuadPart, ReqDesc->u.Port.MaximumAddress.QuadPart, + ReqDesc->u.Port.Length); + + if (ReqDesc->Option == 0) + { + ExFreePool(*ResourceList); + return STATUS_CONFLICTING_ADDRESSES; + } + } + break; + + case CmResourceTypeMemory: + if (!IopFindMemoryResource(ReqDesc, ResDesc)) + { + DPRINT1("Failed to find an available memory resource (0x%x to 0x%x length: 0x%x)\n", + ReqDesc->u.Memory.MinimumAddress.QuadPart, ReqDesc->u.Memory.MaximumAddress.QuadPart, + ReqDesc->u.Memory.Length); + + if (ReqDesc->Option == 0) + { + ExFreePool(*ResourceList); + return STATUS_CONFLICTING_ADDRESSES; + } + } + break; + + case CmResourceTypeBusNumber: + if (!IopFindBusNumberResource(ReqDesc, ResDesc)) + { + DPRINT1("Failed to find an available bus number resource (0x%x to 0x%x length: 0x%x)\n", + ReqDesc->u.BusNumber.MinBusNumber, ReqDesc->u.BusNumber.MaxBusNumber, + ReqDesc->u.BusNumber.Length); + + if (ReqDesc->Option == 0) + { + ExFreePool(*ResourceList); + return STATUS_CONFLICTING_ADDRESSES; + } + } + break; + + case CmResourceTypeDma: + if (!IopFindDmaResource(ReqDesc, ResDesc)) + { + DPRINT1("Failed to find an available dma resource (0x%x to 0x%x)\n", + ReqDesc->u.Dma.MinimumChannel, ReqDesc->u.Dma.MaximumChannel); + + if (ReqDesc->Option == 0) + { + ExFreePool(*ResourceList); + return STATUS_CONFLICTING_ADDRESSES; + } + } + break; + + default: + DPRINT1("Unsupported resource type: %x\n", ReqDesc->Type); + break; + } + + (*ResourceList)->List[0].PartialResourceList.Count++; + ResDesc++; + } + } + + return STATUS_SUCCESS; +} + NTSTATUS IopAssignDeviceResources( IN PDEVICE_NODE DeviceNode, OUT ULONG *pRequiredSize) { - PIO_RESOURCE_LIST ResourceList; - PIO_RESOURCE_DESCRIPTOR ResourceDescriptor; - PCM_PARTIAL_RESOURCE_DESCRIPTOR DescriptorRaw; PCM_PARTIAL_RESOURCE_LIST pPartialResourceList; - ULONG NumberOfResources = 0; ULONG Size; - ULONG i, j; + ULONG i; + ULONG j; NTSTATUS Status; if (!DeviceNode->BootResources && !DeviceNode->ResourceRequirements) @@ -1371,7 +1712,7 @@ /* Fill DeviceNode->ResourceList * FIXME: the PnP arbiter should go there! - * Actually, use the BootResources if provided, else the resource list #0 + * Actually, use the BootResources if provided, else the resource requirements */ if (DeviceNode->BootResources) @@ -1398,161 +1739,38 @@ } RtlCopyMemory(DeviceNode->ResourceList, DeviceNode->BootResources, Size); - Status = IopDetectResourceConflict(DeviceNode->ResourceList); - if (!NT_SUCCESS(Status)) - goto ByeBye; - - *pRequiredSize = Size; - return STATUS_SUCCESS; - } - - /* Ok, here, we have to use the device requirement list */ - ResourceList = &DeviceNode->ResourceRequirements->List[0]; - if (ResourceList->Version != 1 || ResourceList->Revision != 1) - { - Status = STATUS_REVISION_MISMATCH; - goto ByeBye; - } - - Size = sizeof(CM_RESOURCE_LIST) + ResourceList->Count * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); - DeviceNode->ResourceList = ExAllocatePool(PagedPool, Size); - if (!DeviceNode->ResourceList) - { - Status = STATUS_NO_MEMORY; - goto ByeBye; - } - - DeviceNode->ResourceList->Count = 1; - DeviceNode->ResourceList->List[0].InterfaceType = DeviceNode->ResourceRequirements->InterfaceType; - DeviceNode->ResourceList->List[0].BusNumber = DeviceNode->ResourceRequirements->BusNumber; - DeviceNode->ResourceList->List[0].PartialResourceList.Version = 1; - DeviceNode->ResourceList->List[0].PartialResourceList.Revision = 1; - - for (i = 0; i < ResourceList->Count; i++) - { - ResourceDescriptor = &ResourceList->Descriptors[i]; - - if (ResourceDescriptor->Option == 0 || ResourceDescriptor->Option == IO_RESOURCE_PREFERRED) - { - DescriptorRaw = &DeviceNode->ResourceList->List[0].PartialResourceList.PartialDescriptors[NumberOfResources]; - NumberOfResources++; - - /* Copy ResourceDescriptor to DescriptorRaw and DescriptorTranslated */ - DescriptorRaw->Type = ResourceDescriptor->Type; - DescriptorRaw->ShareDisposition = ResourceDescriptor->ShareDisposition; - DescriptorRaw->Flags = ResourceDescriptor->Flags; - switch (ResourceDescriptor->Type) - { - case CmResourceTypePort: - { - DescriptorRaw->u.Port.Start = ResourceDescriptor->u.Port.MinimumAddress; - DescriptorRaw->u.Port.Length = ResourceDescriptor->u.Port.Length; - break; - } - case CmResourceTypeInterrupt: - { - INTERFACE_TYPE BusType; - ULONG SlotNumber; - ULONG ret; - UCHAR Irq; - - DescriptorRaw->u.Interrupt.Level = 0; - DescriptorRaw->u.Interrupt.Vector = ResourceDescriptor->u.Interrupt.MinimumVector; - /* FIXME: HACK: if we have a PCI device, we try - * to keep the IRQ assigned by the BIOS */ - if (NT_SUCCESS(IoGetDeviceProperty( - DeviceNode->PhysicalDeviceObject, - DevicePropertyLegacyBusType, - sizeof(INTERFACE_TYPE), - &BusType, - &ret)) && BusType == PCIBus) - { - /* We have a PCI bus */ - if (NT_SUCCESS(IoGetDeviceProperty( - DeviceNode->PhysicalDeviceObject, - DevicePropertyAddress, - sizeof(ULONG), - &SlotNumber, - &ret)) && SlotNumber > 0) - { - /* We have a good slot number */ - ret = HalGetBusDataByOffset(PCIConfiguration, - DeviceNode->ResourceRequirements->BusNumber, - SlotNumber, - &Irq, - 0x3c /* PCI_INTERRUPT_LINE */, - sizeof(UCHAR)); - if (ret != 0 && ret != 2 - && ResourceDescriptor->u.Interrupt.MinimumVector <= Irq - && ResourceDescriptor->u.Interrupt.MaximumVector >= Irq) - { - /* The device already has an assigned IRQ */ - DescriptorRaw->u.Interrupt.Vector = Irq; - } - else - { - DPRINT1("Trying to assign IRQ 0x%lx to %wZ\n", - DescriptorRaw->u.Interrupt.Vector, - &DeviceNode->InstancePath); - Irq = (UCHAR)DescriptorRaw->u.Interrupt.Vector; - ret = HalSetBusDataByOffset(PCIConfiguration, - DeviceNode->ResourceRequirements->BusNumber, - SlotNumber, - &Irq, - 0x3c /* PCI_INTERRUPT_LINE */, - sizeof(UCHAR)); - if (ret == 0 || ret == 2) - ASSERT(FALSE); - } - } - } - break; - } - case CmResourceTypeMemory: - { - DescriptorRaw->u.Memory.Start = ResourceDescriptor->u.Memory.MinimumAddress; - DescriptorRaw->u.Memory.Length = ResourceDescriptor->u.Memory.Length; - break; - } - case CmResourceTypeDma: - { - DescriptorRaw->u.Dma.Channel = ResourceDescriptor->u.Dma.MinimumChannel; - DescriptorRaw->u.Dma.Port = 0; /* FIXME */ - DescriptorRaw->u.Dma.Reserved1 = 0; - break; - } - case CmResourceTypeBusNumber: - { - DescriptorRaw->u.BusNumber.Start = ResourceDescriptor->u.BusNumber.MinBusNumber; - DescriptorRaw->u.BusNumber.Length = ResourceDescriptor->u.BusNumber.Length; - DescriptorRaw->u.BusNumber.Reserved = ResourceDescriptor->u.BusNumber.Reserved; - break; - } - /*CmResourceTypeDevicePrivate: - case CmResourceTypePcCardConfig: - case CmResourceTypeMfCardConfig: - { - RtlCopyMemory( - &DescriptorRaw->u.DevicePrivate, - &ResourceDescriptor->u.DevicePrivate, - sizeof(ResourceDescriptor->u.DevicePrivate)); - RtlCopyMemory( - &DescriptorTranslated->u.DevicePrivate, - &ResourceDescriptor->u.DevicePrivate, - sizeof(ResourceDescriptor->u.DevicePrivate)); - break; - }*/ - default: - DPRINT1("IopAssignDeviceResources(): unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type); - NumberOfResources--; - } - } - - } - - DeviceNode->ResourceList->List[0].PartialResourceList.Count = NumberOfResources; - - Status = IopDetectResourceConflict(DeviceNode->ResourceList); + Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL); + if (NT_SUCCESS(Status) || !DeviceNode->ResourceRequirements) + { + if (!NT_SUCCESS(Status) && !DeviceNode->ResourceRequirements) + { + DPRINT1("Using conflicting boot resources because no requirements were supplied!\n"); + } + + *pRequiredSize = Size; + return STATUS_SUCCESS; + } + else + { + DPRINT1("Boot resources for %wZ cause a resource conflict!\n", &DeviceNode->InstancePath); + ExFreePool(DeviceNode->ResourceList); + } + } + + Status = IopCreateResourceListFromRequirements(DeviceNode->ResourceRequirements, + &DeviceNode->ResourceList); + if (!NT_SUCCESS(Status)) + goto ByeBye; + + Size = FIELD_OFFSET(CM_RESOURCE_LIST, List); + for (i = 0; i < DeviceNode->ResourceList->Count; i++) + { + pPartialResourceList = &DeviceNode->ResourceList->List[i].PartialResourceList; + Size += FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList.PartialDescriptors) + + pPartialResourceList->Count * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + } + + Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL); if (!NT_SUCCESS(Status)) goto ByeBye; @@ -2744,6 +2962,8 @@ PUNICODE_STRING pHardwareId; ULONG DeviceIndex = 0; BOOLEAN IsDeviceDesc; + PUCHAR CmResourceList; + ULONG ListCount; if (RelativePath) { @@ -2858,7 +3078,7 @@ DPRINT("ExAllocatePool() failed\n"); goto nextdevice; } - if (ParentBootResourcesLength == 0) + if (ParentBootResourcesLength < sizeof(CM_FULL_RESOURCE_DESCRIPTOR)) { RtlCopyMemory(BootResources, pValueInformation->Data, pValueInformation->DataLength); } @@ -3094,10 +3314,29 @@ ZwDeleteKey(hLevel2Key); goto nextdevice; } - if (BootResourcesLength > 0) - { + if (BootResourcesLength >= sizeof(CM_FULL_RESOURCE_DESCRIPTOR)) + { + CmResourceList = ExAllocatePool(PagedPool, BootResourcesLength + sizeof(ULONG)); + if (!CmResourceList) + { + ZwClose(hLogConf); + ZwDeleteKey(hLevel2Key); + goto nextdevice; + } + + /* Add the list count (1st member of CM_RESOURCE_LIST) */ + ListCount = 1; + RtlCopyMemory(CmResourceList, + &ListCount, + sizeof(ULONG)); + + /* Now add the actual list (2nd member of CM_RESOURCE_LIST) */ + RtlCopyMemory(CmResourceList + sizeof(ULONG), + BootResources, + BootResourcesLength); + /* Save boot resources to 'LogConf\BootConfig' */ - Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_FULL_RESOURCE_DESCRIPTOR, BootResources, BootResourcesLength); + Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_FULL_RESOURCE_DESCRIPTOR, CmResourceList, BootResourcesLength + sizeof(ULONG)); if (!NT_SUCCESS(Status)) { DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status); @@ -3110,7 +3349,10 @@ nextdevice: if (BootResources && BootResources != ParentBootResources) + { ExFreePool(BootResources); + BootResources = NULL; + } if (hLevel2Key) { ZwClose(hLevel2Key); Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Sun Apr 4 03:18:41 2010 @@ -694,9 +694,13 @@ break; } - /* Pass this IRP down to the root device PDO */ - IoSkipCurrentIrpStackLocation(Irp); - return IoCallDriver(DeviceExtension->Ldo, Irp); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + + return Status; } static NTSTATUS @@ -778,16 +782,16 @@ /* Copy existing resource requirement list */ ResourceList = ExAllocatePool( PagedPool, - FIELD_OFFSET(CM_RESOURCE_LIST, List) + DeviceExtension->DeviceInfo->ResourceListSize); + DeviceExtension->DeviceInfo->ResourceListSize); if (!ResourceList) return STATUS_NO_MEMORY; - ResourceList->Count = 1; RtlCopyMemory( - &ResourceList->List, + ResourceList, DeviceExtension->DeviceInfo->ResourceList, DeviceExtension->DeviceInfo->ResourceListSize); - Irp->IoStatus.Information = (ULONG_PTR)ResourceList; + + Irp->IoStatus.Information = (ULONG_PTR)ResourceList; } return STATUS_SUCCESS;
14 years, 7 months
1
0
0
0
[cgutman] 46707: [NTOSKRNL] - Pass IRPs down to the root PDO if we don't handle it - Don't complain if we get an IRP that we don't expect. We are the parent bus driver for the device so we are responsible for completing those IRPs.
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 02:33:19 2010 New Revision: 46707 URL:
http://svn.reactos.org/svn/reactos?rev=46707&view=rev
Log: [NTOSKRNL] - Pass IRPs down to the root PDO if we don't handle it - Don't complain if we get an IRP that we don't expect. We are the parent bus driver for the device so we are responsible for completing those IRPs. Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Sun Apr 4 02:33:19 2010 @@ -677,27 +677,26 @@ if (NT_SUCCESS(Status)) DeviceExtension->State = dsStarted; } - break; + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; case IRP_MN_STOP_DEVICE: DPRINT("IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n"); /* Root device cannot be stopped */ - Status = STATUS_NOT_SUPPORTED; - break; + Irp->IoStatus.Status = Status = STATUS_INVALID_DEVICE_REQUEST; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; default: DPRINT("IRP_MJ_PNP / Unknown minor function 0x%lx\n", IrpSp->MinorFunction); - Status = STATUS_NOT_IMPLEMENTED; break; } - if (Status != STATUS_PENDING) - { - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - - return Status; + /* Pass this IRP down to the root device PDO */ + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(DeviceExtension->Ldo, Irp); } static NTSTATUS @@ -707,48 +706,25 @@ IN PIO_STACK_LOCATION IrpSp) { PDEVICE_RELATIONS Relations; - DEVICE_RELATION_TYPE RelationType; NTSTATUS Status = Irp->IoStatus.Status; - RelationType = IrpSp->Parameters.QueryDeviceRelations.Type; - - switch (RelationType) - { - /* FIXME: remove */ - case BusRelations: - { - if (IoGetAttachedDevice(DeviceObject) != DeviceObject) - { - /* We're not alone in the stack */ - DPRINT1("PnP is misbehaving ; don't know how to handle IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); - } - break; - } - - case TargetDeviceRelation: - { - DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n"); - Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS)); - if (!Relations) - { - DPRINT("ExAllocatePoolWithTag() failed\n"); - Status = STATUS_NO_MEMORY; - } - else - { - ObReferenceObject(DeviceObject); - Relations->Count = 1; - Relations->Objects[0] = DeviceObject; - Status = STATUS_SUCCESS; - Irp->IoStatus.Information = (ULONG_PTR)Relations; - } - break; - } - - default: - { - DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / unknown relation type 0x%lx\n", RelationType); - } + if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation) + return Status; + + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n"); + Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS)); + if (!Relations) + { + DPRINT("ExAllocatePoolWithTag() failed\n"); + Status = STATUS_NO_MEMORY; + } + else + { + ObReferenceObject(DeviceObject); + Relations->Count = 1; + Relations->Objects[0] = DeviceObject; + Status = STATUS_SUCCESS; + Irp->IoStatus.Information = (ULONG_PTR)Relations; } return Status;
14 years, 7 months
1
0
0
0
[cgutman] 46706: [PCI] - Handle IRP_MN_QUERY_DEVICE_RELATIONS for TargetDeviceRelation for PCI's child PDOs
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Apr 4 02:00:21 2010 New Revision: 46706 URL:
http://svn.reactos.org/svn/reactos?rev=46706&view=rev
Log: [PCI] - Handle IRP_MN_QUERY_DEVICE_RELATIONS for TargetDeviceRelation for PCI's child PDOs Modified: trunk/reactos/drivers/bus/pci/pdo.c Modified: trunk/reactos/drivers/bus/pci/pdo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=…
============================================================================== --- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Sun Apr 4 02:00:21 2010 @@ -1290,6 +1290,33 @@ return STATUS_SUCCESS; } +static NTSTATUS +PdoQueryDeviceRelations( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + PIO_STACK_LOCATION IrpSp) +{ + PDEVICE_RELATIONS DeviceRelations; + + /* We only support TargetDeviceRelation for child PDOs */ + if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation) + return Irp->IoStatus.Status; + + /* We can do this because we only return 1 PDO for TargetDeviceRelation */ + DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations)); + if (!DeviceRelations) + return STATUS_INSUFFICIENT_RESOURCES; + + DeviceRelations->Count = 1; + DeviceRelations->Objects[0] = DeviceObject; + + /* The PnP manager will remove this when it is done with the PDO */ + ObReferenceObject(DeviceObject); + + Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations; + + return STATUS_SUCCESS; +} static NTSTATUS PdoSetPower( @@ -1362,8 +1389,7 @@ break; case IRP_MN_QUERY_DEVICE_RELATIONS: - /* FIXME: Possibly handle for RemovalRelations */ - DPRINT("Unimplemented IRP_MN_QUERY_DEVICE_RELATIONS received\n"); + Status = PdoQueryDeviceRelations(DeviceObject, Irp, IrpSp); break; case IRP_MN_QUERY_DEVICE_TEXT:
14 years, 7 months
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200