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 2017
----- 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
19 participants
213 discussions
Start a n
N
ew thread
[mjansen] 75274: [USER32_APITEST] Add tests to validate the messages sent during MDI window creation. CORE-12052 The test passes from 2k3 - 10.
by mjansen@svn.reactos.org
Author: mjansen Date: Mon Jul 3 20:33:36 2017 New Revision: 75274 URL:
http://svn.reactos.org/svn/reactos?rev=75274&view=rev
Log: [USER32_APITEST] Add tests to validate the messages sent during MDI window creation. CORE-12052 The test passes from 2k3 - 10. Modified: trunk/rostests/apitests/user32/CreateWindowEx.c Modified: trunk/rostests/apitests/user32/CreateWindowEx.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CreateWin…
============================================================================== --- trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/CreateWindowEx.c [iso-8859-1] Mon Jul 3 20:33:36 2017 @@ -70,6 +70,7 @@ HWND g_TestWindow = NULL; HWND g_ChildWindow = NULL; +HWND g_hwndMDIClient = NULL; static int get_iwnd(HWND hWnd) { @@ -649,9 +650,489 @@ } + +static LRESULT CALLBACK MSGTestProcMDI(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lRet; + int iwnd = get_iwnd(hWnd); + + if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) + return DefWindowProc(hWnd, message, wParam, lParam); + + switch(message) + { + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_GETICON: + case WM_GETTEXT: + return DefWindowProc(hWnd, message, wParam, lParam); + break; + case WM_NCCREATE: + { + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_NcExpectStyle); + ok_hex_(create->dwExStyle, g_NcExpectExStyle); + } + break; + case WM_CREATE: + { + CLIENTCREATESTRUCT ccs = { 0 }; + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_ExpectStyle); + ok_hex_(create->dwExStyle, g_ExpectExStyle); + + g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL, + WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, + 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs); + + ShowWindow(g_hwndMDIClient, SW_SHOW); + + } + break; + case WM_NCCALCSIZE: + case WM_STYLECHANGING: + case WM_STYLECHANGED: + case WM_SIZE: + RECORD_MESSAGE(iwnd, message, SENT, wParam, 0); + break; + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + ok(wParam == 0,"expected wParam=0\n"); + RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0); + break; + default: + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + break; + } + lRet = DefWindowProc(hWnd, message, wParam, lParam); + RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0); + return lRet; +} + +MSG_ENTRY create_chain_MDI[] = +{ + { 1, WM_GETMINMAXINFO, SENT }, + { 1, WM_GETMINMAXINFO, SENT_RET }, + { 1, WM_NCCREATE, SENT }, + { 1, WM_NCCREATE, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_CREATE, SENT }, + { 1, WM_PARENTNOTIFY, SENT }, + { 1, WM_PARENTNOTIFY, SENT_RET }, + { 1, WM_CREATE, SENT_RET }, + { 0, 0 } +}; + +static void Test_Messages_MDI(void) +{ + HWND hWnd; + + RegisterSimpleClass(MSGTestProcMDI, L"Test_Message_Window_MDI_XX"); + + g_ExpectStyle = g_NcExpectStyle = 0; + g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE; + g_FaultLine = __LINE__ + 1; + hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", L"", 0, 10, 20, + 200, 210, NULL, NULL, 0, NULL); + + ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd); + COMPARE_CACHE(create_chain_MDI); + DestroyWindow(hWnd); + g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL; + EMPTY_CACHE(); + + g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW; + g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW; + g_FaultLine = __LINE__ + 1; + hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_Window_MDI_XX", L"", WS_OVERLAPPEDWINDOW, 10, 20, + 200, 210, NULL, NULL, 0, NULL); + + ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd); + COMPARE_CACHE(create_chain_MDI); + DestroyWindow(hWnd); + g_TestWindow = g_hwndMDIClient = g_ChildWindow = NULL; + EMPTY_CACHE(); + + UnregisterClassW(L"Test_Message_Window_MDI_XX", NULL); +} + + +static LRESULT CALLBACK MSGTestProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lRet; + int iwnd = get_iwnd(hWnd); + + if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) + return DefWindowProc(hWnd, message, wParam, lParam); + + switch(message) + { + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_GETICON: + case WM_GETTEXT: + return DefWindowProc(hWnd, message, wParam, lParam); + break; + case WM_NCCREATE: + { + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_NcExpectStyle); + ok_hex_(create->dwExStyle, g_NcExpectExStyle); + } + break; + case WM_CREATE: + { + MDICREATESTRUCT mcs = {0}; + CLIENTCREATESTRUCT ccs = { 0 }; + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + HWND hchild; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_ExpectStyle); + ok_hex_(create->dwExStyle, g_ExpectExStyle); + + + g_hwndMDIClient = CreateWindow("MDICLIENT", (LPCTSTR) NULL, + WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, + 0, 0, 0, 0, hWnd, (HMENU) 0xCAC, NULL, (LPSTR) &ccs); + + ShowWindow(g_hwndMDIClient, SW_SHOW); + + + mcs.szClass = "Test_Message_MDI_Window_Child2"; + mcs.x = mcs.cx = CW_USEDEFAULT; + mcs.y = mcs.cy = CW_USEDEFAULT; + mcs.style = WS_MAXIMIZE; + + hchild = (HWND) SendMessage (g_hwndMDIClient, WM_MDICREATE, 0, + (LONG)(LPMDICREATESTRUCT) &mcs); + ok(hchild == g_ChildWindow, "We are testing with %p instead of %p\n", g_ChildWindow, hchild); + + } + break; + case WM_NCCALCSIZE: + case WM_STYLECHANGING: + case WM_STYLECHANGED: + case WM_SIZE: + RECORD_MESSAGE(iwnd, message, SENT, wParam, 0); + break; + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + ok(wParam == 0,"expected wParam=0\n"); + RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0); + break; + default: + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + break; + } + lRet = DefWindowProc(hWnd, message, wParam, lParam); + RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0); + return lRet; +} + +static LRESULT CALLBACK MSGChildProcMDI2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lRet; + int iwnd = get_iwnd(hWnd); + + if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message)) + return DefMDIChildProc(hWnd, message, wParam, lParam); + + switch(message) + { + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_GETICON: + case WM_GETTEXT: + return DefMDIChildProc(hWnd, message, wParam, lParam); + break; + case WM_NCCREATE: + { + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_ChildNcExpectStyle); + ok_hex_(create->dwExStyle, g_ChildNcExpectExStyle); + } + break; + case WM_CREATE: + { + LPCREATESTRUCT create = (LPCREATESTRUCT)lParam; + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + ok_hex_(create->style, g_ChildExpectStyle); + ok_hex_(create->dwExStyle, g_ChildExpectExStyle); + } + break; + case WM_NCCALCSIZE: + case WM_STYLECHANGING: + case WM_STYLECHANGED: + case WM_SIZE: + RECORD_MESSAGE(iwnd, message, SENT, wParam, 0); + break; + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + ok(wParam == 0,"expected wParam=0\n"); + RECORD_MESSAGE(iwnd, message, SENT, ((WINDOWPOS*)lParam)->flags, 0); + break; + default: + RECORD_MESSAGE(iwnd, message, SENT, 0, 0); + break; + } + lRet = DefMDIChildProc(hWnd, message, wParam, lParam); + RECORD_MESSAGE(iwnd, message, SENT_RET, 0, 0); + return lRet; +} + + +MSG_ENTRY child_create_chain_MDI[] = +{ + { 1, WM_GETMINMAXINFO, SENT }, + { 1, WM_GETMINMAXINFO, SENT_RET }, + { 1, WM_NCCREATE, SENT }, + { 1, WM_NCCREATE, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_CREATE, SENT }, + { 1, WM_PARENTNOTIFY, SENT }, + { 1, WM_PARENTNOTIFY, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_NCCREATE, SENT }, + { 2, WM_NCCREATE, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_CREATE, SENT }, + { 2, WM_CREATE, SENT_RET }, + { 2, WM_SIZE, SENT }, + { 2, WM_SIZE, SENT_RET }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT, 1 }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_SIZE, SENT, SIZE_MAXIMIZED }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + { 2, WM_SIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT, TRUE }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_SHOWWINDOW, SENT }, + { 2, WM_SHOWWINDOW, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_MDIACTIVATE, SENT }, + { 2, WM_MDIACTIVATE, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + { 1, WM_CREATE, SENT_RET }, + { 0, 0 }, +}; + +MSG_ENTRY child_create_chain_MDI_below8[] = +{ + { 1, WM_GETMINMAXINFO, SENT }, + { 1, WM_GETMINMAXINFO, SENT_RET }, + { 1, WM_NCCREATE, SENT }, + { 1, WM_NCCREATE, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_CREATE, SENT }, + { 1, WM_PARENTNOTIFY, SENT }, + { 1, WM_PARENTNOTIFY, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_NCCREATE, SENT }, + { 2, WM_NCCREATE, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_CREATE, SENT }, + { 2, WM_CREATE, SENT_RET }, + { 2, WM_SIZE, SENT }, + { 2, WM_SIZE, SENT_RET }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT, 1 }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_SIZE, SENT, SIZE_MAXIMIZED }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + { 2, WM_SIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT_RET }, + //{ 2, WM_NCCALCSIZE, SENT, TRUE }, + //{ 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_SHOWWINDOW, SENT }, + { 2, WM_SHOWWINDOW, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_MDIACTIVATE, SENT }, + { 2, WM_MDIACTIVATE, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + { 1, WM_CREATE, SENT_RET }, + { 0, 0 }, +}; + +MSG_ENTRY child_create_chain_MDI_below8_nonsrv[] = +{ + { 1, WM_GETMINMAXINFO, SENT }, + { 1, WM_GETMINMAXINFO, SENT_RET }, + { 1, WM_NCCREATE, SENT }, + { 1, WM_NCCREATE, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_CREATE, SENT }, + { 1, WM_PARENTNOTIFY, SENT }, + { 1, WM_PARENTNOTIFY, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_NCCREATE, SENT }, + { 2, WM_NCCREATE, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_CREATE, SENT }, + { 2, WM_CREATE, SENT_RET }, + { 2, WM_SIZE, SENT }, + { 2, WM_SIZE, SENT_RET }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x8000 }, + { 2, WM_GETMINMAXINFO, SENT }, + { 2, WM_GETMINMAXINFO, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT, 1 }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW | 0x8800 }, + { 2, WM_MOVE, SENT }, + { 2, WM_MOVE, SENT_RET }, + { 2, WM_SIZE, SENT, SIZE_MAXIMIZED }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + // + + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + // - + { 2, WM_SIZE, SENT_RET }, + { 2, WM_WINDOWPOSCHANGED, SENT_RET }, + { 2, WM_NCCALCSIZE, SENT, TRUE }, + { 2, WM_NCCALCSIZE, SENT_RET }, + { 2, WM_SHOWWINDOW, SENT }, + { 2, WM_SHOWWINDOW, SENT_RET }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT }, + { 2, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE }, + { 2, WM_WINDOWPOSCHANGING, SENT_RET }, + { 2, WM_MDIACTIVATE, SENT }, + { 2, WM_MDIACTIVATE, SENT_RET }, + { 2, WM_CHILDACTIVATE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGING, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED }, + { 1, WM_WINDOWPOSCHANGING, SENT_RET }, + { 1, WM_NCCALCSIZE, SENT, TRUE }, + { 1, WM_NCCALCSIZE, SENT_RET }, + { 1, WM_WINDOWPOSCHANGED, SENT, SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOREDRAW | SWP_FRAMECHANGED | SWP_NOACTIVATE | 0x1800 }, + { 1, WM_WINDOWPOSCHANGED, SENT_RET }, + { 1, WM_CREATE, SENT_RET }, + { 0, 0 }, +}; + +static void Test_Messages_MDI_Child(void) +{ + HWND hWnd; + + BOOL Below8 = !IsWindows8OrGreater(); + BOOL Below8NonServer = !IsWindows8OrGreater() && !IsWindowsServer(); + + RegisterSimpleClass(MSGTestProcMDI2, L"Test_Message_MDI_Window_X2"); + RegisterSimpleClass(MSGChildProcMDI2, L"Test_Message_MDI_Window_Child2"); + + g_ExpectStyle = g_NcExpectStyle = 0; + g_ExpectExStyle = g_NcExpectExStyle = WS_EX_CLIENTEDGE; + g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_MAXIMIZE | WS_OVERLAPPEDWINDOW; + g_ChildExpectExStyle = g_ChildNcExpectExStyle = WS_EX_WINDOWEDGE | WS_EX_MDICHILD; + g_FaultLine = __LINE__ + 1; + hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_MDI_Window_X2", L"", 0, 10, 20, + 200, 210, NULL, NULL, 0, NULL); + + ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd); + COMPARE_CACHE(Below8NonServer ? (child_create_chain_MDI_below8_nonsrv) : (Below8 ? child_create_chain_MDI_below8 : child_create_chain_MDI)); + DestroyWindow(hWnd); + g_TestWindow = g_ChildWindow = NULL; + EMPTY_CACHE(); + + g_ExpectStyle = g_NcExpectStyle = WS_OVERLAPPEDWINDOW; + g_ExpectExStyle = g_NcExpectExStyle = WS_EX_OVERLAPPEDWINDOW; + g_ChildExpectStyle = g_ChildNcExpectStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_MAXIMIZE | WS_OVERLAPPEDWINDOW; + g_ChildExpectExStyle = g_ChildNcExpectExStyle = WS_EX_WINDOWEDGE | WS_EX_MDICHILD; + g_FaultLine = __LINE__ + 1; + hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Test_Message_MDI_Window_X2", L"", WS_OVERLAPPEDWINDOW, 10, 20, + 200, 210, NULL, NULL, 0, NULL); + + ok(hWnd == g_TestWindow, "We are testing with %p instead of %p\n", g_TestWindow, hWnd); + COMPARE_CACHE(Below8NonServer ? (child_create_chain_MDI_below8_nonsrv) : (Below8 ? child_create_chain_MDI_below8 : child_create_chain_MDI)); + DestroyWindow(hWnd); + g_TestWindow = g_ChildWindow = NULL; + EMPTY_CACHE(); + + UnregisterClassW(L"Test_Message_Window_X2", NULL); + UnregisterClassW(L"Test_Message_MDI_Window_Child2", NULL); +} + + START_TEST(CreateWindowEx) { Test_Params(); Test_Messages(); Test_Messages_Child(); -} + Test_Messages_MDI(); + Test_Messages_MDI_Child(); +}
7 years, 5 months
1
0
0
0
[hbelusca] 75273: [REACTOS]: Introduce the experimental all-in-one ReactOS BootCD, containing both the text-mode 1st-stage installer and the LiveCD functionality with the 1st-stage GUI installer. O...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Mon Jul 3 17:53:23 2017 New Revision: 75273 URL:
http://svn.reactos.org/svn/reactos?rev=75273&view=rev
Log: [REACTOS]: Introduce the experimental all-in-one ReactOS BootCD, containing both the text-mode 1st-stage installer and the LiveCD functionality with the 1st-stage GUI installer. Our separate LiveCD ISOs become obsolete, and this completely remove the need for the so-called "hybridcd" ISO. Some details: - the "hybridcd" build target is completely removed, since now the new BootCD *is* basically what we used to call "hybridcd"; - the "livecd" build target is kept so far (to minimize the code changes), but internally I start to refer to it as "LiveImage", and it is reduced to a minimum: currently a minimal non-bootable "liveimage.iso" is built in order to implement the "ReactOS Live in RAMDISK" functionality (we currently don't support other file formats apart from ISO and flat disk for a RAMDISK), while the "ReactOS Live" (non-RAMDISK) is implemented by adding to the BootCD file tree the files from the LiveImage. These files add two root directories, "Profiles" and "reactos" (the SystemRoot for the non-ramdisk LiveImage). - The minimal text-mode ReactOS installation used during the 1st-stage text-mode installer, including USETUP itself and the executable for the 1st-stage GUI installer and the reactos.cab (installation source) are moved to the root directory called "i386" (ideally, one directory per architecture). - the "bootcdregtest" target, i.e. the ISOs we feed our testbots with, are left untouched, i.e. they are only constituted of the 1st-stage text-mode installation, in the root directory named "reactos". More details will be presented in a subsequent mail to the ros-dev mailing list. Added: branches/setup_improvements/boot/bootdata/autorun.inf - copied, changed from r75272, branches/setup_improvements/boot/bootdata/autorun-bootcd.inf branches/setup_improvements/boot/bootdata/bootcd-regtest.ini - copied unchanged from r75272, branches/setup_improvements/boot/bootdata/bootcd.ini branches/setup_improvements/boot/bootdata/bootcd.ini - copied, changed from r75272, branches/setup_improvements/boot/bootdata/hybridcd.ini Removed: branches/setup_improvements/boot/bootdata/autorun-bootcd.inf branches/setup_improvements/boot/bootdata/autorun-hybridcd.inf branches/setup_improvements/boot/bootdata/autorun-livecd.inf branches/setup_improvements/boot/bootdata/hybridcd.ini branches/setup_improvements/boot/bootdata/livecd.ini Modified: branches/setup_improvements/base/setup/welcome/CMakeLists.txt branches/setup_improvements/boot/CMakeLists.txt branches/setup_improvements/boot/bootdata/CMakeLists.txt branches/setup_improvements/boot/bootdata/welcome_config/welcome.ini branches/setup_improvements/boot/freeldr/bootsect/CMakeLists.txt branches/setup_improvements/boot/freeldr/freeldr/CMakeLists.txt branches/setup_improvements/modules/CMakeLists.txt branches/setup_improvements/sdk/cmake/CMakeMacros.cmake Modified: branches/setup_improvements/base/setup/welcome/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/w…
============================================================================== --- branches/setup_improvements/base/setup/welcome/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/welcome/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -4,4 +4,7 @@ add_executable(welcome welcome.c welcome.rc) set_module_type(welcome win32gui UNICODE) add_importlibs(welcome gdi32 user32 shell32 msvcrt kernel32 ntdll) -add_cd_file(TARGET welcome DESTINATION reactos NO_CAB FOR bootcd) +add_cd_file(TARGET welcome DESTINATION reactos FOR all) + +# Welcome.exe renamed as Setup.exe for the BootCD +add_cd_file(TARGET welcome DESTINATION root NO_CAB NAME_ON_CD setup.exe FOR bootcd) Modified: branches/setup_improvements/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/CMakeLi…
============================================================================== --- branches/setup_improvements/boot/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/boot/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -67,9 +67,9 @@ -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort - -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst + -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/bootcd.iso - DEPENDS isombr native-isohybrid native-mkisofs + DEPENDS isombr native-isohybrid native-mkisofs livecd VERBATIM) ## BootCDRegTest @@ -82,12 +82,12 @@ -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} -eltorito-boot loader/isobtrt.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort - -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst + -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/bootcdregtest.iso DEPENDS isombr native-isohybrid native-mkisofs VERBATIM) -## LiveCD +## LiveImage -- Constitutes a small RAMDISK ISO, and is also merged with the regular BootCD # Create the file list file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst "") file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") @@ -121,59 +121,14 @@ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst "Profiles/Default User/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") add_custom_target(livecd - COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/livecd.iso -iso-level 4 + COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/liveimage.iso -iso-level 4 -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} - -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog - -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort - -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst - COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/livecd.iso - DEPENDS isombr native-isohybrid native-mkisofs + -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst + DEPENDS native-mkisofs VERBATIM) -## HybridCD -# Create the file list -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "${CMAKE_CURRENT_BINARY_DIR}/empty\n") -# Create the empty Desktop, Favorites, and Start Menu folders. And many more. -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Documents/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Documents/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Documents/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/My Documents=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/All Users/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Cookies=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Desktop=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Favorites=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Local Settings/Application Data=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Local Settings/History=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Local Settings/Temporary Internet Files=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/My Music=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/My Pictures=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/My Videos=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/NetHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/PrintHood=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") - -add_custom_target(hybridcd - COMMAND native-mkisofs -quiet -o ${REACTOS_BINARY_DIR}/hybridcd.iso -iso-level 4 - -publisher ${ISO_MANUFACTURER} -preparer ${ISO_MANUFACTURER} -volid ${ISO_VOLNAME} -volset ${ISO_VOLNAME} - -eltorito-boot loader/isoboot.bin -no-emul-boot -boot-load-size 4 -eltorito-alt-boot -eltorito-platform efi -eltorito-boot loader/efisys.bin -no-emul-boot -hide boot.catalog - -sort ${CMAKE_CURRENT_BINARY_DIR}/bootfiles.sort - -duplicates-once -no-cache-inodes -graft-points -path-list ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst - COMMAND native-isohybrid -b ${_isombr_file} ${REACTOS_BINARY_DIR}/hybridcd.iso - DEPENDS bootcd livecd - VERBATIM) - -add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR bootcd regtest livecd hybridcd) +add_cd_file(TARGET efisys FILE ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin DESTINATION loader NO_CAB FOR bootcd regtest) add_subdirectory(freeldr) add_subdirectory(bootdata) Modified: branches/setup_improvements/boot/bootdata/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -1,10 +1,10 @@ add_subdirectory(packages) -# Common hives - +# Setup settings file add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/txtsetup.sif DESTINATION reactos NO_CAB FOR bootcd regtest) +# Common hives add_registry_inf( caroots.inf hivecls.inf @@ -13,26 +13,24 @@ hivesys.inf hivebcd.inf) - # Regtest add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/regtest.cmd DESTINATION reactos/bin FOR all) # autorun.inf -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-bootcd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR bootcd) -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-livecd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR livecd) -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun-hybridcd.inf DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD autorun.inf FOR hybridcd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun.inf DESTINATION root NO_CAB FOR bootcd) # icon.ico -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB NOT_IN_HYBRIDCD FOR all hybridcd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB FOR bootcd) # readme.txt -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB NOT_IN_HYBRIDCD FOR all hybridcd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB FOR bootcd regtest) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION reactos FOR all) -# Welcome.exe optional custom configuration (only for HybridCD) +## NOTE: The root file Setup.exe is a renamed Welcome.exe for BootCD purposes. +# Welcome.exe optional custom configuration (only for LiveCD) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/) # Copy the main configuration file - add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/welcome.ini DESTINATION bootcd/reactos NO_CAB FOR hybridcd) + add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/welcome_config/welcome.ini DESTINATION reactos NO_CAB FOR livecd) # Convert the translation files (name format: xx-YY.ini) into UTF-16 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/welcome_config) @@ -43,22 +41,21 @@ add_custom_command(OUTPUT "${_converted_file}" COMMAND native-utf16le "${_source_file}" "${_converted_file}" DEPENDS native-utf16le "${_source_file}") - add_cd_file(TARGET converted_welcome_i18n_files FILE ${_converted_file} DESTINATION bootcd/reactos/welcome NO_CAB NAME_ON_CD ${_file} FOR hybridcd) + add_cd_file(TARGET converted_welcome_i18n_files FILE ${_converted_file} DESTINATION reactos/welcome NO_CAB NAME_ON_CD ${_file} FOR livecd) list(APPEND _converted_welcome_i18n_files ${_converted_file}) endforeach(_file) add_custom_target(converted_welcome_i18n_files DEPENDS ${_converted_welcome_i18n_files}) endif() # freeldr.ini -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB NOT_IN_HYBRIDCD NAME_ON_CD freeldr.ini FOR bootcd regtest) -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd.ini DESTINATION root NOT_IN_HYBRIDCD NAME_ON_CD freeldr.ini FOR livecd) -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd.ini DESTINATION root NAME_ON_CD freeldr.ini FOR hybridcd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB NAME_ON_CD freeldr.ini FOR bootcd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd-regtest.ini DESTINATION root NO_CAB NAME_ON_CD freeldr.ini FOR regtest) # Unattend +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd/unattend.inf DESTINATION reactos NO_CAB FOR bootcd) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/unattend.inf DESTINATION reactos NO_CAB FOR regtest) -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd/unattend.inf DESTINATION reactos NO_CAB FOR bootcd) -# LiveCD shortcuts +# LiveImage shortcuts macro(add_livecd_shortcut name app dest) add_link(NAME ${name} CMD_LINE_ARGS ${app} ICON ${app} PATH livecd_start.cmd GUID "{450D8FBA-AD25-11D0-98A8-0800361B1103}" MINIMIZE) list(APPEND LIVECD_SHORTCUTS "${CMAKE_CURRENT_BINARY_DIR}/${name}.lnk") Removed: branches/setup_improvements/boot/bootdata/autorun-bootcd.inf URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/autorun-bootcd.inf [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/autorun-bootcd.inf (removed) @@ -1,3 +0,0 @@ -[autorun] -open=reactos\welcome.exe -icon=icon.ico Removed: branches/setup_improvements/boot/bootdata/autorun-hybridcd.inf URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/autorun-hybridcd.inf [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/autorun-hybridcd.inf (removed) @@ -1,3 +0,0 @@ -[autorun] -open=bootcd\reactos\welcome.exe -icon=icon.ico Removed: branches/setup_improvements/boot/bootdata/autorun-livecd.inf URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/autorun-livecd.inf [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/autorun-livecd.inf (removed) @@ -1,3 +0,0 @@ -[autorun] -open=readme.txt -icon=icon.ico Copied: branches/setup_improvements/boot/bootdata/autorun.inf (from r75272, branches/setup_improvements/boot/bootdata/autorun-bootcd.inf) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/autorun-bootcd.inf [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/autorun.inf [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -1,3 +1,3 @@ [autorun] -open=reactos\welcome.exe +open=setup.exe icon=icon.ico Copied: branches/setup_improvements/boot/bootdata/bootcd.ini (from r75272, branches/setup_improvements/boot/bootdata/hybridcd.ini) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/hybridcd.ini [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/bootcd.ini [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -1,9 +1,9 @@ [FREELOADER] -DefaultOS=Setup -TimeOut=5 +DefaultOS=LiveCD_Debug +TimeOut=10 [Display] -TitleText=ReactOS Hybrid-CD +TitleText=ReactOS Setup & Live BootCD StatusBarColor=Cyan StatusBarTextColor=Black BackdropTextColor=White @@ -25,50 +25,55 @@ TimeText=Seconds until highlighted choice will be started automatically: [Operating Systems] -Setup="Setup" -LiveCD="LiveCD" -LiveCD_Debug="LiveCD (Debug)" -LiveCD_Screen="LiveCD (Screen)" -LiveCD_LogFile="LiveCD (Log file)" -LiveCD_RamDisk="LiveCD in RAM" -LiveCD_RamDisk_Debug="LiveCD in RAM (Debug)" -LiveCD_RamDisk_Screen="LiveCD in RAM (Screen)" +Setup="ReactOS Setup (Text Mode)" +LiveCD="ReactOS Setup (Graphics Mode) & Live" +LiveCD_Debug="ReactOS Live (Debug)" +LiveCD_Screen="ReactOS Live (Screen)" +; LiveCD_LogFile="ReactOS Live (Log file)" +LiveCD_RamDisk="ReactOS Setup (Graphics Mode) & Live in RAM" +LiveCD_RamDisk_Debug="ReactOS Live in RAM (Debug)" +LiveCD_RamDisk_Screen="ReactOS Live in RAM (Screen)" +HddBoot="Boot from first hard disk" [Setup] BootType=ReactOSSetup -SystemPath=\bootcd +SystemPath=\ [LiveCD] BootType=Windows2003 -SystemPath=\livecd\reactos +SystemPath=\reactos Options=/MININT [LiveCD_Debug] BootType=Windows2003 -SystemPath=\livecd\reactos +SystemPath=\reactos Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT [LiveCD_Screen] BootType=Windows2003 -SystemPath=\livecd\reactos +SystemPath=\reactos Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT -[LiveCD_LogFile] -BootType=Windows2003 -SystemPath=\livecd\reactos -Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT +; [LiveCD_LogFile] +; BootType=Windows2003 +; SystemPath=\reactos +; Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT [LiveCD_RamDisk] BootType=Windows2003 SystemPath=ramdisk(0)\reactos -Options=/MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD +Options=/MININT /RDPATH=liveimage.iso /RDEXPORTASCD [LiveCD_RamDisk_Debug] BootType=Windows2003 SystemPath=ramdisk(0)\reactos -Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD +Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=liveimage.iso /RDEXPORTASCD [LiveCD_RamDisk_Screen] BootType=Windows2003 SystemPath=ramdisk(0)\reactos -Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD +Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=liveimage.iso /RDEXPORTASCD + +[HddBoot] +BootType=Drive +BootDrive=hd0 Removed: branches/setup_improvements/boot/bootdata/hybridcd.ini URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/hybridcd.ini [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/hybridcd.ini (removed) @@ -1,74 +0,0 @@ -[FREELOADER] -DefaultOS=Setup -TimeOut=5 - -[Display] -TitleText=ReactOS Hybrid-CD -StatusBarColor=Cyan -StatusBarTextColor=Black -BackdropTextColor=White -BackdropColor=Blue -BackdropFillStyle=Medium -TitleBoxTextColor=White -TitleBoxColor=Red -MessageBoxTextColor=White -MessageBoxColor=Blue -MenuTextColor=Gray -MenuColor=Black -TextColor=Gray -SelectedTextColor=Black -SelectedColor=Gray -ShowTime=No -MenuBox=No -CenterMenu=No -MinimalUI=Yes -TimeText=Seconds until highlighted choice will be started automatically: - -[Operating Systems] -Setup="Setup" -LiveCD="LiveCD" -LiveCD_Debug="LiveCD (Debug)" -LiveCD_Screen="LiveCD (Screen)" -LiveCD_LogFile="LiveCD (Log file)" -LiveCD_RamDisk="LiveCD in RAM" -LiveCD_RamDisk_Debug="LiveCD in RAM (Debug)" -LiveCD_RamDisk_Screen="LiveCD in RAM (Screen)" - -[Setup] -BootType=ReactOSSetup -SystemPath=\bootcd - -[LiveCD] -BootType=Windows2003 -SystemPath=\livecd\reactos -Options=/MININT - -[LiveCD_Debug] -BootType=Windows2003 -SystemPath=\livecd\reactos -Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT - -[LiveCD_Screen] -BootType=Windows2003 -SystemPath=\livecd\reactos -Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT - -[LiveCD_LogFile] -BootType=Windows2003 -SystemPath=\livecd\reactos -Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT - -[LiveCD_RamDisk] -BootType=Windows2003 -SystemPath=ramdisk(0)\reactos -Options=/MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD - -[LiveCD_RamDisk_Debug] -BootType=Windows2003 -SystemPath=ramdisk(0)\reactos -Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD - -[LiveCD_RamDisk_Screen] -BootType=Windows2003 -SystemPath=ramdisk(0)\reactos -Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=livecd\livecd.iso /RDEXPORTASCD Removed: branches/setup_improvements/boot/bootdata/livecd.ini URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/livecd.ini [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/livecd.ini (removed) @@ -1,51 +0,0 @@ -[FREELOADER] -DefaultOS=LiveCD_Debug -TimeOut=5 - -[Display] -TitleText=ReactOS LiveCD -StatusBarColor=Cyan -StatusBarTextColor=Black -BackdropTextColor=White -BackdropColor=Blue -BackdropFillStyle=Medium -TitleBoxTextColor=White -TitleBoxColor=Red -MessageBoxTextColor=White -MessageBoxColor=Blue -MenuTextColor=Gray -MenuColor=Black -TextColor=Gray -SelectedTextColor=Black -SelectedColor=Gray -ShowTime=No -MenuBox=No -CenterMenu=No -MinimalUI=Yes -TimeText=Seconds until highlighted choice will be started automatically: - -[Operating Systems] -LiveCD="LiveCD" -LiveCD_Debug="LiveCD (Debug)" -LiveCD_Screen="LiveCD (Screen)" -LiveCD_LogFile="LiveCD (Log file)" - -[LiveCD] -BootType=Windows2003 -SystemPath=\reactos -Options=/MININT - -[LiveCD_Debug] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT - -[LiveCD_Screen] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT - -[LiveCD_LogFile] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT Modified: branches/setup_improvements/boot/bootdata/welcome_config/welcome.ini URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/bootdat…
============================================================================== --- branches/setup_improvements/boot/bootdata/welcome_config/welcome.ini [iso-8859-1] (original) +++ branches/setup_improvements/boot/bootdata/welcome_config/welcome.ini [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -1,4 +1,3 @@ - [Welcome] DisplayCheckBox = 0 DisplayExitButton = 1 Modified: branches/setup_improvements/boot/freeldr/bootsect/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/freeldr…
============================================================================== --- branches/setup_improvements/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -26,7 +26,7 @@ add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR bootcd regtest) add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat.bin FOR bootcd regtest) add_cd_file(TARGET fat32 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin FOR bootcd regtest) - add_cd_file(TARGET isoboot DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all hybridcd) - add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR bootcd regtest) + add_cd_file(TARGET isoboot DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR bootcd regtest) + add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR bootcd regtest) endif() Modified: branches/setup_improvements/boot/freeldr/freeldr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/boot/freeldr…
============================================================================== --- branches/setup_improvements/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -281,9 +281,7 @@ add_custom_target(freeldr ALL DEPENDS ${_freeldr_pe_output_file}) endif() -# rename freeldr on livecd to setupldr.sys because isoboot.bin looks for setupldr.sys add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR bootcd regtest) -add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR livecd hybridcd NAME_ON_CD setupldr.sys) if(NOT ARCH STREQUAL "arm") concatenate_files( Modified: branches/setup_improvements/modules/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/modules/CMak…
============================================================================== --- branches/setup_improvements/modules/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/modules/CMakeLists.txt [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -15,8 +15,8 @@ add_subdirectory(AHK_Tests) endif() -## Extra files for Boot/Live/Hybrid CD. You need to put them under [boot|live|hybrid]cd_extras -## in the same layout as you want them to be in the CD. +## Extra files for the Boot/Live CD. You need to put them under "[boot|live]cd_extras" +## using the same layout as you want them to be in the CD. if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/bootcd_extras/) file(GLOB_RECURSE EXTRA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd_extras/ ${CMAKE_CURRENT_SOURCE_DIR}/bootcd_extras/*) foreach(item ${EXTRA_FILES}) @@ -29,9 +29,3 @@ add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd_extras/${item} DESTINATION extras NO_CAB NAME_ON_CD ${item} FOR livecd) endforeach(item) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd_extras/) - file(GLOB_RECURSE EXTRA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd_extras/ ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd_extras/*) - foreach(item ${EXTRA_FILES}) - add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd_extras/${item} DESTINATION extras NO_CAB NAME_ON_CD ${item} FOR hybridcd) - endforeach(item) -endif() Modified: branches/setup_improvements/sdk/cmake/CMakeMacros.cmake URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/sdk/cmake/CM…
============================================================================== --- branches/setup_improvements/sdk/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ branches/setup_improvements/sdk/cmake/CMakeMacros.cmake [iso-8859-1] Mon Jul 3 17:53:23 2017 @@ -275,7 +275,7 @@ endmacro() function(add_cd_file) - cmake_parse_arguments(_CD "NO_CAB;NOT_IN_HYBRIDCD" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN}) + cmake_parse_arguments(_CD "NO_CAB" "DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN}) if(NOT (_CD_TARGET OR _CD_FILE)) message(FATAL_ERROR "You must provide a target or a file to install!") endif() @@ -307,7 +307,9 @@ if(NOT __cd EQUAL -1) # whether or not we should put it in reactos.cab or directly on cd if(_CD_NO_CAB) - # directly on cd + # directly on cd - replace the "reactos/" directory name to the current build architecture name + # WARNING: CMake REGEXes are always case-sensitive! + string(REGEX REPLACE "^reactos([\\\\/]+|$)" "${ARCH}\\1" _CD_ARCH_DESTINATION "${_CD_DESTINATION}") foreach(item ${_CD_FILE}) if(_CD_NAME_ON_CD) # rename it in the cd tree @@ -315,11 +317,7 @@ else() get_filename_component(__file ${item} NAME) endif() - set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") - # add it also into the hybridcd if not specified otherwise - if(NOT _CD_NOT_IN_HYBRIDCD) - set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "bootcd/${_CD_DESTINATION}/${__file}=${item}") - endif() + set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST "${_CD_ARCH_DESTINATION}/${__file}=${item}") endforeach() # manage dependency if(_CD_TARGET) @@ -355,30 +353,8 @@ get_filename_component(__file ${item} NAME) endif() set_property(GLOBAL APPEND PROPERTY LIVECD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") - # add it also into the hybridcd if not specified otherwise - if(NOT _CD_NOT_IN_HYBRIDCD) - set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "livecd/${_CD_DESTINATION}/${__file}=${item}") - endif() endforeach() endif() #end livecd - - # do we need also to add it to hybridcd? - list(FIND _CD_FOR hybridcd __cd) - if(NOT __cd EQUAL -1) - # manage dependency - if(_CD_TARGET) - add_dependencies(hybridcd ${_CD_TARGET}) - endif() - foreach(item ${_CD_FILE}) - if(_CD_NAME_ON_CD) - # rename it in the cd tree - set(__file ${_CD_NAME_ON_CD}) - else() - get_filename_component(__file ${item} NAME) - endif() - set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST "${_CD_DESTINATION}/${__file}=${item}") - endforeach() - endif() #end hybridcd # do we add it to regtest? list(FIND _CD_FOR regtest __cd) @@ -412,15 +388,16 @@ endfunction() function(create_iso_lists) - # generate reactos.cab before anything else + # Generate reactos.cab before anything else get_property(_filelist GLOBAL PROPERTY REACTOS_CAB_DEPENDS) - # begin with reactos.inf. We want this command to be always executed, so we pretend it generates another file although it will never do. + # Begin with reactos.inf. We want this command to be always executed, so we pretend it generates another file although it will never do. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/__some_non_existent_file COMMAND ${CMAKE_COMMAND} -E copy_if_different ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf DEPENDS ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.inf reactos_cab_inf) + # Now build reactos.cab itself add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -N -P ${REACTOS_SOURCE_DIR} @@ -429,32 +406,38 @@ add_custom_target(reactos_cab DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab) add_dependencies(reactos_cab reactos_cab_inf) + # Add reactos.cab into the BootCD add_cd_file( TARGET reactos_cab FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab DESTINATION reactos NO_CAB FOR bootcd regtest) + # Add the LiveImage into the BootCD add_cd_file( - FILE ${CMAKE_CURRENT_BINARY_DIR}/livecd.iso - DESTINATION livecd - FOR hybridcd) - + TARGET livecd + FILE ${CMAKE_CURRENT_BINARY_DIR}/liveimage.iso + DESTINATION root + NO_CAB FOR bootcd) + + # Write the LiveImage file list + get_property(_filelist GLOBAL PROPERTY LIVECD_FILE_LIST) + string(REPLACE ";" "\n" _filelist "${_filelist}") + file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.lst "${_filelist}") + unset(_filelist) + + # Write the BootCD file list get_property(_filelist GLOBAL PROPERTY BOOTCD_FILE_LIST) string(REPLACE ";" "\n" _filelist "${_filelist}") file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.lst "${_filelist}") unset(_filelist) - - get_property(_filelist GLOBAL PROPERTY LIVECD_FILE_LIST) - string(REPLACE ";" "\n" _filelist "${_filelist}") - file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.lst "${_filelist}") + # Also, append the file contents list of the LiveImage to the BootCD file list + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.lst "\n") + file(READ ${REACTOS_BINARY_DIR}/boot/livecd.lst _filelist) + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcd.lst "${_filelist}") unset(_filelist) - get_property(_filelist GLOBAL PROPERTY HYBRIDCD_FILE_LIST) - string(REPLACE ";" "\n" _filelist "${_filelist}") - file(APPEND ${REACTOS_BINARY_DIR}/boot/hybridcd.lst "${_filelist}") - unset(_filelist) - + # Write the BootCDRegTest file list get_property(_filelist GLOBAL PROPERTY BOOTCDREGTEST_FILE_LIST) string(REPLACE ";" "\n" _filelist "${_filelist}") file(APPEND ${REACTOS_BINARY_DIR}/boot/bootcdregtest.lst "${_filelist}") @@ -825,7 +808,7 @@ TARGET bcd_hive DESTINATION efi/boot NO_CAB - FOR bootcd regtest livecd) + FOR bootcd regtest) endfunction()
7 years, 5 months
1
0
0
0
[ssawant] 75272: [QCKLNCH] -Refactors and some code fixes (like CComHeapPtr, IID_PPV_ARG, _countof, etc.). -Minor suggestions fixed. CR-122 (https://code.reactos.org/cru/CR-122#details) SelfNote: S...
by ssawant@svn.reactos.org
Author: ssawant Date: Mon Jul 3 15:36:00 2017 New Revision: 75272 URL:
http://svn.reactos.org/svn/reactos?rev=75272&view=rev
Log: [QCKLNCH] -Refactors and some code fixes (like CComHeapPtr, IID_PPV_ARG, _countof, etc.). -Minor suggestions fixed. CR-122 (
https://code.reactos.org/cru/CR-122#details
) SelfNote: Should check if CComHeapPtr is overused! ;p Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.cpp [iso-8859-1] Mon Jul 3 15:36:00 2017 @@ -19,9 +19,7 @@ // *** CISFBand *** CISFBand::CISFBand() : - m_BandID(0), - m_hWndTb(NULL), - m_hInstance(NULL), + m_BandID(0), m_pidl(NULL), m_textFlag(true), m_iconFlag(true) @@ -44,10 +42,10 @@ pt.y = GET_Y_LPARAM(pos); ScreenToClient(&pt); - int index = SendMessage(m_hWndTb, TB_HITTEST, 0, (LPARAM)&pt); - bool chk = SendMessage(m_hWndTb, TB_GETBUTTON, abs(index), (LPARAM)&tb); + int index = SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)&pt); + bool chk = SendMessage(m_hWnd, TB_GETBUTTON, abs(index), (LPARAM)&tb); if(chk) - SHInvokeDefaultCommand(m_hWndTb, m_pISF, (LPITEMIDLIST)tb.dwData); + SHInvokeDefaultCommand(m_hWnd, m_pISF, (LPITEMIDLIST)tb.dwData); return 0; } @@ -64,16 +62,20 @@ pt.y = GET_Y_LPARAM(pos); ScreenToClient(&pt); - int index = SendMessage(m_hWndTb, TB_HITTEST, 0, (LPARAM)&pt); - bool chk = SendMessage(m_hWndTb, TB_GETBUTTON, abs(index), (LPARAM)&tb); - LPITEMIDLIST pidl = (LPITEMIDLIST)tb.dwData; + int index = SendMessage(m_hWnd, TB_HITTEST, 0, (LPARAM)&pt); + bool chk = SendMessage(m_hWnd, TB_GETBUTTON, abs(index), (LPARAM)&tb); + CComHeapPtr<ITEMIDLIST> pidl((LPITEMIDLIST)tb.dwData); if (chk) { ClientToScreen(&pt); - hr = m_pISF->GetUIObjectOf(m_hWndTb, 1, &pidl, IID_IContextMenu, NULL, (void**)&picm); - hr = picm->QueryContextMenu(fmenu, 0, 1, 0x7FFF, CMF_DEFAULTONLY); - int id = TrackPopupMenuEx(fmenu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RETURNCMD, pt.x, pt.y, m_hWndTb, 0); + hr = m_pISF->GetUIObjectOf(m_hWnd, 1, &pidl, IID_NULL_PPV_ARG(IContextMenu, &picm)); + if (FAILED_UNEXPECTEDLY(hr)) return hr; + + hr = picm->QueryContextMenu(fmenu, 0, 1, 0x7FFF, CMF_DEFAULTONLY); + if (FAILED_UNEXPECTEDLY(hr)) return hr; + + int id = TrackPopupMenuEx(fmenu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RETURNCMD, pt.x, pt.y, m_hWnd, 0); if (id > 0) { CMINVOKECOMMANDINFOEX info = { 0 }; @@ -87,7 +89,7 @@ { info.fMask |= CMIC_MASK_SHIFT_DOWN; } - info.hwnd = m_hWndTb; + info.hwnd = m_hWnd; info.lpVerb = MAKEINTRESOURCEA(id - 1); info.lpVerbW = MAKEINTRESOURCEW(id - 0x7FFF); info.nShow = SW_SHOWNORMAL; @@ -101,50 +103,60 @@ } // ToolbarTest -HWND CISFBand::CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst) +HRESULT CISFBand::CreateSimpleToolbar(HWND hWndParent) { // Declare and initialize local constants. const DWORD buttonStyles = BTNS_AUTOSIZE; // Create the toolbar. - HWND hWndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, + m_hWnd = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | TBSTYLE_FLAT | TBSTYLE_LIST | CCS_NORESIZE | CCS_NODIVIDER, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, - hWndParent, NULL, hInst, NULL); - if (hWndToolbar == NULL) - return NULL; + hWndParent, NULL, 0, NULL); + if (m_hWnd == NULL) + return E_FAIL; // Set the image list. HIMAGELIST* piml; HRESULT hr = SHGetImageList(SHIL_SMALL, IID_IImageList, (void**)&piml); - if (FAILED_UNEXPECTEDLY(hr)) - return NULL; - SendMessage(hWndToolbar, TB_SETIMAGELIST, 0, (LPARAM)piml); + if (FAILED_UNEXPECTEDLY(hr)) + { + DestroyWindow(); + return hr; + } + SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)piml); // Enumerate objects - CComPtr<IEnumIDList> pedl; - LPITEMIDLIST pidl = NULL; + CComPtr<IEnumIDList> pEndl; + CComHeapPtr<ITEMIDLIST> pidl; STRRET stret; ULONG count = 0; - hr = m_pISF->EnumObjects(0, SHCONTF_FOLDERS, &pedl); + hr = m_pISF->EnumObjects(0, SHCONTF_FOLDERS, &pEndl); if (FAILED_UNEXPECTEDLY(hr)) - return NULL; - - for (int i=0; pedl->Next(1, &pidl, 0) != S_FALSE; i++, count++) + { + DestroyWindow(); + return hr; + } + + for (int i=0; pEndl->Next(1, &pidl, NULL) != S_FALSE; i++, count++) { WCHAR sz[MAX_PATH]; int index = SHMapPIDLToSystemImageListIndex(m_pISF, pidl, NULL); - m_pISF->GetDisplayNameOf(pidl, SHGDN_NORMAL, &stret); - StrRetToBuf(&stret, pidl, sz, sizeof(sz)); - - TBBUTTON tb = { MAKELONG(index, 0), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, (DWORD_PTR)pidl, (INT_PTR)sz }; - SendMessage(hWndToolbar, TB_INSERTBUTTONW, 0, (LPARAM)&tb); + hr = m_pISF->GetDisplayNameOf(pidl, SHGDN_NORMAL, &stret); + if (FAILED_UNEXPECTEDLY(hr)) + { + strcpyW(sz, L"<Unknown-Name>"); + } + else + StrRetToBuf(&stret, pidl, sz, _countof(sz)); + + TBBUTTON tb = { MAKELONG(index, 0), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, (DWORD_PTR)*&pidl, (INT_PTR)sz }; + SendMessage(m_hWnd, TB_INSERTBUTTONW, 0, (LPARAM)&tb); } // Resize the toolbar, and then show it. - SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0); - - CoTaskMemFree((void*)pidl); - return hWndToolbar; + SendMessage(m_hWnd, TB_AUTOSIZE, 0, 0); + + return hr; } /*****************************************************************************/ @@ -165,8 +177,11 @@ } m_Site = pUnkSite; - m_hWndTb = CreateSimpleToolbar(hwndParent, m_hInstance); - hr = SubclassWindow(m_hWndTb); + hr = CreateSimpleToolbar(hwndParent); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + hr = SubclassWindow(m_hWnd); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -192,11 +207,11 @@ // *** IDeskBand *** STDMETHODIMP CISFBand::GetWindow(OUT HWND *phwnd) { - if (!m_hWndTb) + if (!m_hWnd) return E_FAIL; if (!phwnd) - return E_INVALIDARG; - *phwnd = m_hWndTb; + return E_POINTER; + *phwnd = m_hWnd; return S_OK; } @@ -209,24 +224,26 @@ STDMETHODIMP CISFBand::ShowDW(IN BOOL bShow) { - if (m_hWndTb) - { - ::ShowWindow(m_hWndTb, bShow ? SW_SHOW : SW_HIDE); + if (m_hWnd) + { + ShowWindow(bShow ? SW_SHOW : SW_HIDE); + return S_OK; } - return S_OK; + return E_FAIL; } STDMETHODIMP CISFBand::CloseDW(IN DWORD dwReserved) { - if (m_hWndTb) - { - ::ShowWindow(m_hWndTb, SW_HIDE); - ::DestroyWindow(m_hWndTb); - m_hWndTb = NULL; - } - - return S_OK; + if (m_hWnd) + { + ShowWindow(SW_HIDE); + DestroyWindow(); + m_hWnd = NULL; + return S_OK; + } + + return E_FAIL; } STDMETHODIMP CISFBand::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) @@ -238,9 +255,9 @@ STDMETHODIMP CISFBand::GetBandInfo(IN DWORD dwBandID, IN DWORD dwViewMode, IN OUT DESKBANDINFO *pdbi) { - TRACE("CTaskBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWndTb); + TRACE("CTaskBand::GetBandInfo(0x%x,0x%x,0x%p) hWnd=0x%p\n", dwBandID, dwViewMode, pdbi, m_hWnd); - if (m_hWndTb && pdbi) + if (m_hWnd && pdbi) { m_BandID = dwBandID; @@ -250,19 +267,19 @@ POINTL maxSize; POINTL itemSize; - ::GetWindowRect(m_hWndTb, &actualRect); + GetWindowRect(&actualRect); actualSize.x = actualRect.right - actualRect.left; actualSize.y = actualRect.bottom - actualRect.top; // Obtain the ideal size, to be used as min and max - SendMessageW(m_hWndTb, TB_AUTOSIZE, 0, 0); - SendMessageW(m_hWndTb, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&maxSize)); + SendMessageW(m_hWnd, TB_AUTOSIZE, 0, 0); + SendMessageW(m_hWnd, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&maxSize)); idealSize = maxSize; - SendMessageW(m_hWndTb, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&idealSize)); + SendMessageW(m_hWnd, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&idealSize)); // Obtain the button size, to be used as the integral size - DWORD size = SendMessageW(m_hWndTb, TB_GETBUTTONSIZE, 0, 0); + DWORD size = SendMessageW(m_hWnd, TB_GETBUTTONSIZE, 0, 0); itemSize.x = GET_X_LPARAM(size); itemSize.y = GET_Y_LPARAM(size); @@ -291,9 +308,11 @@ } if (pdbi->dwMask & DBIM_BKCOLOR) pdbi->dwMask &= ~DBIM_BKCOLOR; - - } - return S_OK; + + return S_OK; + } + + return E_FAIL; } /*****************************************************************************/ @@ -370,7 +389,7 @@ STDMETHODIMP CISFBand::ContainsWindow(IN HWND hWnd) { - if (hWnd == m_hWndTb || ::IsChild(m_hWndTb, hWnd)) + if (hWnd == m_hWnd || IsChild(hWnd)) { TRACE("CISFBand::ContainsWindow(0x%p) returns S_OK\n", hWnd); return S_OK; @@ -388,7 +407,7 @@ STDMETHODIMP CISFBand::IsWindowOwner(HWND hWnd) { - return (hWnd == m_hWndTb) ? S_OK : S_FALSE; + return (hWnd == m_hWnd) ? S_OK : S_FALSE; } /*****************************************************************************/ @@ -426,18 +445,18 @@ STDMETHODIMP CISFBand::InitializeSFB(IShellFolder *psf, PCIDLIST_ABSOLUTE pidl) { - LPITEMIDLIST pidlRoot; + CComHeapPtr<ITEMIDLIST> pidlRoot; SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlRoot); if (pidl == NULL || !psf->CompareIDs(0x80000000L, pidl, pidlRoot)) { m_pISF = psf; - m_pidl = pidl; + m_pidl = ILClone(pidl); } else { - psf->BindToObject(pidl, 0, IID_IShellFolder, (void**)&m_pISF); - m_pidl = pidl; + psf->BindToObject(pidl, 0, IID_PPV_ARG(IShellFolder, &m_pISF)); + m_pidl = ILClone(pidl); } return S_OK; @@ -491,10 +510,10 @@ { m_iconFlag = false; - HIMAGELIST* piml = (HIMAGELIST*) SendMessage(m_hWndTb, TB_GETIMAGELIST, 0, 0); + HIMAGELIST* piml = (HIMAGELIST*) SendMessage(m_hWnd, TB_GETIMAGELIST, 0, 0); HRESULT hr = SHGetImageList(SHIL_LARGE, IID_IImageList, (void**)&piml); if (FAILED_UNEXPECTEDLY(hr)) return hr; - SendMessage(m_hWndTb, TB_SETIMAGELIST, 0, (LPARAM)piml); + SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)piml); hr = IUnknown_Exec(m_Site, IID_IDeskBand, DBID_BANDINFOCHANGED, 0, NULL, NULL); if (FAILED_UNEXPECTEDLY(hr)) return hr; break; @@ -503,10 +522,10 @@ { m_iconFlag = true; - HIMAGELIST* piml = (HIMAGELIST*)SendMessage(m_hWndTb, TB_GETIMAGELIST, 0, 0); + HIMAGELIST* piml = (HIMAGELIST*)SendMessage(m_hWnd, TB_GETIMAGELIST, 0, 0); HRESULT hr = SHGetImageList(SHIL_SMALL, IID_IImageList, (void**)&piml); if (FAILED_UNEXPECTEDLY(hr)) return hr; - SendMessage(m_hWndTb, TB_SETIMAGELIST, 0, (LPARAM)piml); + SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)piml); hr = IUnknown_Exec(m_Site, IID_IDeskBand, DBID_BANDINFOCHANGED, 0, NULL, NULL); if (FAILED_UNEXPECTEDLY(hr)) return hr; break; @@ -516,14 +535,14 @@ if (m_textFlag) { m_textFlag = false; - SendMessage(m_hWndTb, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS); + SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS); HRESULT hr = IUnknown_Exec(m_Site, IID_IDeskBand, DBID_BANDINFOCHANGED, 0, NULL, NULL); if (FAILED_UNEXPECTEDLY(hr)) return hr; } else { m_textFlag = true; - SendMessage(m_hWndTb, TB_SETEXTENDEDSTYLE, 0, 0); + SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0, 0); HRESULT hr = IUnknown_Exec(m_Site, IID_IDeskBand, DBID_BANDINFOCHANGED, 0, NULL, NULL); if (FAILED_UNEXPECTEDLY(hr)) return hr; } Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CISFBand.h [iso-8859-1] Mon Jul 3 15:36:00 2017 @@ -25,9 +25,7 @@ DWORD m_BandID; CComPtr<IUnknown> m_Site; - // Toolbar - HWND m_hWndTb; - HINSTANCE m_hInstance; + // Toolbar CComPtr<IShellFolder> m_pISF; PCIDLIST_ABSOLUTE m_pidl; @@ -41,7 +39,7 @@ virtual ~CISFBand(); // Personal Methods - HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst); + HRESULT CreateSimpleToolbar(HWND hWndParent); LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnRButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/qcklnch/CQuickLaunchBand.cpp [iso-8859-1] Mon Jul 3 15:36:00 2017 @@ -17,7 +17,7 @@ HRESULT RegisterComCat() { CComPtr<ICatRegister> pcr; - HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); + HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(ICatRegister, &pcr)); if (SUCCEEDED(hr)) { CATID catid = CATID_DeskBand; @@ -29,7 +29,7 @@ HRESULT UnregisterComCat() { CComPtr<ICatRegister> pcr; - HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr); + HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(ICatRegister, &pcr)); if (SUCCEEDED(hr)) { CATID catid = CATID_DeskBand; @@ -41,8 +41,8 @@ // Pidl Browser LPITEMIDLIST PidlBrowse(HWND hwnd, int nCSIDL) { - LPITEMIDLIST pidlRoot = NULL; - LPITEMIDLIST pidlSelected = NULL; + CComHeapPtr<ITEMIDLIST> pidlRoot; + WCHAR path[MAX_PATH]; if (nCSIDL) @@ -51,12 +51,7 @@ } BROWSEINFO bi = { hwnd, pidlRoot, path, L"Choose a folder", 0, NULL, 0, 0 }; - pidlSelected = SHBrowseForFolder(&bi); - - if (pidlRoot) - { - CoTaskMemFree(pidlRoot); - } + LPITEMIDLIST pidlSelected = SHBrowseForFolder(&bi); return pidlSelected; } @@ -72,21 +67,21 @@ HRESULT CQuickLaunchBand::FinalConstruct() { - HRESULT hr = CISFBand_CreateInstance(IID_IUnknown, (void**) &m_punkISFB); + HRESULT hr = CISFBand_CreateInstance(IID_PPV_ARG(IUnknown, &m_punkISFB)); if (FAILED_UNEXPECTEDLY(hr)) return hr; CComPtr<IShellFolderBand> pISFB; - hr = m_punkISFB->QueryInterface(IID_IShellFolderBand, (void**) &pISFB); + hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IShellFolderBand, &pISFB)); if (FAILED_UNEXPECTEDLY(hr)) return hr; CComPtr<IShellFolder> pISF; hr = SHGetDesktopFolder(&pISF); if (FAILED_UNEXPECTEDLY(hr)) return hr; - LPITEMIDLIST pidl = PidlBrowse(m_hWndBro, CSIDL_DESKTOP); + CComHeapPtr<ITEMIDLIST> pidl(PidlBrowse(m_hWndBro, CSIDL_DESKTOP)); if (pidl == NULL) return E_FAIL; - - pISFB->InitializeSFB(pISF, pidl); + pISFB->InitializeSFB(pISF, pidl); + return hr; } @@ -97,7 +92,7 @@ // Internal CISFBand Calls CComPtr<IObjectWithSite> pIOWS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IObjectWithSite, (void**)&pIOWS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IObjectWithSite, &pIOWS)); if (FAILED(hr)) return hr; return pIOWS->SetSite(pUnkSite); @@ -109,7 +104,7 @@ // Internal CISFBand Calls CComPtr<IObjectWithSite> pIOWS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IObjectWithSite, (void**)&pIOWS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IObjectWithSite, &pIOWS)); if (FAILED(hr)) return hr; return pIOWS->GetSite(riid, ppvSite); @@ -121,7 +116,7 @@ { // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->GetWindow(phwnd); @@ -131,7 +126,7 @@ { // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->ContextSensitiveHelp(fEnterMode); @@ -141,7 +136,7 @@ { // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->ShowDW(bShow); @@ -151,7 +146,7 @@ { // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->CloseDW(dwReserved); @@ -161,7 +156,7 @@ { // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->ResizeBorderDW(prcBorder, punkToolbarSite, fReserved); @@ -173,7 +168,7 @@ // Internal CISFBand Calls CComPtr<IDeskBand> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBand, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBand, &pIDB)); if (FAILED(hr)) return hr; return pIDB->GetBandInfo(dwBandID, dwViewMode, pdbi); @@ -187,7 +182,7 @@ // Internal CISFBand Calls CComPtr<IDeskBar> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBar, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBar, &pIDB)); if (FAILED(hr)) return hr; return pIDB->SetClient(punkClient); @@ -199,7 +194,7 @@ // Internal CISFBand Calls CComPtr<IDeskBar> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBar, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBar, &pIDB)); if (FAILED(hr)) return hr; return pIDB->GetClient(ppunkClient); @@ -211,7 +206,7 @@ // Internal CISFBand Calls CComPtr<IDeskBar> pIDB; - HRESULT hr = m_punkISFB->QueryInterface(IID_IDeskBar, (void**)&pIDB); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IDeskBar, &pIDB)); if (FAILED(hr)) return hr; return pIDB->OnPosRectChangeDB(prc); @@ -225,7 +220,7 @@ // Internal CISFBand Calls CComPtr<IPersistStream> pIPS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IPersistStream, (void**)&pIPS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IPersistStream, &pIPS)); if (FAILED(hr)) return hr; return pIPS->GetClassID(pClassID); @@ -235,7 +230,7 @@ { // Internal CISFBand Calls CComPtr<IPersistStream> pIPS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IPersistStream, (void**)&pIPS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IPersistStream, &pIPS)); if (FAILED(hr)) return hr; return pIPS->IsDirty(); @@ -247,7 +242,7 @@ // Internal CISFBand Calls CComPtr<IPersistStream> pIPS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IPersistStream, (void**)&pIPS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IPersistStream, &pIPS)); if (FAILED(hr)) return hr; return pIPS->Load(pStm); @@ -257,7 +252,7 @@ { // Internal CISFBand Calls CComPtr<IPersistStream> pIPS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IPersistStream, (void**)&pIPS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IPersistStream, &pIPS)); if (FAILED(hr)) return hr; return pIPS->Save(pStm, fClearDirty); @@ -269,7 +264,7 @@ // Internal CISFBand Calls CComPtr<IPersistStream> pIPS; - HRESULT hr = m_punkISFB->QueryInterface(IID_IPersistStream, (void**)&pIPS); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IPersistStream, &pIPS)); if (FAILED(hr)) return hr; return pIPS->GetSizeMax(pcbSize); @@ -294,7 +289,7 @@ { // Internal CISFBand Calls CComPtr<IWinEventHandler> pWEH; - HRESULT hr = m_punkISFB->QueryInterface(IID_IWinEventHandler, (void**)&pWEH); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IWinEventHandler, &pWEH)); if (FAILED(hr)) return hr; return pWEH->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult); @@ -304,7 +299,7 @@ { // Internal CISFBand Calls CComPtr<IWinEventHandler> pWEH; - HRESULT hr = m_punkISFB->QueryInterface(IID_IWinEventHandler, (void**)&pWEH); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IWinEventHandler, &pWEH)); if (FAILED(hr)) return hr; return pWEH->IsWindowOwner(hWnd); @@ -316,7 +311,7 @@ { // Internal CISFBand Calls CComPtr<IOleCommandTarget> pOCT; - HRESULT hr = m_punkISFB->QueryInterface(IID_IOleCommandTarget, (void**)&pOCT); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &pOCT)); if (FAILED(hr)) return hr; return pOCT->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText); @@ -326,7 +321,7 @@ { // Internal CISFBand Calls CComPtr<IOleCommandTarget> pOCT; - HRESULT hr = m_punkISFB->QueryInterface(IID_IOleCommandTarget, (void**)&pOCT); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &pOCT)); if (FAILED(hr)) return hr; return pOCT->Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); @@ -338,7 +333,7 @@ { // Internal CISFBand Calls CComPtr<IContextMenu> pICM; - HRESULT hr = m_punkISFB->QueryInterface(IID_IContextMenu, (void**)&pICM); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IContextMenu, &pICM)); if (FAILED(hr)) return hr; return pICM->GetCommandString(idCmd, uFlags, pwReserved, pszName, cchMax); @@ -348,7 +343,7 @@ { // Internal CISFBand Calls CComPtr<IContextMenu> pICM; - HRESULT hr = m_punkISFB->QueryInterface(IID_IContextMenu, (void**)&pICM); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IContextMenu, &pICM)); if (FAILED(hr)) return hr; return pICM->InvokeCommand(pici); @@ -358,7 +353,7 @@ { // Internal CISFBand Calls CComPtr<IContextMenu> pICM; - HRESULT hr = m_punkISFB->QueryInterface(IID_IContextMenu, (void**)&pICM); + HRESULT hr = m_punkISFB->QueryInterface(IID_PPV_ARG(IContextMenu, &pICM)); if (FAILED(hr)) return hr; return pICM->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
7 years, 5 months
1
0
0
0
[pschweitzer] 75271: [NET] On dismount, you can either use: net use /delete <drive>: or net use <drive>: /delete CORE-13517
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jul 2 20:39:48 2017 New Revision: 75271 URL:
http://svn.reactos.org/svn/reactos?rev=75271&view=rev
Log: [NET] On dismount, you can either use: net use /delete <drive>: or net use <drive>: /delete CORE-13517 Modified: trunk/reactos/base/applications/network/net/cmdUse.c Modified: trunk/reactos/base/applications/network/net/cmdUse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/net/cmdUse.c [iso-8859-1] Sun Jul 2 20:39:48 2017 @@ -78,12 +78,32 @@ } } +static +BOOL +ValidateDeviceName(PWSTR DevName) +{ + DWORD Len; + + Len = wcslen(DevName); + if (Len != 2) + { + return FALSE; + } + + if (!iswalpha(DevName[0]) || DevName[1] != L':') + { + return FALSE; + } + + return TRUE; +} + INT cmdUse( INT argc, WCHAR **argv) { - DWORD Status, Len; + DWORD Status, Len, Delete; if (argc == 2) { @@ -97,14 +117,7 @@ } else if (argc == 3) { - Len = wcslen(argv[2]); - if (Len != 2) - { - ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); - return 1; - } - - if (!iswalpha(argv[2][0]) || argv[2][1] != L':') + if (!ValidateDeviceName(argv[2])) { ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; @@ -119,34 +132,39 @@ return 0; } - Len = wcslen(argv[2]); - if (Len != 1 && Len != 2) - { - ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); - return 1; - } - - if (Len == 2 && argv[2][1] != L':') - { - ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); - return 1; - } - - if (argv[2][0] != L'*' && !iswalpha(argv[2][0])) - { - ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); - return 1; + Delete = 0; + if (wcsicmp(argv[2], L"/DELETE") == 0) + { + Delete = 3; + } + else + { + if ((argv[2][0] != '*' && argv[2][1] != 0) && + !ValidateDeviceName(argv[2])) + { + ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); + return 1; + } } if (wcsicmp(argv[3], L"/DELETE") == 0) { - if (argv[2][0] == L'*') + Delete = 2; + } + + if (Delete != 0) + { + if (!ValidateDeviceName(argv[Delete]) || argv[Delete][0] == L'*') { ConResPrintf(StdErr, IDS_ERROR_INVALID_OPTION_VALUE, L"DeviceName"); return 1; } - return WNetCancelConnection2(argv[2], CONNECT_UPDATE_PROFILE, FALSE); + Status = WNetCancelConnection2(argv[Delete], CONNECT_UPDATE_PROFILE, FALSE); + if (Status != NO_ERROR) + PrintError(Status); + + return Status; } else {
7 years, 5 months
1
0
0
0
[ekohl] 75270: [NETAPI32] - Add DsGetDcSiteCoverageA stub. - Implement DsGetDcSiteCoverageW. [SDK/INCLUDE] Add DsGetDcSiteCoverageA/W prototypes to dsgetdc.h.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jul 2 20:21:27 2017 New Revision: 75270 URL:
http://svn.reactos.org/svn/reactos?rev=75270&view=rev
Log: [NETAPI32] - Add DsGetDcSiteCoverageA stub. - Implement DsGetDcSiteCoverageW. [SDK/INCLUDE] Add DsGetDcSiteCoverageA/W prototypes to dsgetdc.h. Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/dll/win32/netapi32/netlogon.c trunk/reactos/sdk/include/psdk/dsgetdc.h Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jul 2 20:21:27 2017 @@ -16,8 +16,8 @@ @ stub DsGetDcNextW @ stub DsGetDcOpenA @ stub DsGetDcOpenW -@ stub DsGetDcSiteCoverageA -@ stub DsGetDcSiteCoverageW +@ stdcall DsGetDcSiteCoverageA(str ptr str) +@ stdcall DsGetDcSiteCoverageW(wstr ptr wstr) @ stub DsGetForestTrustInformationW @ stdcall DsGetSiteNameA(str str) @ stdcall DsGetSiteNameW(wstr wstr) Modified: trunk/reactos/dll/win32/netapi32/netlogon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netlogo…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] Sun Jul 2 20:21:27 2017 @@ -84,7 +84,7 @@ { FIXME("DsAddressToSiteNamesA(%s, %lu, %p, %p)\n", debugstr_a(ComputerName), EntryCount, SocketAddresses, SiteNames); - return ERROR_NO_LOGON_SERVERS; + return ERROR_CALL_NOT_IMPLEMENTED; } @@ -190,16 +190,6 @@ } -VOID -WINAPI -DsRoleFreeMemory( - _In_ PVOID Buffer) -{ - TRACE("DsRoleFreeMemory(%p)\n", Buffer); - HeapFree(GetProcessHeap(), 0, Buffer); -} - - DWORD WINAPI DsGetDcNameA( @@ -237,13 +227,93 @@ DWORD WINAPI +DsGetDcSiteCoverageA( + _In_opt_ LPCSTR ServerName, + _Out_ PULONG EntryCount, + _Out_ LPSTR **SiteNames) +{ + FIXME("DsGetDcSiteCoverageA(%s, %p, %p)\n", + debugstr_a(ServerName), EntryCount, SiteNames); + return ERROR_CALL_NOT_IMPLEMENTED; +} + + +DWORD +WINAPI +DsGetDcSiteCoverageW( + _In_opt_ LPCWSTR ServerName, + _Out_ PULONG EntryCount, + _Out_ LPWSTR **SiteNames) +{ + PNL_SITE_NAME_ARRAY SiteNameArray = NULL; + PWSTR *SiteNamesBuffer = NULL, Ptr; + ULONG BufferSize, i; + NET_API_STATUS status; + + TRACE("DsGetDcSiteCoverageA(%s, %p, %p)\n", + debugstr_w(ServerName), EntryCount, SiteNames); + + *EntryCount = 0; + *SiteNames = NULL; + + RpcTryExcept + { + status = DsrGetDcSiteCoverageW((PWSTR)ServerName, + &SiteNameArray); + if (status == NERR_Success) + { + if (SiteNameArray->EntryCount == 0) + { + status = ERROR_INVALID_PARAMETER; + } + else + { + BufferSize = SiteNameArray->EntryCount * sizeof(PWSTR); + for (i = 0; i < SiteNameArray->EntryCount; i++) + BufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR); + + status = NetApiBufferAllocate(BufferSize, (PVOID*)&SiteNamesBuffer); + if (status == NERR_Success) + { + ZeroMemory(SiteNamesBuffer, BufferSize); + + Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR)); + for (i = 0; i < SiteNameArray->EntryCount; i++) + { + SiteNamesBuffer[i] = Ptr; + CopyMemory(Ptr, + SiteNameArray->SiteNames[i].Buffer, + SiteNameArray->SiteNames[i].Length); + + Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SiteNames[i].Length + sizeof(WCHAR)); + } + + *EntryCount = SiteNameArray->EntryCount; + *SiteNames = SiteNamesBuffer; + } + } + + MIDL_user_free(SiteNameArray); + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +DWORD +WINAPI DsGetSiteNameA( _In_ LPCSTR ComputerName, _Out_ LPSTR *SiteName) { FIXME("DsGetSiteNameA(%s, %p)\n", debugstr_a(ComputerName), SiteName); - return ERROR_CALL_NOT_IMPLEMENTED; } @@ -271,6 +341,16 @@ RpcEndExcept; return status; +} + + +VOID +WINAPI +DsRoleFreeMemory( + _In_ PVOID Buffer) +{ + TRACE("DsRoleFreeMemory(%p)\n", Buffer); + HeapFree(GetProcessHeap(), 0, Buffer); } Modified: trunk/reactos/sdk/include/psdk/dsgetdc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/dsgetdc.h…
============================================================================== --- trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] Sun Jul 2 20:21:27 2017 @@ -124,6 +124,20 @@ ULONG Flags, PDOMAIN_CONTROLLER_INFOW* DomainControllerInfo); +DWORD +WINAPI +DsGetDcSiteCoverageA( + LPCSTR ServerName, + PULONG EntryCount, + LPSTR **SiteNames); + +DWORD +WINAPI +DsGetDcSiteCoverageW( + LPCWSTR ServerName, + PULONG EntryCount, + LPWSTR **SiteNames); + #ifdef UNICODE typedef DOMAIN_CONTROLLER_INFOW DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; typedef DS_DOMAIN_TRUSTSW DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS; @@ -131,6 +145,7 @@ #define DsAddressToSiteNamesEx DsAddressToSiteNamesExW #define DsEnumerateDomainTrusts DsEnumerateDomainTrustsW #define DsGetDcName DsGetDcNameW +#define DsGetDcSiteCoverage DsGetDcSiteCoverageW #else typedef DOMAIN_CONTROLLER_INFOA DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; typedef DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS; @@ -138,6 +153,7 @@ #define DsAddressToSiteNamesEx DsAddressToSiteNamesExA #define DsEnumerateDomainTrusts DsEnumerateDomainTrustsA #define DsGetDcName DsGetDcNameA +#define DsGetDcSiteCoverage DsGetDcSiteCoverageA #endif #ifdef __cplusplus
7 years, 5 months
1
0
0
0
[pschweitzer] 75269: [RXCE] Assorted fixes: - Avoid list corruption - Avoid stack corruption - Avoid ASSERT on FCB reuse for same file type CORE-11327
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jul 2 20:10:16 2017 New Revision: 75269 URL:
http://svn.reactos.org/svn/reactos?rev=75269&view=rev
Log: [RXCE] Assorted fixes: - Avoid list corruption - Avoid stack corruption - Avoid ASSERT on FCB reuse for same file type CORE-11327 Modified: trunk/reactos/sdk/lib/drivers/rxce/rxce.c Modified: trunk/reactos/sdk/lib/drivers/rxce/rxce.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rxce/rxce.…
============================================================================== --- trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] Sun Jul 2 20:10:16 2017 @@ -2899,13 +2899,13 @@ { PLIST_ENTRY ListEntry; - for (ListEntry = ThisSrvOpen->FobxList.Flink; - ListEntry != &ThisSrvOpen->FobxList; - ListEntry = ListEntry->Flink) + ListEntry = ThisSrvOpen->FobxList.Flink; + while (ListEntry != &ThisSrvOpen->FobxList) { PFOBX Fobx; Fobx = CONTAINING_RECORD(ListEntry, FOBX, FobxQLinks); + ListEntry = ListEntry->Flink; RxFinalizeNetFobx(Fobx, TRUE, ForceFinalize); } } @@ -3662,14 +3662,14 @@ IN RX_FILE_TYPE FileType, IN PFCB_INIT_PACKET InitPacket OPTIONAL) { - NODE_TYPE_CODE OldType; + RX_FILE_TYPE OldType; PAGED_CODE(); DPRINT("RxFinishFcbInitialization(%p, %x, %p)\n", Fcb, FileType, InitPacket); - OldType = Fcb->Header.NodeTypeCode; - Fcb->Header.NodeTypeCode = FileType; + OldType = NodeType(Fcb); + NodeType(Fcb) = FileType; /* If mini-rdr already did the job for mailslot attributes, 0 the rest */ if (BooleanFlagOn(Fcb->FcbState, FCB_STATE_TIME_AND_SIZE_ALREADY_SET) && FileType == RDBSS_NTC_MAILSLOT) { @@ -3688,19 +3688,23 @@ if (FileType != RDBSS_NTC_STORAGE_TYPE_UNKNOWN && FileType != RDBSS_NTC_STORAGE_TYPE_DIRECTORY) { - /* If our FCB newly points to a file, initiliaz everything related */ - if (FileType == RDBSS_NTC_STORAGE_TYPE_FILE && - OldType != RDBSS_NTC_STORAGE_TYPE_FILE) - { - RxInitializeLowIoPerFcbInfo(&((PFCB)Fcb)->Specific.Fcb.LowIoPerFcbInfo); - FsRtlInitializeFileLock(&((PFCB)Fcb)->Specific.Fcb.FileLock, &RxLockOperationCompletion, - &RxUnlockOperation); - - ((PFCB)Fcb)->BufferedLocks.List = NULL; - ((PFCB)Fcb)->BufferedLocks.PendingLockOps = 0; - - Fcb->Header.IsFastIoPossible = FastIoIsQuestionable; - } + /* If our FCB newly points to a file, initiliaze everything related */ + if (FileType == RDBSS_NTC_STORAGE_TYPE_FILE) + + { + if (OldType != RDBSS_NTC_STORAGE_TYPE_FILE) + { + RxInitializeLowIoPerFcbInfo(&((PFCB)Fcb)->Specific.Fcb.LowIoPerFcbInfo); + FsRtlInitializeFileLock(&((PFCB)Fcb)->Specific.Fcb.FileLock, RxLockOperationCompletion, + RxUnlockOperation); + + ((PFCB)Fcb)->BufferedLocks.List = NULL; + ((PFCB)Fcb)->BufferedLocks.PendingLockOps = 0; + + Fcb->Header.IsFastIoPossible = FastIoIsQuestionable; + } + } + /* If not a file, validate type */ else { ASSERT(FileType >= RDBSS_NTC_SPOOLFILE && FileType <= RDBSS_NTC_MAILSLOT); @@ -4561,8 +4565,7 @@ { PAGED_CODE(); - RxTimerInterval.HighPart = -1; - RxTimerInterval.LowPart = -550000; + RxTimerInterval.QuadPart = -550000; KeInitializeSpinLock(&RxTimerLock); InitializeListHead(&RxTimerQueueHead); InitializeListHead(&RxRecurrentWorkItemsList); @@ -6205,15 +6208,17 @@ RxProcessChangeBufferingStateRequestsForSrvOpen( PSRV_OPEN SrvOpen) { - LONG NumberOfBufferingChangeRequests, OldBufferingToken; + LONG NumberOfBufferingChangeRequests, LockedOldBufferingToken, OldBufferingToken; /* Get the current number of change requests */ NumberOfBufferingChangeRequests = ((PSRV_CALL)SrvOpen->pVNetRoot->pNetRoot->pSrvCall)->BufferingManager.CumulativeNumberOfBufferingChangeRequests; /* Get our old token */ - OldBufferingToken = InterlockedCompareExchange(&SrvOpen->BufferingToken, - NumberOfBufferingChangeRequests, NumberOfBufferingChangeRequests); - /* Do we have stuff to process? */ - if (OldBufferingToken != SrvOpen->BufferingToken) + OldBufferingToken = SrvOpen->BufferingToken; + LockedOldBufferingToken = InterlockedCompareExchange(&SrvOpen->BufferingToken, + NumberOfBufferingChangeRequests, + NumberOfBufferingChangeRequests); + /* If buffering state changed in between, process changes */ + if (OldBufferingToken != LockedOldBufferingToken) { PFCB Fcb; NTSTATUS Status;
7 years, 5 months
1
0
0
0
[ekohl] 75268: [NETAPI32] - Add DsAddressToSiteNamesA stub. - Implement DsAddressToSiteNamesW. [SDK/INCLUDE] Add DsAddressToSiteNamesA/W and DsAddressToSiteNamesExA/W prototypes to dsgetdc.h.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jul 2 18:29:38 2017 New Revision: 75268 URL:
http://svn.reactos.org/svn/reactos?rev=75268&view=rev
Log: [NETAPI32] - Add DsAddressToSiteNamesA stub. - Implement DsAddressToSiteNamesW. [SDK/INCLUDE] Add DsAddressToSiteNamesA/W and DsAddressToSiteNamesExA/W prototypes to dsgetdc.h. Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/dll/win32/netapi32/netlogon.c trunk/reactos/sdk/include/psdk/dsgetdc.h Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jul 2 18:29:38 2017 @@ -1,8 +1,8 @@ @ stub CredpValidateTargetName -@ stub DsAddressToSiteNamesA +@ stdcall DsAddressToSiteNamesA(str long ptr str) @ stub DsAddressToSiteNamesExA @ stub DsAddressToSiteNamesExW -@ stub DsAddressToSiteNamesW +@ stdcall DsAddressToSiteNamesW(wstr long ptr wstr) @ stub DsDeregisterDnsHostRecordsA @ stub DsDeregisterDnsHostRecordsW 8 stdcall DsEnumerateDomainTrustsA(wstr long ptr ptr) Modified: trunk/reactos/dll/win32/netapi32/netlogon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netlogo…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] Sun Jul 2 18:29:38 2017 @@ -9,6 +9,7 @@ /* INCLUDES ******************************************************************/ #include "netapi32.h" +#include <winsock2.h> #include <rpc.h> #include <dsrole.h> #include <dsgetdc.h> @@ -75,6 +76,92 @@ DWORD WINAPI +DsAddressToSiteNamesA( + _In_opt_ LPCSTR ComputerName, + _In_ DWORD EntryCount, + _In_ PSOCKET_ADDRESS SocketAddresses, + _Out_ LPSTR **SiteNames) +{ + FIXME("DsAddressToSiteNamesA(%s, %lu, %p, %p)\n", + debugstr_a(ComputerName), EntryCount, SocketAddresses, SiteNames); + return ERROR_NO_LOGON_SERVERS; +} + + +DWORD +WINAPI +DsAddressToSiteNamesW( + _In_opt_ LPCWSTR ComputerName, + _In_ DWORD EntryCount, + _In_ PSOCKET_ADDRESS SocketAddresses, + _Out_ LPWSTR **SiteNames) +{ + PNL_SITE_NAME_ARRAY SiteNameArray = NULL; + PWSTR *SiteNamesBuffer = NULL, Ptr; + ULONG BufferSize, i; + NET_API_STATUS status; + + TRACE("DsAddressToSiteNamesW(%s, %lu, %p, %p)\n", + debugstr_w(ComputerName), EntryCount, SocketAddresses, SiteNames); + + if (EntryCount == 0) + return ERROR_INVALID_PARAMETER; + + *SiteNames = NULL; + + RpcTryExcept + { + status = DsrAddressToSiteNamesW((PWSTR)ComputerName, + EntryCount, + (PNL_SOCKET_ADDRESS)SocketAddresses, + &SiteNameArray); + if (status == NERR_Success) + { + if (SiteNameArray->EntryCount == 0) + { + status = ERROR_INVALID_PARAMETER; + } + else + { + BufferSize = SiteNameArray->EntryCount * sizeof(PWSTR); + for (i = 0; i < SiteNameArray->EntryCount; i++) + BufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR); + + status = NetApiBufferAllocate(BufferSize, (PVOID*)&SiteNamesBuffer); + if (status == NERR_Success) + { + ZeroMemory(SiteNamesBuffer, BufferSize); + + Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR)); + for (i = 0; i < SiteNameArray->EntryCount; i++) + { + SiteNamesBuffer[i] = Ptr; + CopyMemory(Ptr, + SiteNameArray->SiteNames[i].Buffer, + SiteNameArray->SiteNames[i].Length); + + Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SiteNames[i].Length + sizeof(WCHAR)); + } + + *SiteNames = SiteNamesBuffer; + } + } + + MIDL_user_free(SiteNameArray); + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +DWORD +WINAPI DsEnumerateDomainTrustsA( _In_opt_ LPSTR ServerName, _In_ ULONG Flags, Modified: trunk/reactos/sdk/include/psdk/dsgetdc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/dsgetdc.h…
============================================================================== --- trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] Sun Jul 2 18:29:38 2017 @@ -63,6 +63,36 @@ } DS_DOMAIN_TRUSTSW, *PDS_DOMAIN_TRUSTSW; DWORD WINAPI +DsAddressToSiteNamesA( + LPCSTR ComputerName, + DWORD EntryCount, + PSOCKET_ADDRESS SocketAddresses, + LPSTR **SiteNames); + +DWORD WINAPI +DsAddressToSiteNamesW( + LPCWSTR ComputerName, + DWORD EntryCount, + PSOCKET_ADDRESS SocketAddresses, + LPWSTR **SiteNames); + +DWORD WINAPI +DsAddressToSiteNamesExA( + LPCSTR ComputerName, + DWORD EntryCount, + PSOCKET_ADDRESS SocketAddresses, + LPSTR **SiteNames, + LPSTR **SubnetNames); + +DWORD WINAPI +DsAddressToSiteNamesExW( + LPCWSTR ComputerName, + DWORD EntryCount, + PSOCKET_ADDRESS SocketAddresses, + LPWSTR **SiteNames, + LPWSTR **SubnetNames); + +DWORD WINAPI DsEnumerateDomainTrustsA( LPSTR ServerName, ULONG Flags, @@ -97,11 +127,15 @@ #ifdef UNICODE typedef DOMAIN_CONTROLLER_INFOW DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; typedef DS_DOMAIN_TRUSTSW DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS; +#define DsAddressToSiteNames DsAddressToSiteNamesW +#define DsAddressToSiteNamesEx DsAddressToSiteNamesExW #define DsEnumerateDomainTrusts DsEnumerateDomainTrustsW #define DsGetDcName DsGetDcNameW #else typedef DOMAIN_CONTROLLER_INFOA DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO; typedef DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS; +#define DsAddressToSiteNames DsAddressToSiteNamesA +#define DsAddressToSiteNamesEx DsAddressToSiteNamesExA #define DsEnumerateDomainTrusts DsEnumerateDomainTrustsA #define DsGetDcName DsGetDcNameA #endif
7 years, 5 months
1
0
0
0
[pschweitzer] 75267: [COPYSUP] Addendum to r75265 (bis)
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jul 2 17:08:27 2017 New Revision: 75267 URL:
http://svn.reactos.org/svn/reactos?rev=75267&view=rev
Log: [COPYSUP] Addendum to r75265 (bis) Modified: trunk/reactos/sdk/lib/drivers/CMakeLists.txt Modified: trunk/reactos/sdk/lib/drivers/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/CMakeLists…
============================================================================== --- trunk/reactos/sdk/lib/drivers/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/CMakeLists.txt [iso-8859-1] Sun Jul 2 17:08:27 2017 @@ -1,5 +1,6 @@ add_subdirectory(chew) +add_subdirectory(copysup) add_subdirectory(csq) add_subdirectory(hidparser) add_subdirectory(ip)
7 years, 5 months
1
0
0
0
[pschweitzer] 75266: [RDBSS] Addendum to r75265
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jul 2 17:04:12 2017 New Revision: 75266 URL:
http://svn.reactos.org/svn/reactos?rev=75266&view=rev
Log: [RDBSS] Addendum to r75265 Modified: trunk/reactos/sdk/lib/drivers/rdbsslib/CMakeLists.txt Modified: trunk/reactos/sdk/lib/drivers/rdbsslib/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rdbsslib/C…
============================================================================== --- trunk/reactos/sdk/lib/drivers/rdbsslib/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/rdbsslib/CMakeLists.txt [iso-8859-1] Sun Jul 2 17:04:12 2017 @@ -1,6 +1,7 @@ add_definitions(-DUNICODE -D_UNICODE -DRDBSS_TRACKER) -include_directories(${REACTOS_SOURCE_DIR}/drivers/filesystems/mup) +include_directories(${REACTOS_SOURCE_DIR}/drivers/filesystems/mup + ${REACTOS_SOURCE_DIR}/sdk/lib/drivers/copysup) list(APPEND SOURCE rdbss.c)
7 years, 5 months
1
0
0
0
[pschweitzer] 75265: [RDBSS] - Implement RxCloseAssociatedSrvOpen(), RxFastIoRead(), RxPurgeNetFcb(), RxRemoveShareAccess(), RxRemoveShareAccessPerSrvOpens() - Continue implementation of RxCommonCl...
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jul 2 17:00:11 2017 New Revision: 75265 URL:
http://svn.reactos.org/svn/reactos?rev=75265&view=rev
Log: [RDBSS] - Implement RxCloseAssociatedSrvOpen(), RxFastIoRead(), RxPurgeNetFcb(), RxRemoveShareAccess(), RxRemoveShareAccessPerSrvOpens() - Continue implementation of RxCommonCleanup() to handle allocated SRV_OPEN - Halfplement RxFastIoCheckIfPossible() so that it handles read operations - Stub RxCancelNotifyChangeDirectoryRequestsForFobx() [RXCE] - Implement RxChangeBufferingState(), RxFinalizeSrvOpen(), RxFreeFcbObject(), RxGatherRequestsForSrvOpen(), RxGetDeviceObjectOfInstance(), RxInitializeRxTimer(), RxMarkFobxOnCleanup(), RxMarkFobxOnClose(), RxpDiscardChangeBufferingStateRequests(), RxpDispatchChangeBufferingStateRequests(), RxpLookupSrvOpenForRequestLite(), RxpMarkInstanceForScavengedFinalization(), RxPostOneShotTimerRequest(), RxPrepareRequestForReuse(), RxProcessChangeBufferingStateRequestsForSrvOpen(), RxpUndoScavengerFinalizationMarking(), RxPurgeChangeBufferingStateRequestsForSrvOpen(), RxPurgeFobxFromCache(), RxRemoveNameNetFcb(), RxScavengerTimerRoutine(), RxTimerDispatch() - Finish implementation of RxDereference() to handle scavenger - Finish implementation of RxLowIoCompletionTail() to handle blocked operations resume - Fix a bug in RxFinalizeNetFcb() where it was dereferencing its NET_ROOT instead of its V_NET_ROOT - Fix bugs in __RxAcquireFcb() where it improperly handled the lack of RX_CONTEXT - Halfplement RxResumeBlockedOperations_ALL() to extract blocked operations from RX_CONTEXT (and drop them...) - Stub RxDispatchChangeBufferingStateRequests(), RxScavengerFinalizeEntries() [COPYSUP] - Implement FsRtlCopyRead2() This library is basically what you can find in FsRtl with an extended support of Top Level IRP. It is used by RDBSS for FastIO. Next to come in it will be FsRtlCopyWrite2(). This commit brings several improvements to current work on RBDSS/RXCE. First of all, both libraries will leak less (again!). It also brings the scavenger infrastructure (not fully fonctionnal though). Our NFS driver doesn't make use of it though. Finally, this brings support of FastIO (for read operations ;-)) to our NFS driver! Regarding CORE-13484, with copy + FastIO I could copy a file without troubles. But that seems to be still problematic with xcopy without FastIO... CORE-13484 CORE-11327 Added: trunk/reactos/sdk/lib/drivers/copysup/ trunk/reactos/sdk/lib/drivers/copysup/CMakeLists.txt (with props) trunk/reactos/sdk/lib/drivers/copysup/copysup.c (with props) trunk/reactos/sdk/lib/drivers/copysup/copysup.h (with props) Modified: trunk/reactos/drivers/filesystems/nfs/CMakeLists.txt trunk/reactos/sdk/include/ddk/buffring.h trunk/reactos/sdk/include/ddk/fcb.h trunk/reactos/sdk/include/ddk/mrxfcb.h trunk/reactos/sdk/include/ddk/nodetype.h trunk/reactos/sdk/include/ddk/rxcontx.h trunk/reactos/sdk/include/ddk/rxprocs.h trunk/reactos/sdk/include/ddk/rxtimer.h trunk/reactos/sdk/include/ddk/scavengr.h trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c trunk/reactos/sdk/lib/drivers/rxce/rxce.c Modified: trunk/reactos/drivers/filesystems/nfs/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/nfs/CM…
============================================================================== --- trunk/reactos/drivers/filesystems/nfs/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/nfs/CMakeLists.txt [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -11,7 +11,7 @@ add_library(nfs41_driver SHARED ${SOURCE} nfs.rc) set_module_type(nfs41_driver kernelmodedriver) -target_link_libraries(nfs41_driver ntoskrnl_vista rdbsslib rxce memcmp ${PSEH_LIB}) +target_link_libraries(nfs41_driver ntoskrnl_vista rdbsslib rxce copysup memcmp ${PSEH_LIB}) add_importlibs(nfs41_driver ntoskrnl hal) if((NOT MSVC) AND (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")) Modified: trunk/reactos/sdk/include/ddk/buffring.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/buffring.h…
============================================================================== --- trunk/reactos/sdk/include/ddk/buffring.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/buffring.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -1,5 +1,19 @@ #ifndef __BUFFRING_H__ #define __BUFFRING_H__ + +#define RX_REQUEST_PREPARED_FOR_HANDLING 0x10000000 + +typedef struct _CHANGE_BUFFERING_STATE_REQUEST_ +{ + LIST_ENTRY ListEntry; + ULONG Flags; +#if (_WIN32_WINNT < 0x0600) + PSRV_CALL pSrvCall; +#endif + PSRV_OPEN SrvOpen; + PVOID SrvOpenKey; + PVOID MRxContext; +} CHANGE_BUFFERING_STATE_REQUEST, *PCHANGE_BUFFERING_STATE_REQUEST; typedef struct _RX_BUFFERING_MANAGER_ { @@ -50,6 +64,10 @@ _In_ PFCB Fcb); VOID +RxPurgeChangeBufferingStateRequestsForSrvOpen( + _In_ PSRV_OPEN SrvOpen); + +VOID RxCompleteSrvOpenKeyAssociation( _Inout_ PSRV_OPEN SrvOpen); Modified: trunk/reactos/sdk/include/ddk/fcb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/fcb.h?rev=…
============================================================================== --- trunk/reactos/sdk/include/ddk/fcb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/fcb.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -211,10 +211,14 @@ #define FCB_STATE_FILE_IS_BUF_COMPRESSED 0x00004000 #define FCB_STATE_FILE_IS_DISK_COMPRESSED 0x00008000 #define FCB_STATE_FILE_IS_SHADOWED 0x00010000 +#define FCB_STATE_BUFFERSTATE_CHANGING 0x00002000 #define FCB_STATE_SPECIAL_PATH 0x00020000 #define FCB_STATE_TIME_AND_SIZE_ALREADY_SET 0x00040000 +#define FCB_STATE_FILETIMECACHEING_ENABLED 0x00080000 #define FCB_STATE_FILESIZECACHEING_ENABLED 0x00100000 +#define FCB_STATE_LOCK_BUFFERING_ENABLED 0x00200000 #define FCB_STATE_COLLAPSING_ENABLED 0x00400000 +#define FCB_STATE_OPENSHARING_ENABLED 0x00800000 #define FCB_STATE_READBUFFERING_ENABLED 0x01000000 #define FCB_STATE_READCACHING_ENABLED 0x02000000 #define FCB_STATE_WRITEBUFFERING_ENABLED 0x04000000 @@ -223,6 +227,17 @@ #define FCB_STATE_ADDEDBACKSLASH 0x20000000 #define FCB_STATE_FOBX_USED 0x40000000 #define FCB_STATE_SRVOPEN_USED 0x80000000 + +#define FCB_STATE_BUFFERING_STATE_MASK \ + ((FCB_STATE_WRITECACHING_ENABLED \ + | FCB_STATE_WRITEBUFFERING_ENABLED \ + | FCB_STATE_READCACHING_ENABLED \ + | FCB_STATE_READBUFFERING_ENABLED \ + | FCB_STATE_OPENSHARING_ENABLED \ + | FCB_STATE_COLLAPSING_ENABLED \ + | FCB_STATE_LOCK_BUFFERING_ENABLED \ + | FCB_STATE_FILESIZECACHEING_ENABLED \ + | FCB_STATE_FILETIMECACHEING_ENABLED)) typedef struct _FCB_INIT_PACKET { @@ -276,6 +291,7 @@ #define FOBX_FLAG_SRVOPEN_CLOSED 0x1000000 #define FOBX_FLAG_UNC_NAME 0x2000000 #define FOBX_FLAG_ENCLOSED_ALLOCATED 0x4000000 +#define FOBX_FLAG_MARKED_AS_DORMANT 0x8000000 typedef struct _FOBX { @@ -354,53 +370,57 @@ DbgPrint("%ld\n", Count); \ } -#define RxReferenceSrvCall(SrvCall) \ - RxpTrackReference(RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall); \ - RxReference(SrvCall) - -#define RxDereferenceSrvCall(SrvCall, LockHoldingState) \ - RxpTrackDereference(RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall); \ - RxDereference(SrvCall, LockHoldingState) - -#define RxReferenceNetRoot(NetRoot) \ - RxpTrackReference(RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot); \ - RxReference(NetRoot) - -#define RxDereferenceNetRoot(NetRoot, LockHoldingState) \ - RxpTrackDereference(RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot); \ - RxDereference(NetRoot, LockHoldingState) - -#define RxReferenceVNetRoot(VNetRoot) \ - RxpTrackReference(RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot); \ - RxReference(VNetRoot) - -#define RxDereferenceVNetRoot(VNetRoot, LockHoldingState) \ - RxpTrackDereference(RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot); \ - RxDereference(VNetRoot, LockHoldingState) - -#define RxDereferenceNetFobx(Fobx, LockHoldingState) \ - RxpTrackDereference(RDBSS_REF_TRACK_NETFOBX, __FILE__, __LINE__, Fobx); \ - RxDereference(Fobx, LockHoldingState) - -#define RxReferenceSrvOpen(SrvOpen) \ - RxpTrackReference(RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen); \ - RxReference(SrvOpen) - -#define RxDereferenceSrvOpen(SrvOpen, LockHoldingState) \ - RxpTrackDereference(RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen); \ - RxDereference(SrvOpen, LockHoldingState) - -#define RxReferenceNetFcb(Fcb) \ - (RxpTrackReference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ - RxpReferenceNetFcb(Fcb)) - -#define RxDereferenceNetFcb(Fcb) \ - ((LONG)RxpTrackDereference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ - RxpDereferenceNetFcb(Fcb)) - -#define RxDereferenceAndFinalizeNetFcb(Fcb, RxContext, RecursiveFinalize, ForceFinalize) \ - (RxpTrackDereference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ - RxpDereferenceAndFinalizeNetFcb(Fcb, RxContext, RecursiveFinalize, ForceFinalize)) +#define RxReferenceSrvCall(SrvCall) \ + RxpTrackReference(RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall); \ + RxReference(SrvCall) + +#define RxDereferenceSrvCall(SrvCall, LockHoldingState) \ + RxpTrackDereference(RDBSS_REF_TRACK_SRVCALL, __FILE__, __LINE__, SrvCall); \ + RxDereference(SrvCall, LockHoldingState) + +#define RxReferenceNetRoot(NetRoot) \ + RxpTrackReference(RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot); \ + RxReference(NetRoot) + +#define RxDereferenceNetRoot(NetRoot, LockHoldingState) \ + RxpTrackDereference(RDBSS_REF_TRACK_NETROOT, __FILE__, __LINE__, NetRoot); \ + RxDereference(NetRoot, LockHoldingState) + +#define RxReferenceVNetRoot(VNetRoot) \ + RxpTrackReference(RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot); \ + RxReference(VNetRoot) + +#define RxDereferenceVNetRoot(VNetRoot, LockHoldingState) \ + RxpTrackDereference(RDBSS_REF_TRACK_VNETROOT, __FILE__, __LINE__, VNetRoot); \ + RxDereference(VNetRoot, LockHoldingState) + +#define RxReferenceNetFobx(Fobx) \ + RxpTrackReference(RDBSS_REF_TRACK_NETFOBX, __FILE__, __LINE__, Fobx); \ + RxReference(Fobx) + +#define RxDereferenceNetFobx(Fobx, LockHoldingState) \ + RxpTrackDereference(RDBSS_REF_TRACK_NETFOBX, __FILE__, __LINE__, Fobx); \ + RxDereference(Fobx, LockHoldingState) + +#define RxReferenceSrvOpen(SrvOpen) \ + RxpTrackReference(RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen); \ + RxReference(SrvOpen) + +#define RxDereferenceSrvOpen(SrvOpen, LockHoldingState) \ + RxpTrackDereference(RDBSS_REF_TRACK_SRVOPEN, __FILE__, __LINE__, SrvOpen); \ + RxDereference(SrvOpen, LockHoldingState) + +#define RxReferenceNetFcb(Fcb) \ + (RxpTrackReference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ + RxpReferenceNetFcb(Fcb)) + +#define RxDereferenceNetFcb(Fcb) \ + ((LONG)RxpTrackDereference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ + RxpDereferenceNetFcb(Fcb)) + +#define RxDereferenceAndFinalizeNetFcb(Fcb, RxContext, RecursiveFinalize, ForceFinalize) \ + (RxpTrackDereference(RDBSS_REF_TRACK_NETFCB, __FILE__, __LINE__, Fcb), \ + RxpDereferenceAndFinalizeNetFcb(Fcb, RxContext, RecursiveFinalize, ForceFinalize)) PSRV_CALL RxCreateSrvCall( @@ -532,6 +552,10 @@ #define RxWaitForStableSrvOpen(S, R) RxWaitForStableCondition(&(S)->Condition, &(S)->TransitionWaitList, (R), NULL) #define RxTransitionSrvOpen(S, C) RxUpdateCondition((C), &(S)->Condition, &(S)->TransitionWaitList) + +VOID +RxRemoveNameNetFcb( + _Out_ PFCB ThisFcb); LONG RxpReferenceNetFcb( @@ -616,6 +640,16 @@ #define TRACKER_RELEASE_NON_EXCL_FCB_FOR_THRD_BUFF_PENDING 0x72727430 #define TRACKER_RELEASE_EXCL_FCB_FOR_THRD_BUFF_PENDING 0x72727431 #define TRACKER_FCB_FREE 0x72724372 -#endif - -#endif + +#define FCB_STATE_BUFFERING_STATE_WITH_NO_SHARES \ + (( FCB_STATE_WRITECACHING_ENABLED \ + | FCB_STATE_WRITEBUFFERING_ENABLED \ + | FCB_STATE_READCACHING_ENABLED \ + | FCB_STATE_READBUFFERING_ENABLED \ + | FCB_STATE_LOCK_BUFFERING_ENABLED \ + | FCB_STATE_FILESIZECACHEING_ENABLED \ + | FCB_STATE_FILETIMECACHEING_ENABLED)) + +#endif + +#endif Modified: trunk/reactos/sdk/include/ddk/mrxfcb.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/mrxfcb.h?r…
============================================================================== --- trunk/reactos/sdk/include/ddk/mrxfcb.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/mrxfcb.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -132,7 +132,9 @@ #define SRVOPEN_FLAG_CLOSE_DELAYED 0x8 #define SRVOPEN_FLAG_FILE_RENAMED 0x10 #define SRVOPEN_FLAG_FILE_DELETED 0x20 +#define SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING 0x40 #define SRVOPEN_FLAG_COLLAPSING_DISABLED 0x80 +#define SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_REQUESTS_PURGED 0x100 #define SRVOPEN_FLAG_NO_BUFFERING_STATE_CHANGE 0x200 #define SRVOPEN_FLAG_ORPHANED 0x400 Modified: trunk/reactos/sdk/include/ddk/nodetype.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/nodetype.h…
============================================================================== --- trunk/reactos/sdk/include/ddk/nodetype.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/nodetype.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -42,6 +42,7 @@ #define RDBSS_NTC_STORAGE_TYPE_DIRECTORY ((NODE_TYPE_CODE)0xec02) #define RDBSS_NTC_STORAGE_TYPE_FILE ((NODE_TYPE_CODE)0xec03) #define RDBSS_NTC_OPENTARGETDIR_FCB ((NODE_TYPE_CODE)0xecff) +#define RDBSS_NTC_IPC_SHARE ((NODE_TYPE_CODE)0xecfe) #define RDBSS_NTC_MAILSLOT ((NODE_TYPE_CODE)0xecfd) #define RDBSS_NTC_SPOOLFILE ((NODE_TYPE_CODE)0xecfc) #define RDBSS_NTC_SRVCALL ((NODE_TYPE_CODE)0xeb10) Modified: trunk/reactos/sdk/include/ddk/rxcontx.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/rxcontx.h?…
============================================================================== --- trunk/reactos/sdk/include/ddk/rxcontx.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/rxcontx.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -428,6 +428,18 @@ InitializeListHead((Source)); \ } +#define RxTransferListWithMutex(Destination, Source, Mutex) \ + { \ + ExAcquireFastMutex(Mutex); \ + RxTransferList(Destination, Source); \ + ExReleaseFastMutex(Mutex); \ + } + +VOID +RxCancelNotifyChangeDirectoryRequestsForFobx( + PFOBX Fobx + ); + VOID NTAPI RxInitializeContext( @@ -472,4 +484,8 @@ _Inout_ PRX_CONTEXT RxContext, _Inout_ PLIST_ENTRY BlockingIoQ); -#endif +VOID +RxResumeBlockedOperations_ALL( + _Inout_ PRX_CONTEXT RxContext); + +#endif Modified: trunk/reactos/sdk/include/ddk/rxprocs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/rxprocs.h?…
============================================================================== --- trunk/reactos/sdk/include/ddk/rxprocs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/rxprocs.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -469,6 +469,10 @@ RxUpdateShareAccessPerSrvOpens( _In_ PSRV_OPEN SrvOpen); +VOID +RxRemoveShareAccessPerSrvOpens( + _Inout_ PSRV_OPEN SrvOpen); + #if DBG NTSTATUS RxCheckShareAccess( @@ -529,8 +533,31 @@ _In_ PUNICODE_STRING DeviceName); VOID +RxPrepareRequestForReuse( + PCHANGE_BUFFERING_STATE_REQUEST Request); + +VOID RxpDiscardChangeBufferingStateRequests( _Inout_ PLIST_ENTRY DiscardedRequests); + +VOID +RxGatherRequestsForSrvOpen( + _Inout_ PSRV_CALL SrvCall, + _In_ PSRV_OPEN SrvOpen, + _Inout_ PLIST_ENTRY RequestsListHead); + +NTSTATUS +RxpLookupSrvOpenForRequestLite( + _In_ PSRV_CALL SrvCall, + _Inout_ PCHANGE_BUFFERING_STATE_REQUEST Request); + +VOID +RxProcessChangeBufferingStateRequestsForSrvOpen( + PSRV_OPEN SrvOpen); + +NTSTATUS +RxPurgeFobxFromCache( + PFOBX FobxToBePurged); VOID RxUndoScavengerFinalizationMarking( Modified: trunk/reactos/sdk/include/ddk/rxtimer.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/rxtimer.h?…
============================================================================== --- trunk/reactos/sdk/include/ddk/rxtimer.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/rxtimer.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -8,6 +8,15 @@ ULONG Options; } RX_WORK_ITEM, *PRX_WORK_ITEM; +NTSTATUS +NTAPI +RxPostOneShotTimerRequest( + _In_ PRDBSS_DEVICE_OBJECT pDeviceObject, + _In_ PRX_WORK_ITEM pWorkItem, + _In_ PRX_WORKERTHREAD_ROUTINE Routine, + _In_ PVOID pContext, + _In_ LARGE_INTEGER TimeInterval); + NTSTATUS NTAPI RxInitializeRxTimer( Modified: trunk/reactos/sdk/include/ddk/scavengr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/scavengr.h…
============================================================================== --- trunk/reactos/sdk/include/ddk/scavengr.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ddk/scavengr.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -117,6 +117,10 @@ _In_ PFCB Fcb); VOID +RxpMarkInstanceForScavengedFinalization( + PVOID Instance); + +VOID RxpUndoScavengerFinalizationMarking( _In_ PVOID Instance); Added: trunk/reactos/sdk/lib/drivers/copysup/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/copysup/CM…
============================================================================== --- trunk/reactos/sdk/lib/drivers/copysup/CMakeLists.txt (added) +++ trunk/reactos/sdk/lib/drivers/copysup/CMakeLists.txt [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -0,0 +1,7 @@ +add_definitions(-DUNICODE -D_UNICODE) + +list(APPEND SOURCE + copysup.c) + +add_library(copysup ${SOURCE}) +add_dependencies(copysup bugcodes xdk) Propchange: trunk/reactos/sdk/lib/drivers/copysup/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/sdk/lib/drivers/copysup/copysup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/copysup/co…
============================================================================== --- trunk/reactos/sdk/lib/drivers/copysup/copysup.c (added) +++ trunk/reactos/sdk/lib/drivers/copysup/copysup.c [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -0,0 +1,182 @@ +/* + * ReactOS kernel + * Copyright (C) 2017 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: sdk/lib/drivers/copysup/copysup.c + * PURPOSE: CopySup library + * PROGRAMMER: Pierre Schweitzer (pierre(a)reactos.org) + */ + +/* INCLUDES *****************************************************************/ + +#include "copysup.h" +#include <pseh/pseh2.h> + +/* FUNCTIONS ****************************************************************/ + +/* + * @implemented + */ +BOOLEAN +FsRtlCopyRead2( + 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, + IN PVOID TopLevelContext) +{ + BOOLEAN Ret; + ULONG PageCount; + LARGE_INTEGER FinalOffset; + PFSRTL_COMMON_FCB_HEADER Fcb; + PFAST_IO_DISPATCH FastIoDispatch; + PDEVICE_OBJECT RelatedDeviceObject; + + PAGED_CODE(); + + Ret = TRUE; + PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(FileOffset, Length); + + /* Null-length read is always OK */ + if (Length == 0) + { + IoStatus->Information = 0; + IoStatus->Status = STATUS_SUCCESS; + + return TRUE; + } + + /* Check we don't overflow */ + FinalOffset.QuadPart = FileOffset->QuadPart + Length; + if (FinalOffset.QuadPart <= 0) + { + return FALSE; + } + + /* Get the FCB (at least, its header) */ + Fcb = FileObject->FsContext; + + FsRtlEnterFileSystem(); + + /* Acquire its resource (shared) */ + if (Wait) + { + ExAcquireResourceSharedLite(Fcb->Resource, TRUE); + } + else + { + if (!ExAcquireResourceSharedLite(Fcb->Resource, FALSE)) + { + Ret = FALSE; + goto CriticalSection; + } + } + + /* If cache wasn't initialized, or FastIO isn't possible, fail */ + if (FileObject->PrivateCacheMap == NULL || Fcb->IsFastIoPossible == FastIoIsNotPossible) + { + Ret = FALSE; + goto Resource; + } + + /* If FastIO is questionable, then, question! */ + if (Fcb->IsFastIoPossible == FastIoIsQuestionable) + { + RelatedDeviceObject = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = RelatedDeviceObject->DriverObject->FastIoDispatch; + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + + /* If it's not possible, then fail */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, FileOffset, Length, + Wait, LockKey, TRUE, IoStatus, RelatedDeviceObject)) + { + Ret = FALSE; + goto Resource; + } + } + + /* If we get beyond file end... */ + if (FinalOffset.QuadPart > Fcb->FileSize.QuadPart) + { + /* Fail if the offset was already beyond file end */ + if (FileOffset->QuadPart >= Fcb->FileSize.QuadPart) + { + IoStatus->Information = 0; + IoStatus->Status = STATUS_END_OF_FILE; + goto Resource; + } + + /* Otherwise, just fix read length */ + Length = (ULONG)(Fcb->FileSize.QuadPart - FileOffset->QuadPart); + } + + /* Set caller provided context as TLI */ + IoSetTopLevelIrp(TopLevelContext); + + _SEH2_TRY + { + /* If we cannot wait, or if file is bigger than 4GB */ + if (!Wait || (FinalOffset.HighPart | Fcb->FileSize.HighPart) != 0) + { + /* Forward to Cc */ + Ret = CcCopyRead(FileObject, FileOffset, Length, Wait, Buffer, IoStatus); + SetFlag(FileObject->Flags, FO_FILE_FAST_IO_READ); + + /* Validate output */ + ASSERT(!Ret || (IoStatus->Status == STATUS_END_OF_FILE) || (((ULONGLONG)FileOffset->QuadPart + IoStatus->Information) <= (ULONGLONG)Fcb->FileSize.QuadPart)); + } + else + { + /* Forward to Cc */ + CcFastCopyRead(FileObject, FileOffset->LowPart, Length, PageCount, Buffer, IoStatus); + SetFlag(FileObject->Flags, FO_FILE_FAST_IO_READ); + + /* Validate output */ + ASSERT((IoStatus->Status == STATUS_END_OF_FILE) || ((FileOffset->LowPart + IoStatus->Information) <= Fcb->FileSize.LowPart)); + } + + /* If read was successful, update the byte offset in the FO */ + if (Ret) + { + FileObject->CurrentByteOffset.QuadPart = FileOffset->QuadPart + IoStatus->Information; + } + } + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + Ret = FALSE; + } + _SEH2_END; + + /* Reset TLI */ + IoSetTopLevelIrp(NULL); + +Resource: + ExReleaseResourceLite(Fcb->Resource); +CriticalSection: + FsRtlExitFileSystem(); + + return Ret; +} Propchange: trunk/reactos/sdk/lib/drivers/copysup/copysup.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/sdk/lib/drivers/copysup/copysup.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/copysup/co…
============================================================================== --- trunk/reactos/sdk/lib/drivers/copysup/copysup.h (added) +++ trunk/reactos/sdk/lib/drivers/copysup/copysup.h [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -0,0 +1,18 @@ +#ifndef _COPYSUP_H_ +#define _COPYSUP_H_ + +#include <ntifs.h> + +BOOLEAN +FsRtlCopyRead2( + _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, + _In_ PVOID TopLevelContext); + +#endif Propchange: trunk/reactos/sdk/lib/drivers/copysup/copysup.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rdbsslib/r…
============================================================================== --- trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -30,6 +30,7 @@ #include <pseh/pseh2.h> #include <limits.h> #include <dfs.h> +#include <copysup.h> #define NDEBUG #include <debug.h> @@ -356,6 +357,11 @@ PRX_CONTEXT RxContext, FILE_INFORMATION_CLASS FileInfoClass, PVOID Buffer); + +VOID +RxPurgeNetFcb( + PFCB Fcb, + PRX_CONTEXT LocalContext); NTSTATUS RxQueryAlternateNameInfo( @@ -780,6 +786,13 @@ } VOID +RxCancelNotifyChangeDirectoryRequestsForFobx( + PFOBX Fobx) +{ + UNIMPLEMENTED; +} + +VOID NTAPI RxCancelRoutine( PDEVICE_OBJECT DeviceObject, @@ -969,17 +982,6 @@ } return Status; -} - -NTSTATUS -NTAPI -RxChangeBufferingState( - PSRV_OPEN SrvOpen, - PVOID Context, - BOOLEAN ComputeNewState) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; } VOID @@ -1058,13 +1060,202 @@ return STATUS_SUCCESS; } +/* + * @implemented + */ NTSTATUS RxCloseAssociatedSrvOpen( IN PFOBX Fobx, IN PRX_CONTEXT RxContext OPTIONAL) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PFCB Fcb; + NTSTATUS Status; + PSRV_OPEN SrvOpen; + BOOLEAN CloseSrvOpen; + PRX_CONTEXT LocalContext; + + PAGED_CODE(); + + /* Assume SRV_OPEN is already closed */ + CloseSrvOpen = FALSE; + /* If we have a FOBX, we'll have to close it */ + if (Fobx != NULL) + { + /* If the FOBX isn't closed yet */ + if (!BooleanFlagOn(Fobx->Flags, FOBX_FLAG_SRVOPEN_CLOSED)) + { + SrvOpen = Fobx->SrvOpen; + Fcb = (PFCB)SrvOpen->pFcb; + /* Check whether we've to close SRV_OPEN first */ + if (!BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_CLOSED)) + { + CloseSrvOpen = TRUE; + } + else + { + ASSERT(RxIsFcbAcquiredExclusive(Fcb)); + + /* Not much to do */ + SetFlag(Fobx->Flags, FOBX_FLAG_SRVOPEN_CLOSED); + + if (SrvOpen->OpenCount > 0) + { + --SrvOpen->OpenCount; + } + } + } + + /* No need to close SRV_OPEN, so close FOBX */ + if (!CloseSrvOpen) + { + RxMarkFobxOnClose(Fobx); + + return STATUS_SUCCESS; + } + } + else + { + /* No FOBX? No RX_CONTEXT, ok, job done! */ + if (RxContext == NULL) + { + return STATUS_SUCCESS; + } + + /* Get the FCB from RX_CONTEXT */ + Fcb = (PFCB)RxContext->pFcb; + SrvOpen == NULL; + } + + /* If we don't have RX_CONTEXT, allocte one, we'll need it */ + if (RxContext == NULL) + { + ASSERT(Fobx != NULL); + + LocalContext = RxCreateRxContext(NULL, Fcb->RxDeviceObject, RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING | RX_CONTEXT_FLAG_WAIT); + if (LocalContext == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + LocalContext->MajorFunction = 2; + LocalContext->pFcb = RX_GET_MRX_FCB(Fcb); + LocalContext->pFobx = (PMRX_FOBX)Fobx; + LocalContext->pRelevantSrvOpen = (PMRX_SRV_OPEN)Fobx->SrvOpen; + } + else + { + LocalContext = RxContext; + } + + ASSERT(RxIsFcbAcquiredExclusive(Fcb)); + + /* Now, close the FOBX */ + if (Fobx != NULL) + { + RxMarkFobxOnClose(Fobx); + } + else + { + InterlockedDecrement((volatile long *)&Fcb->OpenCount); + } + + /* If not a "standard" file, SRV_OPEN can be null */ + if (SrvOpen == NULL) + { + ASSERT((NodeType(Fcb) == RDBSS_NTC_OPENTARGETDIR_FCB) || (NodeType(Fcb) == RDBSS_NTC_IPC_SHARE) || (NodeType(Fcb) == RDBSS_NTC_MAILSLOT)); + RxDereferenceNetFcb(Fcb); + + if (LocalContext != RxContext) + { + RxDereferenceAndDeleteRxContext(LocalContext); + } + + return STATUS_SUCCESS; + } + + /* If SRV_OPEN isn't in a good condition, nothing to close */ + if (SrvOpen->Condition != Condition_Good) + { + if (LocalContext != RxContext) + { + RxDereferenceAndDeleteRxContext(LocalContext); + } + + return STATUS_SUCCESS; + } + + /* Decrease open count */ + if (SrvOpen->OpenCount > 0) + { + --SrvOpen->OpenCount; + } + + /* If we're the only one left, is there a FOBX handled by Scavenger? */ + if (SrvOpen->OpenCount == 1) + { + if (!IsListEmpty(&SrvOpen->FobxList)) + { + if (!IsListEmpty(&CONTAINING_RECORD(SrvOpen->FobxList.Flink, FOBX, FobxQLinks)->ScavengerFinalizationList)) + { + SetFlag(SrvOpen->Flags, SRVOPEN_FLAG_CLOSE_DELAYED); + } + } + } + + /* Nothing left, purge FCB */ + if (SrvOpen->OpenCount == 0 && RxContext == NULL) + { + RxPurgeNetFcb(Fcb, LocalContext); + } + + /* Already closed? Job done! */ + SrvOpen = Fobx->SrvOpen; + if (SrvOpen == NULL || + (SrvOpen->OpenCount != 0 && !BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING)) || + BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_CLOSED)) + { + SetFlag(Fobx->Flags, FOBX_FLAG_SRVOPEN_CLOSED); + if (LocalContext != RxContext) + { + RxDereferenceAndDeleteRxContext(LocalContext); + } + + return STATUS_SUCCESS; + } + + ASSERT(RxIsFcbAcquiredExclusive(Fcb)); + + /* Inform mini-rdr about closing */ + MINIRDR_CALL(Status, LocalContext, Fcb->MRxDispatch, MRxCloseSrvOpen, (LocalContext)); + DPRINT("MRxCloseSrvOpen returned: %lx, called with RX_CONTEXT %p for FOBX %p (FCB %p, SRV_OPEN %p)\n ", + Status, RxContext, Fobx, Fcb, SrvOpen); + + /* And mark as such */ + SetFlag(SrvOpen->Flags, SRVOPEN_FLAG_CLOSED); + SrvOpen->Key = (PVOID)-1; + + /* If we were delayed, we're not! */ + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_CLOSE_DELAYED)) + { + InterlockedDecrement(&((PSRV_CALL)Fcb->pNetRoot->pSrvCall)->NumberOfCloseDelayedFiles); + } + + /* Clear access */ + RxRemoveShareAccessPerSrvOpens(SrvOpen); + RxPurgeChangeBufferingStateRequestsForSrvOpen(SrvOpen); + + /* Dereference */ + RxDereferenceSrvOpen(SrvOpen, LHS_ExclusiveLockHeld); + + /* Mark the FOBX closed as well */ + SetFlag(Fobx->Flags, FOBX_FLAG_SRVOPEN_CLOSED); + + if (LocalContext != RxContext) + { + RxDereferenceAndDeleteRxContext(LocalContext); + } + + return Status; } /* @@ -1258,9 +1449,12 @@ #define BugCheckFileId RDBSS_BUG_CHECK_CLEANUP PFCB Fcb; PFOBX Fobx; + ULONG OpenCount; NTSTATUS Status; - BOOLEAN NeedPurge; + PNET_ROOT NetRoot; PFILE_OBJECT FileObject; + PLARGE_INTEGER TruncateSize; + BOOLEAN NeedPurge, FcbTableAcquired, OneLeft, IsFile, FcbAcquired; PAGED_CODE(); @@ -1300,6 +1494,8 @@ return Status; } + FcbAcquired = TRUE; + Fobx->AssociatedFileObject = NULL; /* In case SRV_OPEN used is part of FCB */ @@ -1326,8 +1522,186 @@ return STATUS_SUCCESS; } - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + /* Report the fact that file could be set as delete on close */ + if (BooleanFlagOn(Fobx->Flags, FOBX_FLAG_DELETE_ON_CLOSE)) + { + SetFlag(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE); + } + + /* Cancel any pending notification */ + RxCancelNotifyChangeDirectoryRequestsForFobx(Fobx); + + /* Backup open count before we start playing with it */ + OpenCount = Fcb->ShareAccess.OpenCount; + + NetRoot = (PNET_ROOT)Fcb->pNetRoot; + FcbTableAcquired = FALSE; + OneLeft = FALSE; + + _SEH2_TRY + { + /* Unclean count and delete on close? Verify whether we're the one */ + if (Fcb->UncleanCount == 1 && BooleanFlagOn(Fcb->FcbState, FCB_STATE_DELETE_ON_CLOSE)) + { + if (RxAcquireFcbTableLockExclusive(&NetRoot->FcbTable, FALSE)) + { + FcbTableAcquired = TRUE; + } + else + { + RxReleaseFcb(Context, Fcb); + + RxAcquireFcbTableLockExclusive(&NetRoot->FcbTable, TRUE); + + Status = RxAcquireExclusiveFcb(Context, Fcb); + if (Status != STATUS_SUCCESS) + { + RxReleaseFcbTableLock(&NetRoot->FcbTable); + return Status; + } + + FcbTableAcquired = TRUE; + } + + if (Fcb->UncleanCount == 1) + { + OneLeft = TRUE; + } + else + { + RxReleaseFcbTableLock(&NetRoot->FcbTable); + FcbTableAcquired = FALSE; + } + } + + IsFile = FALSE; + TruncateSize = NULL; + /* Handle cleanup for pipes and printers */ + if (NetRoot->Type == NET_ROOT_PIPE || NetRoot->Type == NET_ROOT_PRINT) + { + UNIMPLEMENTED; + } + /* Handle cleanup for files */ + else if (NetRoot->Type == NET_ROOT_DISK || NetRoot->Type == NET_ROOT_WILD) + { + if (NodeType(Fcb) == RDBSS_NTC_STORAGE_TYPE_FILE) + { + UNIMPLEMENTED; + IsFile = TRUE; + } + } + + /* We have to still be there! */ + ASSERT(Fcb->UncleanCount != 0); + InterlockedDecrement((volatile long *)&Fcb->UncleanCount); + + if (BooleanFlagOn(FileObject->Flags, FO_NO_INTERMEDIATE_BUFFERING)) + { + --Fcb->UncachedUncleanCount; + } + + /* Inform mini-rdr about ongoing cleanup */ + MINIRDR_CALL(Status, Context, Fcb->MRxDispatch, MRxCleanupFobx, (Context)); + + ASSERT(Fobx->SrvOpen->UncleanFobxCount != 0); + --Fobx->SrvOpen->UncleanFobxCount; + + /* Flush cache */ + if (DisableFlushOnCleanup) + { + /* Only if we're the last standing */ + if (Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL && + Fcb->UncleanCount == Fcb->UncachedUncleanCount) + { + DPRINT1("Flushing %p due to last cached handle cleanup\n", Context); + RxFlushFcbInSystemCache(Fcb, TRUE); + } + } + else + { + /* Always */ + if (Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL) + { + DPRINT1("Flushing %p on cleanup\n", Context); + RxFlushFcbInSystemCache(Fcb, TRUE); + } + } + + /* If only remaining uncached & unclean, then flush and purge */ + if (!BooleanFlagOn(FileObject->Flags, FO_NO_INTERMEDIATE_BUFFERING)) + { + if (Fcb->UncachedUncleanCount != 0) + { + if (Fcb->UncachedUncleanCount == Fcb->UncleanCount && + Fcb->NonPaged->SectionObjectPointers.DataSectionObject != NULL) + { + DPRINT1("Flushing FCB in system cache for %p\n", Context); + RxPurgeFcbInSystemCache(Fcb, NULL, 0, FALSE, TRUE); + } + } + } + + /* If purge required, flush */ + if (!OneLeft && NeedPurge) + { + DPRINT1("Flushing FCB in system cache for %p\n", Context); + RxFlushFcbInSystemCache(Fcb, TRUE); + } + + /* If it was a file, drop cache */ + if (IsFile) + { + DPRINT1("Uninit cache map for file\n"); + RxUninitializeCacheMap(Context, FileObject, TruncateSize); + } + + /* If that's the one left, or if it needs purge, flush */ + if (OneLeft || NeedPurge) + { + RxPurgeFcbInSystemCache(Fcb, NULL, 0, FALSE, !OneLeft); + /* Also remove from FCB table */ + if (OneLeft) + { + RxRemoveNameNetFcb(Fcb); + RxReleaseFcbTableLock(&NetRoot->FcbTable); + FcbTableAcquired = FALSE; + } + } + + /* Remove any share access */ + if (OpenCount != 0 && NetRoot->Type == NET_ROOT_DISK) + { + RxRemoveShareAccess(FileObject, &Fcb->ShareAccess, "Cleanup the share access", "ClnUpShr"); + } + + /* In case there's caching, on a file, update file metadata */ + if (NodeType(Fcb) == RDBSS_NTC_STORAGE_TYPE_FILE && BooleanFlagOn(Fobx->Flags, 0x20000000) && + BooleanFlagOn(Fcb->FcbState, FCB_STATE_WRITECACHING_ENABLED) && !BooleanFlagOn(Fobx->pSrvOpen->Flags, SRVOPEN_FLAG_DONTUSE_WRITE_CACHING)) + { + UNIMPLEMENTED; + } + + /* We're clean! */ + SetFlag(FileObject->Flags, FO_CLEANUP_COMPLETE); + + FcbAcquired = FALSE; + RxReleaseFcb(Context, Fcb); + } + _SEH2_FINALLY + { + if (FcbAcquired) + { + RxReleaseFcb(Context, Fcb); + } + + if (FcbTableAcquired) + { + RxReleaseFcbTableLock(&NetRoot->FcbTable); + } + } + _SEH2_END; + + return Status; #undef BugCheckFileId } @@ -3234,6 +3608,96 @@ PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject) { + PFCB Fcb; + PSRV_OPEN SrvOpen; + + PAGED_CODE(); + + /* Get the FCB to validate it */ + Fcb = FileObject->FsContext; + if (NodeType(Fcb) != RDBSS_NTC_STORAGE_TYPE_FILE) + { + DPRINT1("Not a file, FastIO not possible!\n"); + return FALSE; + } + + if (FileObject->DeletePending) + { + DPRINT1("File delete pending\n"); + return FALSE; + } + + /* If there's a pending write operation, deny fast operation */ + if (Fcb->NonPaged->OutstandingAsyncWrites != 0) + { + DPRINT1("Write operations to be completed\n"); + return FALSE; + } + + /* Deny read on orphaned node */ + SrvOpen = (PSRV_OPEN)((PFOBX)FileObject->FsContext2)->pSrvOpen; + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_ORPHANED)) + { + DPRINT1("SRV_OPEN orphaned\n"); + return FALSE; + } + + if (BooleanFlagOn(Fcb->FcbState, FCB_STATE_ORPHANED)) + { + DPRINT1("FCB orphaned\n"); + return FALSE; + } + + /* If there's a buffering state change pending, deny fast operation (it might change + * cache status) + */ + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING)) + { + DPRINT1("Buffering change pending\n"); + return FALSE; + } + + /* File got renamed/deleted, deny operation */ + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_FILE_DELETED) || + BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_FILE_RENAMED)) + { + DPRINT1("File renamed/deleted\n"); + return FALSE; + } + + /* Process pending change buffering state operations */ + FsRtlEnterFileSystem(); + RxProcessChangeBufferingStateRequestsForSrvOpen(SrvOpen); + FsRtlExitFileSystem(); + + /* If operation to come is a read operation */ + if (CheckForReadOperation) + { + LARGE_INTEGER LargeLength; + + /* Check that read cache is enabled */ + if (!BooleanFlagOn(Fcb->FcbState, FCB_STATE_READCACHING_ENABLED)) + { + DPRINT1("Read caching disabled\n"); + return FALSE; + } + + /* Check whether there's a lock conflict */ + LargeLength.QuadPart = Length; + if (!FsRtlFastCheckLockForRead(&Fcb->Specific.Fcb.FileLock, + FileOffset, + &LargeLength, + LockKey, + FileObject, + PsGetCurrentProcess())) + { + DPRINT1("FsRtlFastCheckLockForRead failed\n"); + return FALSE; + } + + return TRUE; + } + UNIMPLEMENTED; return FALSE; } @@ -3263,6 +3727,9 @@ } } +/* + * @implemented + */ BOOLEAN NTAPI RxFastIoRead( @@ -3275,8 +3742,32 @@ PIO_STATUS_BLOCK IoStatus, PDEVICE_OBJECT DeviceObject) { - UNIMPLEMENTED; - return FALSE; + BOOLEAN Ret; + RX_TOPLEVELIRP_CONTEXT TopLevelContext; + + PAGED_CODE(); + + DPRINT("RxFastIoRead: %p (%p, %p)\n", FileObject, FileObject->FsContext, + FileObject->FsContext2); + DPRINT("Reading %ld at %I64x\n", Length, FileOffset->QuadPart); + + /* Prepare a TLI context */ + ASSERT(RxIsThisTheTopLevelIrp(NULL)); + RxInitializeTopLevelIrpContext(&TopLevelContext, (PIRP)FSRTL_FAST_IO_TOP_LEVEL_IRP, + (PRDBSS_DEVICE_OBJECT)DeviceObject); + + Ret = FsRtlCopyRead2(FileObject, FileOffset, Length, Wait, LockKey, Buffer, + IoStatus, DeviceObject, &TopLevelContext); + if (Ret) + { + DPRINT("Read OK\n"); + } + else + { + DPRINT1("Read failed!\n"); + } + + return Ret; } BOOLEAN @@ -4399,15 +4890,6 @@ return STATUS_SUCCESS; } -NTSTATUS -NTAPI -RxInitializeRxTimer( - VOID) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - /* * @implemented */ @@ -5020,6 +5502,28 @@ IN PRDBSS_DEVICE_OBJECT RxDeviceObject) { UNIMPLEMENTED; +} + +/* + * @implemented + */ +VOID +RxPurgeNetFcb( + PFCB Fcb, + PRX_CONTEXT LocalContext) +{ + NTSTATUS Status; + + PAGED_CODE(); + + /* First, flush */ + MmFlushImageSection(&Fcb->NonPaged->SectionObjectPointers, MmFlushForWrite); + + /* And force close */ + RxReleaseFcb(NULL, Fcb); + MmForceSectionClosed(&Fcb->NonPaged->SectionObjectPointers, TRUE); + Status = RxAcquireExclusiveFcb(NULL, Fcb); + ASSERT(Status == STATUS_SUCCESS); } NTSTATUS @@ -5610,6 +6114,9 @@ return Context; } +/* + * @implemented + */ VOID RxRemoveShareAccess( _Inout_ PFILE_OBJECT FileObject, @@ -5617,7 +6124,58 @@ _In_ PSZ where, _In_ PSZ wherelogtag) { - UNIMPLEMENTED; + PAGED_CODE(); + + RxDumpCurrentAccess(where, "before", wherelogtag, ShareAccess); + IoRemoveShareAccess(FileObject, ShareAccess); + RxDumpCurrentAccess(where, "after", wherelogtag, ShareAccess); +} + +/* + * @implemented + */ +VOID +RxRemoveShareAccessPerSrvOpens( + IN OUT PSRV_OPEN SrvOpen) +{ + ACCESS_MASK DesiredAccess; + BOOLEAN ReadAccess; + BOOLEAN WriteAccess; + BOOLEAN DeleteAccess; + + PAGED_CODE(); + + /* Get access that were granted to SRV_OPEN */ + DesiredAccess = SrvOpen->DesiredAccess; + ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; + WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; + DeleteAccess = (DesiredAccess & DELETE) != 0; + + /* If any, drop them */ + if ((ReadAccess) || (WriteAccess) || (DeleteAccess)) + { + BOOLEAN SharedRead; + BOOLEAN SharedWrite; + BOOLEAN SharedDelete; + ULONG DesiredShareAccess; + PSHARE_ACCESS ShareAccess; + + ShareAccess = &((PFCB)SrvOpen->pFcb)->ShareAccessPerSrvOpens; + DesiredShareAccess = SrvOpen->ShareAccess; + + ShareAccess->Readers -= ReadAccess; + ShareAccess->Writers -= WriteAccess; + ShareAccess->Deleters -= DeleteAccess; + + ShareAccess->OpenCount--; + + SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; + SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; + SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; + ShareAccess->SharedRead -= SharedRead; + ShareAccess->SharedWrite -= SharedWrite; + ShareAccess->SharedDelete -= SharedDelete; + } } NTSTATUS Modified: trunk/reactos/sdk/lib/drivers/rxce/rxce.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rxce/rxce.…
============================================================================== --- trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] Sun Jul 2 17:00:11 2017 @@ -77,6 +77,19 @@ VOID NTAPI +RxScavengerTimerRoutine( + PVOID Context); + +VOID +NTAPI +RxTimerDispatch( + _In_ struct _KDPC *Dpc, + _In_opt_ PVOID DeferredContext, + _In_opt_ PVOID SystemArgument1, + _In_opt_ PVOID SystemArgument2); + +VOID +NTAPI RxWorkItemDispatcher( PVOID Context); @@ -116,6 +129,13 @@ FAST_MUTEX RxLowIoPagingIoSyncMutex; BOOLEAN RxContinueFromAssert = TRUE; ULONG RxExplodePoolTags = 1; +LARGE_INTEGER RxTimerInterval; +RX_SPIN_LOCK RxTimerLock; +LIST_ENTRY RxTimerQueueHead; +LIST_ENTRY RxRecurrentWorkItemsList; +KDPC RxTimerDpc; +KTIMER RxTimer; +ULONG RxTimerTickCount; #if DBG BOOLEAN DumpDispatchRoutine = TRUE; #else @@ -568,6 +588,149 @@ RxWorkQueue = WorkQueue; RxpWorkerThreadDispatcher(RxWorkQueue, NULL); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RxChangeBufferingState( + PSRV_OPEN SrvOpen, + PVOID Context, + BOOLEAN ComputeNewState) +{ + PFCB Fcb; + NTSTATUS Status, MiniStatus; + ULONG NewBufferingState, OldBufferingState; + + PAGED_CODE(); + + DPRINT("RxChangeBufferingState(%p, %p, %d)\n", SrvOpen, Context, ComputeNewState); + + Fcb = (PFCB)SrvOpen->pFcb; + ASSERT(NodeTypeIsFcb(Fcb)); + /* First of all, mark that buffering state is changing */ + SetFlag(Fcb->FcbState, FCB_STATE_BUFFERSTATE_CHANGING); + + /* Assume success */ + Status = STATUS_SUCCESS; + _SEH2_TRY + { + /* If we're asked to compute a new state, ask the mini-rdr for it */ + if (ComputeNewState) + { + MINIRDR_CALL_THROUGH(MiniStatus, Fcb->MRxDispatch, MRxComputeNewBufferingState, + ((PMRX_SRV_OPEN)SrvOpen, Context, &NewBufferingState)); + if (MiniStatus != STATUS_SUCCESS) + { + NewBufferingState = 0; + } + } + else + { + /* If not, use SRV_OPEN state */ + NewBufferingState = SrvOpen->BufferingFlags; + } + + /* If no shared access, and if we're not asked to compute a new state, use maximum flags set */ + if ((Fcb->ShareAccess.SharedRead + Fcb->ShareAccess.SharedWrite + Fcb->ShareAccess.SharedDelete) == 0 && !ComputeNewState) + { + SetFlag(NewBufferingState, FCB_STATE_BUFFERING_STATE_WITH_NO_SHARES); + } + + /* If there's a lock operation to complete, clear that flag */ + if (Fcb->OutstandingLockOperationsCount != 0) + { + ClearFlag(NewBufferingState, FCB_STATE_LOCK_BUFFERING_ENABLED); + } + + /* Get the old state */ + OldBufferingState = Fcb->FcbState & FCB_STATE_BUFFERING_STATE_MASK; + DPRINT("ChangeBufferingState %x -> %x (%x)\n", OldBufferingState, NewBufferingState, SrvOpen->BufferingFlags); + + /* If we're dropping write cache, then flush the FCB */ + if (BooleanFlagOn(OldBufferingState, FCB_STATE_WRITECACHING_ENABLED) && + !BooleanFlagOn(NewBufferingState, FCB_STATE_WRITECACHING_ENABLED)) + { + DPRINT("Flushing\n"); + + Status = RxFlushFcbInSystemCache(Fcb, TRUE); + } + + /* If we're dropping read cache, then purge */ + if (Fcb->UncleanCount == 0 || + (BooleanFlagOn(OldBufferingState, FCB_STATE_READCACHING_ENABLED) && + !BooleanFlagOn(NewBufferingState, FCB_STATE_READCACHING_ENABLED)) || + BooleanFlagOn(NewBufferingState, FCB_STATE_DELETE_ON_CLOSE)) + { + DPRINT("Purging\n"); + + if (!NT_SUCCESS(Status)) + { + DPRINT("Previous flush failed with status: %lx\n", Status); + } + + CcPurgeCacheSection(&Fcb->NonPaged->SectionObjectPointers, NULL, 0, TRUE); + } + + /* If there's already a change pending in SRV_OPEN */ + if (ComputeNewState && BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING)) + { + /* If there's a FOBX at least */ + if (!IsListEmpty(&SrvOpen->FobxList)) + { + PRX_CONTEXT RxContext; + + /* Create a fake context to pass to the mini-rdr */ + RxContext = RxCreateRxContext(NULL, Fcb->RxDeviceObject, RX_CONTEXT_FLAG_MUST_SUCCEED_NONBLOCKING | RX_CONTEXT_FLAG_WAIT); + if (RxContext != NULL) + { + PFOBX Fobx; + + RxContext->pFcb = RX_GET_MRX_FCB(Fcb); + + /* Give the first FOBX */ + Fobx = CONTAINING_RECORD(SrvOpen->FobxList.Flink, FOBX, FobxQLinks); + RxContext->pFobx = (PMRX_FOBX)Fobx; + RxContext->pRelevantSrvOpen = Fobx->pSrvOpen; + + /* If there was a delayed close, perform it */ + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_CLOSE_DELAYED)) + { + DPRINT("Oplock break close for %p\n", SrvOpen); + + RxCloseAssociatedSrvOpen(Fobx, RxContext); + } + /* Otherwise, inform the mini-rdr about completion */ + else + { + MINIRDR_CALL_THROUGH(MiniStatus, Fcb->MRxDispatch, MRxCompleteBufferingStateChangeRequest, + (RxContext, (PMRX_SRV_OPEN)SrvOpen, Context)); + (void)MiniStatus; + } + + RxDereferenceAndDeleteRxContext(RxContext); + } + } + } + + /* Set the new state */ + Fcb->FcbState ^= (NewBufferingState ^ Fcb->FcbState) & FCB_STATE_BUFFERING_STATE_MASK; + } + _SEH2_FINALLY + { + /* Job done, clear the flag */ + ClearFlag(Fcb->FcbState, FCB_STATE_BUFFERSTATE_CHANGING); + + if (!BooleanFlagOn(NewBufferingState, FCB_STATE_FILETIMECACHEING_ENABLED)) + { + ClearFlag(Fcb->FcbState, FCB_STATE_TIME_AND_SIZE_ALREADY_SET); + } + } + _SEH2_END; + + return Status; } NTSTATUS @@ -1798,6 +1961,9 @@ return VNetRoot; } +/* + * @implemented + */ VOID RxDereference( IN OUT PVOID Instance, @@ -1859,9 +2025,21 @@ /* We have to be locked exclusively */ if (LockHoldingState != LHS_ExclusiveLockHeld) { - UNIMPLEMENTED; + if ((NodeType == RDBSS_NTC_FOBX && RefCount == 0) || + (NodeType >= RDBSS_NTC_SRVCALL && NodeType <= RDBSS_NTC_V_NETROOT)) + { + RxpMarkInstanceForScavengedFinalization(Instance); + } + RxReleaseScavengerMutex(); return; + } + else + { + if (BooleanFlagOn(NodeType, RX_SCAVENGER_MASK)) + { + RxpUndoScavengerFinalizationMarking(Instance); + } } RxReleaseScavengerMutex(); @@ -2014,6 +2192,14 @@ } } +VOID +NTAPI +RxDispatchChangeBufferingStateRequests( + PVOID Context) +{ + UNIMPLEMENTED; +} + /* * @implemented */ @@ -2328,7 +2514,7 @@ ASSERT(ForceFinalize || ((ThisFcb->OpenCount == 0) && (ThisFcb->UncleanCount == 0))); - DPRINT("Finalizing FCB open: %d (%d)", ThisFcb->OpenCount, ForceFinalize); + DPRINT("Finalizing FCB open: %d (%d)\n", ThisFcb->OpenCount, ForceFinalize); /* If finalization was not already initiated, go ahead */ if (!ThisFcb->UpperFinalizationDone) @@ -2391,7 +2577,7 @@ ExDeleteResourceLite(ThisFcb->Header.PagingIoResource); InterlockedDecrement((volatile long *)&ThisFcb->pNetRoot->NumberOfFcbs); - RxDereferenceNetRoot(ThisFcb->pNetRoot, LHS_LockNotHeld); + RxDereferenceVNetRoot(ThisFcb->VNetRoot, LHS_LockNotHeld); ASSERT(IsListEmpty(&ThisFcb->FcbTableEntry.HashLinks)); ASSERT(!ThisFcb->fMiniInited); @@ -2692,14 +2878,116 @@ return TRUE; } +/* + * @implemented + */ BOOLEAN RxFinalizeSrvOpen( OUT PSRV_OPEN ThisSrvOpen, IN BOOLEAN RecursiveFinalize, IN BOOLEAN ForceFinalize) { - UNIMPLEMENTED; - return FALSE; + PFCB Fcb; + + PAGED_CODE(); + + /* We have to have a SRV_OPEN */ + ASSERT(NodeType(ThisSrvOpen) == RDBSS_NTC_SRVOPEN); + + /* If that's a recursive finalization, finalize any related FOBX */ + if (RecursiveFinalize) + { + PLIST_ENTRY ListEntry; + + for (ListEntry = ThisSrvOpen->FobxList.Flink; + ListEntry != &ThisSrvOpen->FobxList; + ListEntry = ListEntry->Flink) + { + PFOBX Fobx; + + Fobx = CONTAINING_RECORD(ListEntry, FOBX, FobxQLinks); + RxFinalizeNetFobx(Fobx, TRUE, ForceFinalize); + } + } + + /* If we have still references, don't finalize unless forced */ + if (ThisSrvOpen->NodeReferenceCount != 0 && + !ForceFinalize) + { + return FALSE; + } + + DPRINT("Finalize SRV_OPEN: %p (with %d ref), forced: %d\n", ThisSrvOpen, ThisSrvOpen->NodeReferenceCount, ForceFinalize); + + /* Only finalize if closed, or if it wasn't already done and SRV_OPEN is in a bad shape */ + Fcb = (PFCB)ThisSrvOpen->pFcb; + if ((!ThisSrvOpen->UpperFinalizationDone && ThisSrvOpen->Condition != Condition_Good) || + BooleanFlagOn(ThisSrvOpen->Flags, SRVOPEN_FLAG_CLOSED)) + { + PV_NET_ROOT VNetRoot; + + /* Associated FCB can't be fake one */ + ASSERT(NodeType(Fcb) != RDBSS_NTC_OPENTARGETDIR_FCB); + ASSERT(RxIsFcbAcquiredExclusive (Fcb)); + + /* Purge any pending operation */ + RxPurgeChangeBufferingStateRequestsForSrvOpen(ThisSrvOpen); + + /* If the FCB wasn't orphaned, inform the mini-rdr about close */ + if (!BooleanFlagOn(Fcb->FcbState, FCB_STATE_ORPHANED)) + { + NTSTATUS Status; + + MINIRDR_CALL_THROUGH(Status, Fcb->MRxDispatch, MRxForceClosed, ((PMRX_SRV_OPEN)ThisSrvOpen)); + (void)Status; + } + + /* Remove ourselves from the FCB */ + RemoveEntryList(&ThisSrvOpen->SrvOpenQLinks); + InitializeListHead(&ThisSrvOpen->SrvOpenQLinks); + ++Fcb->SrvOpenListVersion; + + /* If we have a V_NET_ROOT, dereference it */ + VNetRoot = (PV_NET_ROOT)ThisSrvOpen->pVNetRoot; + if (VNetRoot != NULL) + { + InterlockedDecrement((volatile long *)&VNetRoot->pNetRoot->NumberOfSrvOpens); + RxDereferenceVNetRoot(VNetRoot, LHS_LockNotHeld); + ThisSrvOpen->pVNetRoot = NULL; + } + + /* Finalization done */ + ThisSrvOpen->UpperFinalizationDone = TRUE; + } + + /* Don't free memory if still referenced */ + if (ThisSrvOpen->NodeReferenceCount != 0) + { + return FALSE; + } + + /* No key association left */ + ASSERT(IsListEmpty(&ThisSrvOpen->SrvOpenKeyList)); + + /* If we're still in some FCB, remove us */ + if (!IsListEmpty(&ThisSrvOpen->SrvOpenQLinks)) + { + RemoveEntryList(&ThisSrvOpen->SrvOpenQLinks); + } + + /* If enclosed allocation, mark the memory zone free and dereference FCB */ + if (BooleanFlagOn(ThisSrvOpen->Flags, SRVOPEN_FLAG_ENCLOSED_ALLOCATED)) + { + ClearFlag(Fcb->FcbState, FCB_STATE_SRVOPEN_USED); + RxDereferenceNetFcb(Fcb); + } + /* Otherwise, free the memory */ + else + { + RxFreeFcbObject(ThisSrvOpen); + } + + return TRUE; } /* @@ -3605,11 +3893,47 @@ return IoStatus.Status; } +/* + * @implemented + */ VOID RxFreeFcbObject( PVOID Object) { - UNIMPLEMENTED; + PAGED_CODE(); + + /* If that's a FOBX/SRV_OPEN, nothing to do, just free it */ + if (NodeType(Object) == RDBSS_NTC_FOBX || NodeType(Object) == RDBSS_NTC_SRVOPEN) + { + RxFreePoolWithTag(Object, RX_FCB_POOLTAG); + } + /* If that's a FCB... */ + else if (NodeTypeIsFcb(Object)) + { + PFCB Fcb; + PRDBSS_DEVICE_OBJECT DeviceObject; + + Fcb = (PFCB)Object; + DeviceObject = Fcb->RxDeviceObject; + + /* Delete per stream contexts */ + FsRtlTeardownPerStreamContexts(&Fcb->Header); + + SetFlag(Fcb->Header.Flags, FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH); + + /* If there was a non-paged FCB allocated, free it */ + if (!BooleanFlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE)) + { + RxFreePoolWithTag(Fcb->NonPaged, RX_NONPAGEDFCB_POOLTAG); + } + + /* Free the FCB */ + RxFreePool(Fcb); + + /* Update statistics */ + InterlockedDecrement(&RxNumberOfActiveFcbs); + InterlockedDecrement((volatile long *)&DeviceObject->NumberOfActiveFcbs); + } } /* @@ -3652,6 +3976,128 @@ /* And just free the object */ RxFreePool(pObject); +} + +/* + * @implemented + */ +VOID +RxGatherRequestsForSrvOpen( + IN OUT PSRV_CALL SrvCall, + IN PSRV_OPEN SrvOpen, + IN OUT PLIST_ENTRY RequestsListHead) +{ + KIRQL OldIrql; + LIST_ENTRY Discarded, *Entry; + PCHANGE_BUFFERING_STATE_REQUEST Request; + + /* Dispatch any pending operation first */ + RxpDispatchChangeBufferingStateRequests(SrvCall, SrvOpen, &Discarded); + + /* Then, get any entry related to our key and SRV_OPEN */ + KeAcquireSpinLock(&SrvCall->BufferingManager.SpinLock, &OldIrql); + Entry = SrvCall->BufferingManager.HandlerList.Flink; + while (Entry != &SrvCall->BufferingManager.HandlerList) + { + Request = CONTAINING_RECORD(Entry, CHANGE_BUFFERING_STATE_REQUEST, ListEntry); + Entry = Entry->Flink; + if (Request->SrvOpenKey == SrvOpen->Key && Request->SrvOpen == SrvOpen) + { + RemoveEntryList(&Request->ListEntry); + InsertTailList(RequestsListHead, &Request->ListEntry); + } + } + KeReleaseSpinLock(&SrvCall->BufferingManager.SpinLock, OldIrql); + + /* Perform the same search in the last change list */ + Entry = SrvCall->BufferingManager.LastChanceHandlerList.Flink; + while (Entry != &SrvCall->BufferingManager.LastChanceHandlerList) + { + Request = CONTAINING_RECORD(Entry, CHANGE_BUFFERING_STATE_REQUEST, ListEntry); + Entry = Entry->Flink; + if (Request->SrvOpenKey == SrvOpen->Key && Request->SrvOpen == SrvOpen) + { + RemoveEntryList(&Request->ListEntry); + InsertTailList(RequestsListHead, &Request->ListEntry); + } + } + + /* Discard the discarded requests */ + RxpDiscardChangeBufferingStateRequests(&Discarded); +} + +/* + * @implemented + */ +PRDBSS_DEVICE_OBJECT +RxGetDeviceObjectOfInstance( + PVOID Instance) +{ + NODE_TYPE_CODE NodeType; + PRDBSS_DEVICE_OBJECT DeviceObject; + + PAGED_CODE(); + + /* We only handle a few object types */ + NodeType = NodeType(Instance); + ASSERT((NodeType == RDBSS_NTC_SRVCALL) || (NodeType == RDBSS_NTC_NETROOT) || + (NodeType == RDBSS_NTC_V_NETROOT) || (NodeType == RDBSS_NTC_SRVOPEN) || (NodeType == RDBSS_NTC_FOBX)); + + /* Get the device object depending on the object */ + switch (NodeType) + { + case RDBSS_NTC_FOBX: + { + PFOBX Fobx; + + Fobx = (PFOBX)Instance; + DeviceObject = Fobx->RxDeviceObject; + break; + } + + case RDBSS_NTC_SRVCALL: + { + PSRV_CALL SrvCall; + + SrvCall = (PSRV_CALL)Instance; + DeviceObject = SrvCall->RxDeviceObject; + break; + } + + case RDBSS_NTC_NETROOT: + { + PNET_ROOT NetRoot; + + NetRoot = (PNET_ROOT)Instance; + DeviceObject = NetRoot->pSrvCall->RxDeviceObject; + break; + } + + case RDBSS_NTC_V_NETROOT: + { + PV_NET_ROOT VNetRoot; + + VNetRoot = (PV_NET_ROOT)Instance; + DeviceObject = VNetRoot->pNetRoot->pSrvCall->RxDeviceObject; + break; + } + + case RDBSS_NTC_SRVOPEN: + { + PSRV_OPEN SrvOpen; + + SrvOpen = (PSRV_OPEN)Instance; + DeviceObject = ((PFCB)SrvOpen->pFcb)->RxDeviceObject; + break; + } + + default: + DeviceObject = NULL; + break; + } + + /* Job done */ + return DeviceObject; } /* @@ -4103,6 +4549,28 @@ UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RxInitializeRxTimer( + VOID) +{ + PAGED_CODE(); + + RxTimerInterval.HighPart = -1; + RxTimerInterval.LowPart = -550000; + KeInitializeSpinLock(&RxTimerLock); + InitializeListHead(&RxTimerQueueHead); + InitializeListHead(&RxRecurrentWorkItemsList); + KeInitializeDpc(&RxTimerDpc, RxTimerDispatch, NULL); + KeInitializeTimer(&RxTimer); + RxTimerTickCount = 0; + + return STATUS_SUCCESS; } NTSTATUS @@ -4454,6 +4922,9 @@ _SEH2_END; } +/* + * @implemented + */ NTSTATUS RxLowIoCompletionTail( IN PRX_CONTEXT RxContext) @@ -4484,10 +4955,15 @@ Operation = RxContext->LowIoContext.Operation; if (Operation == LOWIO_OP_READ || Operation == LOWIO_OP_WRITE) { + /* Remove ourselves from the list and resume operations */ if (BooleanFlagOn(RxContext->LowIoContext.ParamsFor.ReadWrite.Flags, LOWIO_READWRITEFLAG_PAGING_IO)) { - UNIMPLEMENTED; - Status = STATUS_NOT_IMPLEMENTED; + ExAcquireFastMutexUnsafe(&RxLowIoPagingIoSyncMutex); + RemoveEntryList(&RxContext->RxContextSerializationQLinks); + RxContext->RxContextSerializationQLinks.Flink = NULL; + RxContext->RxContextSerializationQLinks.Blink = NULL; + ExReleaseFastMutexUnsafe(&RxLowIoPagingIoSyncMutex); + RxResumeBlockedOperations_ALL(RxContext); } } else @@ -4762,19 +5238,148 @@ return Irp->AssociatedIrp.SystemBuffer; } +/* + * @implemented + */ VOID RxMarkFobxOnCleanup( PFOBX pFobx, PBOOLEAN NeedPurge) { - UNIMPLEMENTED; -} - + PFCB Fcb; + PFOBX ScavengerFobx; + LARGE_INTEGER TickCount; + PRDBSS_SCAVENGER Scavenger; + + PAGED_CODE(); + + /* No FOBX, nothing to mark */ + if (pFobx == NULL) + { + return; + } + + /* Query time for close */ + KeQueryTickCount(&TickCount); + + Fcb = (PFCB)pFobx->pSrvOpen->pFcb; + ASSERT(NodeTypeIsFcb(Fcb)); + + Scavenger = Fcb->RxDeviceObject->pRdbssScavenger; + RxAcquireScavengerMutex(); + + ScavengerFobx = NULL; + /* If that's not a file, or even not a disk resource, just mark as dormant */ + if (NodeType(Fcb) != RDBSS_NTC_STORAGE_TYPE_FILE || Fcb->VNetRoot->pNetRoot->DeviceType != FILE_DEVICE_DISK) + { + SetFlag(pFobx->Flags, FOBX_FLAG_MARKED_AS_DORMANT); + InitializeListHead(&pFobx->ClosePendingList); + ++Scavenger->NumberOfDormantFiles; + } + else + { + ASSERT(Scavenger->NumberOfDormantFiles >= 0); + /* If we're about to reach the maximum dormant of FOBX */ + if (Scavenger->NumberOfDormantFiles >= Scavenger->MaximumNumberOfDormantFiles) + { + /* This should never be wrong... */ + if (!IsListEmpty(&Scavenger->ClosePendingFobxsList)) + { + /* Then, take the first from the list (oldest) and save it for later purge */ + ScavengerFobx = CONTAINING_RECORD(Scavenger->ClosePendingFobxsList.Flink, FOBX, ClosePendingList); + if (ScavengerFobx->pSrvOpen != NULL && ScavengerFobx->pSrvOpen->pFcb == RX_GET_MRX_FCB(Fcb)) + { + *NeedPurge = TRUE; + ScavengerFobx = NULL; + } + else + { + RxReferenceNetFobx(ScavengerFobx); + } + } + } + + /* Mark ourselves as dormant */ + SetFlag(pFobx->Flags, FOBX_FLAG_MARKED_AS_DORMANT); + pFobx->CloseTime.QuadPart = TickCount.QuadPart; + + /* And insert us in the list of dormant files */ + InsertTailList(&Scavenger->ClosePendingFobxsList, &pFobx->ClosePendingList); + /* If scavenger was inactive, start it */ + if (Scavenger->NumberOfDormantFiles++ == 0 && Scavenger->State == RDBSS_SCAVENGER_INACTIVE) + { + Scavenger->State = RDBSS_SCAVENGER_DORMANT; + RxPostOneShotTimerRequest(RxFileSystemDeviceObject, &Scavenger->WorkItem, RxScavengerTimerRoutine, + Fcb->RxDeviceObject, Scavenger->TimeLimit); + } + } + + RxReleaseScavengerMutex(); + + /* If we had reached max */ + if (ScavengerFobx != NULL) + { + NTSTATUS Status; + + /* Purge the oldest FOBX */ + Status = RxPurgeFobxFromCache(ScavengerFobx); + if (Status != STATUS_SUCCESS) + { + *NeedPurge = TRUE; + } + } +} + +/* + * @implemented + */ VOID RxMarkFobxOnClose( PFOBX Fobx) { - UNIMPLEMENTED; + PFCB Fcb; + PRDBSS_SCAVENGER Scavenger; + + PAGED_CODE(); + + /* No FOBX, nothing to mark */ + if (Fobx == NULL) + { + return; + } + + Fcb = (PFCB)Fobx->pSrvOpen->pFcb; + ASSERT(NodeTypeIsFcb(Fcb)); + + Scavenger = Fcb->RxDeviceObject->pRdbssScavenger; + + RxAcquireScavengerMutex(); + /* Only mark it if it was already marked as dormant */ + if (BooleanFlagOn(Fobx->Flags, FOBX_FLAG_MARKED_AS_DORMANT)) + { + /* If FCB wasn't already decrement, do it now */ + if (!Fobx->fOpenCountDecremented) + { + Fcb = (PFCB)Fobx->pSrvOpen->pFcb; + ASSERT(NodeTypeIsFcb(Fcb)); + InterlockedDecrement((volatile long *)&Fcb->OpenCount); + + Fobx->fOpenCountDecremented = TRUE; + } + + /* We're no longer dormant */ + InterlockedDecrement(&Scavenger->NumberOfDormantFiles); + ClearFlag(Fobx->Flags, FOBX_FLAG_MARKED_AS_DORMANT); + } + + /* If we were inserted in the scavenger, drop ourselves out */ + if (!IsListEmpty(&Fobx->ClosePendingList)) + { + RemoveEntryList(&Fobx->ClosePendingList); + InitializeListHead(&Fobx->ClosePendingList); + } + + RxReleaseScavengerMutex(); } /* @@ -4929,7 +5534,7 @@ } /* If locking was OK (or not needed!), attempt finalization */ - if (NT_SUCCESS(Status)) + if (Status == STATUS_SUCCESS) { Freed = RxFinalizeNetFcb(ThisFcb, RecursiveFinalize, ForceFinalize, References); } @@ -5005,20 +5610,338 @@ RxReleasePrefixTableLock(PrefixTable); } +/* + * @implemented + */ VOID RxpDiscardChangeBufferingStateRequests( _Inout_ PLIST_ENTRY DiscardedRequests) { - UNIMPLEMENTED; -} - + PLIST_ENTRY Entry; + + PAGED_CODE(); + + /* No requests to discard */ + if (IsListEmpty(DiscardedRequests)) + { + return; + } + + /* Free all the discarded requests */ + Entry = DiscardedRequests->Flink; + while (Entry != DiscardedRequests) + { + PCHANGE_BUFFERING_STATE_REQUEST Request; + + Request = CONTAINING_RECORD(Entry, CHANGE_BUFFERING_STATE_REQUEST, ListEntry); + Entry = Entry->Flink; + + DPRINT("Req %p for %p (%p) discarded\n", Request, Request->SrvOpenKey, Request->SrvOpen); + + RxPrepareRequestForReuse(Request); + RxFreePool(Request); + } +} + +/* + * @implemented + */ VOID RxpDispatchChangeBufferingStateRequests( PSRV_CALL SrvCall, PSRV_OPEN SrvOpen, PLIST_ENTRY DiscardedRequests) { - UNIMPLEMENTED; + KIRQL OldIrql; + NTSTATUS Status; + BOOLEAN StartDispatcher; + LIST_ENTRY AcceptedReqs; + LIST_ENTRY DispatcherList; + PRX_BUFFERING_MANAGER BufferingManager; + + /* Initialize our lists */ + InitializeListHead(&AcceptedReqs); + InitializeListHead(DiscardedRequests); + + /* Transfer the requests to dispatch locally */ + BufferingManager = &SrvCall->BufferingManager; + KeAcquireSpinLock(&BufferingManager->SpinLock, &OldIrql); + RxTransferList(&DispatcherList, &BufferingManager->DispatcherList); + KeReleaseSpinLock(&BufferingManager->SpinLock, OldIrql); + + /* If there were requests */ + if (!IsListEmpty(&DispatcherList)) + { + PLIST_ENTRY Entry; + + /* For each of the entries... */ + Entry = DispatcherList.Flink; + while (Entry != &DispatcherList) + { + PCHANGE_BUFFERING_STATE_REQUEST Request; + + Request = CONTAINING_RECORD(Entry, CHANGE_BUFFERING_STATE_REQUEST, ListEntry); + Entry = Entry->Flink; + + /* If we have been provided a SRV_OPEN, see whether it matches */ + if (SrvOpen != NULL) + { + /* Match, the request is accepted */ + if (Request->SrvOpenKey == SrvOpen->Key) + { + Request->SrvOpen = SrvOpen; + RxReferenceSrvOpen(SrvOpen); + + RemoveEntryList(&Request->ListEntry); + InsertTailList(&AcceptedReqs, &Request->ListEntry); + + /* Move to the next entry */ + continue; + } + else + { + Status = STATUS_PENDING; + } + } + else + { + /* No SRV_OPEN provided, try to find one */ + Status = RxpLookupSrvOpenForRequestLite(SrvCall, Request); + } + + /* We found a matching SRV_OPEN, accept the request */ + if (Status == STATUS_SUCCESS) + { + RemoveEntryList(&Request->ListEntry); + InsertTailList(&AcceptedReqs, &Request->ListEntry); + } + /* Another run might help handling it, don't discard it */ + else if (Status == STATUS_PENDING) + { + continue; + } + /* Otherwise, discard the request */ + else + { + ASSERT(Status == STATUS_NOT_FOUND); + + RemoveEntryList(&Request->ListEntry); + InsertTailList(DiscardedRequests, &Request->ListEntry); + } + } + } + + KeAcquireSpinLock(&BufferingManager->SpinLock, &OldIrql); + /* Nothing to dispatch, no need to start dispatcher */ + if (IsListEmpty(&DispatcherList)) + { + StartDispatcher = FALSE; + } + else + { + /* Transfer back the list of the not treated entries to the buffering manager */ + RxTransferList(&BufferingManager->DispatcherList, &DispatcherList); + StartDispatcher = (BufferingManager->DispatcherActive == FALSE); + /* If the dispatcher isn't active, start it */ + if (StartDispatcher) + { + BufferingManager->DispatcherActive = TRUE; + } + } + + /* If there were accepted requests, move them to the buffering manager */ + if (!IsListEmpty(&AcceptedReqs)) + { + RxTransferList(&BufferingManager->HandlerList, &AcceptedReqs); + } + KeReleaseSpinLock(&BufferingManager->SpinLock, OldIrql); + + /* If we're to start the dispatcher, do it */ + if (StartDispatcher) + { + RxReferenceSrvCall(SrvCall); + DPRINT("Starting dispatcher\n"); + RxPostToWorkerThread(RxFileSystemDeviceObject, HyperCriticalWorkQueue, + &BufferingManager->DispatcherWorkItem, + RxDispatchChangeBufferingStateRequests, SrvCall); + } +} + +/* + * @implemented + */ +NTSTATUS +RxpLookupSrvOpenForRequestLite( + IN PSRV_CALL SrvCall, + IN OUT PCHANGE_BUFFERING_STATE_REQUEST Request) +{ + NTSTATUS Status; + PLIST_ENTRY Entry; + PSRV_OPEN SrvOpen; + + PAGED_CODE(); + + Status = STATUS_SUCCESS; + /* Browse all our associated SRV_OPENs to find the one! */ + for (Entry = SrvCall->BufferingManager.SrvOpenLists[0].Flink; + Entry != &SrvCall->BufferingManager.SrvOpenLists[0]; + Entry = Entry->Flink) + { + /* Same key, not orphaned, this is ours */ + SrvOpen = CONTAINING_RECORD(Entry, SRV_OPEN, SrvOpenKeyList); + if (SrvOpen->Key == Request->SrvOpenKey) + { + if (!BooleanFlagOn(SrvOpen->pFcb->FcbState, FCB_STATE_ORPHANED)) + { + RxReferenceSrvOpen(SrvOpen); + break; + } + } + } + + /* We didn't manage to find a SRV_OPEN */ + if (Entry == &SrvCall->BufferingManager.SrvOpenLists[0]) + { + SrvOpen = NULL; + + /* The coming open might help, mark as pending for later retry */ + if (SrvCall->BufferingManager.NumberOfOutstandingOpens != 0) + { + Status = STATUS_PENDING; + } + /* Else, it's a complete failure */ + else + { + Status = STATUS_NOT_FOUND; + } + } + + /* Return the (not) found SRV_OPEN */ + Request->SrvOpen = SrvOpen; + + return Status; +} + +/* + * @implemented + */ +VOID +RxpMarkInstanceForScavengedFinalization( + PVOID Instance) +{ + NODE_TYPE_CODE NodeType; + PNODE_TYPE_AND_SIZE Node; + PRDBSS_SCAVENGER Scavenger; + PRDBSS_DEVICE_OBJECT DeviceObject; + PLIST_ENTRY ScavengerHead, InstEntry; + + PAGED_CODE(); + + /* If still referenced, don't mark it (broken caller) */ + Node = (PNODE_TYPE_AND_SIZE)Instance; + if (Node->NodeReferenceCount > 1) + { + return; + } + + DeviceObject = RxGetDeviceObjectOfInstance(Instance); + Scavenger = DeviceObject->pRdbssScavenger; + + /* Mark the node */ + NodeType = NodeType(Instance); + SetFlag(NodeType(Node), RX_SCAVENGER_MASK); + DPRINT("Node %p has now the scavenger mark!\n", Instance); + + /* Increase the count in the scavenger, and queue it */ + ScavengerHead = NULL; + switch (NodeType) + { + case RDBSS_NTC_FOBX: + ++Scavenger->FobxsToBeFinalized; + ScavengerHead = &Scavenger->FobxFinalizationList; + InstEntry = &((PFOBX)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_SRVCALL: + ++Scavenger->SrvCallsToBeFinalized; + ScavengerHead = &Scavenger->SrvCallFinalizationList; + InstEntry = &((PSRV_CALL)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_NETROOT: + ++Scavenger->NetRootsToBeFinalized; + ScavengerHead = &Scavenger->NetRootFinalizationList; + InstEntry = &((PNET_ROOT)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_V_NETROOT: + ++Scavenger->VNetRootsToBeFinalized; + ScavengerHead = &Scavenger->VNetRootFinalizationList; + InstEntry = &((PV_NET_ROOT)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_SRVOPEN: + ++Scavenger->SrvOpensToBeFinalized; + ScavengerHead = &Scavenger->SrvOpenFinalizationList; + InstEntry = &((PSRV_OPEN)Instance)->ScavengerFinalizationList; + break; + } + + /* Extra ref for scavenger */ + InterlockedIncrement((volatile long *)&Node->NodeReferenceCount); + + /* If matching type */ + if (ScavengerHead != NULL) + { + /* Insert in the scavenger list */ + InsertTailList(ScavengerHead, InstEntry); + + /* And if it wasn't started, start it */ + if (Scavenger->State == RDBSS_SCAVENGER_INACTIVE) + { + Scavenger->State = RDBSS_SCAVENGER_DORMANT; + RxPostOneShotTimerRequest(RxFileSystemDeviceObject, &Scavenger->WorkItem, + RxScavengerTimerRoutine, DeviceObject, Scavenger->TimeLimit); + } + } +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RxPostOneShotTimerRequest( + IN PRDBSS_DEVICE_OBJECT pDeviceObject, + IN PRX_WORK_ITEM pWorkItem, + IN PRX_WORKERTHREAD_ROUTINE Routine, + IN PVOID pContext, + IN LARGE_INTEGER TimeInterval) +{ + KIRQL OldIrql; + + ASSERT(pWorkItem != NULL); + + /* Prepare the work item */ + ExInitializeWorkItem(&pWorkItem->WorkQueueItem, Routine, pContext); + pWorkItem->WorkQueueItem.pDeviceObject = pDeviceObject; + + /* Last tick can be computed with the number of times it was caller (timertickcount) + * and the interval between calls + */ + KeAcquireSpinLock(&RxTimerLock, &OldIrql); + pWorkItem->LastTick = (TimeInterval.QuadPart / 550000) + RxTimerTickCount + 1; + /* Insert in work queue */ + InsertTailList(&RxTimerQueueHead, &pWorkItem->WorkQueueItem.List); + KeReleaseSpinLock(&RxTimerLock, OldIrql); + + /* If there are queued events, queue an execution */ + if (IsListEmpty(&RxTimerQueueHead)) + { + KeSetTimer(&RxTimer, RxTimerInterval, &RxTimerDpc); + } + + return STATUS_SUCCESS; } /* @@ -5231,6 +6154,41 @@ * @implemented */ VOID +RxPrepareRequestForReuse( + PCHANGE_BUFFERING_STATE_REQUEST Request) +{ + PSRV_OPEN SrvOpen; + + PAGED_CODE(); + + SrvOpen = Request->SrvOpen; + + /* If the request was already prepared for service */ + if (BooleanFlagOn(Request->Flags, RX_REQUEST_PREPARED_FOR_HANDLING)) + { + /* We have to dereference the associated SRV_OPEN depending on the lock */ + if (RxIsFcbAcquiredExclusive(SrvOpen->pFcb)) + { + RxDereferenceSrvOpen(SrvOpen, LHS_ExclusiveLockHeld); + } + else + { + RxDereferenceSrvOpen(SrvOpen, LHS_LockNotHeld); + } + } + /* Otherwise, just dereference */ + else if (SrvOpen != NULL) + { + RxDereferenceSrvOpen(SrvOpen, LHS_LockNotHeld); + } + + Request->SrvOpen = NULL; +} + +/* + * @implemented + */ +VOID NTAPI RxProcessChangeBufferingStateRequests( _In_ PVOID SrvCall) @@ -5238,6 +6196,37 @@ /* Call internal routine */ RxUndoScavengerFinalizationMarking(SrvCall); RxpProcessChangeBufferingStateRequests(SrvCall, TRUE); +} + +/* + * @implemented + */ +VOID +RxProcessChangeBufferingStateRequestsForSrvOpen( + PSRV_OPEN SrvOpen) +{ + LONG NumberOfBufferingChangeRequests, OldBufferingToken; + + /* Get the current number of change requests */ + NumberOfBufferingChangeRequests = ((PSRV_CALL)SrvOpen->pVNetRoot->pNetRoot->pSrvCall)->BufferingManager.CumulativeNumberOfBufferingChangeRequests; + /* Get our old token */ + OldBufferingToken = InterlockedCompareExchange(&SrvOpen->BufferingToken, + NumberOfBufferingChangeRequests, NumberOfBufferingChangeRequests); + /* Do we have stuff to process? */ + if (OldBufferingToken != SrvOpen->BufferingToken) + { + PFCB Fcb; + NTSTATUS Status; + + /* Acquire the FCB and start processing */ + Fcb = (PFCB)SrvOpen->pFcb; + Status = RxAcquireExclusiveFcb(NULL, Fcb); + if (Status == STATUS_SUCCESS) + { + RxProcessFcbChangeBufferingStateRequest(Fcb); + RxReleaseFcb(NULL, Fcb); + } + } } VOID @@ -5280,22 +6269,111 @@ UNIMPLEMENTED; } +/* + * @implemented + */ VOID RxpUndoScavengerFinalizationMarking( PVOID Instance) { + PLIST_ENTRY ListEntry; PNODE_TYPE_AND_SIZE Node; + PRDBSS_SCAVENGER Scavenger; PAGED_CODE(); Node = (PNODE_TYPE_AND_SIZE)Instance; /* There's no marking - nothing to do */ - if (!BooleanFlagOn(Node->NodeTypeCode, RX_SCAVENGER_MASK)) + if (!BooleanFlagOn(NodeType(Node), RX_SCAVENGER_MASK)) { return; } - UNIMPLEMENTED; + /* First of all, remove the mark */ + ClearFlag(NodeType(Node), RX_SCAVENGER_MASK); + DPRINT("Node %p no longer has the scavenger mark\n"); + + /* And now, remove from the scavenger */ + Scavenger = RxGetDeviceObjectOfInstance(Instance)->pRdbssScavenger; + switch (NodeType(Node)) + { + case RDBSS_NTC_FOBX: + --Scavenger->FobxsToBeFinalized; + ListEntry = &((PFOBX)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_SRVCALL: + --Scavenger->SrvCallsToBeFinalized; + ListEntry = &((PSRV_CALL)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_NETROOT: + --Scavenger->NetRootsToBeFinalized; + ListEntry = &((PNET_ROOT)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_V_NETROOT: + --Scavenger->VNetRootsToBeFinalized; + ListEntry = &((PV_NET_ROOT)Instance)->ScavengerFinalizationList; + break; + + case RDBSS_NTC_SRVOPEN: + --Scavenger->SrvOpensToBeFinalized; + ListEntry = &((PSRV_OPEN)Instance)->ScavengerFinalizationList; + break; + } + + /* Also, remove the extra ref from the scavenger */ + RemoveEntryList(ListEntry); + InterlockedDecrement((volatile long *)&Node->NodeReferenceCount); +} + +/* + * @implemented + */ +VOID +RxPurgeChangeBufferingStateRequestsForSrvOpen( + PSRV_OPEN SrvOpen) +{ + PSRV_CALL SrvCall; + LIST_ENTRY Discarded; + + PAGED_CODE(); + + ASSERT(RxIsFcbAcquiredExclusive(SrvOpen->Fcb)); + + /* Initialize our discarded list */ + InitializeListHead(&Discarded); + + SrvCall = (PSRV_CALL)SrvOpen->Fcb->VNetRoot->pNetRoot->pSrvCall; + RxAcquireBufferingManagerMutex(&SrvCall->BufferingManager); + + /* Set the flag, and get the requests */ + InitializeListHead(&SrvOpen->SrvOpenKeyList); + SetFlag(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_REQUESTS_PURGED); + RxGatherRequestsForSrvOpen(SrvCall, SrvOpen, &Discarded); + + RxReleaseBufferingManagerMutex(&SrvCall->BufferingManager); + + /* If there were discarded requests */ + if (!IsListEmpty(&Discarded)) + { + /* And a pending buffering state change */ + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_BUFFERING_STATE_CHANGE_PENDING)) + { + /* Clear the flag, and set the associated event - job done */ + RxAcquireSerializationMutex(); + ClearFlag(SrvOpen->Fcb->FcbState, FCB_STATE_BUFFERING_STATE_CHANGE_PENDING); + if (SrvOpen->Fcb->pBufferingStateChangeCompletedEvent != NULL) + { + KeSetEvent(SrvOpen->Fcb->pBufferingStateChangeCompletedEvent, IO_NETWORK_INCREMENT, FALSE); + } + RxReleaseSerializationMutex(); + } + + /* Drop the discarded requests */ + RxpDiscardChangeBufferingStateRequests(&Discarded); + } } /* @@ -5373,6 +6451,52 @@ /* Return appropriate status */ Status = (Purged ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); DPRINT("Purge for FCB %p returns %lx\n", Fcb, Status); + + return Status; +} + +/* + * @implemented + */ +NTSTATUS +RxPurgeFobxFromCache( + PFOBX FobxToBePurged) +{ + NTSTATUS Status; + PFCB FcbToBePurged; + + PAGED_CODE(); + + FcbToBePurged = (PFCB)FobxToBePurged->pSrvOpen->pFcb; + ASSERT(FcbToBePurged != NULL); + + /* If we cannot have our FCB exclusively, give up */ + Status = RxAcquireExclusiveFcb(NULL, FcbToBePurged); + if (Status != STATUS_SUCCESS) + { + RxDereferenceNetFobx(FobxToBePurged, LHS_LockNotHeld); + return Status; + } + + /* Don't let the FCB disappear */ + RxReferenceNetFcb(FcbToBePurged); + + /* If the SRV_OPEN was already closed, or if there are unclean FOBX, give up */ + if (BooleanFlagOn(FobxToBePurged->Flags, FOBX_FLAG_SRVOPEN_CLOSED) || FobxToBePurged->pSrvOpen->UncleanFobxCount != 0) + { + DPRINT("FCB purge skipped\n"); + } + else + { + Status = RxPurgeFcbInSystemCache(FcbToBePurged, NULL, 0, FALSE, TRUE); + } + + RxDereferenceNetFobx(FobxToBePurged, LHS_ExclusiveLockHeld); + /* Drop our extra reference */ + if (!RxDereferenceAndFinalizeNetFcb(FcbToBePurged, NULL, FALSE, FALSE)) + { + RxReleaseFcb(NULL, FcbToBePurged); + } return Status; } @@ -5591,6 +6715,30 @@ * @implemented */ VOID +RxRemoveNameNetFcb( + OUT PFCB ThisFcb) +{ + PNET_ROOT NetRoot; + + PAGED_CODE(); + + ASSERT(NodeTypeIsFcb(ThisFcb)); + + /* Just remove the entry from the FCB_TABLE */ + NetRoot = (PNET_ROOT)ThisFcb->VNetRoot->pNetRoot; + ASSERT(RxIsFcbTableLockExclusive(&NetRoot->FcbTable)); + ASSERT(RxIsFcbAcquiredExclusive(ThisFcb)); + + RxFcbTableRemoveFcb(&NetRoot->FcbTable, ThisFcb); + DPRINT("FCB (%p) %wZ removed\n", ThisFcb, &ThisFcb->FcbTableEntry.Path); + /* Mark, so that we don't try to do it twice */ + SetFlag(ThisFcb->FcbState, FCB_STATE_NAME_ALREADY_REMOVED); +} + +/* + * @implemented + */ +VOID RxRemovePrefixTableEntry( IN OUT PRX_PREFIX_TABLE ThisTable, IN OUT PRX_PREFIX_ENTRY Entry) @@ -5673,6 +6821,23 @@ MINIRDR_CALL_THROUGH(Status, NetRoot->pSrvCall->RxDeviceObject->Dispatch, MRxFinalizeNetRoot, ((PMRX_NET_ROOT)NetRoot, FALSE)); (void)Status; + } +} + +VOID +RxResumeBlockedOperations_ALL( + IN OUT PRX_CONTEXT RxContext) +{ + LIST_ENTRY BlockedOps; + + PAGED_CODE(); + + /* Get the blocked operations */ + RxTransferListWithMutex(&BlockedOps, &RxContext->BlockedOperations, RxContext->BlockedOpsMutex); + + if (!IsListEmpty(&BlockedOps)) + { + UNIMPLEMENTED; } } @@ -5765,6 +6930,80 @@ } return TRUE; +} + +VOID +RxScavengerFinalizeEntries( + PRDBSS_DEVICE_OBJECT DeviceObject) +{ + UNIMPLEMENTED; +} + +/* + * @implemented + */ +VOID +NTAPI +RxScavengerTimerRoutine( + PVOID Context) +{ + BOOLEAN Requeue; + PRDBSS_DEVICE_OBJECT DeviceObject; + PRDBSS_SCAVENGER Scavenger; + + PAGED_CODE(); + + DeviceObject = Context; + Scavenger = DeviceObject->pRdbssScavenger; + + Requeue = FALSE; + RxAcquireScavengerMutex(); + /* If the scavenger was dormant, wake it up! */ + if (Scavenger->State == RDBSS_SCAVENGER_DORMANT) + { + /* Done */ + Scavenger->State = RDBSS_SCAVENGER_ACTIVE; + KeResetEvent(&Scavenger->ScavengeEvent); + + /* Scavenger the entries */ + RxReleaseScavengerMutex(); + RxScavengerFinalizeEntries(DeviceObject); + RxAcquireScavengerMutex(); + + /* If we're still active (race) */ + if (Scavenger->State == RDBSS_SCAVENGER_ACTIVE) + { + /* If there are new entries to scavenge, stay dormant and requeue a run */ + if (Scavenger->NumberOfDormantFiles + Scavenger->SrvCallsToBeFinalized + + Scavenger->NetRootsToBeFinalized + Scavenger->VNetRootsToBeFinalized + + Scavenger->FcbsToBeFinalized + Scavenger->SrvOpensToBeFinalized + + Scavenger->FobxsToBeFinalized != 0) + { + Requeue = TRUE; + Scavenger->State = RDBSS_SCAVENGER_DORMANT; + } + /* Otherwise, we're inactive again */ + else + { + Scavenger->State == RDBSS_SCAVENGER_INACTIVE; + } + } + + RxReleaseScavengerMutex(); + + /* Requeue an execution */ + if (Requeue) + { + RxPostOneShotTimerRequest(RxFileSystemDeviceObject, &Scavenger->WorkItem, + RxScavengerTimerRoutine, DeviceObject, Scavenger->TimeLimit); + } + } + else + { + RxReleaseScavengerMutex(); + } + + KeSetEvent(&Scavenger->ScavengeEvent, IO_NO_INCREMENT, FALSE); } BOOLEAN @@ -6238,6 +7477,78 @@ * @implemented */ VOID +NTAPI +RxTimerDispatch( + _In_ struct _KDPC *Dpc, + _In_opt_ PVOID DeferredContext, + _In_opt_ PVOID SystemArgument1, + _In_opt_ PVOID SystemArgument2) +{ + BOOLEAN Set; + LIST_ENTRY LocalList; + PLIST_ENTRY ListEntry; + PRX_WORK_ITEM WorkItem; + + InitializeListHead(&LocalList); + + KeAcquireSpinLockAtDpcLevel(&RxTimerLock); + ++RxTimerTickCount; + + /* Find any entry matching */ + if (!IsListEmpty(&RxTimerQueueHead)) + { + ListEntry = RxTimerQueueHead.Flink; + do + { + WorkItem = CONTAINING_RECORD(ListEntry, RX_WORK_ITEM, WorkQueueItem.List); + if (WorkItem->LastTick == RxTimerTickCount) + { + ListEntry = ListEntry->Flink; + + RemoveEntryList(&WorkItem->WorkQueueItem.List); + InsertTailList(&LocalList, &WorkItem->WorkQueueItem.List); + } + else + { + ListEntry = ListEntry->Flink; + } + } while (ListEntry != &RxTimerQueueHead); + } + /* Do we have to requeue a later execution? */ + Set = !IsListEmpty(&RxTimerQueueHead); + + KeReleaseSpinLockFromDpcLevel(&RxTimerLock); + + /* Requeue if list wasn't empty */ + if (Set) + { + KeSetTimer(&RxTimer, RxTimerInterval, &RxTimerDpc); + } + + /* If we had matching entries */ + if (!IsListEmpty(&LocalList)) + { + /* Post them, one after another */ + ListEntry = LocalList.Flink; + do + { + WorkItem = CONTAINING_RECORD(ListEntry, RX_WORK_ITEM, WorkQueueItem.List); + ListEntry = ListEntry->Flink; + + WorkItem->WorkQueueItem.List.Flink = NULL; + WorkItem->WorkQueueItem.List.Blink = NULL; + RxPostToWorkerThread(WorkItem->WorkQueueItem.pDeviceObject, CriticalWorkQueue, + &WorkItem->WorkQueueItem, WorkItem->WorkQueueItem.WorkerRoutine, + WorkItem->WorkQueueItem.Parameter); + } + while (ListEntry != &LocalList); + } +} + +/* + * @implemented + */ +VOID RxTrackerUpdateHistory( _Inout_opt_ PRX_CONTEXT RxContext, _Inout_ PMRX_FCB MrxFcb, @@ -6676,24 +7987,26 @@ UNIMPLEMENTED; } - /* Nor missing contexts... */ + /* If we don't have a context, assume we can wait! */ if (RxContext == NULL) { - UNIMPLEMENTED; - } - - /* That said: we have a real context! */ - ContextIsPresent = TRUE; - - /* If we've been cancelled in between, give up */ - Status = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_CANCELLED) ? STATUS_CANCELLED : STATUS_SUCCESS; - if (!NT_SUCCESS(Status)) - { - return Status; - } - - /* Can we wait? */ - CanWait = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT); + CanWait = TRUE; + } + else + { + /* That said: we have a real context! */ + ContextIsPresent = TRUE; + + /* If we've been cancelled in between, give up */ + Status = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_CANCELLED) ? STATUS_CANCELLED : STATUS_SUCCESS; + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Can we wait? */ + CanWait = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT); + } while (TRUE) {
7 years, 5 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
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
Results per page:
10
25
50
100
200