ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
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
July 2011
----- 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
24 participants
517 discussions
Start a n
N
ew thread
[gadamopoulos] 52543: [uxtheme] - Implement drawing the menu bar
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Tue Jul 5 10:09:26 2011 New Revision: 52543 URL:
http://svn.reactos.org/svn/reactos?rev=52543&view=rev
Log: [uxtheme] - Implement drawing the menu bar Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win…
============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] Tue Jul 5 10:09:26 2011 @@ -58,6 +58,28 @@ #define HAS_MENU(hwnd,style) ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && GetMenu(hwnd)) #define BUTTON_GAP_SIZE 2 + + +HFONT hMenuFont = NULL; +HFONT hMenuFontBold = NULL; + +void InitMenuFont(VOID) +{ + NONCLIENTMETRICS ncm; + + ncm.cbSize = sizeof(NONCLIENTMETRICS); + + if(!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)) + { + return ; + } + + hMenuFont = CreateFontIndirect(&ncm.lfMenuFont); + + ncm.lfMenuFont.lfWeight = max(ncm.lfMenuFont.lfWeight + 300, 1000); + hMenuFontBold = CreateFontIndirectW(&ncm.lfMenuFont); + +} static BOOL IsWindowActive(HWND hWnd, DWORD ExStyle) @@ -483,9 +505,142 @@ } static void +ThemeDrawMenuItem(PDRAW_CONTEXT pcontext, HMENU Menu, int imenu) +{ + PWCHAR Text; + BOOL flat_menu = FALSE; + MENUITEMINFOW Item; + RECT Rect,rcCalc; + WCHAR wstrItemText[20]; + register int i = 0; + HFONT FontOld = NULL; + UINT uFormat = DT_CENTER | DT_VCENTER | DT_SINGLELINE; + + Item.cbSize = sizeof(MENUITEMINFOW); + Item.fMask = MIIM_FTYPE | MIIM_STATE | MIIM_STRING; + Item.dwTypeData = wstrItemText; + Item.cch = 20; + if (!GetMenuItemInfoW(Menu, imenu, TRUE, &Item)) + return; + + if(Item.fType & MF_SEPARATOR) + return; + + if(Item.cch >= 20) + { + Item.cch++; + Item.dwTypeData = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, Item.cch * sizeof(WCHAR)); + Item.fMask = MIIM_FTYPE | MIIM_STATE | MIIM_STRING; + GetMenuItemInfoW(Menu, imenu, TRUE, &Item); + } + + if(Item.cch == 0) + return; + + flat_menu = GetThemeSysBool(pcontext->theme, TMT_FLATMENUS); + + GetMenuItemRect(pcontext->hWnd, Menu, imenu, &Rect); + + OffsetRect(&Rect, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top); + + SetBkColor(pcontext->hDC, GetSysColor(flat_menu ? COLOR_MENUBAR : COLOR_MENU)); + SetTextColor(pcontext->hDC, GetSysColor(Item.fState & MF_GRAYED ? COLOR_GRAYTEXT : COLOR_MENUTEXT)); + + if (0 != (Item.fState & MFS_DEFAULT)) + { + FontOld = (HFONT)SelectObject(pcontext->hDC, hMenuFontBold); + } + + Rect.left += MENU_BAR_ITEMS_SPACE / 2; + Rect.right -= MENU_BAR_ITEMS_SPACE / 2; + + Text = (PWCHAR) Item.dwTypeData; + if(Text) + { + for (i = 0; L'\0' != Text[i]; i++) + { + if (L'\t' == Text[i] || L'\b' == Text[i]) + { + break; + } + } + } + + SetBkMode(pcontext->hDC, OPAQUE); + + if (0 != (Item.fState & MF_GRAYED)) + { + if (0 == (Item.fState & MF_HILITE)) + { + ++Rect.left; ++Rect.top; ++Rect.right; ++Rect.bottom; + SetTextColor(pcontext->hDC, RGB(0xff, 0xff, 0xff)); + DrawTextW(pcontext->hDC, Text, i, &Rect, uFormat); + --Rect.left; --Rect.top; --Rect.right; --Rect.bottom; + } + SetTextColor(pcontext->hDC, RGB(0x80, 0x80, 0x80)); + SetBkMode(pcontext->hDC, TRANSPARENT); + } + + DrawTextW(pcontext->hDC, Text, i, &Rect, uFormat); + + /* Exclude the area drawn by DrawText from the clip region */ + SetRect(&rcCalc, 0,0,0,0); + DrawTextW(pcontext->hDC, Text, i, &rcCalc, uFormat | DT_CALCRECT); + InflateRect( &Rect, 0, -(rcCalc.bottom+1)/2); + ExcludeClipRect(pcontext->hDC, Rect.left, Rect.top, Rect.right, Rect.bottom); + + if (NULL != FontOld) + { + SelectObject(pcontext->hDC, FontOld); + } +} + +void WINAPI ThemeDrawMenuBar(PDRAW_CONTEXT pcontext, PRECT prcCurrent) { - + HMENU Menu; + MENUBARINFO MenuBarInfo; + int i; + HFONT FontOld = NULL; + BOOL flat_menu; + RECT Rect; + HPEN oldPen ; + + if (!hMenuFont) + InitMenuFont(); + + flat_menu = GetThemeSysBool(pcontext->theme, TMT_FLATMENUS); + + MenuBarInfo.cbSize = sizeof(MENUBARINFO); + if (! GetMenuBarInfo(pcontext->hWnd, OBJID_MENU, 0, &MenuBarInfo)) + return; + + Menu = GetMenu(pcontext->hWnd); + if (GetMenuItemCount(Menu) == 0) + return; + + Rect = MenuBarInfo.rcBar; + OffsetRect(&Rect, -pcontext->wi.rcWindow.left, -pcontext->wi.rcWindow.top); + + /* Draw a line under the menu*/ + oldPen = (HPEN)SelectObject(pcontext->hDC, GetStockObject(DC_PEN)); + SetDCPenColor(pcontext->hDC, GetSysColor(COLOR_3DFACE)); + MoveToEx(pcontext->hDC, Rect.left, Rect.bottom, NULL); + LineTo(pcontext->hDC, Rect.right, Rect.bottom); + SelectObject(pcontext->hDC, oldPen); + + /* Draw menu items */ + FontOld = (HFONT)SelectObject(pcontext->hDC, hMenuFont); + + for (i = 0; i < GetMenuItemCount(Menu); i++) + { + ThemeDrawMenuItem(pcontext, Menu, i); + } + + SelectObject(pcontext->hDC, FontOld); + + /* Fill the menu background area that isn't painted yet*/ + FillRect(pcontext->hDC, &Rect, GetSysColorBrush(flat_menu ? COLOR_MENUBAR : COLOR_MENU)); } static void
13 years, 5 months
1
0
0
0
[gadamopoulos] 52542: [uxtheme] - Fill in WINDOWINFO.cbSize before calling GetWindowInfo - Handle invalid regions passed to WM_NCPAINT - Handle WM_NCUAHDRAWCAPTION and WM_NCUAHDRAWFRAME without doi...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Tue Jul 5 10:04:25 2011 New Revision: 52542 URL:
http://svn.reactos.org/svn/reactos?rev=52542&view=rev
Log: [uxtheme] - Fill in WINDOWINFO.cbSize before calling GetWindowInfo - Handle invalid regions passed to WM_NCPAINT - Handle WM_NCUAHDRAWCAPTION and WM_NCUAHDRAWFRAME without doing anything there for now Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win…
============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] Tue Jul 5 10:04:25 2011 @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS uxtheme.dll - * FILE: dll/win32/uxtheme/themehooks.c + * FILE: dll/win32/uxtheme/nonclient.c * PURPOSE: uxtheme non client area management * PROGRAMMER: Giannis Adamopoulos */ @@ -181,6 +181,7 @@ HWND hWnd, HRGN hRgn) { + pcontext->wi.cbSize = sizeof(pcontext->wi); GetWindowInfo(hWnd, &pcontext->wi); pcontext->hWnd = hWnd; pcontext->Active = IsWindowActive(hWnd, pcontext->wi.dwExStyle); @@ -189,15 +190,11 @@ pcontext->CaptionHeight = pcontext->wi.cyWindowBorders; pcontext->CaptionHeight += GetSystemMetrics(pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMCAPTION : SM_CYCAPTION ); - if(hRgn <= 0) + if(hRgn <= (HRGN)1) { hRgn = CreateRectRgnIndirect(&pcontext->wi.rcWindow); - pcontext->hRgn = hRgn; - } - else - { - pcontext->hRgn = 0; - } + } + pcontext->hRgn = hRgn; pcontext->hDC = GetDCEx(hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_USESTYLE | DCX_KEEPCLIPRGN); } @@ -905,7 +902,11 @@ Point.y = GET_Y_LPARAM(lParam); return DefWndNCHitTest(hWnd, Point); } + case WM_NCUAHDRAWCAPTION: + case WM_NCUAHDRAWFRAME: + /* FIXME: how should these be handled? */ + return 0; default: return DefWndProc(hWnd, Msg, wParam, lParam); } -} +}
13 years, 5 months
1
0
0
0
[tfaber] 52541: [KMTESTS] - prepare the device object for being opened multiple times (required for communication with special-purpose drivers) - more verbose DPRINTs - implement utility functions ...
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Jul 4 19:47:49 2011 New Revision: 52541 URL:
http://svn.reactos.org/svn/reactos?rev=52541&view=rev
Log: [KMTESTS] - prepare the device object for being opened multiple times (required for communication with special-purpose drivers) - more verbose DPRINTs - implement utility functions for app<->driver communication - misc fixes Modified: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c branches/GSoC_2011/KMTestSuite/kmtests/kmtest/support.c branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c Modified: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/i…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] Mon Jul 4 19:47:49 2011 @@ -38,7 +38,14 @@ CHAR LogBuffer[ANYSIZE_ARRAY]; } KMT_RESULTBUFFER, *PKMT_RESULTBUFFER; -#if defined KMT_USER_MODE +#ifdef KMT_KERNEL_MODE +/* Device Extension layout */ +typedef struct +{ + PKMT_RESULTBUFFER ResultBuffer; + PMDL Mdl; +} KMT_DEVICE_EXTENSION, *PKMT_DEVICE_EXTENSION; +#elif defined KMT_USER_MODE VOID KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning); VOID KmtUnloadDriver(VOID); VOID KmtOpenDriver(VOID); @@ -46,7 +53,7 @@ DWORD KmtSendToDriver(IN DWORD ControlCode); DWORD KmtSendStringToDriver(IN DWORD ControlCode, IN PCSTR String); -DWORD KmtSendBufferToDriver(IN DWORD ControlCode, IN OUT PVOID Buffer, IN DWORD Length); +DWORD KmtSendBufferToDriver(IN DWORD ControlCode, IN OUT PVOID Buffer, IN OUT PDWORD Length); #endif /* defined KMT_USER_MODE */ extern PKMT_RESULTBUFFER ResultBuffer; @@ -95,6 +102,11 @@ #define ok_eq_str(value, expected) ok(!strcmp(value, expected), #value " = \"%s\", expected \"%s\"\n", value, expected) #define ok_eq_wstr(value, expected) ok(!wcscmp(value, expected), #value " = \"%ls\", expected \"%ls\"\n", value, expected) +#define KMT_MAKE_CODE(ControlCode) CTL_CODE(FILE_DEVICE_UNKNOWN, \ + 0xA00 + (ControlCode), \ + METHOD_BUFFERED, \ + FILE_ANY_ACCESS) + #if defined KMT_DEFINE_TEST_FUNCTIONS PKMT_RESULTBUFFER ResultBuffer = NULL; @@ -122,6 +134,9 @@ { LONG OldLength; LONG NewLength; + + if (!Buffer) + return; do { @@ -199,6 +214,9 @@ CHAR MessageBuffer[512]; SIZE_T MessageLength; + if (!ResultBuffer) + return; + MessageLength = KmtXSNPrintF(MessageBuffer, sizeof MessageBuffer, NULL, NULL, "%s: %ld tests executed (0 marked as todo, %ld failures), %ld skipped.\n", TestName, @@ -213,6 +231,9 @@ CHAR MessageBuffer[512]; SIZE_T MessageLength; + if (!ResultBuffer) + return; + if (Condition) { InterlockedIncrement(&ResultBuffer->Successes); @@ -260,6 +281,9 @@ { CHAR MessageBuffer[512]; SIZE_T MessageLength; + + if (!ResultBuffer) + return !Condition; if (!Condition) { Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c [iso-8859-1] Mon Jul 4 19:47:49 2011 @@ -9,13 +9,13 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <strsafe.h> +#include <winioctl.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> #include "kmtest.h" -#include <winioctl.h> #include <kmt_public.h> #define KMT_DEFINE_TEST_FUNCTIONS #include <kmt_test.h> @@ -187,7 +187,7 @@ KmtFinishTest(TestName); if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), ResultBuffer->LogBuffer, ResultBuffer->LogBufferLength, &BytesWritten, NULL)) - Error = GetLastError(); + error(Error); return Error; } @@ -229,7 +229,8 @@ error_goto(Error, cleanup); cleanup: - OutputResult(TestName); + if (!Error) + OutputResult(TestName); KmtFreeResultBuffer(ResultBuffer); Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest/support.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest/support.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest/support.c [iso-8859-1] Mon Jul 4 19:47:49 2011 @@ -9,20 +9,26 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <strsafe.h> +#include <winioctl.h> + +#include <assert.h> #include "kmtest.h" +#include <kmt_public.h> #include <kmt_test.h> -#include <kmt_public.h> /* pseudo-tests */ START_TEST(Create) { - // nothing to do here. All tests start the service if needed + // nothing to do here. All tests create the service if needed } START_TEST(Delete) { - // TODO: delete kmtest service + SC_HANDLE Handle = NULL; + DWORD Error = KmtDeleteService(L"Kmtest", &Handle); + + ok_eq_hex(Error, (DWORD)ERROR_SUCCESS); } START_TEST(Start) @@ -32,7 +38,14 @@ START_TEST(Stop) { - // TODO: stop kmtest service + // TODO: requiring the service to be started for this is... bad, + // especially when it's marked for deletion and won't start ;) + SC_HANDLE Handle = NULL; + DWORD Error = KmtStopService(L"Kmtest", &Handle); + + ok_eq_hex(Error, (DWORD)ERROR_SUCCESS); + Error = KmtCloseService(&Handle); + ok_eq_hex(Error, (DWORD)ERROR_SUCCESS); } /* test support functions for special-purpose drivers */ @@ -107,7 +120,7 @@ StringCbCopy(DevicePath, sizeof DevicePath, L"\\\\.\\Global\\GLOBALROOT\\Device\\"); StringCbCat(DevicePath, sizeof DevicePath, TestServiceName); - TestDeviceHandle = CreateFile(KMTEST_DEVICE_PATH, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + TestDeviceHandle = CreateFile(DevicePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (TestDeviceHandle == INVALID_HANDLE_VALUE) error(Error); @@ -138,8 +151,6 @@ __debugbreak(); } } - -/* TODO: check if these will be useful */ /** * @name KmtSendToDriver @@ -154,8 +165,12 @@ KmtSendToDriver( IN DWORD ControlCode) { - // TODO - return ERROR_CALL_NOT_IMPLEMENTED; + DWORD BytesRead; + + if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), NULL, 0, NULL, 0, &BytesRead, NULL)) + return GetLastError(); + + return ERROR_SUCCESS; } /** @@ -173,8 +188,12 @@ IN DWORD ControlCode, IN PCSTR String) { - // TODO - return ERROR_CALL_NOT_IMPLEMENTED; + DWORD BytesRead; + + if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), (PVOID)String, strlen(String), NULL, 0, &BytesRead, NULL)) + return GetLastError(); + + return ERROR_SUCCESS; } /** @@ -190,8 +209,12 @@ KmtSendBufferToDriver( IN DWORD ControlCode, IN OUT PVOID Buffer, - IN DWORD Length) -{ - // TODO - return ERROR_CALL_NOT_IMPLEMENTED; + IN OUT PDWORD Length) +{ + assert(Length); + + if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), Buffer, *Length, NULL, 0, Length, NULL)) + return GetLastError(); + + return ERROR_SUCCESS; } Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Mon Jul 4 19:47:49 2011 @@ -24,13 +24,6 @@ static DRIVER_DISPATCH DriverClose; static DRIVER_DISPATCH DriverIoControl; -/* Device Extension layout */ -typedef struct -{ - PKMT_RESULTBUFFER ResultBuffer; - PMDL Mdl; -} KMT_DEVICE_EXTENSION, *PKMT_DEVICE_EXTENSION; - /* Globals */ static PDEVICE_OBJECT MainDeviceObject; @@ -68,13 +61,13 @@ &DeviceName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN | FILE_READ_ONLY_DEVICE, - TRUE, &MainDeviceObject); + FALSE, &MainDeviceObject); if (!NT_SUCCESS(Status)) goto cleanup; - DPRINT("DriverEntry. Created DeviceObject %p\n", - MainDeviceObject); + DPRINT("DriverEntry. Created DeviceObject %p. DeviceExtension %p\n", + MainDeviceObject, MainDeviceObject->DeviceExtension); DeviceExtension = MainDeviceObject->DeviceExtension; DeviceExtension->ResultBuffer = NULL; DeviceExtension->Mdl = NULL; @@ -146,19 +139,14 @@ { NTSTATUS Status = STATUS_SUCCESS; PIO_STACK_LOCATION IoStackLocation; - PKMT_DEVICE_EXTENSION DeviceExtension; PAGED_CODE(); IoStackLocation = IoGetCurrentIrpStackLocation(Irp); - DPRINT("DriverCreate. DeviceObject=%p\n", - DeviceObject); - - DeviceExtension = DeviceObject->DeviceExtension; - ASSERT(!DeviceExtension->Mdl); - ASSERT(!DeviceExtension->ResultBuffer); - ASSERT(!ResultBuffer); + DPRINT("DriverCreate. DeviceObject=%p, RequestorMode=%d, FileObject=%p, FsContext=%p, FsContext2=%p\n", + DeviceObject, Irp->RequestorMode, IoStackLocation->FileObject, + IoStackLocation->FileObject->FsContext, IoStackLocation->FileObject->FsContext2); Irp->IoStatus.Status = Status; Irp->IoStatus.Information = 0; @@ -195,17 +183,23 @@ IoStackLocation = IoGetCurrentIrpStackLocation(Irp); - DPRINT("DriverClose. DeviceObject=%p\n", - DeviceObject); - + DPRINT("DriverClose. DeviceObject=%p, RequestorMode=%d, FileObject=%p, FsContext=%p, FsContext2=%p\n", + DeviceObject, Irp->RequestorMode, IoStackLocation->FileObject, + IoStackLocation->FileObject->FsContext, IoStackLocation->FileObject->FsContext2); + + ASSERT(IoStackLocation->FileObject->FsContext2 == NULL); DeviceExtension = DeviceObject->DeviceExtension; - if (DeviceExtension->Mdl) + if (DeviceExtension->Mdl && IoStackLocation->FileObject->FsContext == DeviceExtension->Mdl) { MmUnlockPages(DeviceExtension->Mdl); IoFreeMdl(DeviceExtension->Mdl); DeviceExtension->Mdl = NULL; ResultBuffer = DeviceExtension->ResultBuffer = NULL; } + else + { + ASSERT(IoStackLocation->FileObject->FsContext == NULL); + } Irp->IoStatus.Status = Status; Irp->IoStatus.Information = 0; @@ -242,9 +236,10 @@ IoStackLocation = IoGetCurrentIrpStackLocation(Irp); - DPRINT("DriverIoControl. Code=0x%08X, DeviceObject=%p\n", + DPRINT("DriverIoControl. Code=0x%08X, DeviceObject=%p, FileObject=%p, FsContext=%p, FsContext2=%p\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode, - DeviceObject); + DeviceObject, IoStackLocation->FileObject, + IoStackLocation->FileObject->FsContext, IoStackLocation->FileObject->FsContext2); switch (IoStackLocation->Parameters.DeviceIoControl.IoControlCode) { @@ -315,8 +310,15 @@ if (DeviceExtension->Mdl) { + if (IoStackLocation->FileObject->FsContext != DeviceExtension->Mdl) + { + Status = STATUS_ACCESS_DENIED; + break; + } MmUnlockPages(DeviceExtension->Mdl); IoFreeMdl(DeviceExtension->Mdl); + IoStackLocation->FileObject->FsContext = NULL; + ResultBuffer = DeviceExtension->ResultBuffer = NULL; } DeviceExtension->Mdl = IoAllocateMdl(IoStackLocation->Parameters.DeviceIoControl.Type3InputBuffer, @@ -341,6 +343,7 @@ } _SEH2_END; ResultBuffer = DeviceExtension->ResultBuffer = MmGetSystemAddressForMdlSafe(DeviceExtension->Mdl, NormalPagePriority); + IoStackLocation->FileObject->FsContext = DeviceExtension->Mdl; DPRINT("DriverIoControl. ResultBuffer: %ld %ld %ld %ld\n", ResultBuffer->Successes, ResultBuffer->Failures,
13 years, 5 months
1
0
0
0
[cgutman] 52540: [USETUP] - Remove formatting and partitioning hacks which are unnecessary after fixing the invalid signature bug in the FAT formatting code
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 4 19:39:34 2011 New Revision: 52540 URL:
http://svn.reactos.org/svn/reactos?rev=52540&view=rev
Log: [USETUP] - Remove formatting and partitioning hacks which are unnecessary after fixing the invalid signature bug in the FAT formatting code Modified: trunk/reactos/base/setup/usetup/interface/usetup.c trunk/reactos/base/setup/usetup/partlist.c Modified: trunk/reactos/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
============================================================================== --- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Mon Jul 4 19:39:34 2011 @@ -2450,75 +2450,6 @@ CheckActiveBootPartition(PartitionList); } - if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0) - { - /* FIXME: Install boot code. This is a hack! */ - if ((PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32_XINT13) || - (PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32)) - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\fat32.bin"); - - DPRINT("Install FAT32 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - else - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\fat.bin"); - - DPRINT("Install FAT bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat16BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - } - else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0) - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\ext2.bin"); - - DPRINT("Install EXT2 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - else if (FileSystemList->Selected->FormatFunc) - { - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - #ifndef NDEBUG CONSOLE_SetStatusText(" Done. Press any key ..."); CONSOLE_ConInKey(Ir); Modified: trunk/reactos/base/setup/usetup/partlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
============================================================================== --- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Mon Jul 4 19:39:34 2011 @@ -2495,7 +2495,6 @@ PDRIVE_LAYOUT_INFORMATION DriveLayout; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK Iosb; - WCHAR SrcPath[MAX_PATH]; WCHAR DstPath[MAX_PATH]; UNICODE_STRING Name; HANDLE FileHandle; @@ -2689,30 +2688,6 @@ DriveLayout); NtClose (FileHandle); - - /* Install MBR code if the disk is new */ - if (DiskEntry1->NewDisk == TRUE && - DiskEntry1->BiosDiskNumber == 0) - { - wcscpy (SrcPath, SourceRootPath.Buffer); - wcscat (SrcPath, L"\\loader\\dosmbr.bin"); - - DPRINT ("Install MBR bootcode: %S ==> %S\n", - SrcPath, DstPath); - - /* Install MBR bootcode */ - Status = InstallMbrBootCodeToDisk (SrcPath, - DstPath); - if (!NT_SUCCESS (Status)) - { - DPRINT1 ("InstallMbrBootCodeToDisk() failed (Status %lx)\n", - Status); - return FALSE; - } - - DiskEntry1->NewDisk = FALSE; - DiskEntry1->NoMbr = FALSE; - } } Entry1 = Entry1->Flink;
13 years, 5 months
1
0
0
0
[cgutman] 52539: [AFD] - Move the TdiReceiveDatagram call to WarmSocketForBind like it is done for connects
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 4 19:13:45 2011 New Revision: 52539 URL:
http://svn.reactos.org/svn/reactos?rev=52539&view=rev
Log: [AFD] - Move the TdiReceiveDatagram call to WarmSocketForBind like it is done for connects Modified: trunk/reactos/drivers/network/afd/afd/bind.c Modified: trunk/reactos/drivers/network/afd/afd/bind.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/bi…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/bind.c [iso-8859-1] Mon Jul 4 19:13:45 2011 @@ -37,13 +37,33 @@ if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) { - Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object, - &FCB->Recv.Size); - if (NT_SUCCESS(Status)) + if (!FCB->Recv.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object, + &FCB->Recv.Size); + } + + if (NT_SUCCESS(Status) && !FCB->Recv.Window) { FCB->Recv.Window = ExAllocatePool(PagedPool, FCB->Recv.Size); if (!FCB->Recv.Window) Status = STATUS_NO_MEMORY; + } + + if (NT_SUCCESS(Status)) + { + Status = TdiReceiveDatagram(&FCB->ReceiveIrp.InFlightRequest, + FCB->AddressFile.Object, + 0, + FCB->Recv.Window, + FCB->Recv.Size, + FCB->AddressFrom, + &FCB->ReceiveIrp.Iosb, + PacketSocketRecvComplete, + FCB); + + /* We don't want to wait for this read to complete. */ + if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; } } @@ -78,27 +98,6 @@ Status = WarmSocketForBind( FCB ); AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags)); - if( !NT_SUCCESS(Status) ) - return UnlockAndMaybeComplete(FCB, Status, Irp, 0); - - if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) { - AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n")); - - Status = TdiReceiveDatagram - ( &FCB->ReceiveIrp.InFlightRequest, - FCB->AddressFile.Object, - 0, - FCB->Recv.Window, - FCB->Recv.Size, - FCB->AddressFrom, - &FCB->ReceiveIrp.Iosb, - PacketSocketRecvComplete, - FCB ); - - /* We don't want to wait for this read to complete. */ - if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; - } - if (NT_SUCCESS(Status)) FCB->State = SOCKET_STATE_BOUND;
13 years, 5 months
1
0
0
0
[cgutman] 52538: [AFD] - Add support for AFD_INFO_INLINING_MODE - Add support for setting AFD_INFO_RECEIVE_WINDOW_SIZE and AFD_INFO_SEND_WINDOW_SIZE - None of this is used by our current msafd but ...
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 4 18:07:55 2011 New Revision: 52538 URL:
http://svn.reactos.org/svn/reactos?rev=52538&view=rev
Log: [AFD] - Add support for AFD_INFO_INLINING_MODE - Add support for setting AFD_INFO_RECEIVE_WINDOW_SIZE and AFD_INFO_SEND_WINDOW_SIZE - None of this is used by our current msafd but mswsock_new uses it Modified: trunk/reactos/drivers/network/afd/afd/connect.c trunk/reactos/drivers/network/afd/afd/info.c trunk/reactos/drivers/network/afd/include/afd.h Modified: trunk/reactos/drivers/network/afd/afd/connect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Mon Jul 4 18:07:55 2011 @@ -223,26 +223,33 @@ ASSERT(!FCB->Recv.Window); ASSERT(!FCB->Send.Window); - Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, - &FCB->Send.Size); - if (!NT_SUCCESS(Status)) - return Status; - - FCB->Recv.Size = FCB->Send.Size; + if (!FCB->Recv.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, + &FCB->Recv.Size); + if (!NT_SUCCESS(Status)) + return Status; + } + + if (!FCB->Send.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, + &FCB->Send.Size); + if (!NT_SUCCESS(Status)) + return Status; + } /* Allocate the receive area and start receiving */ - FCB->Recv.Window = - ExAllocatePool( PagedPool, FCB->Recv.Size ); - - if( !FCB->Recv.Window ) return STATUS_NO_MEMORY; - - FCB->Send.Window = - ExAllocatePool( PagedPool, FCB->Send.Size ); - - if( !FCB->Send.Window ) { - ExFreePool( FCB->Recv.Window ); - FCB->Recv.Window = NULL; - return STATUS_NO_MEMORY; + if (!FCB->Recv.Window) + { + FCB->Recv.Window = ExAllocatePool( PagedPool, FCB->Recv.Size ); + if( !FCB->Recv.Window ) return STATUS_NO_MEMORY; + } + + if (!FCB->Send.Window) + { + FCB->Send.Window = ExAllocatePool( PagedPool, FCB->Send.Size ); + if( !FCB->Send.Window ) return STATUS_NO_MEMORY; } FCB->State = SOCKET_STATE_CONNECTED; Modified: trunk/reactos/drivers/network/afd/afd/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Mon Jul 4 18:07:55 2011 @@ -50,6 +50,10 @@ case AFD_INFO_BLOCKING_MODE: InfoReq->Information.Boolean = FCB->NonBlocking; break; + + case AFD_INFO_INLINING_MODE: + InfoReq->Information.Boolean = FCB->OobInline; + break; case AFD_INFO_RECEIVE_CONTENT_SIZE: /* Only touch InfoReq if a socket has been set up. @@ -106,6 +110,7 @@ PAFD_INFO InfoReq = LockRequest(Irp, IrpSp); PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; + PCHAR NewBuffer; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); @@ -117,6 +122,61 @@ case AFD_INFO_BLOCKING_MODE: AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n", InfoReq->Information.Boolean)); FCB->NonBlocking = InfoReq->Information.Boolean; + break; + case AFD_INFO_INLINING_MODE: + FCB->OobInline = InfoReq->Information.Boolean; + break; + case AFD_INFO_RECEIVE_WINDOW_SIZE: + NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong); + if (NewBuffer) + { + if (FCB->Recv.Content > InfoReq->Information.Ulong) + FCB->Recv.Content = InfoReq->Information.Ulong; + + if (FCB->Recv.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Recv.Window, + FCB->Recv.Content); + + ExFreePool(FCB->Recv.Window); + } + + FCB->Recv.Size = InfoReq->Information.Ulong; + FCB->Recv.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } + break; + case AFD_INFO_SEND_WINDOW_SIZE: + NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong); + if (NewBuffer) + { + if (FCB->Send.BytesUsed > InfoReq->Information.Ulong) + FCB->Send.BytesUsed = InfoReq->Information.Ulong; + + if (FCB->Send.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Send.Window, + FCB->Send.BytesUsed); + + ExFreePool(FCB->Send.Window); + } + + FCB->Send.Size = InfoReq->Information.Ulong; + FCB->Send.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } break; default: AFD_DbgPrint(MIN_TRACE,("Unknown request %d\n", InfoReq->InformationClass)); Modified: trunk/reactos/drivers/network/afd/include/afd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
============================================================================== --- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Jul 4 18:07:55 2011 @@ -173,7 +173,7 @@ } AFD_STORED_DATAGRAM, *PAFD_STORED_DATAGRAM; typedef struct _AFD_FCB { - BOOLEAN Locked, Critical, Overread, NonBlocking; + BOOLEAN Locked, Critical, Overread, NonBlocking, OobInline; UINT State, Flags, GroupID, GroupType; KIRQL OldIrql; UINT LockCount;
13 years, 5 months
1
0
0
0
[cgutman] 52537: [MSAFD/AFD] - Pass the non-blocking information as a boolean (mswsock_new does this too) [AFD] - Don't block waiting for a connection to accept on a non-blocking listener
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 4 17:37:45 2011 New Revision: 52537 URL:
http://svn.reactos.org/svn/reactos?rev=52537&view=rev
Log: [MSAFD/AFD] - Pass the non-blocking information as a boolean (mswsock_new does this too) [AFD] - Don't block waiting for a connection to accept on a non-blocking listener Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c trunk/reactos/dll/win32/msafd/misc/event.c trunk/reactos/dll/win32/msafd/misc/sndrcv.c trunk/reactos/dll/win32/msafd/msafd.h trunk/reactos/drivers/network/afd/afd/info.c trunk/reactos/drivers/network/afd/afd/listen.c trunk/reactos/drivers/network/afd/afd/read.c trunk/reactos/drivers/network/afd/afd/write.c trunk/reactos/drivers/network/afd/include/afd.h Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -264,7 +264,7 @@ /* Save Group Info */ if (g != 0) { - GetSocketInformation(Socket, AFD_INFO_GROUP_ID_TYPE, 0, &GroupData); + GetSocketInformation(Socket, AFD_INFO_GROUP_ID_TYPE, NULL, NULL, &GroupData); Socket->SharedData.GroupID = GroupData.u.LowPart; Socket->SharedData.GroupType = GroupData.u.HighPart; } @@ -272,11 +272,13 @@ /* Get Window Sizes and Save them */ GetSocketInformation (Socket, AFD_INFO_SEND_WINDOW_SIZE, + NULL, &Socket->SharedData.SizeOfSendBuffer, NULL); GetSocketInformation (Socket, AFD_INFO_RECEIVE_WINDOW_SIZE, + NULL, &Socket->SharedData.SizeOfRecvBuffer, NULL); @@ -467,6 +469,7 @@ /* Find out how many Sends are in Progress */ if (GetSocketInformation(Socket, AFD_INFO_SENDS_IN_PROGRESS, + NULL, &SendsInProgress, NULL)) { @@ -1951,6 +1954,7 @@ { PSOCKET_INFORMATION Socket = NULL; BOOLEAN NeedsCompletion; + BOOLEAN NonBlocking; /* Get the Socket Structure associate to this Socket*/ Socket = GetSocketStructure(Handle); @@ -1970,8 +1974,9 @@ *lpErrno = WSAEFAULT; return SOCKET_ERROR; } - Socket->SharedData.NonBlocking = *((PULONG)lpvInBuffer) ? 1 : 0; - *lpErrno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, (PULONG)lpvInBuffer, NULL); + NonBlocking = *((PULONG)lpvInBuffer) ? TRUE : FALSE; + Socket->SharedData.NonBlocking = NonBlocking ? 1 : 0; + *lpErrno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &NonBlocking, NULL, NULL); if (*lpErrno != NO_ERROR) return SOCKET_ERROR; else @@ -1982,7 +1987,7 @@ *lpErrno = WSAEFAULT; return SOCKET_ERROR; } - *lpErrno = GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, (PULONG)lpvOutBuffer, NULL); + *lpErrno = GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, NULL, (PULONG)lpvOutBuffer, NULL); if (*lpErrno != NO_ERROR) return SOCKET_ERROR; else @@ -2258,6 +2263,7 @@ int GetSocketInformation(PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, + PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL) { @@ -2309,6 +2315,10 @@ { *LargeInteger = InfoData.Information.LargeInteger; } + if (Boolean != NULL) + { + *Boolean = InfoData.Information.Boolean; + } NtClose( SockEvent ); @@ -2319,7 +2329,8 @@ int SetSocketInformation(PSOCKET_INFORMATION Socket, - ULONG AfdInformationClass, + ULONG AfdInformationClass, + PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL) { @@ -2348,6 +2359,10 @@ if (LargeInteger != NULL) { InfoData.Information.LargeInteger = *LargeInteger; + } + if (Boolean != NULL) + { + InfoData.Information.Boolean = *Boolean; } AFD_DbgPrint(MID_TRACE,("XXX Info %x (Data %x)\n", Modified: trunk/reactos/dll/win32/msafd/misc/event.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/event…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/event.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/event.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -26,7 +26,7 @@ AFD_EVENT_SELECT_INFO EventSelectInfo; PSOCKET_INFORMATION Socket = NULL; NTSTATUS Status; - ULONG BlockMode; + BOOLEAN BlockMode; HANDLE SockEvent; Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE, @@ -44,8 +44,8 @@ } /* Set Socket to Non-Blocking */ - BlockMode = 1; - SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL); + BlockMode = TRUE; + SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL, NULL); Socket->SharedData.NonBlocking = TRUE; /* Deactivate Async Select if there is one */ Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/sndrc…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -25,7 +25,7 @@ PSOCKET_INFORMATION Socket = NULL; PASYNC_DATA AsyncData; NTSTATUS Status; - ULONG BlockMode; + BOOLEAN BlockMode; /* Get the Socket Structure associated to this Socket */ Socket = GetSocketStructure(Handle); @@ -44,8 +44,8 @@ } /* Change the Socket to Non Blocking */ - BlockMode = 1; - SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL); + BlockMode = TRUE; + SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL, NULL); Socket->SharedData.NonBlocking = TRUE; /* Deactive WSPEventSelect */ Modified: trunk/reactos/dll/win32/msafd/msafd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/msafd.h?re…
============================================================================== --- trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -417,14 +417,16 @@ int GetSocketInformation( PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, - PULONG Ulong OPTIONAL, + PBOOLEAN Boolean OPTIONAL, + PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL ); int SetSocketInformation( PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, - PULONG Ulong OPTIONAL, + PBOOLEAN Boolean OPTIONAL, + PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL ); Modified: trunk/reactos/drivers/network/afd/afd/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -48,7 +48,7 @@ break; case AFD_INFO_BLOCKING_MODE: - InfoReq->Information.Ulong = FCB->BlockingMode; + InfoReq->Information.Boolean = FCB->NonBlocking; break; case AFD_INFO_RECEIVE_CONTENT_SIZE: @@ -115,8 +115,8 @@ _SEH2_TRY { switch (InfoReq->InformationClass) { case AFD_INFO_BLOCKING_MODE: - AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n", InfoReq->Information.Ulong)); - FCB->BlockingMode = InfoReq->Information.Ulong; + AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n", InfoReq->Information.Boolean)); + FCB->NonBlocking = InfoReq->Information.Boolean; break; default: AFD_DbgPrint(MIN_TRACE,("Unknown request %d\n", InfoReq->InformationClass)); Modified: trunk/reactos/drivers/network/afd/afd/listen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -315,6 +315,10 @@ SocketStateUnlock( FCB ); return Status; + } else if (FCB->NonBlocking) { + AFD_DbgPrint(MID_TRACE,("No connection ready on a non-blocking socket\n")); + + return UnlockAndMaybeComplete(FCB, STATUS_CANT_WAIT, Irp, 0); } else { AFD_DbgPrint(MID_TRACE,("Holding\n")); Modified: trunk/reactos/drivers/network/afd/afd/read.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -346,7 +346,8 @@ Status = ReceiveActivity( FCB, Irp ); - if( Status == STATUS_PENDING && (RecvReq->AfdFlags & AFD_IMMEDIATE) ) { + if( Status == STATUS_PENDING && + ((RecvReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking)) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); Status = STATUS_CANT_WAIT; TotalBytesCopied = 0; @@ -690,7 +691,7 @@ return UnlockAndMaybeComplete ( FCB, Status, Irp, Irp->IoStatus.Information ); } - } else if( RecvReq->AfdFlags & AFD_IMMEDIATE ) { + } else if( (RecvReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); Status = STATUS_CANT_WAIT; FCB->PollState &= ~AFD_EVENT_RECEIVE; Modified: trunk/reactos/drivers/network/afd/afd/write.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -340,7 +340,7 @@ AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State)); if( FCB->State != SOCKET_STATE_CONNECTED ) { - if( SendReq->AfdFlags & AFD_IMMEDIATE ) { + if( (SendReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); return UnlockAndMaybeComplete @@ -404,7 +404,7 @@ else { FCB->PollState &= ~AFD_EVENT_SEND; - if( SendReq->AfdFlags & AFD_IMMEDIATE ) { + if( (SendReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); return UnlockAndMaybeComplete Modified: trunk/reactos/drivers/network/afd/include/afd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
============================================================================== --- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Jul 4 17:37:45 2011 @@ -173,8 +173,8 @@ } AFD_STORED_DATAGRAM, *PAFD_STORED_DATAGRAM; typedef struct _AFD_FCB { - BOOLEAN Locked, Critical, Overread; - UINT State, Flags, BlockingMode, GroupID, GroupType; + BOOLEAN Locked, Critical, Overread, NonBlocking; + UINT State, Flags, GroupID, GroupType; KIRQL OldIrql; UINT LockCount; PVOID CurrentThread;
13 years, 5 months
1
0
0
0
[tkreuzer] 52536: [RTL] - Fix RtlFindSetBits to search for bits before the HintIndex as well - Remove a wrong (and commented out) ASSERT - Fix MSVC warnings
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Jul 4 16:30:45 2011 New Revision: 52536 URL:
http://svn.reactos.org/svn/reactos?rev=52536&view=rev
Log: [RTL] - Fix RtlFindSetBits to search for bits before the HintIndex as well - Remove a wrong (and commented out) ASSERT - Fix MSVC warnings Modified: trunk/reactos/lib/rtl/bitmap.c Modified: trunk/reactos/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=52536…
============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Mon Jul 4 16:30:45 2011 @@ -152,11 +152,11 @@ if (BitScanReverse(&Position, Value >> 32)) { - return Position + 32; + return (CCHAR)(Position + 32); } else if (BitScanReverse(&Position, (ULONG)Value)) { - return Position; + return (CCHAR)Position; } return -1; @@ -170,11 +170,11 @@ if (BitScanForward(&Position, (ULONG)Value)) { - return Position; + return (CCHAR)Position; } else if (BitScanForward(&Position, Value >> 32)) { - return Position + 32; + return (CCHAR)(Position + 32); } return -1; @@ -187,9 +187,6 @@ IN PULONG BitMapBuffer, IN ULONG SizeOfBitMap) { - // FIXME: some bugger here! - //ASSERT(SizeOfBitMap > 0); - /* Setup the bitmap header */ BitMapHeader->SizeOfBitMap = SizeOfBitMap; BitMapHeader->Buffer = BitMapBuffer; @@ -212,7 +209,7 @@ IN OUT PRTL_BITMAP BitMapHeader) { ULONG LengthInUlongs; - + LengthInUlongs = (BitMapHeader->SizeOfBitMap + 31) >> 5; RtlFillMemoryUlong(BitMapHeader->Buffer, LengthInUlongs << 2, ~0); } @@ -481,7 +478,7 @@ IN ULONG NumberToFind, IN ULONG HintIndex) { - ULONG CurrentBit, CurrentLength; + ULONG CurrentBit, Margin, CurrentLength; /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) @@ -495,12 +492,15 @@ return HintIndex; } + /* First margin is end of bitmap */ + Margin = BitMapHeader->SizeOfBitMap; + +retry: /* Start with hint index, length is 0 */ CurrentBit = HintIndex; - CurrentLength = 0; /* Loop until something is found or the end is reached */ - while (CurrentBit + NumberToFind <= BitMapHeader->SizeOfBitMap) + while (CurrentBit + NumberToFind <= Margin) { /* Search for the next set run, by skipping a clear run */ CurrentBit += RtlpGetLengthOfRunClear(BitMapHeader, @@ -522,6 +522,15 @@ CurrentBit += CurrentLength; } + /* Did we start at a hint? */ + if (HintIndex) + { + /* Retry at the start */ + Margin = min(HintIndex + NumberToFind, BitMapHeader->SizeOfBitMap); + HintIndex = 0; + goto retry; + } + /* Nothing found */ return MAXULONG; } @@ -641,7 +650,7 @@ for (Run = 0; Run < SizeOfRunArray; Run++) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &StartingIndex); @@ -672,7 +681,7 @@ while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &StartingIndex); @@ -716,7 +725,7 @@ while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &Index); @@ -749,7 +758,7 @@ while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunSet(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunSet(BitMapHeader, FromIndex, &Index);
13 years, 5 months
1
0
0
0
[tkreuzer] 52535: [NTOSKRNL] - Initialize an uninitialized variable - MI_GET_NEXT_COLOR() doesn't have an argument - Fix a warning on MSVC
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Jul 4 16:26:52 2011 New Revision: 52535 URL:
http://svn.reactos.org/svn/reactos?rev=52535&view=rev
Log: [NTOSKRNL] - Initialize an uninitialized variable - MI_GET_NEXT_COLOR() doesn't have an argument - Fix a warning on MSVC Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/ARM3/miavl.h trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Mon Jul 4 16:26:52 2011 @@ -244,7 +244,7 @@ // Returns the color of a page // #define MI_GET_PAGE_COLOR(x) ((x) & MmSecondaryColorMask) -#define MI_GET_NEXT_COLOR(x) (MI_GET_PAGE_COLOR(++MmSystemPageColor)) +#define MI_GET_NEXT_COLOR() (MI_GET_PAGE_COLOR(++MmSystemPageColor)) #define MI_GET_NEXT_PROCESS_COLOR(x) (MI_GET_PAGE_COLOR(++(x)->NextPageColor)) #ifndef _M_AMD64 Modified: trunk/reactos/ntoskrnl/mm/ARM3/miavl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miavl.h?r…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miavl.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miavl.h [iso-8859-1] Mon Jul 4 16:26:52 2011 @@ -20,7 +20,7 @@ * * The other difference is that the AVL package for Rtl has custom callbacks for * comparison purposes (which would access some internal, opaque, user data) while - * the Mm package stores the user-data inline as StartingVpn and EndingVpn. So + * the Mm package stores the user-data inline as StartingVpn and EndingVpn. So * when a compare is being made, RtlpAvlCompareRoutine is called, which will either * perform the Mm work, or call the user-specified callback in the Rtl case. */ @@ -54,7 +54,7 @@ { return GenericEqual; } - else + else { return GenericGreaterThan; } @@ -80,7 +80,7 @@ FORCEINLINE RtlBalance(IN PRTL_BALANCED_LINKS Node) { - return Node->u1.Balance; + return (SCHAR)Node->u1.Balance; } PRTL_BALANCED_LINKS Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Mon Jul 4 16:26:52 2011 @@ -2086,7 +2086,7 @@ PIMAGE_NT_HEADERS NtHeaders; PIMAGE_SECTION_HEADER Section; PFN_NUMBER DriverPages; - ULONG CurrentProtection, SectionProtection, CombinedProtection, ProtectionMask; + ULONG CurrentProtection, SectionProtection, CombinedProtection = 0, ProtectionMask; ULONG Sections, Size; ULONG_PTR BaseAddress, CurrentAddress; PMMPTE PointerPte, StartPte, LastPte, CurrentPte, ComboPte = NULL;
13 years, 5 months
1
0
0
0
[cgutman] 52534: - Small fix for my last commit to prevent problems if ExAllocatePool fails
by cgutman@svn.reactos.org
Author: cgutman Date: Mon Jul 4 15:45:58 2011 New Revision: 52534 URL:
http://svn.reactos.org/svn/reactos?rev=52534&view=rev
Log: - Small fix for my last commit to prevent problems if ExAllocatePool fails Modified: trunk/reactos/drivers/network/afd/afd/read.c Modified: trunk/reactos/drivers/network/afd/afd/read.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Mon Jul 4 15:45:58 2011 @@ -513,8 +513,6 @@ SocketStateUnlock(FCB); return Irp->IoStatus.Status; } - - FCB->Recv.Content += Irp->IoStatus.Information; DatagramRecv = ExAllocatePool( NonPagedPool, DGSize ); @@ -536,6 +534,7 @@ SocketStateUnlock( FCB ); return Status; } else { + FCB->Recv.Content += DatagramRecv->Len; InsertTailList( &FCB->DatagramList, &DatagramRecv->ListEntry ); }
13 years, 5 months
1
0
0
0
← Newer
1
...
45
46
47
48
49
50
51
52
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Results per page:
10
25
50
100
200