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
2025
April
March
February
January
2024
December
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
January 2007
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 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
21 participants
401 discussions
Start a n
N
ew thread
[gedmurphy] 25616: merge r25600
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jan 24 18:26:51 2007 New Revision: 25616 URL:
http://svn.reactos.org/svn/reactos?rev=25616&view=rev
Log: merge r25600 Modified: branches/ros-branch-0_3_1/reactos/boot/bootdata/hivesft.inf Modified: branches/ros-branch-0_3_1/reactos/boot/bootdata/hivesft.inf URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/boot/b…
============================================================================== --- branches/ros-branch-0_3_1/reactos/
…
[View More]
boot/bootdata/hivesft.inf (original) +++ branches/ros-branch-0_3_1/reactos/boot/bootdata/hivesft.inf Wed Jan 24 18:26:51 2007 @@ -40,7 +40,6 @@ ; SysFontSubstitutes are also returned by EnumFontFamilies, FontSubstitutes aren't HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Arial",0x00000000,"DejaVu Vera Sans" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Courier New",0x00000000,"DejaVu Vera Sans Mono" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Marlett",0x00000000,"TGMarlett" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Times New Roman",0x00000000,"DejaVu Vera Serif" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","Tahoma",0x00000000,"DejaVu Vera Sans" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes","MS Sans Serif",0x00000000,"DejaVu Vera Sans"
[View Less]
18 years, 2 months
1
0
0
0
[gedmurphy] 25615: merge new icon/cursor selection code, cursors and radio button drawing code from head
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jan 24 18:25:43 2007 New Revision: 25615 URL:
http://svn.reactos.org/svn/reactos?rev=25615&view=rev
Log: merge new icon/cursor selection code, cursors and radio button drawing code from head Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_appstarting.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_cdautostart.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_cross.cur branches/
…
[View More]
ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_dragobject.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_hand.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_help.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_ibeam.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_icon.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_no.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_normal.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_pen.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_size.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizeall.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizenesw.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizens.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizenwse.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizewe.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_up.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_wait.cur branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/draw.c branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/icon.c Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_appstarting.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_cdautostart.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_cross.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_dragobject.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_hand.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_help.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_ibeam.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_icon.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_no.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_normal.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_pen.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_size.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizeall.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizenesw.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizens.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizenwse.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_sizewe.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_up.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/resources/ocr_wait.cur URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/draw.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/draw.c (original) +++ branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/draw.c Wed Jan 24 18:25:43 2007 @@ -717,123 +717,81 @@ return TRUE; } -/* Ported from WINE20020904 */ -/* Draw a radio/radioimage/radiomask button coming from DrawFrameControl() - * - * Does a pretty good job in emulating MS behavior. Some quirks are - * however there because MS uses a TrueType font (Marlett) to draw - * the buttons. - */ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags) { - RECT myr; - int i; - int SmallDiam = UITOOLS_MakeSquareRect(r, &myr); - int BorderShrink = SmallDiam / 16; - HPEN hpsave; - HBRUSH hbsave; - int xc, yc; - - if(BorderShrink < 1) BorderShrink = 1; - - if((uFlags & 0xff) == DFCS_BUTTONRADIOIMAGE) - { - FillRect(dc, r, (HBRUSH)GetStockObject(BLACK_BRUSH)); - } - - xc = myr.left + SmallDiam - SmallDiam/2; - yc = myr.top + SmallDiam - SmallDiam/2; - - /* Define bounding box */ - i = 14*SmallDiam/16; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; + RECT rc; + LOGFONT lf; + HFONT hFont, hOldFont; + int SmallDiam, i; + + LPCTSTR OutRight = TEXT("j"); // Outer right + LPCTSTR OutLeft = TEXT("k"); // Outer left + LPCTSTR InRight = TEXT("l"); // inner right + LPCTSTR InLeft = TEXT("m"); // inner left + LPCTSTR Center = TEXT("n"); // center + + SmallDiam = UITOOLS_MakeSquareRect(r, &rc); + + ZeroMemory(&lf, sizeof(LOGFONT)); + lf.lfHeight = SmallDiam; + lf.lfWidth = 0; + lf.lfWeight = FW_NORMAL; + lf.lfCharSet = DEFAULT_CHARSET; + lstrcpy(lf.lfFaceName, TEXT("Marlett")); + hFont = CreateFontIndirect(&lf); + hOldFont = SelectObject(dc, hFont); if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK) { - hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH)); - Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); - SelectObject(dc, hbsave); + SetBkMode(dc, OPAQUE); + SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); + TextOut(dc, rc.left, rc.top, Center, 1); + SetBkMode(dc, TRANSPARENT); + SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); + TextOut(dc, rc.left, rc.top, OutRight, 1); + SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); + TextOut(dc, rc.left, rc.top, OutLeft, 1); } else { - if(uFlags & (DFCS_FLAT|DFCS_MONO)) - { - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_WINDOWFRAME)); - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME)); - Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); - SelectObject(dc, hbsave); - SelectObject(dc, hpsave); + SetBkMode(dc, TRANSPARENT); + + /* Center section, white for active, grey for inactive */ + i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; + SetTextColor(dc, GetSysColor(i)); + TextOut(dc, rc.left, rc.top, Center, 1); + + if(uFlags & (DFCS_FLAT | DFCS_MONO)) + { + SetTextColor(dc, GetSysColor(COLOR_WINDOWFRAME)); + TextOut(dc, rc.left, rc.top, OutRight, 1); + TextOut(dc, rc.left, rc.top, OutLeft, 1); + TextOut(dc, rc.left, rc.top, InRight, 1); + TextOut(dc, rc.left, rc.top, InLeft, 1); } else { - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(COLOR_BTNHIGHLIGHT)); - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT)); - Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top); - - SelectObject(dc, GetSysColorPen(COLOR_BTNSHADOW)); - SelectObject(dc, GetSysColorBrush(COLOR_BTNSHADOW)); - Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom); - - myr.left += BorderShrink; - myr.right -= BorderShrink; - myr.top += BorderShrink; - myr.bottom -= BorderShrink; - - SelectObject(dc, GetSysColorPen(COLOR_3DLIGHT)); - SelectObject(dc, GetSysColorBrush(COLOR_3DLIGHT)); - Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top); - - SelectObject(dc, GetSysColorPen(COLOR_3DDKSHADOW)); - SelectObject(dc, GetSysColorBrush(COLOR_3DDKSHADOW)); - Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.right+1, myr.top, myr.left-1, myr.bottom); - SelectObject(dc, hbsave); - SelectObject(dc, hpsave); + SetTextColor(dc, GetSysColor(COLOR_BTNSHADOW)); + TextOut(dc, rc.left, rc.top, OutRight, 1); + SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT)); + TextOut(dc, rc.left, rc.top, OutLeft, 1); + SetTextColor(dc, GetSysColor(COLOR_3DDKSHADOW)); + TextOut(dc, rc.left, rc.top, InRight, 1); + SetTextColor(dc, GetSysColor(COLOR_3DLIGHT)); + TextOut(dc, rc.left, rc.top, InLeft, 1); } - - i = 10*SmallDiam/16; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; - i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); - Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); - SelectObject(dc, hbsave); - SelectObject(dc, hpsave); } if(uFlags & DFCS_CHECKED) { - i = 6*SmallDiam/16; - i = i < 1 ? 1 : i; - myr.left = xc - i+i/2; - myr.right = xc + i/2; - myr.top = yc - i+i/2; - myr.bottom = yc + i/2; - - i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT; - hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i)); - hpsave = (HPEN)SelectObject(dc, GetSysColorPen(i)); - Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom); - SelectObject(dc, hpsave); - SelectObject(dc, hbsave); - } - - /* FIXME: M$ has a Polygon in the center at relative points: */ - /* 0.476, 0.476 (times SmallDiam, SmallDiam) */ - /* 0.476, 0.525 */ - /* 0.500, 0.500 */ - /* 0.500, 0.499 */ - /* when the button is unchecked. The reason for it is unknown. The */ - /* color is COLOR_BTNHIGHLIGHT, although the Polygon gets painted at */ - /* least 3 times (it looks like a clip-region when you see it happen). */ - /* I do not really see a reason why this should be implemented. If you */ - /* have a good reason, let me know. Maybe this is a quirk in the Marlett */ - /* font. */ + LPCTSTR Check = TEXT("i"); + + SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); + TextOut(dc, rc.left, rc.top, Check, 1); + } + + SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); + SelectObject(dc, hOldFont); return TRUE; } Modified: branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/icon.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/dll/wi…
============================================================================== --- branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/icon.c (original) +++ branches/ros-branch-0_3_1/reactos/dll/win32/user32/windows/icon.c Wed Jan 24 18:25:43 2007 @@ -247,10 +247,10 @@ if (! fIcon) { wXHotspot = *(WORD*)pbIconBits; - pbIconBits+=sizeof(WORD); + pbIconBits += sizeof(WORD); wYHotspot = *(WORD*)pbIconBits; - pbIconBits+=sizeof(WORD); - cbIconBits-=2*sizeof(WORD); + pbIconBits += sizeof(WORD); + cbIconBits -= 2 * sizeof(WORD); } else { @@ -266,7 +266,7 @@ } memcpy(SafeIconImage, pbIconBits, cbIconBits); - /* take into acount the origonal height was for both the AND and XOR images */ + /* take into acount the original height was for both the AND and XOR images */ if(fIcon) SafeIconImage->icHeader.biHeight /= 2; @@ -326,7 +326,7 @@ return (HICON)0; } /* FIXME - does there really *have* to be a color bitmap? monochrome cursors don't have one */ - if(IconInfo->hbmColor && !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap)) + if(/*IconInfo->hbmColor &&*/ !GetObjectW(IconInfo->hbmColor, sizeof(BITMAP), &ColorBitmap)) { return (HICON)0; } @@ -440,35 +440,47 @@ PBYTE presbits, BOOL fIcon) { - return LookupIconIdFromDirectoryEx( presbits, fIcon, - fIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR), - fIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), LR_DEFAULTCOLOR ); -} - -/* Ported from WINE20030408 */ -GRPCURSORICONDIRENTRY* -CURSORICON_FindBestCursor( GRPCURSORICONDIR *dir, int width, int height, int colors) -{ - int i; - GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL; + return LookupIconIdFromDirectoryEx(presbits, + fIcon, + fIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR), + fIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), + LR_DEFAULTCOLOR); +} + + + + + +/* + * The following macro function accounts for the irregularities of + * accessing cursor and icon resources in files and resource entries. + */ +typedef BOOL +(*fnGetCIEntry)(LPVOID dir, int n, int *width, int *height, int *bits ); + +/********************************************************************** + * CURSORICON_FindBestIcon + * + * Find the icon closest to the requested size and number of colors. + */ +static int +CURSORICON_FindBestIcon(LPVOID dir, + fnGetCIEntry get_entry, + int Width, + int Height, + int ColorBits) +{ + int i, cx, cy, Bits, BestBits = 0, BestEntry = -1; UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff; UINT iTempXDiff, iTempYDiff, iTempColorDiff; - - if (dir->idCount < 1) - { - DPRINT("Empty directory!\n"); - return NULL; - } - if (dir->idCount == 1) - return &dir->idEntries[0]; /* No choice... */ /* Find Best Fit */ iTotalDiff = 0xFFFFFFFF; iColorDiff = 0xFFFFFFFF; - for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) - { - iTempXDiff = abs(width - entry->ResInfo.icon.bWidth); - iTempYDiff = abs(height - entry->ResInfo.icon.bHeight); + for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ ) + { + iTempXDiff = abs(Width - cx); + iTempYDiff = abs(Height - cy); if(iTotalDiff > (iTempXDiff + iTempYDiff)) { @@ -479,49 +491,52 @@ } /* Find Best Colors for Best Fit */ - for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) - { - if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff && - abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff) + for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ ) + { + if(abs(Width - cx) == iXDiff && abs(Height - cy) == iYDiff) { - iTempColorDiff = abs(colors - entry->ResInfo.icon.bColorCount); - + iTempColorDiff = abs(ColorBits - Bits); if(iColorDiff > iTempColorDiff) - { - bestEntry = entry; + { + BestEntry = i; + BestBits = Bits; iColorDiff = iTempColorDiff; - } + } } } - return bestEntry; -} - -/* Ported from WINE20030408 */ -GRPCURSORICONDIRENTRY* -CURSORICON_FindBestIcon( GRPCURSORICONDIR *dir, int width, int height, int colorbits) -{ - int i; - GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL; + DPRINT("Best Icon: ResId: %d, bits : %d\n", BestEntry, BestBits); + + return BestEntry; +} + + + +/********************************************************************** + * CURSORICON_FindBestCursor + * + * Find the cursor closest to the requested size. + * FIXME: parameter 'color' ignored and entries with more than 1 bpp + * ignored too + */ +static int +CURSORICON_FindBestCursor(LPVOID dir, + fnGetCIEntry get_entry, + int Width, + int Height, + int ColorBits) +{ + int i, cx, cy, Bits, BestBits = 0, BestEntry = -1; UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff; UINT iTempXDiff, iTempYDiff, iTempColorDiff; - - if (dir->idCount < 1) - { - DPRINT("Empty directory!\n"); - return NULL; - } - if (dir->idCount == 1) - return &dir->idEntries[0]; /* No choice... */ /* Find Best Fit */ iTotalDiff = 0xFFFFFFFF; iColorDiff = 0xFFFFFFFF; - for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) - { - iTempXDiff = abs(width - entry->ResInfo.icon.bWidth); - - iTempYDiff = abs(height - entry->ResInfo.icon.bHeight); + for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ ) + { + iTempXDiff = abs(Width - cx); + iTempYDiff = abs(Height - cy); if(iTotalDiff > (iTempXDiff + iTempYDiff)) { @@ -529,68 +544,141 @@ iYDiff = iTempYDiff; iTotalDiff = iXDiff + iYDiff; } - } + } /* Find Best Colors for Best Fit */ - for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) - { - if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff && - abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff) + for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ ) + { + if(abs(Width - cx) == iXDiff && abs(Height - cy) == iYDiff) { - iTempColorDiff = abs(colorbits - entry->wBitCount); + iTempColorDiff = abs(ColorBits - Bits); if(iColorDiff > iTempColorDiff) { - bestEntry = entry; + BestEntry = i; + BestBits = Bits; iColorDiff = iTempColorDiff; } } } - return bestEntry; -} - -/* Ported from WINE20030408 */ -/* - * @implemented - */ -INT STDCALL -LookupIconIdFromDirectoryEx( - PBYTE presbits, - BOOL fIcon, - int cxDesired, - int cyDesired, - UINT Flags) -{ - GRPCURSORICONDIR *dir = (GRPCURSORICONDIR*)presbits; - UINT retVal = 0; - - if (dir && !dir->idReserved && (IMAGE_ICON == dir->idType || IMAGE_CURSOR == dir->idType)) - { - GRPCURSORICONDIRENTRY *entry; - HDC hdc; - int ColorBits; - - hdc = CreateICW(NULL, NULL, NULL, NULL); - if (Flags & LR_MONOCHROME) - { - ColorBits = 1; - } - else - { - ColorBits = GetDeviceCaps(hdc, BITSPIXEL); - if (ColorBits > 8) - ColorBits = 8; - } - DeleteDC(hdc); - - entry = CURSORICON_FindBestIcon( dir, cxDesired, cyDesired, ColorBits ); - - if (entry) - retVal = entry->nID; - } - else - { - DbgPrint("invalid resource directory\n"); - } - return retVal; -} + DPRINT("Best Cursor: ResId: %d, bits : %d\n", BestEntry, BestBits); + + return BestEntry; +} + + +static BOOL +CURSORICON_GetResIconEntry(LPVOID dir, + int n, + int *Width, + int *Height, + int *Bits) +{ + GRPCURSORICONDIR *ResDir = dir; + ICONRESDIR *Icon; + + if (ResDir->idCount <= n) + return FALSE; + + Icon = &ResDir->idEntries[n].ResInfo.icon; + *Width = Icon->bWidth; + *Height = Icon->bHeight; + *Bits = ResDir->idEntries[n].wBitCount; + return TRUE; +} + +static BOOL +CURSORICON_GetResCursorEntry(LPVOID dir, + int n, + int *Width, + int *Height, + int *Bits) +{ + GRPCURSORICONDIR *ResDir = dir; + CURSORRESDIR *Cursor; + + if (ResDir->idCount <= n) + return FALSE; + + Cursor = &ResDir->idEntries[n].ResInfo.cursor; + *Width = Cursor->wWidth; + *Height = Cursor->wHeight; + *Bits = ResDir->idEntries[n].wBitCount; + return TRUE; +} + +static GRPCURSORICONDIRENTRY * +CURSORICON_FindBestIconRes(GRPCURSORICONDIR * dir, + int Width, + int Height, + int ColorBits) +{ + int n; + n = CURSORICON_FindBestIcon(dir, + CURSORICON_GetResIconEntry, + Width, + Height, + ColorBits); + if (n < 0) + return NULL; + + return &dir->idEntries[n]; +} + +static GRPCURSORICONDIRENTRY * +CURSORICON_FindBestCursorRes(GRPCURSORICONDIR *dir, + int Width, + int Height, + int ColorBits) +{ + int n; + n = CURSORICON_FindBestCursor(dir, + CURSORICON_GetResCursorEntry, + Width, + Height, + ColorBits); + if (n < 0) + return NULL; + + return &dir->idEntries[n]; +} + + +INT WINAPI +LookupIconIdFromDirectoryEx(PBYTE xdir, + BOOL bIcon, + INT width, + INT height, + UINT cFlag) +{ + GRPCURSORICONDIR *dir = (GRPCURSORICONDIR*)xdir; + UINT retVal = 0; + if(dir && !dir->idReserved && (IMAGE_ICON == dir->idType || IMAGE_CURSOR == dir->idType)) + { + GRPCURSORICONDIRENTRY *entry = NULL; + int ColorBits; + + if (cFlag & LR_MONOCHROME) + { + ColorBits = 1; + } + else + { + HDC hdc = CreateICW(NULL, NULL, NULL, NULL); + ColorBits = GetDeviceCaps(hdc, BITSPIXEL); + DeleteDC(hdc); + } + + if(bIcon) + entry = CURSORICON_FindBestIconRes(dir, width, height, ColorBits); + else + entry = CURSORICON_FindBestCursorRes(dir, width, height, 1); + + if (entry) + retVal = entry->nID; + } + else + DPRINT1("%s() : Invalid resource directory\n", __FUNCTION__); + + return retVal; +}
[View Less]
18 years, 2 months
1
0
0
0
[fireball] 25614: - Merge 25572 (except the NTLPC related part), this fixes VMWare detection. - Merge a small part of 25501 ("Fix the KiMask32Array").
by fireball@svn.reactos.org
Author: fireball Date: Wed Jan 24 15:14:04 2007 New Revision: 25614 URL:
http://svn.reactos.org/svn/reactos?rev=25614&view=rev
Log: - Merge 25572 (except the NTLPC related part), this fixes VMWare detection. - Merge a small part of 25501 ("Fix the KiMask32Array"). Modified: branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/vmwinst.c branches/ros-branch-0_3_1/reactos/include/ndk/asm.h branches/ros-branch-0_3_1/reactos/ntoskrnl/KrnlFun.c branches/ros-branch-0_3_1/reactos/
…
[View More]
ntoskrnl/dbgk/dbgkutil.c branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/debug.c branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/trap.s branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/thrdobj.c Modified: branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/vmwinst.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/s…
============================================================================== --- branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/vmwinst.c (original) +++ branches/ros-branch-0_3_1/reactos/base/setup/vmwinst/vmwinst.c Wed Jan 24 15:14:04 2007 @@ -1010,7 +1010,7 @@ { PVOID ExceptionHandler; - //int Version; + int Version; WCHAR *lc; hAppInstance = hInstance; @@ -1024,9 +1024,9 @@ return 1; } - //if(!DetectVMware(&Version)) - { - //return 1; + if(!DetectVMware(&Version)) + { + return 1; } /* unregister the handler */ Modified: branches/ros-branch-0_3_1/reactos/include/ndk/asm.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/includ…
============================================================================== --- branches/ros-branch-0_3_1/reactos/include/ndk/asm.h (original) +++ branches/ros-branch-0_3_1/reactos/include/ndk/asm.h Wed Jan 24 15:14:04 2007 @@ -498,6 +498,7 @@ #define STATUS_ACCESS_VIOLATION 0xC0000005 #define STATUS_IN_PAGE_ERROR 0xC0000006 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001 +#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096 #define STATUS_STACK_OVERFLOW 0xC00000FD #define KI_EXCEPTION_ACCESS_VIOLATION 0x10000004 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/KrnlFun.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/KrnlFun.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/KrnlFun.c Wed Jan 24 15:14:04 2007 @@ -24,7 +24,6 @@ // // Ke1: // - Implement KiInitMachineDependent. -// - Implement Privileged Instruction Handler in Umode GPF. // // Fstub: // - Implement IoAssignDriveLetters using mount manager support. Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/dbgkutil.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/dbgkutil.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/dbgkutil.c Wed Jan 24 15:14:04 2007 @@ -238,15 +238,13 @@ if (Teb) { /* Copy the system library name and link to it */ -#if 0 wcsncpy(Teb->StaticUnicodeBuffer, L"ntdll.dll", sizeof(Teb->StaticUnicodeBuffer) / sizeof(WCHAR)); -#endif Teb->Tib.ArbitraryUserPointer = Teb->StaticUnicodeBuffer; /* Return it in the debug event as well */ - LoadDll->NamePointer = Teb->Tib.ArbitraryUserPointer; + LoadDll->NamePointer = &Teb->Tib.ArbitraryUserPointer; } /* Get a handle */ Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/debug.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/debug.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/dbgk/debug.c Wed Jan 24 15:14:04 2007 @@ -221,13 +221,9 @@ PsGetCurrentProcess()->CreateReported = TRUE; /* Send the LPC command */ -#if 0 Status = LpcRequestWaitReplyPort(Port, (PPORT_MESSAGE)Message, (PPORT_MESSAGE)&Buffer[0]); -#else - Status = STATUS_UNSUCCESSFUL; -#endif /* Flush the instruction cache */ ZwFlushInstructionCache(NtCurrentProcess(), NULL, 0); @@ -486,6 +482,15 @@ i = 0; while ((NextEntry != ListHead) && (i < 500)) { + /* Skip the first entry */ + if (!i) + { + /* Go to the next module */ + NextEntry = NextEntry->Flink; + i++; + continue; + } + /* Get the entry */ LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, @@ -724,7 +729,7 @@ /* Get the next thread */ ThisThread = PsGetNextProcessThread(Process, ThisThread); OldThread = pLastThread; - } while(ThisThread); + } while (ThisThread); /* Check the API status */ if (!NT_SUCCESS(Status)) @@ -1075,7 +1080,7 @@ OwnerProcess, DebugObject); /* If this isn't the last handle, do nothing */ - if (HandleCount > 1) return; + if (SystemHandleCount > 1) return; /* Otherwise, lock the debug object */ ExAcquireFastMutex(&DebugObject->Mutex); @@ -1293,8 +1298,12 @@ /* Check if we couldn't acquire rundown for it */ if (DebugEvent->Flags & 0x10) { - /* Set busy flag */ - InterlockedOr((PLONG)&DebugEvent->Flags, 0x100); + /* Set the skip termination flag */ + PspSetCrossThreadFlag(EventThread, CT_SKIP_CREATION_MSG_BIT); + + /* Insert it into the temp list */ + RemoveEntryList(&DebugEvent->EventList); + InsertTailList(&TempList, &DebugEvent->EventList); } else { @@ -1312,15 +1321,15 @@ /* Clear the backout thread */ DebugEvent->BackoutThread = NULL; - /* Set flag */ - InterlockedOr((PLONG)&DebugEvent->Flags, 0x80); + /* Set skip flag */ + PspSetCrossThreadFlag(EventThread, CT_SKIP_CREATION_MSG_BIT); } } else { - /* FIXME: TODO */ - DPRINT1("Unhandled dbgk path!\n"); - KEBUGCHECK(0); + /* Insert it into the temp list */ + RemoveEntryList(&DebugEvent->EventList); + InsertTailList(&TempList, &DebugEvent->EventList); } /* Check if the lock is held */ @@ -1346,11 +1355,14 @@ if (LastThread) ObDereferenceObject(LastThread); /* Loop our temporary list */ - NextEntry = TempList.Flink; - while (NextEntry != &TempList) - { - /* FIXME: TODO */ - KEBUGCHECK(0); + while (!IsListEmpty(&TempList)) + { + /* Remove the event */ + NextEntry = RemoveHeadList(&TempList); + DebugEvent = CONTAINING_RECORD (NextEntry, DEBUG_EVENT, EventList); + + /* Wake it */ + DbgkpWakeTarget(DebugEvent); } /* Check if we got here through success and mark the PEB, then return */ @@ -1520,9 +1532,8 @@ /* Make sure that the status is valid */ if ((ContinueStatus != DBG_CONTINUE) && + (ContinueStatus != DBG_EXCEPTION_HANDLED) && (ContinueStatus != DBG_EXCEPTION_NOT_HANDLED) && - (ContinueStatus != DBG_REPLY_LATER) && - (ContinueStatus != DBG_UNABLE_TO_PROVIDE_HANDLE) && (ContinueStatus != DBG_TERMINATE_THREAD) && (ContinueStatus != DBG_TERMINATE_PROCESS)) { @@ -1820,41 +1831,48 @@ DBGUI_WAIT_STATE_CHANGE WaitStateChange; NTSTATUS Status = STATUS_SUCCESS; PDEBUG_EVENT DebugEvent, DebugEvent2; - PLIST_ENTRY ListHead, NextEntry; + PLIST_ENTRY ListHead, NextEntry, NextEntry2; PAGED_CODE(); DBGKTRACE(DBGK_OBJECT_DEBUG, "Handle: %p\n", DebugHandle); /* Clear the initial wait state change structure */ RtlZeroMemory(&WaitStateChange, sizeof(WaitStateChange)); - /* Check if the call was from user mode */ - if (PreviousMode != KernelMode) - { - /* Protect probe in SEH */ - _SEH_TRY - { - /* Check if we came with a timeout */ - if (Timeout) - { - /* Make a copy on the stack */ - SafeTimeOut = ProbeForReadLargeInteger(Timeout); - Timeout = &SafeTimeOut; - } - + /* Protect probe in SEH */ + _SEH_TRY + { + /* Check if we came with a timeout */ + if (Timeout) + { + /* Check if the call was from user mode */ + if (PreviousMode != KernelMode) + { + /* Probe it */ + ProbeForReadLargeInteger(Timeout); + } + + /* Make a local copy */ + SafeTimeOut = *Timeout; + Timeout = &SafeTimeOut; + + /* Query the current time */ + KeQuerySystemTime(&StartTime); + } + + /* Check if the call was from user mode */ + if (PreviousMode != KernelMode) + { /* Probe the state change structure */ ProbeForWrite(StateChange, sizeof(*StateChange), sizeof(ULONG)); } - _SEH_HANDLE - { - /* Get the exception code */ - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - if (!NT_SUCCESS(Status)) return Status; - - /* Query the current time */ - KeQuerySystemTime(&StartTime); - } + } + _SEH_HANDLE + { + /* Get the exception code */ + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if (!NT_SUCCESS(Status)) return Status; /* Get the debug object */ Status = ObReferenceObjectByHandle(DebugHandle, @@ -1870,13 +1888,13 @@ Thread = NULL; /* Wait on the debug object given to us */ - Status = KeWaitForSingleObject(DebugObject, - Executive, - PreviousMode, - Alertable, - Timeout); while (TRUE) { + Status = KeWaitForSingleObject(DebugObject, + Executive, + PreviousMode, + Alertable, + Timeout); if (!NT_SUCCESS(Status) || (Status == STATUS_TIMEOUT) || (Status == STATUS_ALERTED) || @@ -1917,10 +1935,11 @@ GotEvent = TRUE; /* Loop the list internally */ - while (&DebugEvent->EventList != NextEntry) + NextEntry2 = DebugObject->EventList.Flink; + while (NextEntry2 != NextEntry) { /* Get the debug event */ - DebugEvent2 = CONTAINING_RECORD(NextEntry, + DebugEvent2 = CONTAINING_RECORD(NextEntry2, DEBUG_EVENT, EventList); @@ -1936,7 +1955,7 @@ } /* Move to the next entry */ - NextEntry = NextEntry->Flink; + NextEntry2 = NextEntry2->Flink; } /* Check if we still have a valid event */ @@ -1962,14 +1981,15 @@ /* Set flag */ DebugEvent->Flags |= 1; - Status = STATUS_SUCCESS; } else { /* Unsignal the event */ - DebugObject->EventsPresent.Header.SignalState = 0; - Status = STATUS_SUCCESS; - } + KeClearEvent(&DebugObject->EventsPresent); + } + + /* Set success */ + Status = STATUS_SUCCESS; } /* Release the mutex */ @@ -1980,13 +2000,22 @@ if (!GotEvent) { /* Check if we can wait again */ - if (!SafeTimeOut.QuadPart) + if (SafeTimeOut.QuadPart < 0) { /* Query the new time */ KeQuerySystemTime(&NewTime); /* Substract times */ - /* FIXME: TODO */ + SafeTimeOut.QuadPart += (NewTime.QuadPart - StartTime.QuadPart); + StartTime = NewTime; + + /* Check if we've timed out */ + if (SafeTimeOut.QuadPart > 0) + { + /* We have, break out of the loop */ + Status = STATUS_TIMEOUT; + break; + } } } else Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/trap.s URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/trap.s (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/i386/trap.s Wed Jan 24 15:14:04 2007 @@ -90,6 +90,33 @@ _UnhandledMsg: .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx!!!\n" +_KiTrapPrefixTable: + .byte 0xF2 /* REP */ + .byte 0xF3 /* REP INS/OUTS */ + .byte 0x67 /* ADDR */ + .byte 0xF0 /* LOCK */ + .byte 0x66 /* OP */ + .byte 0x2E /* SEG */ + .byte 0x3E /* DS */ + .byte 0x26 /* ES */ + .byte 0x64 /* FS */ + .byte 0x65 /* GS */ + .byte 0x36 /* SS */ + +_KiTrapIoTable: + .byte 0xE4 /* IN */ + .byte 0xE5 /* IN */ + .byte 0xEC /* IN */ + .byte 0xED /* IN */ + .byte 0x6C /* INS */ + .byte 0x6D /* INS */ + .byte 0xE6 /* OUT */ + .byte 0xE7 /* OUT */ + .byte 0xEE /* OUT */ + .byte 0xEF /* OUT */ + .byte 0x6E /* OUTS */ + .byte 0x6F /* OUTS */ + /* SOFTWARE INTERRUPT SERVICES ***********************************************/ .text @@ -1423,6 +1450,29 @@ jmp _KiSystemFatalException .endfunc +.func KiTrapExceptHandler +_KiTrapExceptHandler: + + /* Setup SEH handler frame */ + mov esp, [esp+8] + pop fs:[KPCR_EXCEPTION_LIST] + add esp, 4 + pop ebp + + /* Check if the fault came from user mode */ + test dword ptr [ebp+KTRAP_FRAME_CS], MODE_MASK + jnz SetException + + /* Kernel fault, bugcheck */ + push ebp + push 0 + push 0 + push 0 + push 0 + push KMODE_EXCEPTION_NOT_HANDLED + call _KeBugCheckWithTf@24 +.endfunc + .func KiTrap13 Dr_kitd: DR_TRAP_FIXUP V86_kitd: V86_TRAP_FIXUP @@ -1627,6 +1677,7 @@ lea eax, [ebp+KTRAP_FRAME_ESP] cmp edx, eax jz HandleSegPop + int 3 /* Handle segment POP fault by setting it to 0 */ HandleSegPop: @@ -1665,7 +1716,7 @@ /* Update EIP (will be updated below again) */ add dword ptr [ebp+KTRAP_FRAME_EIP], 1 -HandleBop4: +HandleEsPop: /* Clear the segment, update EIP and ESP */ mov dword ptr [edx], 0 add dword ptr [ebp+KTRAP_FRAME_EIP], 1 @@ -1677,15 +1728,23 @@ cmp dword ptr [ebx+EPROCESS_VDM_OBJECTS], 0 jz CheckPrivilegedInstruction + /* Bring interrupts back */ + sti + /* Check what kind of instruction this is */ mov eax, [ebp+KTRAP_FRAME_EIP] mov eax, [eax] /* FIXME: Check for BOP4 */ + /* Check if this is POP ES */ + mov edx, ebp + add edx, KTRAP_FRAME_ES + cmp al, 0x07 + jz HandleEsPop + /* Check if this is POP FS */ - mov edx, ebp - add edx, KTRAP_FRAME_FS + add edx, KTRAP_FRAME_FS - KTRAP_FRAME_ES cmp ax, 0xA10F jz HandleSegPop2 @@ -1695,16 +1754,102 @@ jz HandleSegPop2 CheckPrivilegedInstruction: + /* Bring interrupts back */ + sti + + /* Setup a SEH handler */ + push ebp + push offset _KiTrapExceptHandler + push fs:[KPCR_EXCEPTION_LIST] + mov fs:[KPCR_EXCEPTION_LIST], esp + + /* Get EIP */ + mov esi, [ebp+KTRAP_FRAME_EIP] + + /* Setup loop count */ + mov ecx, 15 + +InstLoop: + /* Save loop count */ + push ecx + + /* Get the instruction */ + lods byte ptr [esi] + + /* Now lookup in the prefix table */ + mov ecx, 11 + mov edi, offset _KiTrapPrefixTable + repnz scasb + + /* Restore loop count */ + pop ecx + + /* If it's not a prefix byte, check other instructions */ + jnz NotPrefixByte + /* FIXME */ UNHANDLED_PATH +NotPrefixByte: + /* FIXME: Check if it's a HLT */ + + /* Check if the instruction has two bytes */ + cmp al, 0xF + jne CheckRing3Io + + /* FIXME */ + UNHANDLED_PATH + +CheckRing3Io: + /* Get EFLAGS and IOPL */ + mov ebx, [ebp+KTRAP_FRAME_EFLAGS] + and ebx, 0x3000 + shr ebx, 12 + + /* Check the CS's RPL mask */ + mov ecx, [ebp+KTRAP_FRAME_CS] + and ecx, RPL_MASK + cmp ebx, ecx + jge NotIoViolation + CheckPrivilegedInstruction2: - /* FIXME */ - UNHANDLED_PATH + /* Check if this is a CLI or STI */ + cmp al, 0xFA + je IsPrivInstruction + cmp al, 0xFB + je IsPrivInstruction + + /* Setup I/O table lookup */ + mov ecx, 13 + mov edi, offset _KiTrapIoTable + + /* Loopup in the table */ + repnz scasb + jnz NotIoViolation + + /* FIXME: Check IOPM!!! */ + +IsPrivInstruction: + /* Cleanup the SEH frame */ + pop fs:[KPCR_EXCEPTION_LIST] + add esp, 8 + + /* Setup the exception */ + mov ebx, [ebp+KTRAP_FRAME_EIP] + mov eax, STATUS_PRIVILEGED_INSTRUCTION + jmp _DispatchNoParam + +NotIoViolation: + /* Cleanup the SEH frame */ + pop fs:[KPCR_EXCEPTION_LIST] + add esp, 8 SetException: - /* FIXME */ - UNHANDLED_PATH + /* Setup the exception */ + mov ebx, [ebp+KTRAP_FRAME_EIP] + mov esi, -1 + mov eax, STATUS_ACCESS_VIOLATION + jmp _DispatchTwoParam DispatchV86Gpf: /* FIXME */ Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/thrdobj.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/thrdobj.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/thrdobj.c Wed Jan 24 15:14:04 2007 @@ -18,7 +18,7 @@ ULONG KiMask32Array[MAXIMUM_PRIORITY] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, - 0x40, 0x80, 0x100, 0x200, 0x4000, 0x800, + 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000,
[View Less]
18 years, 2 months
1
0
0
0
[fireball] 25613: Merge 25473.
by fireball@svn.reactos.org
Author: fireball Date: Wed Jan 24 14:50:03 2007 New Revision: 25613 URL:
http://svn.reactos.org/svn/reactos?rev=25613&view=rev
Log: Merge 25473. Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gate.c branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gmutex.c Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/
…
[View More]
ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h Wed Jan 24 14:50:03 2007 @@ -732,7 +732,8 @@ ASSERT(PushLock->Waiting || PushLock->Shared == 0); /* Unlock the pushlock */ - OldValue.Value = InterlockedExchangeAddSizeT((PLONG)PushLock, -1); + OldValue.Value = InterlockedExchangeAddSizeT((PLONG)PushLock, + -EX_PUSH_LOCK_LOCK); /* Sanity checks */ ASSERT(OldValue.Locked); Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gate.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gate.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gate.c Wed Jan 24 14:50:03 2007 @@ -78,7 +78,7 @@ /* Release the APC lock and return */ KiReleaseApcLock(&ApcLock); - return; + break; } /* Setup a Wait Block */ @@ -122,8 +122,8 @@ /* Find a new thread to run */ Status = KiSwapThread(Thread, KeGetCurrentPrcb()); - /* Check if we were executing an APC */ - if (Status != STATUS_KERNEL_APC) return; + /* Make sure we weren't executing an APC */ + if (Status == STATUS_SUCCESS) return; } } while (TRUE); } @@ -149,18 +149,14 @@ KiAcquireDispatcherObject(&Gate->Header); /* Make sure we're not already signaled or that the list is empty */ - if (Gate->Header.SignalState) - { - /* Lower IRQL and quit */ - KeLowerIrql(OldIrql); - return; - } + if (Gate->Header.SignalState) break; /* Check if our wait list is empty */ if (IsListEmpty(&Gate->Header.WaitListHead)) { /* It is, so signal the event */ Gate->Header.SignalState = 1; + break; } else { @@ -187,7 +183,7 @@ RemoveEntryList(&WaitBlock->WaitListEntry); /* Clear wait status */ - WaitThread->WaitStatus = 0; + WaitThread->WaitStatus = STATUS_SUCCESS; /* Set state and CPU */ WaitThread->State = DeferredReady; @@ -223,6 +219,7 @@ /* Exit the dispatcher */ KiExitDispatcher(OldIrql); + return; } } Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gmutex.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gmutex.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ke/gmutex.c Wed Jan 24 14:50:03 2007 @@ -30,9 +30,6 @@ BitsToRemove = GM_LOCK_BIT; BitsToAdd = GM_LOCK_WAITER_INC; - /* Get the Count Bits */ - OldValue = GuardedMutex->Count; - /* Start change loop */ for (;;) { @@ -42,43 +39,47 @@ ASSERT((BitsToAdd == GM_LOCK_WAITER_INC) || (BitsToAdd == GM_LOCK_WAITER_WOKEN)); - /* Check if the Guarded Mutex is locked */ - if (OldValue & GM_LOCK_BIT) + /* Get the Count Bits */ + OldValue = GuardedMutex->Count; + + /* Start internal bit change loop */ + for (;;) { - /* Sanity check */ - ASSERT((BitsToRemove == GM_LOCK_BIT) || - ((OldValue & GM_LOCK_WAITER_WOKEN) != 0)); - - /* Unlock it by removing the Lock Bit */ - NewValue = InterlockedCompareExchange(&GuardedMutex->Count, - OldValue ^ BitsToRemove, - OldValue); - if (NewValue == OldValue) break; - - /* Value got changed behind our backs, start over */ + /* Check if the Guarded Mutex is locked */ + if (OldValue & GM_LOCK_BIT) + { + /* Sanity check */ + ASSERT((BitsToRemove == GM_LOCK_BIT) || + ((OldValue & GM_LOCK_WAITER_WOKEN) != 0)); + + /* Unlock it by removing the Lock Bit */ + NewValue = OldValue ^ BitsToRemove; + NewValue = InterlockedCompareExchange(&GuardedMutex->Count, + NewValue, + OldValue); + if (NewValue == OldValue) return; + } + else + { + /* The Guarded Mutex isn't locked, so simply set the bits */ + NewValue = OldValue + BitsToAdd; + NewValue = InterlockedCompareExchange(&GuardedMutex->Count, + NewValue, + OldValue); + if (NewValue == OldValue) break; + } + + /* Old value changed, loop again */ OldValue = NewValue; } - else - { - /* The Guarded Mutex isn't locked, so simply set the bits */ - NewValue = InterlockedCompareExchange(&GuardedMutex->Count, - OldValue + BitsToAdd, - OldValue); - if (NewValue != OldValue) - { - /* Value got changed behind our backs, start over */ - OldValue = NewValue; - continue; - } - - /* Now we have to wait for it */ - KeWaitForGate(&GuardedMutex->Gate, WrGuardedMutex, KernelMode); - ASSERT((GuardedMutex->Count & GM_LOCK_WAITER_WOKEN) != 0); - - /* Ok, the wait is done, so set the new bits */ - BitsToRemove = GM_LOCK_BIT | GM_LOCK_WAITER_WOKEN; - BitsToAdd = GM_LOCK_WAITER_WOKEN; - } + + /* Now we have to wait for it */ + KeWaitForGate(&GuardedMutex->Gate, WrGuardedMutex, KernelMode); + ASSERT((GuardedMutex->Count & GM_LOCK_WAITER_WOKEN) != 0); + + /* Ok, the wait is done, so set the new bits */ + BitsToRemove = GM_LOCK_BIT | GM_LOCK_WAITER_WOKEN; + BitsToAdd = GM_LOCK_WAITER_WOKEN; } } @@ -109,7 +110,7 @@ GuardedMutex->Owner = NULL; /* Add the Lock Bit */ - OldValue = InterlockedExchangeAdd(&GuardedMutex->Count, 1); + OldValue = InterlockedExchangeAdd(&GuardedMutex->Count, GM_LOCK_BIT); ASSERT((OldValue & GM_LOCK_BIT) == 0); /* Check if it was already locked, but not woken */ @@ -247,7 +248,7 @@ /* Remove the lock */ OldBit = InterlockedBitTestAndReset(&GuardedMutex->Count, GM_LOCK_BIT_V); - if (OldBit) + if (!OldBit) { /* Re-enable APCs */ KeLeaveGuardedRegion();
[View Less]
18 years, 2 months
1
0
0
0
[fireball] 25612: - Merge a couple of small bugfixes from 25461 (smss and csrss related) - Merge 25472
by fireball@svn.reactos.org
Author: fireball Date: Wed Jan 24 13:52:55 2007 New Revision: 25612 URL:
http://svn.reactos.org/svn/reactos?rev=25612&view=rev
Log: - Merge a couple of small bugfixes from 25461 (smss and csrss related) - Merge 25472 Modified: branches/ros-branch-0_3_1/reactos/base/system/smss/smapi.c branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/handle.c branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/rundown.c branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h branches/
…
[View More]
ros-branch-0_3_1/reactos/subsystems/win32/csrss/api/wapi.c Modified: branches/ros-branch-0_3_1/reactos/base/system/smss/smapi.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/base/s…
============================================================================== --- branches/ros-branch-0_3_1/reactos/base/system/smss/smapi.c (original) +++ branches/ros-branch-0_3_1/reactos/base/system/smss/smapi.c Wed Jan 24 13:52:55 2007 @@ -144,7 +144,7 @@ break; case LPC_PORT_CLOSED: Reply = NULL; - break; + continue; default: if ((Request.SmHeader.ApiIndex) && (Request.SmHeader.ApiIndex < (sizeof SmApi / sizeof SmApi[0]))) Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/handle.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/handle.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/handle.c Wed Jan 24 13:52:55 2007 @@ -866,8 +866,6 @@ DPRINT("DestroyHandleByEntry HT:0x%p Entry:0x%p\n", HandleTable, Entry); - if (!(HandleTable->Flags & EX_HANDLE_TABLE_CLOSING)) - { KeEnterCriticalRegion(); ExAcquireHandleLockExclusive(HandleTable); @@ -879,7 +877,6 @@ ExReleaseHandleLock(HandleTable); KeLeaveCriticalRegion(); - } } PHANDLE_TABLE_ENTRY Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/rundown.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/rundown.c (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/ex/rundown.c Wed Jan 24 13:52:55 2007 @@ -36,21 +36,21 @@ { ULONG_PTR Value = RunRef->Count, NewValue; - /* Make sure a rundown is not active */ - if (Value & EX_RUNDOWN_ACTIVE) return FALSE; - /* Loop until successfully incremented the counter */ for (;;) { + /* Make sure a rundown is not active */ + if (Value & EX_RUNDOWN_ACTIVE) return FALSE; + /* Add a reference */ NewValue = Value + EX_RUNDOWN_COUNT_INC; /* Change the value */ - Value = ExpChangeRundown(RunRef, NewValue, Value); - if (Value == NewValue) return TRUE; - - /* Make sure a rundown is not active */ - if (Value & EX_RUNDOWN_ACTIVE) return FALSE; + NewValue = ExpChangeRundown(RunRef, NewValue, Value); + if (NewValue == Value) return TRUE; + + /* Update it */ + Value = NewValue; } } @@ -78,25 +78,22 @@ IN ULONG Count) { ULONG_PTR Value = RunRef->Count, NewValue; - - /* Make sure a rundown is not active */ - if (Value & EX_RUNDOWN_ACTIVE) return FALSE; - - /* Convert the count to our internal representation */ - Count <<= EX_RUNDOWN_COUNT_SHIFT; /* Loop until successfully incremented the counter */ for (;;) { - /* Add references */ - NewValue = Value + Count; - - /* Change the value */ - Value = ExpChangeRundown(RunRef, NewValue, Value); - if (Value == NewValue) return TRUE; - /* Make sure a rundown is not active */ if (Value & EX_RUNDOWN_ACTIVE) return FALSE; + + /* Add references */ + NewValue = Value + EX_RUNDOWN_COUNT_INC * Count; + + /* Change the value */ + NewValue = ExpChangeRundown(RunRef, NewValue, Value); + if (NewValue == Value) return TRUE; + + /* Update the value */ + Value = NewValue; } } @@ -201,11 +198,11 @@ ULONG_PTR Value = RunRef->Count, NewValue; PEX_RUNDOWN_WAIT_BLOCK WaitBlock; - /* Check if rundown is not active */ - if (!(Value & EX_RUNDOWN_ACTIVE)) + /* Loop until successfully incremented the counter */ + for (;;) { - /* Loop until successfully incremented the counter */ - for (;;) + /* Check if rundown is not active */ + if (!(Value & EX_RUNDOWN_ACTIVE)) { /* Sanity check */ ASSERT((Value >= EX_RUNDOWN_COUNT_INC) || (KeNumberProcessors > 1)); @@ -214,24 +211,29 @@ NewValue = Value - EX_RUNDOWN_COUNT_INC; /* Change the value */ - Value = ExpChangeRundown(RunRef, NewValue, Value); - if (Value == NewValue) return; - - /* Loop again if we're still not active */ - if (Value & EX_RUNDOWN_ACTIVE) break; + NewValue = ExpChangeRundown(RunRef, NewValue, Value); + if (NewValue == Value) break; + + /* Update value */ + Value = NewValue; + } + else + { + /* Get the wait block */ + WaitBlock = (PEX_RUNDOWN_WAIT_BLOCK)(Value & ~EX_RUNDOWN_ACTIVE); + ASSERT((WaitBlock->Count > 0) || (KeNumberProcessors > 1)); + + /* Remove the one count */ + if (!InterlockedDecrementSizeT(&WaitBlock->Count)) + { + /* We're down to 0 now, so signal the event */ + KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE); + } + + /* We're all done */ + break; } } - - /* Get the wait block */ - WaitBlock = (PEX_RUNDOWN_WAIT_BLOCK)(Value & ~EX_RUNDOWN_ACTIVE); - ASSERT((WaitBlock->Count > 0) || (KeNumberProcessors > 1)); - - /* Remove the one count */ - if (!InterlockedDecrementSizeT(&WaitBlock->Count)) - { - /* We're down to 0 now, so signal the event */ - KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE); - } } /*++ @@ -260,37 +262,43 @@ ULONG_PTR Value = RunRef->Count, NewValue; PEX_RUNDOWN_WAIT_BLOCK WaitBlock; - /* Check if rundown is not active */ - if (!(Value & EX_RUNDOWN_ACTIVE)) + /* Loop until successfully incremented the counter */ + for (;;) { - /* Loop until successfully incremented the counter */ - for (;;) + /* Check if rundown is not active */ + if (!(Value & EX_RUNDOWN_ACTIVE)) { /* Sanity check */ - ASSERT((Value >= EX_RUNDOWN_COUNT_INC * Count) || (KeNumberProcessors > 1)); + ASSERT((Value >= EX_RUNDOWN_COUNT_INC * Count) || + (KeNumberProcessors > 1)); /* Get the new value */ - NewValue = Value - (Count * EX_RUNDOWN_COUNT_INC); + NewValue = Value - EX_RUNDOWN_COUNT_INC * Count; /* Change the value */ - Value = ExpChangeRundown(RunRef, NewValue, Value); - if (Value == NewValue) return; - - /* Loop again if we're still not active */ - if (Value & EX_RUNDOWN_ACTIVE) break; + NewValue = ExpChangeRundown(RunRef, NewValue, Value); + if (NewValue == Value) break; + + /* Update value */ + Value = NewValue; } - } - - /* Get the wait block */ - WaitBlock = (PEX_RUNDOWN_WAIT_BLOCK)(Value & ~EX_RUNDOWN_ACTIVE); - ASSERT((WaitBlock->Count >= Count) || (KeNumberProcessors > 1)); - - /* Remove the count */ - if (InterlockedExchangeAddSizeT(&WaitBlock->Count, -(LONG)Count) == - (LONG)Count) - { - /* We're down to 0 now, so signal the event */ - KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE); + else + { + /* Get the wait block */ + WaitBlock = (PEX_RUNDOWN_WAIT_BLOCK)(Value & ~EX_RUNDOWN_ACTIVE); + ASSERT((WaitBlock->Count >= Count) || (KeNumberProcessors > 1)); + + /* Remove the counts */ + if (InterlockedExchangeAddSizeT(&WaitBlock->Count, + -(LONG)Count) == (LONG)Count) + { + /* We're down to 0 now, so signal the event */ + KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE); + } + + /* We're all done */ + break; + } } } @@ -330,17 +338,17 @@ EX_RUNDOWN_ACTIVE); /* Start waitblock set loop */ - for(;;) + for (;;) { /* Save the count */ Count = Value >> EX_RUNDOWN_COUNT_SHIFT; - /* If the count is over one or we don't have en event yet, create it */ - if (Count || !Event) + /* If the count is over one and we don't have en event yet, create it */ + if ((Count) && !(Event)) { /* Initialize the event */ KeInitializeEvent(&WaitBlock.WakeEvent, - NotificationEvent, + SynchronizationEvent, FALSE); /* Set the pointer */ Modified: branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/ntoskr…
============================================================================== --- branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h (original) +++ branches/ros-branch-0_3_1/reactos/ntoskrnl/include/internal/ex.h Wed Jan 24 13:52:55 2007 @@ -351,7 +351,7 @@ FORCEINLINE _ExAcquireRundownProtection(IN PEX_RUNDOWN_REF RunRef) { - ULONG_PTR Value, NewValue, OldValue; + ULONG_PTR Value, NewValue; /* Get the current value and mask the active bit */ Value = RunRef->Count &~ EX_RUNDOWN_ACTIVE; @@ -360,8 +360,8 @@ NewValue = Value + EX_RUNDOWN_COUNT_INC; /* Change the value */ - OldValue = ExpChangeRundown(RunRef, NewValue, Value); - if (OldValue != Value) + NewValue = ExpChangeRundown(RunRef, NewValue, Value); + if (NewValue != Value) { /* Rundown was active, use long path */ return ExfAcquireRundownProtection(RunRef); @@ -392,7 +392,7 @@ FORCEINLINE _ExReleaseRundownProtection(IN PEX_RUNDOWN_REF RunRef) { - ULONG_PTR Value, NewValue, OldValue; + ULONG_PTR Value, NewValue; /* Get the current value and mask the active bit */ Value = RunRef->Count &~ EX_RUNDOWN_ACTIVE; @@ -401,10 +401,10 @@ NewValue = Value - EX_RUNDOWN_COUNT_INC; /* Change the value */ - OldValue = ExpChangeRundown(RunRef, NewValue, Value); + NewValue = ExpChangeRundown(RunRef, NewValue, Value); /* Check if the rundown was active */ - if (OldValue != Value) + if (NewValue != Value) { /* Rundown was active, use long path */ ExfReleaseRundownProtection(RunRef); @@ -463,7 +463,7 @@ /* Set the active bit */ Value = ExpChangeRundown(RunRef, EX_RUNDOWN_ACTIVE, 0); - if ((Value) || (Value != EX_RUNDOWN_ACTIVE)) + if ((Value) && (Value != EX_RUNDOWN_ACTIVE)) { /* If the the rundown wasn't already active, then take the long path */ ExfWaitForRundownProtectionRelease(RunRef); Modified: branches/ros-branch-0_3_1/reactos/subsystems/win32/csrss/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_1/reactos/subsys…
============================================================================== --- branches/ros-branch-0_3_1/reactos/subsystems/win32/csrss/api/wapi.c (original) +++ branches/ros-branch-0_3_1/reactos/subsystems/win32/csrss/api/wapi.c Wed Jan 24 13:52:55 2007 @@ -225,9 +225,12 @@ /* If the connection was closed, handle that */ if (Request->Header.u2.s2.Type == LPC_PORT_CLOSED) { - DPRINT1("Port died, oh well\n"); + DPRINT("Port died, oh well\n"); CsrFreeProcessData( Request->Header.ClientId.UniqueProcess ); - break; + //NtClose(); + Reply = NULL; + continue; + //break; } if (Request->Header.u2.s2.Type == LPC_CONNECTION_REQUEST) @@ -239,7 +242,7 @@ if (Request->Header.u2.s2.Type == LPC_CLIENT_DIED) { - DPRINT1("Clietn died, oh well\n"); + DPRINT("Client died, oh well\n"); Reply = NULL; continue; }
[View Less]
18 years, 2 months
1
0
0
0
[ion] 25611: - Rewrite kernel timer implementation to use Windows 2003's hash-based table timer model. Extremely scalable, since each timer list has its own lock, and optimized for speed since timers are hashed with the tick count at each update (timer.c). - Implement a new timer expiration function which takes advantage of the fact that timers are now hashed with the system tickcount, and thus only parses the "hot" lists (dpc.c). - Detect timer expiration during KeUpdateSystemTime and edit the
by ion@svn.reactos.org
Author: ion Date: Wed Jan 24 09:50:28 2007 New Revision: 25611 URL:
http://svn.reactos.org/svn/reactos?rev=25611&view=rev
Log: - Rewrite kernel timer implementation to use Windows 2003's hash-based table timer model. Extremely scalable, since each timer list has its own lock, and optimized for speed since timers are hashed with the tick count at each update (timer.c). - Implement a new timer expiration function which takes advantage of the fact that timers are now hashed with the system
…
[View More]
tickcount, and thus only parses the "hot" lists (dpc.c). - Detect timer expiration during KeUpdateSystemTime and edit the KPRCB to notify of timer expiration. This will be picked up by the timer expiration DPC (clock.s). - Add support for new timer code in dispatcher (wait.c, queue.c, ke_x.h). - Change system startup to support the new timer DPC/list (krnlinit.c, clock.c). - Remove corresponding entry from kernel fun, and update the guidance plan with recent successes and setbacks. This patch is likely the last big architectural change in the kernel except for enabling the new scheduler at a later time. Modified: trunk/reactos/ntoskrnl/KrnlFun.c trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/include/internal/ke_x.h trunk/reactos/ntoskrnl/ke/clock.c trunk/reactos/ntoskrnl/ke/dpc.c trunk/reactos/ntoskrnl/ke/i386/clock.S trunk/reactos/ntoskrnl/ke/krnlinit.c trunk/reactos/ntoskrnl/ke/queue.c trunk/reactos/ntoskrnl/ke/timer.c trunk/reactos/ntoskrnl/ke/wait.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/ntoskrnl/KrnlFun.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=256…
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
Modified: trunk/reactos/ntoskrnl/ke/clock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/clock.c?rev=25…
Modified: trunk/reactos/ntoskrnl/ke/dpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/dpc.c?rev=2561…
Modified: trunk/reactos/ntoskrnl/ke/i386/clock.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/clock.S?r…
Modified: trunk/reactos/ntoskrnl/ke/krnlinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/krnlinit.c?rev…
Modified: trunk/reactos/ntoskrnl/ke/queue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/queue.c?rev=25…
Modified: trunk/reactos/ntoskrnl/ke/timer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/timer.c?rev=25…
Modified: trunk/reactos/ntoskrnl/ke/wait.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/wait.c?rev=256…
[View Less]
18 years, 2 months
1
0
0
0
[ion] 25610: - Fix a bug in NtSetTimer which was causing us to completely disregard the due time. - kmtest now reports 0 failures for the extimer regression test.
by ion@svn.reactos.org
Author: ion Date: Wed Jan 24 07:46:31 2007 New Revision: 25610 URL:
http://svn.reactos.org/svn/reactos?rev=25610&view=rev
Log: - Fix a bug in NtSetTimer which was causing us to completely disregard the due time. - kmtest now reports 0 failures for the extimer regression test. Modified: trunk/reactos/ntoskrnl/ex/timer.c Modified: trunk/reactos/ntoskrnl/ex/timer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/timer.c?rev=25…
=========================================
…
[View More]
===================================== --- trunk/reactos/ntoskrnl/ex/timer.c (original) +++ trunk/reactos/ntoskrnl/ex/timer.c Wed Jan 24 07:46:31 2007 @@ -601,6 +601,11 @@ _SEH_END; if(!NT_SUCCESS(Status)) return Status; } + else + { + /* Capture the time directly */ + TimerDueTime = *DueTime; + } /* Get the Timer Object */ Status = ObReferenceObjectByHandle(TimerHandle, @@ -681,7 +686,7 @@ KeInitializeApc(&Timer->TimerApc, &Thread->Tcb, CurrentApcEnvironment, - &ExpTimerApcKernelRoutine, + ExpTimerApcKernelRoutine, (PKRUNDOWN_ROUTINE)NULL, (PKNORMAL_ROUTINE)TimerApcRoutine, PreviousMode, @@ -727,5 +732,3 @@ /* Return to Caller */ return Status; } - -/* EOF */
[View Less]
18 years, 2 months
1
0
0
0
[dcote] 25609: Added test calls for function FsRtlMdlReadDev() and FsRtlMdlReadCompleteDev()
by dcote@svn.reactos.org
Author: dcote Date: Wed Jan 24 02:12:32 2007 New Revision: 25609 URL:
http://svn.reactos.org/svn/reactos?rev=25609&view=rev
Log: Added test calls for function FsRtlMdlReadDev() and FsRtlMdlReadCompleteDev() Modified: trunk/reactos/ntoskrnl/tests/fsrtl.c Modified: trunk/reactos/ntoskrnl/tests/fsrtl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/tests/fsrtl.c?rev…
============================================================================== --- trunk/reactos/
…
[View More]
ntoskrnl/tests/fsrtl.c (original) +++ trunk/reactos/ntoskrnl/tests/fsrtl.c Wed Jan 24 02:12:32 2007 @@ -24,6 +24,7 @@ LONGLONG i = 0; PCHAR Buffer; + PMDL MdlChain = 0; LARGE_INTEGER Offset; ULONG Length = 0; @@ -38,6 +39,22 @@ /* Allocate a 100KB buffer to do IOs */ Buffer = ExAllocatePool(PagedPool,100*_1KB); + /* ------------------------------------------------------------------------ + TESTING: + BOOLEAN + NTAPI + FsRtlCopyWrite(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + OUT PVOID Buffer, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + with Wait = TRUE + + ------------------------------------------------------------------------ */ FsRtlTest_OpenTestFile(&Fh, &Pfo); /* Extract the test variable from the FCB struct */ @@ -48,21 +65,21 @@ /* Try to cache without caching having been initialized. This should fail.*/ Length = 10*_1KB; - FSRTL_TEST("No cache map test.",!FsRtlCopyWrite(Pfo,AllocationSize,Length,TRUE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - No cache map test.",!FsRtlCopyWrite(Pfo,AllocationSize,Length,TRUE,0,Buffer,&IoStatus,NULL)); /* We are going to build a 100k file */ /* This will inititate caching and build some size */ Offset.QuadPart = 0; Length = 100*_1KB; Return = FsRltTest_WritefileZw(Fh,&Offset,Length, Buffer, &IoStatus); - FSRTL_TEST("Building 100k filesize.",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyWrite() - Building 100k filesize.",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Extending the file by 1/2 sector, 256 bytes. */ Offset.QuadPart = 0x7fffffffffff; Length = 0x100; Return = FsRltTest_WritefileZw(Fh,NULL,Length, Buffer, &IoStatus); - FSRTL_TEST("Extending by 1/2 sector.",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyWrite() - Extending by 1/2 sector.",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Append to the file past the allocation size*/ @@ -70,18 +87,18 @@ Offset.HighPart = 0xFFFFFFFF; OldSize.QuadPart = FileSize->QuadPart; Length = (ULONG) (AllocationSize->QuadPart -ValidDataLength->QuadPart); - FSRTL_TEST("Testing extending past allocation size",!FsRtlCopyWrite(Pfo,&Offset,Length+1,TRUE,0,Buffer,&IoStatus,NULL)); - FSRTL_TEST("Testing extending not past allocation size",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); - FSRTL_TEST("Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); + FSRTL_TEST("FsRtlCopyWrite() - Testing extending past allocation size",!FsRtlCopyWrite(Pfo,&Offset,Length+1,TRUE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - Testing extending not past allocation size",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); /* Try do write a 65kb IO and check that if fails. Maximum IO size for thus function is 64KB */ Offset.QuadPart = 0; Length = 65*_1KB; - FSRTL_TEST("65KB IO Test",!FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - 65KB IO Test",!FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); /* Try do write a 64kb IO. Maximum IO size for thus function is 64KB */ Length = 64*_1KB; - FSRTL_TEST("64KB IO Test",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - 64KB IO Test",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) /* Test the fast Io questionable flag This test fails and should succeed. I am not sure why. When FsRtlCopyWrite() queries the FastIoTable of the related @@ -92,10 +109,10 @@ /* Test the fast Io not possible flag */ FcbHeader->IsFastIoPossible = FastIoIsNotPossible; - FSRTL_TEST("FastIo is not possible flag",!FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - FastIo is not possible flag",!FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) /* Set the flag back to what it was */ FcbHeader->IsFastIoPossible = FastIoIsPossible; - FSRTL_TEST("FastIo is possbile flag",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - FastIo is possbile flag",FsRtlCopyWrite(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)) if (Pfo) { @@ -109,10 +126,22 @@ Fh = NULL; } - - /* ------------------------------------------------------------------------*/ - /* ------------------------------------------------------------------------*/ - /* ------------------------------------------------------------------------*/ + /* ------------------------------------------------------------------------ + TESTING: + BOOLEAN + NTAPI + FsRtlCopyWrite(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + OUT PVOID Buffer, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + with Wait = FALSE + + ------------------------------------------------------------------------ */ /* We are going to repeat the same bunch of tests but with Wait = FALSE. So we exercise the second part of the function. */ FsRtlTest_OpenTestFile(&Fh, &Pfo); @@ -125,21 +154,21 @@ /* Try to cache without caching having been initialized. This should fail.*/ Length = 10*_1KB; - FSRTL_TEST("No cache map test. Wait = FALSE",!FsRtlCopyWrite(Pfo,AllocationSize,Length,FALSE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - No cache map test. Wait = FALSE",!FsRtlCopyWrite(Pfo,AllocationSize,Length,FALSE,0,Buffer,&IoStatus,NULL)); /* We are going to build a 100k file */ /* This will inititate caching and build some size */ Offset.QuadPart = 0; Length = 100*_1KB; Return = FsRltTest_WritefileZw(Fh,&Offset,Length, Buffer, &IoStatus); - FSRTL_TEST("Building 100k filesize. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyWrite() - Building 100k filesize. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Extending the file by 1/2 sector, 256 bytes. */ Offset.QuadPart = 0x7fffffffffff; Length = 0x100; Return = FsRltTest_WritefileZw(Fh,NULL,Length, Buffer, &IoStatus); - FSRTL_TEST("Extending by 1/2 sector. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyWrite() - Extending by 1/2 sector. Wait = FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Append to the file past the allocation size*/ @@ -147,18 +176,18 @@ Offset.HighPart = 0xFFFFFFFF; OldSize.QuadPart = FileSize->QuadPart; Length = (ULONG) (AllocationSize->QuadPart -ValidDataLength->QuadPart); - FSRTL_TEST("Testing extending past allocation size Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length+1,FALSE,0,Buffer,&IoStatus,NULL)); - FSRTL_TEST("Testing extending not past allocation size. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); - FSRTL_TEST("Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); + FSRTL_TEST("FsRtlCopyWrite() - Testing extending past allocation size Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length+1,FALSE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - Testing extending not past allocation size. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - Check filesize",(FileSize->QuadPart = (OldSize.QuadPart+Length))); /* Try do write a 65kb IO and check that if fails. Maximum IO size for thus function is 64KB */ Offset.QuadPart = 0; Length = 65*_1KB; - FSRTL_TEST("65KB IO Test. Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyWrite() - 65KB IO Test. Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); /* Try do write a 64kb IO. Maximum IO size for thus function is 64KB */ Length = 64*_1KB; - FSRTL_TEST("64KB IO Test. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - 64KB IO Test. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) /* Test the fast Io questionable flag This test fails and should succeed. I am not sure why. When FsRtlCopyWrite() queries the FastIoTable of the related @@ -169,18 +198,27 @@ /* Test the fast Io not possible flag */ FcbHeader->IsFastIoPossible = FastIoIsNotPossible; - FSRTL_TEST("FastIo is not possible flag. Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - FastIo is not possible flag. Wait = FALSE",!FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) /* Set the flag back to what it was */ FcbHeader->IsFastIoPossible = FastIoIsPossible; - FSRTL_TEST("FastIo is possbile flag. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) + FSRTL_TEST("FsRtlCopyWrite() - FastIo is possbile flag. Wait = FALSE",FsRtlCopyWrite(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)) /* ------------------------------------------------------------------------------------------ - ------------------------------------------------------------------------------------------ - ------------------------------------------------------------------------------------------ - */ - - /* Testing FsRtlCopyRead() function */ + TESTING: + + BOOLEAN + NTAPI + FsRtlCopyRead(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN BOOLEAN Wait, + IN ULONG LockKey, + OUT PVOID Buffer, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + ------------------------------------------------------------------------------------------ */ Offset.LowPart = 0x0; Offset.HighPart = 0x0; @@ -188,24 +226,24 @@ /* Testing a 64KB read with Wait = TRUE */ Return = FsRtlCopyRead(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL); - FSRTL_TEST("Testing 64k IO Wait=TRUE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyRead() - Testing 64k IO Wait=TRUE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Testing a 64KB read with Wait = FALSE */ Return = FsRtlCopyRead(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL); - FSRTL_TEST("Testing 64k IO Wait=FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlCopyRead() - Testing 64k IO Wait=FALSE",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); Return = TRUE; /* Testing read past the end of the file */ Offset.QuadPart = FileSize->QuadPart - (5 * _1KB); Length = 10 * _1KB; Return = FsRtlCopyRead(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL); - FSRTL_TEST("Testing reading past end of file but starting before EOF",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status) && IoStatus.Information == (FileSize->QuadPart-Offset.QuadPart))); + FSRTL_TEST("FsRtlCopyRead() - Testing reading past end of file but starting before EOF",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status) && IoStatus.Information == (FileSize->QuadPart-Offset.QuadPart))); Offset.QuadPart = FileSize->QuadPart + 1; Length = 10 * _1KB; Return = FsRtlCopyRead(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL); - FSRTL_TEST("Testing reading past end of file but starting after EOF",(NT_SUCCESS(Return) && (IoStatus.Status == STATUS_END_OF_FILE) && IoStatus.Information == 0)); + FSRTL_TEST("FsRtlCopyRead() - Testing reading past end of file but starting after EOF",(NT_SUCCESS(Return) && (IoStatus.Status == STATUS_END_OF_FILE) && IoStatus.Information == 0)); /* Testing a 64KB read with Wait = TRUE */ @@ -213,11 +251,99 @@ Offset.HighPart = 0x0; Length = 0x10000; FcbHeader->IsFastIoPossible = FastIoIsNotPossible; - FSRTL_TEST("FastIo is not possible flag. Wait = FALSE",!FsRtlCopyRead(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); - FSRTL_TEST("FastIo is not possible flag. Wait = TRUE",!FsRtlCopyRead(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); - - Return = TRUE; - + FSRTL_TEST("FsRtlCopyRead() - FastIo is not possible flag. Wait = FALSE",!FsRtlCopyRead(Pfo,&Offset,Length,FALSE,0,Buffer,&IoStatus,NULL)); + FSRTL_TEST("FsRtlCopyRead() - FastIo is not possible flag. Wait = TRUE",!FsRtlCopyRead(Pfo,&Offset,Length,TRUE,0,Buffer,&IoStatus,NULL)); + FcbHeader->IsFastIoPossible = FastIoIsPossible; + Return = TRUE; + + if (Pfo) + { + ObDereferenceObject(Pfo); + Pfo = NULL; + } + + if (Fh) + { + ZwClose(Fh); + Fh = NULL; + } + + + /* ------------------------------------------------------------------------------------------ + TESTING: + + FsRtlMdlReadDev(IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN ULONG LockKey, + OUT PMDL *MdlChain, + OUT PIO_STATUS_BLOCK IoStatus, + IN PDEVICE_OBJECT DeviceObject) + + FsRtlMdlReadCompleteDev(IN PFILE_OBJECT FileObject, + IN PMDL MemoryDescriptorList, + IN PDEVICE_OBJECT DeviceObject) + + ------------------------------------------------------------------------------------------ + */ + + FsRtlTest_OpenTestFile(&Fh, &Pfo); + + /* Extract the test variable from the FCB struct */ + FcbHeader = (PFSRTL_COMMON_FCB_HEADER)Pfo->FsContext; + AllocationSize = &FcbHeader->AllocationSize; + ValidDataLength = &FcbHeader->ValidDataLength; + FileSize = &FcbHeader->FileSize; + + + /* We are going to build a 100k file */ + /* This will inititate caching and build some size */ + Offset.QuadPart = 0; + Length = 100*_1KB; + Return = FsRltTest_WritefileZw(Fh,&Offset,Length, Buffer, &IoStatus); + FSRTL_TEST("FsRtlMdlReadDev() - Building 100k filesize.",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + Return = TRUE; + + + Offset.LowPart = 0x0; + Offset.HighPart = 0x0; + Length = 0x10000; + + /* Testing a 64KB read */ + MdlChain = NULL; + Return = FsRtlMdlReadDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL); + FSRTL_TEST("FsRtlMdlReadDev() - Testing 64k IO",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status ) && IoStatus.Information == Length)); + FSRTL_TEST("FsRtlMdlReadDev() - Releasing the MDL",FsRtlMdlReadCompleteDev(Pfo,MdlChain,NULL)); + + + /* Testing read past the end of the file */ + Offset.QuadPart = FileSize->QuadPart - (5 * _1KB); + Length = 10 * _1KB; + MdlChain = NULL; + Return = FsRtlMdlReadDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL); + FSRTL_TEST("FsRtlMdlReadDev() - Testing reading past end of file but starting before EOF",(NT_SUCCESS(Return) && NT_SUCCESS(IoStatus.Status) && IoStatus.Information == (FileSize->QuadPart-Offset.QuadPart))); + FSRTL_TEST("FsRtlMdlReadDev() - Releasing the MDL",FsRtlMdlReadCompleteDev(Pfo,MdlChain,NULL)); + + Offset.QuadPart = FileSize->QuadPart + 1; + Length = 10 * _1KB; + MdlChain = NULL; + Return = FsRtlMdlReadDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL); + FSRTL_TEST("FsRtlMdlReadDev() - Testing reading past end of file but starting after EOF",(NT_SUCCESS(Return) && (IoStatus.Status == STATUS_END_OF_FILE) && IoStatus.Information == 0)); + + /* Testing FastIoIsNotPossible */ + Offset.LowPart = 0x0; + Offset.HighPart = 0x0; + MdlChain = NULL; + Length = 0x10000; + FcbHeader->IsFastIoPossible = FastIoIsNotPossible; + FSRTL_TEST("FsRtlMdlReadDev() - FastIo is not possible flag. Wait = TRUE",!FsRtlMdlReadDev(Pfo,&Offset,Length,0,&MdlChain,&IoStatus,NULL)); + + Return = TRUE; + + + + /* The test if over. Do clean up */ + Cleanup: if (Pfo)
[View Less]
18 years, 2 months
1
0
0
0
[ion] 25608: - Fix reference count bugs in executive timer implementation. - Don't modify status when failing due to an access fault (NT doesn't!). - Do parameter checks before bothering with expensive SEHing.
by ion@svn.reactos.org
Author: ion Date: Wed Jan 24 02:10:13 2007 New Revision: 25608 URL:
http://svn.reactos.org/svn/reactos?rev=25608&view=rev
Log: - Fix reference count bugs in executive timer implementation. - Don't modify status when failing due to an access fault (NT doesn't!). - Do parameter checks before bothering with expensive SEHing. Modified: trunk/reactos/ntoskrnl/ex/timer.c Modified: trunk/reactos/ntoskrnl/ex/timer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/timer.c?
…
[View More]
rev=25…
============================================================================== --- trunk/reactos/ntoskrnl/ex/timer.c (original) +++ trunk/reactos/ntoskrnl/ex/timer.c Wed Jan 24 02:10:13 2007 @@ -79,7 +79,7 @@ /* Cancel the timer and remove its DPC and APC */ KeCancelTimer(&Timer->KeTimer); KeRemoveQueueDpc(&Timer->TimerDpc); - if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo = 2; + if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo++; /* Add another dereference to do */ DerefsToDo++; @@ -101,7 +101,6 @@ /* Release lock and return */ KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql); - return; } VOID @@ -200,7 +199,7 @@ /* Disable it */ Timer->ApcAssociated = FALSE; - DerefsToDo = 2; + DerefsToDo++; } } else @@ -306,7 +305,7 @@ /* Cancel the Timer */ KeCancelTimer(&Timer->KeTimer); KeRemoveQueueDpc(&Timer->TimerDpc); - if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo = 2; + if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo++; DerefsToDo++; } else @@ -351,7 +350,7 @@ } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - Status = _SEH_GetExceptionCode(); + } _SEH_END; } @@ -374,6 +373,14 @@ NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); + /* Check for correct timer type */ + if ((TimerType != NotificationTimer) && + (TimerType != SynchronizationTimer)) + { + /* Fail */ + return STATUS_INVALID_PARAMETER_4; + } + /* Check Parameter Validity */ if (PreviousMode != KernelMode) { @@ -387,12 +394,6 @@ } _SEH_END; if(!NT_SUCCESS(Status)) return Status; - } - - /* Check for correct timer type */ - if ((TimerType != NotificationTimer) && (TimerType != SynchronizationTimer)) - { - return STATUS_INVALID_PARAMETER_4; } /* Create the Object */ @@ -427,16 +428,20 @@ NULL, &hTimer); - /* Make sure it's safe to write to the handle */ - _SEH_TRY - { - *TimerHandle = hTimer; - } - _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; + /* Check for success */ + if (NT_SUCCESS(Status)) + { + /* Make sure it's safe to write to the handle */ + _SEH_TRY + { + *TimerHandle = hTimer; + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + + } + _SEH_END; + } } /* Return to Caller */ @@ -486,7 +491,7 @@ } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - Status = _SEH_GetExceptionCode(); + } _SEH_END; } @@ -578,13 +583,16 @@ NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); + /* Check for a valid Period */ + if (Period < 0) return STATUS_INVALID_PARAMETER_6; + /* Check Parameter Validity */ if (PreviousMode != KernelMode) { _SEH_TRY { TimerDueTime = ProbeForReadLargeInteger(DueTime); - if(PreviousState) ProbeForWriteBoolean(PreviousState); + if (PreviousState) ProbeForWriteBoolean(PreviousState); } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { @@ -593,9 +601,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) return Status; } - - /* Check for a valid Period */ - if (Period < 0) return STATUS_INVALID_PARAMETER_6; /* Get the Timer Object */ Status = ObReferenceObjectByHandle(TimerHandle, @@ -640,7 +645,7 @@ /* Cancel the Timer */ KeCancelTimer(&Timer->KeTimer); KeRemoveQueueDpc(&Timer->TimerDpc); - if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo = 2; + if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo++; DerefsToDo++; } else @@ -653,6 +658,7 @@ State = KeReadStateTimer(&Timer->KeTimer); /* Handle Wake Timers */ + Timer->WakeTimer = WakeTimer; KeAcquireSpinLockAtDpcLevel(&ExpWakeListLock); if ((WakeTimer) && !(Timer->WakeTimerListEntry.Flink)) { @@ -713,7 +719,6 @@ } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - Status = _SEH_GetExceptionCode(); } _SEH_END; }
[View Less]
18 years, 2 months
1
0
0
0
[ion] 25607: - Fix some warnings. - Rearrange some code. - Remove useless/deprecated code.
by ion@svn.reactos.org
Author: ion Date: Wed Jan 24 01:46:38 2007 New Revision: 25607 URL:
http://svn.reactos.org/svn/reactos?rev=25607&view=rev
Log: - Fix some warnings. - Rearrange some code. - Remove useless/deprecated code. Modified: trunk/reactos/ntoskrnl/ex/handle.c trunk/reactos/ntoskrnl/include/internal/ke_x.h trunk/reactos/ntoskrnl/ke/wait.c Modified: trunk/reactos/ntoskrnl/ex/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/handle.c?rev=2…
=======================
…
[View More]
======================================================= --- trunk/reactos/ntoskrnl/ex/handle.c (original) +++ trunk/reactos/ntoskrnl/ex/handle.c Wed Jan 24 01:46:38 2007 @@ -1066,7 +1066,7 @@ /* Loop each entry */ while (NewTable->NextHandleNeedingPool < - HandleTable->NextHandleNeedingPool) + HandleTable->NextHandleNeedingPool) { /* Insert it into the duplicated copy */ if (!ExpAllocateHandleTableEntrySlow(NewTable, FALSE)) Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke_x.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ke_x.h Wed Jan 24 01:46:38 2007 @@ -193,7 +193,8 @@ (Object)->OwnerThread = Thread; \ \ /* Disable APCs if needed */ \ - Thread->KernelApcDisable -= (Object)->ApcDisable; \ + Thread->KernelApcDisable = Thread->KernelApcDisable - \ + (Object)->ApcDisable; \ \ /* Check if it's abandoned */ \ if ((Object)->Abandoned) \ @@ -238,7 +239,8 @@ (Object)->OwnerThread = Thread; \ \ /* Disable APCs if needed */ \ - Thread->KernelApcDisable -= (Object)->ApcDisable; \ + Thread->KernelApcDisable = Thread->KernelApcDisable - \ + (Object)->ApcDisable; \ \ /* Check if it's abandoned */ \ if ((Object)->Abandoned) \ @@ -259,7 +261,7 @@ // // Satisfies the wait of any nonmutant dispatcher object // -#define KiSatisfyNonMutantWait(Object, Thread) \ +#define KiSatisfyNonMutantWait(Object) \ { \ if (((Object)->Header.Type & TIMER_OR_EVENT_TYPE) == \ EventSynchronizationObject) \ @@ -454,7 +456,7 @@ /* Fill out the wait block */ \ WaitBlock = &WaitBlockArray[Index]; \ WaitBlock->Object = Object[Index]; \ - WaitBlock->WaitKey = Index; \ + WaitBlock->WaitKey = (USHORT)Index; \ WaitBlock->WaitType = WaitType; \ WaitBlock->Thread = Thread; \ \ @@ -1470,10 +1472,6 @@ FORCEINLINE KiInsertWaitTimer(IN PKTIMER Timer) { - /* Set default data */ - Timer->Header.Inserted = TRUE; - if (!Timer->Period) Timer->Header.SignalState = FALSE; - /* Now insert it into the Timer List */ InsertAscendingList(&KiTimerListHead, Timer, Modified: trunk/reactos/ntoskrnl/ke/wait.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/wait.c?rev=256…
============================================================================== --- trunk/reactos/ntoskrnl/ke/wait.c (original) +++ trunk/reactos/ntoskrnl/ke/wait.c Wed Jan 24 01:46:38 2007 @@ -11,33 +11,9 @@ #include <ntoskrnl.h> #define NDEBUG -#include <internal/debug.h> +#include <debug.h> /* PRIVATE FUNCTIONS *********************************************************/ - -#if 0 -VOID -FASTCALL -KiWaitSatisfyAll(PKWAIT_BLOCK FirstBlock) -{ - PKWAIT_BLOCK WaitBlock = FirstBlock; - PKTHREAD WaitThread = WaitBlock->Thread; - - /* Loop through all the Wait Blocks, and wake each Object */ - do - { - /* Make sure it hasn't timed out */ - if (WaitBlock->WaitKey != STATUS_TIMEOUT) - { - /* Wake the Object */ - KiSatisfyObjectWait((PKMUTANT)WaitBlock->Object, WaitThread); - } - - /* Move to the next block */ - WaitBlock = WaitBlock->NextWaitBlock; - } while (WaitBlock != FirstBlock); -} -#endif VOID FASTCALL @@ -163,7 +139,7 @@ BOOLEAN PendingApc; /* Make sure we're at synchronization level */ - ASSERT_IRQL_EQUAL(SYNCH_LEVEL); + ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL); /* Check if we have deferred threads */ KiCheckDeferredReadyList(Prcb); @@ -288,7 +264,7 @@ /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ goto NoWait; @@ -426,7 +402,7 @@ else if (CurrentObject->Header.SignalState > 0) { /* Another satisfied object */ - KiSatisfyNonMutantWait(CurrentObject, Thread); + KiSatisfyNonMutantWait(CurrentObject); WaitStatus = STATUS_WAIT_0; goto DontWait; } @@ -440,7 +416,8 @@ { /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= + Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ WaitStatus = STATUS_TIMEOUT; @@ -626,7 +603,7 @@ else if (CurrentObject->Header.SignalState > 0) { /* Another signaled object, unwait and return */ - KiSatisfyNonMutantWait(CurrentObject, Thread); + KiSatisfyNonMutantWait(CurrentObject); WaitStatus = Index; goto DontWait; } @@ -702,7 +679,8 @@ { /* Check if the timer expired */ InterruptTime.QuadPart = KeQueryInterruptTime(); - if (InterruptTime.QuadPart >= Timer->DueTime.QuadPart) + if ((ULONGLONG)InterruptTime.QuadPart >= + Timer->DueTime.QuadPart) { /* It did, so we don't need to wait */ WaitStatus = STATUS_TIMEOUT;
[View Less]
18 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
41
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
Results per page:
10
25
50
100
200