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
April 2010
----- 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
22 participants
435 discussions
Start a n
N
ew thread
[ekohl] 46695: [NTOSKRNL] - Implement the calculation of access rights for the MAXIMUM_ALLOWED case.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Apr 3 12:52:17 2010 New Revision: 46695 URL:
http://svn.reactos.org/svn/reactos?rev=46695&view=rev
Log: [NTOSKRNL] - Implement the calculation of access rights for the MAXIMUM_ALLOWED case. Modified: trunk/reactos/ntoskrnl/se/semgr.c Modified: trunk/reactos/ntoskrnl/se/semgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/semgr.c?rev=46…
============================================================================== --- trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] Sat Apr 3 12:52:17 2010 @@ -391,6 +391,9 @@ LUID_AND_ATTRIBUTES Privilege; ACCESS_MASK CurrentAccess, AccessMask; ACCESS_MASK RemainingAccess; + ACCESS_MASK TempAccess; + ACCESS_MASK TempGrantedAccess = 0; + ACCESS_MASK TempDeniedAccess = 0; PACCESS_TOKEN Token; ULONG i; PACL Dacl; @@ -544,6 +547,69 @@ return FALSE; } + /* Determine the MAXIMUM_ALLOWED access rights */ + if (DesiredAccess & MAXIMUM_ALLOWED) + { + CurrentAce = (PACE)(Dacl + 1); + for (i = 0; i < Dacl->AceCount; i++) + { + Sid = (PSID)(CurrentAce + 1); + if (CurrentAce->Header.AceType == ACCESS_DENIED_ACE_TYPE) + { + if (SepSidInToken(Token, Sid)) + { + /* Map access rights from the ACE */ + TempAccess = CurrentAce->AccessMask; + RtlMapGenericMask(&TempAccess, GenericMapping); + + /* Deny access rights that have not been granted yet */ + TempDeniedAccess |= (TempAccess & ~TempGrantedAccess); + } + } + else if (CurrentAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE) + { + if (SepSidInToken(Token, Sid)) + { + /* Map access rights from the ACE */ + TempAccess = CurrentAce->AccessMask; + RtlMapGenericMask(&TempAccess, GenericMapping); + + /* Grant access rights that have not been denied yet */ + TempGrantedAccess |= (TempAccess & ~TempDeniedAccess); + } + } + else + { + DPRINT1("Unsupported ACE type 0x%lx\n", CurrentAce->Header.AceType); + } + + /* Get to the next ACE */ + CurrentAce = (PACE)((ULONG_PTR)CurrentAce + CurrentAce->Header.AceSize); + } + + /* Fail if some rights have not been granted */ + RemainingAccess &= ~(MAXIMUM_ALLOWED | TempGrantedAccess); + if (RemainingAccess != 0) + { + *GrantedAccess = 0; + *AccessStatus = STATUS_ACCESS_DENIED; + return FALSE; + } + + /* Set granted access right and access status */ + *GrantedAccess = TempGrantedAccess | PreviouslyGrantedAccess; + if (*GrantedAccess != 0) + { + *AccessStatus = STATUS_SUCCESS; + return TRUE; + } + else + { + *AccessStatus = STATUS_ACCESS_DENIED; + return FALSE; + } + } + /* RULE 4: Grant rights according to the DACL */ CurrentAce = (PACE)(Dacl + 1); for (i = 0; i < Dacl->AceCount; i++) @@ -570,7 +636,7 @@ } else { - DPRINT1("Unknown Ace type 0x%lx\n", CurrentAce->Header.AceType); + DPRINT1("Unsupported ACE type 0x%lx\n", CurrentAce->Header.AceType); } CurrentAce = (PACE)((ULONG_PTR)CurrentAce + CurrentAce->Header.AceSize); } @@ -580,14 +646,8 @@ *GrantedAccess = CurrentAccess & DesiredAccess; - if (DesiredAccess & MAXIMUM_ALLOWED) - { - *GrantedAccess = CurrentAccess; - *AccessStatus = STATUS_SUCCESS; - return TRUE; - } - else if ((*GrantedAccess & ~VALID_INHERIT_FLAGS) == - (DesiredAccess & ~VALID_INHERIT_FLAGS)) + if ((*GrantedAccess & ~VALID_INHERIT_FLAGS) == + (DesiredAccess & ~VALID_INHERIT_FLAGS)) { *AccessStatus = STATUS_SUCCESS; return TRUE;
14 years, 8 months
1
0
0
0
[tkreuzer] 46694: Remove svn:mergeinfo property from several files
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Apr 3 10:03:17 2010 New Revision: 46694 URL:
http://svn.reactos.org/svn/reactos?rev=46694&view=rev
Log: Remove svn:mergeinfo property from several files Modified: branches/header-work/dll/directx/bdaplgin/classfactory.cpp (props changed) branches/header-work/dll/directx/d3d8/d3d8.spec (props changed) branches/header-work/dll/directx/dsound_new/classfactory.c (props changed) branches/header-work/dll/directx/dsound_new/dsound.spec (props changed) branches/header-work/dll/directx/dsound_new/dsound_convert.c (props changed) branches/header-work/dll/directx/dsound_new/regsvr.c (props changed) branches/header-work/dll/shellext/devcpux/devcpux.spec (props changed) branches/header-work/dll/shellext/slayer/slayer.spec (props changed) branches/header-work/include/ndk/amd64/ (props changed) branches/header-work/include/ndk/amd64/asmmacro.S (props changed) branches/header-work/lib/sdk/crt/time/ (props changed) branches/header-work/ntoskrnl/kdbg/ (props changed) branches/header-work/subsystems/win32/win32k/include/engobjects.h (props changed) branches/header-work/tools/rsym/rsym.c (props changed) branches/header-work/tools/rsym/rsym.h (props changed) branches/header-work/tools/rsym/rsym.mak (props changed) branches/header-work/tools/rsym/rsym_common.c (props changed) Propchange: branches/header-work/dll/directx/bdaplgin/classfactory.cpp ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,3 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/bdaplgin/classfactory.cpp:34741,34870,36969,40927,41070,41500,44339,44467-44468,44470-44471,44501,44503-44504,44506,44511-44512,44521,44523-44526,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/branches/ros-amd64-bringup/reactos/dll/directx/ksproxy/classfactory.cpp:34711-34712,34743,34780-34782,34812,34839,34842,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35683,35739,35746,35762,35771,35777,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36172,36360,36388-36389,36445,36502-36503,36505,36570,36614,36899,36930,36936,36992,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148-38151,38264-38265,38268,38355,39151,39333,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41082-41086,41097-41098,41101,41449,41479,41484-41485,41499,41531,41536,41540,41546-41547,41549,43080,43426,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43838-43840,43857-43858,43860,43905-43907,43969,44002,44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338,44389,44391,44426,44460,44530,44540,44601 -/trunk/reactos/dll/directx/bdaplgin/classfactory.cpp:45691-46666 Propchange: branches/header-work/dll/directx/d3d8/d3d8.spec ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/d3d8/d3d8.spec:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38148-38151,38264-38265,38268,38355,39333,39335,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41029,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,41549,43080,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/directx/d3d8/d3d8.spec:45691-46666 Propchange: branches/header-work/dll/directx/dsound_new/classfactory.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,3 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/dsound_new/classfactory.c:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36502-36503,36505,36898,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38355,39335,39639,40122-40123,40125,40155,40247,40324,40753,40927,40986-40987,40989,40993,40995-40996,41001,41029,41044-41045,41047-41049,41070,41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857,43860,43905,43907,43969,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/branches/ros-amd64-bringup/reactos/dll/win32/netshell/classfactory.c:34711-34712,34743,34812,34839,34842,34917,35323-35324,35347-35348,35361,35436,35509,35515,35588,35739,35746,35771,35789,35823,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36360,36388-36389,36570,36614,36930,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41030,41050,41052,41082-41086,41499,41549,43080,43426,43454,43677,43682 -/trunk/reactos/dll/directx/dsound_new/classfactory.c:45691-46666 Propchange: branches/header-work/dll/directx/dsound_new/dsound.spec ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,3 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/dsound/dsound.spec:34711-34712,34743,34812,34839,34842,34917,35323-35324,35347-35348,35361,35436,35509,35515,35588,35739,35746,35771,35789,35823,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36360,36388-36389,36570,36614,36930,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41030,41050,41052,41082-41086,41499,41549,43080,43426,43454,43677,43682 -/branches/ros-amd64-bringup/reactos/dll/directx/dsound_new/dsound.spec:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36502-36503,36505,36898,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38355,39335,39639,40122-40123,40125,40155,40247,40324,40753,40927,40986-40987,40989,40993,40995-40996,41001,41029,41044-41045,41047-41049,41070,41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857,43860,43905,43907,43969,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/directx/dsound_new/dsound.spec:45691-46666 Propchange: branches/header-work/dll/directx/dsound_new/dsound_convert.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,3 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/dsound/dsound_convert.c:34711-34712,34743,34780-34782,34812,34839,34842,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35683,35739,35746,35762,35771,35777,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36172,36360,36388-36389,36445,36502-36503,36505,36570,36614,36899,36930,36936,36992,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148-38151,38264-38265,38268,38355,39151,39333,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41082-41086,41097-41098,41101,41449,41479,41484-41485,41499,41531,41536,41540,41546-41547,41549,43080,43426,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43838-43840,43857-43858,43860,43905-43907,43969,44002,44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338,44389,44391,44426,44460,44530,44540,44601 -/branches/ros-amd64-bringup/reactos/dll/directx/dsound_new/dsound_convert.c:34741,34870,36969,40927,41070,41500,44339,44467-44468,44470-44471,44501,44503-44504,44506,44511-44512,44521,44523-44526,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/directx/dsound_new/dsound_convert.c:45691-46666 Propchange: branches/header-work/dll/directx/dsound_new/regsvr.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,3 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/directx/dsound/regsvr.c:34711-34712,34743,34812,34839,34842,34917,35323-35324,35347-35348,35361,35436,35509,35515,35588,35739,35746,35771,35789,35823,35902,35904-35906,35942,35947-35949,35952-35953,35966,36013,36360,36388-36389,36570,36614,36930,37323,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38148,38151,38265,38268,39151,39333,39345,40991,41000,41027-41028,41030,41050,41052,41082-41086,41499,41549,43080,43426,43454,43677,43682 -/branches/ros-amd64-bringup/reactos/dll/directx/dsound_new/regsvr.c:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36502-36503,36505,36898,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38355,39335,39639,40122-40123,40125,40155,40247,40324,40753,40927,40986-40987,40989,40993,40995-40996,41001,41029,41044-41045,41047-41049,41070,41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857,43860,43905,43907,43969,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/directx/dsound_new/regsvr.c:45691-46666 Propchange: branches/header-work/dll/shellext/devcpux/devcpux.spec ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/shellext/devcpux/devcpux.spec:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38268,38355,39333,39335,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41029,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,41549,43080,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/shellext/devcpux/devcpux.spec:45691-46666 Propchange: branches/header-work/dll/shellext/slayer/slayer.spec ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/dll/shellext/slayer/slayer.spec:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38268,38355,39333,39335,39345,39639,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41029,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,41549,43080,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/dll/shellext/slayer/slayer.spec:45691-46666 Propchange: branches/header-work/include/ndk/amd64/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/include/ndk/amd64:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34925,34965,34967,34970,35323-35324,35347-35348,35361,35436,35509,35588,35655,35683,35739,35762,35777,35781,35805,35823,35827,35952,35966,36011-36012,36172,36360,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37323,37434,37472,37475,37536,37820-37821,37868-37869,37990,38013-38014,38092,38100,38149-38150,38264,38355,39335,39338,39347,39639,40088,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41029-41030,41044-41045,41047-41049,41070-41071,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43426,43447,43454,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43777,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44178,44205,44218,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44491,44499-44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44623,44631,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/include/ndk/amd64:45691-46666 Propchange: branches/header-work/include/ndk/amd64/asmmacro.S ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/include/ndk/amd64/asmmacro.S:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37475,37536,37820-37821,37868-37869,37990,38013-38014,38092,38100,38149-38150,38264,38355,39335,39338,39347,39639,40088,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41029-41030,41044-41045,41047-41049,41070-41071,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43426,43447,43454,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43777,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44178,44205,44218,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44491,44499-44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44623,44631,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/include/ndk/amd64/asmmacro.S:45691-46666 Propchange: branches/header-work/lib/sdk/crt/time/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,4 +1,0 @@ -/branches/ros-amd64-bringup/reactos/lib/sdk/crt/time:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38268,38355,39335,39639,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/branches/ros-amd64-bringup/reactos/lib/sdk/crt/time_new:42414 -/trunk/reactos/lib/sdk/crt/time:45691-46666 -/trunk/reactos/lib/sdk/crt/time_new:39350-42241 Propchange: branches/header-work/ntoskrnl/kdbg/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/ntoskrnl/kdbg:34711-34712,34741,34743,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,34969,34986,35323-35324,35347-35348,35361,35436,35444,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,35968,35970-35971,36011-36013,36172,36332,36360,36380,36388-36389,36397,36445,36502-36503,36505,36570,36614,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36992,37323,37433-37435,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38099-38100,38148-38151,38264-38265,38268,38355,39151,39160,39333,39335,39345,39522,39639,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479,41484-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/ntoskrnl/kdbg:45691-46666 Propchange: branches/header-work/subsystems/win32/win32k/include/engobjects.h ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/include/engobjects.h:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,38092,38100,38149-38150,38264,38268,38355,39335,39639,40095,40122-40123,40125,40128,40155,40247,40324,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/subsystems/win32/win32k/include/engobjects.h:45691-46666 Propchange: branches/header-work/tools/rsym/rsym.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/tools/rsym/rsym.c:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37291,37302,37305,37320,37329,37462,37895,38092,38100,38129,38149-38150,38264,38268,38330-38331,38341,38355,38947,38973,39072,39114,39121,39335,39639,40122-40123,40125,40128,40155,40247,40324,40605,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/tools/rsym/rsym.c:45691-46666 Propchange: branches/header-work/tools/rsym/rsym.h ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/tools/rsym/rsym.h:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37291,37302,37305,37320,37329,37462,37895,38092,38100,38129,38149-38150,38264,38268,38330-38331,38341,38355,38947,38973,39072,39114,39121,39335,39639,40122-40123,40125,40128,40155,40247,40324,40605,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/tools/rsym/rsym.h:45691-46666 Propchange: branches/header-work/tools/rsym/rsym.mak ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/tools/rsym/rsym.mak:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37291,37302,37305,37320,37329,37462,37895,38092,38100,38129,38149-38150,38264,38268,38330-38331,38341,38355,38947,38973,39072,39114,39121,39335,39639,40122-40123,40125,40128,40155,40247,40324,40605,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/tools/rsym/rsym.mak:45691-46666 Propchange: branches/header-work/tools/rsym/rsym_common.c ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo (removed) @@ -1,2 +1,0 @@ -/branches/ros-amd64-bringup/reactos/tools/rsym/rsym_common.c:34741,34780-34782,34803,34864,34870,34874,34877,34908-34909,34965,35655,35683,35762,35777,35781,35805,35827,36011-36012,36172,36380,36397,36445,36502-36503,36505,36898-36899,36936,36949,36951,36958,36961,36964,36969,36972,36992,37291,37302,37305,37320,37329,37462,37895,38092,38100,38129,38149-38150,38264,38268,38330-38331,38341,38355,38947,38973,39072,39114,39121,39335,39639,40122-40123,40125,40128,40155,40247,40324,40605,40753,40927-40928,40986-40987,40989,40993,40995-40996,41001,41028-41029,41044-41045,41047-41049,41070,41097-41098,41101,41449,41479,41484-41485,41500,41502,41531,41536,41540,41546-41547,43506,43566,43574,43598,43600-43602,43604-43605,43757,43775,43836,43838-43840,43857-43858,43860,43905-43907,43969,44002,44036-44037,44039-44040,44044-44045,44065,44095,44123,44144,44205,44238,44294,44338-44339,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44772,45124,45126-45127,46394,46478,46511,46524,46526,46534-46535,46537-46539,46589 -/trunk/reactos/tools/rsym/rsym_common.c:45691-46666
14 years, 8 months
1
0
0
0
[sir_richard] 46693: [NTOS]: Implement Configuration Manager routines for building a driver list, sorting it, detecting circular dependencies and ordering, combining groups, tags, group orders and tag orders, etc. Replaces the "drvrlist" I/O interface currently in ReactOS. [NTOS]: Use the new Cm interface in IopInitializeSystemDrivers to parse the ordered list of system drivers to load. Make it use ZwLoadDriver directly instead of having a hacked IopLoadDriver function. [NTOS]: Drivers should no
by sir_richard@svn.reactos.org
Author: sir_richard Date: Sat Apr 3 09:44:38 2010 New Revision: 46693 URL:
http://svn.reactos.org/svn/reactos?rev=46693&view=rev
Log: [NTOS]: Implement Configuration Manager routines for building a driver list, sorting it, detecting circular dependencies and ordering, combining groups, tags, group orders and tag orders, etc. Replaces the "drvrlist" I/O interface currently in ReactOS. [NTOS]: Use the new Cm interface in IopInitializeSystemDrivers to parse the ordered list of system drivers to load. Make it use ZwLoadDriver directly instead of having a hacked IopLoadDriver function. [NTOS]: Drivers should not show up loading n times a reboot now (some drivers seemed to do this in the past when they failed to load). [NTOS]: The system driver code could be further improved by checknig if the driver has already been loaded, or attempted and failed to load, but it is already much better now than in the past. [PERF]: Boot-time improvement since the new system driver loading code uses low-level Cm interfaces (portability side-effect: can be shared with FreeLDR) instead of the complex parse-based object-manager-based system-calls. Removed: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c Modified: trunk/reactos/ntoskrnl/config/cmboot.c trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/include/internal/cm.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/iomgr/iomgr.c trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Modified: trunk/reactos/ntoskrnl/config/cmboot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmboot.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmboot.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmboot.c [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -1,20 +1,19 @@ /* * PROJECT: ReactOS Kernel - * LICENSE: GPL - See COPYING in the top level directory + * LICENSE: BSD - See COPYING.ARM in the top level directory * FILE: ntoskrnl/config/cmboot.c * PURPOSE: Configuration Manager - Boot Initialization - * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * PROGRAMMERS: ReactOS Portable Systems Group + * Alex Ionescu (alex.ionescu(a)reactos.org) */ -/* INCLUDES ******************************************************************/ +/* INCLUDES *******************************************************************/ #include "ntoskrnl.h" #define NDEBUG #include "debug.h" - -/* GLOBALS *******************************************************************/ - -/* FUNCTIONS *****************************************************************/ + +/* FUNCTIONS ******************************************************************/ HCELL_INDEX NTAPI @@ -124,3 +123,559 @@ /* Return the CCS Cell */ return ControlSetCell; } + +ULONG +NTAPI +CmpFindTagIndex(IN PHHIVE Hive, + IN HCELL_INDEX TagCell, + IN HCELL_INDEX GroupOrderCell, + IN PUNICODE_STRING GroupName) +{ + PCM_KEY_VALUE TagValue, Value; + HCELL_INDEX OrderCell; + PULONG TagOrder, DriverTag; + ULONG CurrentTag, Length; + PCM_KEY_NODE Node; + BOOLEAN BufferAllocated; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Get the tag */ + Value = HvGetCell(Hive, TagCell); + ASSERT(Value); + DriverTag = (PULONG)CmpValueToData(Hive, Value, &Length); + ASSERT(DriverTag); + + /* Get the order array */ + Node = HvGetCell(Hive, GroupOrderCell); + ASSERT(Node); + OrderCell = CmpFindValueByName(Hive, Node, GroupName); + if (OrderCell == HCELL_NIL) return -2; + + /* And read it */ + TagValue = HvGetCell(Hive, OrderCell); + CmpGetValueData(Hive, TagValue, &Length, (PVOID*)&TagOrder, &BufferAllocated, &OrderCell); + ASSERT(TagOrder); + + /* Parse each tag */ + for (CurrentTag = 1; CurrentTag <= TagOrder[0]; CurrentTag++) + { + /* Find a match */ + if (TagOrder[CurrentTag] == *DriverTag) + { + /* Found it -- return the tag */ + if (BufferAllocated) ExFreePool(TagOrder); + return CurrentTag; + } + } + + /* No matches, so assume next to last ordering */ + if (BufferAllocated) ExFreePool(TagOrder); + return -2; +} + +BOOLEAN +NTAPI +CmpAddDriverToList(IN PHHIVE Hive, + IN HCELL_INDEX DriverCell, + IN HCELL_INDEX GroupOrderCell, + IN PUNICODE_STRING RegistryPath, + IN PLIST_ENTRY BootDriverListHead) +{ + PBOOT_DRIVER_NODE DriverNode; + PBOOT_DRIVER_LIST_ENTRY DriverEntry; + PCM_KEY_NODE Node; + ULONG NameLength, Length; + HCELL_INDEX ValueCell, TagCell; + PCM_KEY_VALUE Value; + PUNICODE_STRING FileName, RegistryString; + UNICODE_STRING UnicodeString; + PULONG ErrorControl; + PWCHAR Buffer; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Allocate a driver node and initialize it */ + DriverNode = CmpAllocate(sizeof(BOOT_DRIVER_NODE), FALSE, TAG_CM); + if (!DriverNode) return FALSE; + DriverEntry = &DriverNode->ListEntry; + DriverEntry->RegistryPath.Buffer = NULL; + DriverEntry->FilePath.Buffer = NULL; + + /* Get the driver cell */ + Node = HvGetCell(Hive, DriverCell); + ASSERT(Node); + + /* Get the name from the cell */ + DriverNode->Name.Length = Node->Flags & KEY_COMP_NAME ? + CmpCompressedNameSize(Node->Name, Node->NameLength) : + Node->NameLength; + DriverNode->Name.MaximumLength = DriverNode->Name.Length; + NameLength = DriverNode->Name.Length; + + /* Now allocate the buffer for it and copy the name */ + DriverNode->Name.Buffer = CmpAllocate(NameLength, FALSE, TAG_CM); + if (!DriverNode->Name.Buffer) return FALSE; + if (Node->Flags & KEY_COMP_NAME) + { + /* Compressed name */ + CmpCopyCompressedName(DriverNode->Name.Buffer, + DriverNode->Name.Length, + Node->Name, + Node->NameLength); + } + else + { + /* Normal name */ + RtlCopyMemory(DriverNode->Name.Buffer, Node->Name, Node->NameLength); + } + + /* Now find the image path */ + RtlInitUnicodeString(&UnicodeString, L"ImagePath"); + ValueCell = CmpFindValueByName(Hive, Node, &UnicodeString); + if (ValueCell == HCELL_NIL) + { + /* Couldn't find it, so assume the drivers path */ + Length = sizeof(L"System32\\Drivers\\") + NameLength + sizeof(L".sys"); + + /* Allocate the path name */ + FileName = &DriverEntry->FilePath; + FileName->Length = 0; + FileName->MaximumLength = Length; + FileName->Buffer = CmpAllocate(Length, FALSE,TAG_CM); + if (!FileName->Buffer) return FALSE; + + /* Write the path name */ + RtlAppendUnicodeToString(FileName, L"System32\\Drivers\\"); + RtlAppendUnicodeStringToString(FileName, &DriverNode->Name); + RtlAppendUnicodeToString(FileName, L".sys"); + } + else + { + /* Path name exists, so grab it */ + Value = HvGetCell(Hive, ValueCell); + ASSERT(Value); + + /* Allocate and setup the path name */ + FileName = &DriverEntry->FilePath; + Buffer = (PWCHAR)CmpValueToData(Hive, Value, &Length); + FileName->MaximumLength = FileName->Length = Length; + FileName->Buffer = CmpAllocate(Length, FALSE, TAG_CM); + + /* Transfer the data */ + if (!(FileName->Buffer) || !(Buffer)) return FALSE; + RtlCopyMemory(FileName->Buffer, Buffer, Length); + } + + /* Now build the registry path */ + RegistryString = &DriverEntry->RegistryPath; + RegistryString->Length = 0; + RegistryString->MaximumLength = RegistryPath->Length + NameLength; + RegistryString->Buffer = CmpAllocate(RegistryString->MaximumLength, FALSE, TAG_CM); + if (!RegistryString->Buffer) return FALSE; + + /* Add the driver name to it */ + RtlAppendUnicodeStringToString(RegistryString, RegistryPath); + RtlAppendUnicodeStringToString(RegistryString, &DriverNode->Name); + + /* The entry is done, add it */ + InsertHeadList(BootDriverListHead, &DriverEntry->Link); + + /* Now find error control settings */ + RtlInitUnicodeString(&UnicodeString, L"ErrorControl"); + ValueCell = CmpFindValueByName(Hive, Node, &UnicodeString); + if (ValueCell == HCELL_NIL) + { + /* Couldn't find it, so assume default */ + DriverNode->ErrorControl = NormalError; + } + else + { + /* Otherwise, read whatever the data says */ + Value = HvGetCell(Hive, ValueCell); + ASSERT(Value); + ErrorControl = (PULONG)CmpValueToData(Hive, Value, &Length); + ASSERT(ErrorControl); + DriverNode->ErrorControl = *ErrorControl; + } + + /* Next, get the group cell */ + RtlInitUnicodeString(&UnicodeString, L"group"); + ValueCell = CmpFindValueByName(Hive, Node, &UnicodeString); + if (ValueCell == HCELL_NIL) + { + /* Couldn't find, so set an empty string */ + RtlInitEmptyUnicodeString(&DriverNode->Group, NULL, 0); + } + else + { + /* Found it, read the group value */ + Value = HvGetCell(Hive, ValueCell); + ASSERT(Value); + + /* Copy it into the node */ + DriverNode->Group.Buffer = (PWCHAR)CmpValueToData(Hive, Value, &Length); + if (!DriverNode->Group.Buffer) return FALSE; + DriverNode->Group.Length = Length - sizeof(UNICODE_NULL); + DriverNode->Group.MaximumLength = DriverNode->Group.Length; + } + + /* Finally, find the tag */ + RtlInitUnicodeString(&UnicodeString, L"Tag"); + TagCell = CmpFindValueByName(Hive, Node, &UnicodeString); + if (TagCell == HCELL_NIL) + { + /* No tag, so load last */ + DriverNode->Tag = -1; + } + else + { + /* Otherwise, decode it based on tag order */ + DriverNode->Tag = CmpFindTagIndex(Hive, + TagCell, + GroupOrderCell, + &DriverNode->Group); + } + + /* All done! */ + return TRUE; +} + +BOOLEAN +NTAPI +CmpIsLoadType(IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN SERVICE_LOAD_TYPE LoadType) +{ + PCM_KEY_NODE Node; + HCELL_INDEX ValueCell; + UNICODE_STRING ValueString = RTL_CONSTANT_STRING(L"Start"); + PCM_KEY_VALUE Value; + ULONG Length; + PLONG Data; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Open the start cell */ + Node = HvGetCell(Hive, Cell); + ASSERT(Node); + ValueCell = CmpFindValueByName(Hive, Node, &ValueString); + if (ValueCell == HCELL_NIL) return FALSE; + + /* Read the start value */ + Value = HvGetCell(Hive, ValueCell); + ASSERT(Value); + Data = (PLONG)CmpValueToData(Hive, Value, &Length); + ASSERT(Data); + + /* Return if the type matches */ + return (*Data == LoadType); +} + +BOOLEAN +NTAPI +CmpFindDrivers(IN PHHIVE Hive, + IN HCELL_INDEX ControlSet, + IN SERVICE_LOAD_TYPE LoadType, + IN PWCHAR BootFileSystem OPTIONAL, + IN PLIST_ENTRY DriverListHead) +{ + HCELL_INDEX ServicesCell, ControlCell, GroupOrderCell, DriverCell; + UNICODE_STRING Name; + ULONG i; + WCHAR Buffer[128]; + UNICODE_STRING UnicodeString, KeyPath; + PBOOT_DRIVER_NODE FsNode; + PCM_KEY_NODE ControlNode, ServicesNode, Node; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Open the control set key */ + ControlNode = HvGetCell(Hive, ControlSet); + ASSERT(ControlNode); + + /* Get services cell */ + RtlInitUnicodeString(&Name, L"Services"); + ServicesCell = CmpFindSubKeyByName(Hive, ControlNode, &Name); + if (ServicesCell == HCELL_NIL) return FALSE; + + /* Open services key */ + ServicesNode = HvGetCell(Hive, ServicesCell); + ASSERT(ServicesNode); + + /* Get control cell */ + RtlInitUnicodeString(&Name, L"Control"); + ControlCell = CmpFindSubKeyByName(Hive, ControlNode, &Name); + if (ControlCell == HCELL_NIL) return FALSE; + + /* Get the group order cell and read it */ + RtlInitUnicodeString(&Name, L"GroupOrderList"); + Node = HvGetCell(Hive, ControlCell); + ASSERT(Node); + GroupOrderCell = CmpFindSubKeyByName(Hive, Node, &Name); + if (GroupOrderCell == HCELL_NIL) return FALSE; + + /* Build the root registry path */ + RtlInitEmptyUnicodeString(&KeyPath, Buffer, sizeof(Buffer)); + RtlAppendUnicodeToString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); + + /* Find the first subkey (ie: the first driver or service) */ + i = 0; + DriverCell = CmpFindSubKeyByNumber(Hive, ServicesNode, i); + while (DriverCell != HCELL_NIL) + { + /* Make sure it's a driver of this start type */ + if (CmpIsLoadType(Hive, DriverCell, LoadType)) + { + /* Add it to the list */ + CmpAddDriverToList(Hive, + DriverCell, + GroupOrderCell, + &KeyPath, + DriverListHead); + + } + + /* Try the next subkey */ + DriverCell = CmpFindSubKeyByNumber(Hive, ServicesNode, ++i); + } + + /* Check if we have a boot file system */ + if (BootFileSystem) + { + /* Find it */ + RtlInitUnicodeString(&UnicodeString, BootFileSystem); + DriverCell = CmpFindSubKeyByName(Hive, ServicesNode, &UnicodeString); + if (DriverCell != HCELL_NIL) + { + /* Always add it to the list */ + CmpAddDriverToList(Hive, + DriverCell, + GroupOrderCell, + &KeyPath, + DriverListHead); + + /* Mark it as critical so it always loads */ + FsNode = CONTAINING_RECORD(DriverListHead->Flink, + BOOT_DRIVER_NODE, + ListEntry.Link); + FsNode->ErrorControl = SERVICE_ERROR_CRITICAL; + } + } + + /* We're done! */ + return TRUE; +} + +BOOLEAN +NTAPI +CmpDoSort(IN PLIST_ENTRY DriverListHead, + IN PUNICODE_STRING OrderList) +{ + PWCHAR Current, End = NULL; + PLIST_ENTRY NextEntry; + UNICODE_STRING GroupName; + PBOOT_DRIVER_NODE CurrentNode; + + /* We're going from end to start, so get to the last group and keep going */ + Current = &OrderList->Buffer[OrderList->Length / sizeof(WCHAR)]; + while (Current > OrderList->Buffer) + { + /* Scan the current string */ + do + { + if (*Current == UNICODE_NULL) End = Current; + } while ((*(--Current - 1) != UNICODE_NULL) && (Current != OrderList->Buffer)); + + /* This is our cleaned up string for this specific group */ + ASSERT(End != NULL); + GroupName.Length = (End - Current) * sizeof(WCHAR); + GroupName.MaximumLength = GroupName.Length; + GroupName.Buffer = Current; + + /* Now loop the driver list */ + NextEntry = DriverListHead->Flink; + while (NextEntry != DriverListHead) + { + /* Get this node */ + CurrentNode = CONTAINING_RECORD(NextEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + + /* Get the next entry now since we'll do a relink */ + NextEntry = CurrentNode->ListEntry.Link.Flink; + + /* Is there a group name and does it match the current group? */ + if ((CurrentNode->Group.Buffer) && + (RtlEqualUnicodeString(&GroupName, &CurrentNode->Group, TRUE))) + { + /* Remove from this location and re-link in the new one */ + RemoveEntryList(&CurrentNode->ListEntry.Link); + InsertHeadList(DriverListHead, &CurrentNode->ListEntry.Link); + } + } + + /* Move on */ + Current--; + } + + /* All done */ + return TRUE; +} + +BOOLEAN +NTAPI +CmpSortDriverList(IN PHHIVE Hive, + IN HCELL_INDEX ControlSet, + IN PLIST_ENTRY DriverListHead) +{ + HCELL_INDEX Controls, GroupOrder, ListCell; + UNICODE_STRING Name, DependList; + PCM_KEY_VALUE ListNode; + ULONG Length; + PCM_KEY_NODE Node; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Open the control key */ + Node = HvGetCell(Hive, ControlSet); + ASSERT(Node); + RtlInitUnicodeString(&Name, L"Control"); + Controls = CmpFindSubKeyByName(Hive, Node, &Name); + if (Controls == HCELL_NIL) return FALSE; + + /* Open the service group order */ + Node = HvGetCell(Hive, Controls); + ASSERT(Node); + RtlInitUnicodeString(&Name, L"ServiceGroupOrder"); + GroupOrder = CmpFindSubKeyByName(Hive, Node, &Name); + if (GroupOrder == HCELL_NIL) return FALSE; + + /* Open the list key */ + Node = HvGetCell(Hive, GroupOrder); + ASSERT(Node); + RtlInitUnicodeString(&Name, L"list"); + ListCell = CmpFindValueByName(Hive, Node, &Name); + if (ListCell == HCELL_NIL) return FALSE; + + /* Now read the actual list */ + ListNode = HvGetCell(Hive, ListCell); + ASSERT(ListNode); + if (ListNode->Type != REG_MULTI_SZ) return FALSE; + + /* Copy it into a buffer */ + DependList.Buffer = (PWCHAR)CmpValueToData(Hive, ListNode, &Length); + if (!DependList.Buffer) return FALSE; + DependList.Length = DependList.MaximumLength = Length - sizeof(UNICODE_NULL); + + /* And start the recurive sort algorithm */ + return CmpDoSort(DriverListHead, &DependList); +} + +BOOLEAN +NTAPI +CmpOrderGroup(IN PBOOT_DRIVER_NODE StartNode, + IN PBOOT_DRIVER_NODE EndNode) +{ + PBOOT_DRIVER_NODE CurrentNode, PreviousNode; + PLIST_ENTRY ListEntry; + + /* Base case, nothing to do */ + if (StartNode == EndNode) return TRUE; + + /* Loop the nodes */ + CurrentNode = StartNode; + do + { + /* Save this as the previous node */ + PreviousNode = CurrentNode; + + /* And move to the next one */ + ListEntry = CurrentNode->ListEntry.Link.Flink; + CurrentNode = CONTAINING_RECORD(ListEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + + /* Check if the previous driver had a bigger tag */ + if (PreviousNode->Tag > CurrentNode->Tag) + { + /* Check if we need to update the tail */ + if (CurrentNode == EndNode) + { + /* Update the tail */ + ListEntry = CurrentNode->ListEntry.Link.Blink; + EndNode = CONTAINING_RECORD(ListEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + } + + /* Remove this driver since we need to move it */ + RemoveEntryList(&CurrentNode->ListEntry.Link); + + /* Keep looping until we find a driver with a lower tag than ours */ + while ((PreviousNode->Tag > CurrentNode->Tag) && (PreviousNode != StartNode)) + { + /* We'll be re-inserted at this spot */ + ListEntry = PreviousNode->ListEntry.Link.Blink; + PreviousNode = CONTAINING_RECORD(ListEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + } + + /* Do the insert in the new location */ + InsertTailList(&PreviousNode->ListEntry.Link, &CurrentNode->ListEntry.Link); + + /* Update the head, if needed */ + if (PreviousNode == StartNode) StartNode = CurrentNode; + } + } while (CurrentNode != EndNode); + + /* All done */ + return TRUE; +} + +BOOLEAN +NTAPI +CmpResolveDriverDependencies(IN PLIST_ENTRY DriverListHead) +{ + PLIST_ENTRY NextEntry; + PBOOT_DRIVER_NODE StartNode, EndNode, CurrentNode; + + /* Loop the list */ + NextEntry = DriverListHead->Flink; + while (NextEntry != DriverListHead) + { + /* Find the first entry */ + StartNode = CONTAINING_RECORD(NextEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + do + { + /* Find the last entry */ + EndNode = CONTAINING_RECORD(NextEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + + /* Get the next entry */ + NextEntry = NextEntry->Flink; + CurrentNode = CONTAINING_RECORD(NextEntry, + BOOT_DRIVER_NODE, + ListEntry.Link); + + /* If the next entry is back to the top, break out */ + if (NextEntry == DriverListHead) break; + + /* Otherwise, check if this entry is equal */ + if (!RtlEqualUnicodeString(&StartNode->Group, + &CurrentNode->Group, + TRUE)) + { + /* It is, so we've detected a cycle, break out */ + break; + } + } while (NextEntry != DriverListHead); + + /* Now we have the correct start and end pointers, so do the sort */ + CmpOrderGroup(StartNode, EndNode); + } + + /* We're done */ + return TRUE; +} + +/* EOF */ Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -1,12 +1,13 @@ /* * PROJECT: ReactOS Kernel - * LICENSE: GPL - See COPYING in the top level directory + * LICENSE: BSD - See COPYING.ARM in the top level directory * FILE: ntoskrnl/config/cmsysini.c * PURPOSE: Configuration Manager - System Initialization Code - * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * PROGRAMMERS: ReactOS Portable Systems Group + * Alex Ionescu (alex.ionescu(a)reactos.org) */ -/* INCLUDES ******************************************************************/ +/* INCLUDES *******************************************************************/ #include "ntoskrnl.h" #define NDEBUG @@ -33,7 +34,7 @@ extern LONG CmpFlushStarveWriters; extern BOOLEAN CmFirstTime; -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ VOID NTAPI @@ -1576,6 +1577,162 @@ VOID NTAPI +CmpFreeDriverList(IN PHHIVE Hive, + IN PLIST_ENTRY DriverList) +{ + PLIST_ENTRY NextEntry, OldEntry; + PBOOT_DRIVER_NODE DriverNode; + PAGED_CODE(); + + /* Parse the current list */ + NextEntry = DriverList->Flink; + while (NextEntry != DriverList) + { + /* Get the driver node */ + DriverNode = CONTAINING_RECORD(NextEntry, BOOT_DRIVER_NODE, ListEntry.Link); + + /* Get the next entry now, since we're going to free it later */ + OldEntry = NextEntry; + NextEntry = NextEntry->Flink; + + /* Was there a name? */ + if (DriverNode->Name.Buffer) + { + /* Free it */ + CmpFree(DriverNode->Name.Buffer, DriverNode->Name.Length); + } + + /* Was there a registry path? */ + if (DriverNode->ListEntry.RegistryPath.Buffer) + { + /* Free it */ + CmpFree(DriverNode->ListEntry.RegistryPath.Buffer, + DriverNode->ListEntry.RegistryPath.MaximumLength); + } + + /* Was there a file path? */ + if (DriverNode->ListEntry.FilePath.Buffer) + { + /* Free it */ + CmpFree(DriverNode->ListEntry.FilePath.Buffer, + DriverNode->ListEntry.FilePath.MaximumLength); + } + + /* Now free the node, and move on */ + CmpFree(OldEntry, sizeof(BOOT_DRIVER_NODE)); + } +} + +PUNICODE_STRING* +NTAPI +CmGetSystemDriverList(VOID) +{ + LIST_ENTRY DriverList; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + PCM_KEY_BODY KeyBody; + PHHIVE Hive; + HCELL_INDEX RootCell, ControlCell; + HANDLE KeyHandle; + UNICODE_STRING KeyName; + PLIST_ENTRY NextEntry; + ULONG i; + PUNICODE_STRING* ServicePath = NULL; + BOOLEAN Success, AutoSelect; + PBOOT_DRIVER_LIST_ENTRY DriverEntry; + PAGED_CODE(); + + /* Initialize the driver list */ + InitializeListHead(&DriverList); + + /* Open the system hive key */ + RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System"); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes); + if (!NT_SUCCESS(Status)) return NULL; + + /* Reference the key object to get the root hive/cell to access directly */ + Status = ObReferenceObjectByHandle(KeyHandle, + KEY_QUERY_VALUE, + CmpKeyObjectType, + KernelMode, + (PVOID*)&KeyBody, + NULL); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + NtClose(KeyHandle); + return NULL; + } + + /* Do all this under the registry lock */ + CmpLockRegistryExclusive(); + + /* Get the hive and key cell */ + Hive = KeyBody->KeyControlBlock->KeyHive; + RootCell = KeyBody->KeyControlBlock->KeyCell; + + /* Open the current control set key */ + RtlInitUnicodeString(&KeyName, L"Current"); + ControlCell = CmpFindControlSet(Hive, RootCell, &KeyName, &AutoSelect); + if (ControlCell == HCELL_NIL) goto EndPath; + + /* Find all system drivers */ + Success = CmpFindDrivers(Hive, ControlCell, SystemLoad, NULL, &DriverList); + if (!Success) goto EndPath; + + /* Sort by group/tag */ + if (!CmpSortDriverList(Hive, ControlCell, &DriverList)) goto EndPath; + + /* Remove circular dependencies (cycles) and sort */ + if (!CmpResolveDriverDependencies(&DriverList)) goto EndPath; + + /* Loop the list to count drivers */ + for (i = 0, NextEntry = DriverList.Flink; + NextEntry != &DriverList; + i++, NextEntry = NextEntry->Flink); + + /* Allocate the array */ + ServicePath = ExAllocatePool(NonPagedPool, (i + 1) * sizeof(PUNICODE_STRING)); + if (!ServicePath) KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 2, 1, 0, 0); + + /* Loop the driver list */ + for (i = 0, NextEntry = DriverList.Flink; + NextEntry != &DriverList; + i++, NextEntry = NextEntry->Flink) + { + /* Get the entry */ + DriverEntry = CONTAINING_RECORD(NextEntry, BOOT_DRIVER_LIST_ENTRY, Link); + + /* Allocate the path for the caller and duplicate the registry path */ + ServicePath[i] = ExAllocatePool(NonPagedPool, sizeof(UNICODE_STRING)); + RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, + &DriverEntry->RegistryPath, + ServicePath[i]); + } + + /* Terminate the list */ + ServicePath[i] = NULL; + +EndPath: + /* Free the driver list if we had one */ + if (!IsListEmpty(&DriverList)) CmpFreeDriverList(Hive, &DriverList); + + /* Unlock the registry */ + CmpUnlockRegistry(); + + /* Close the key handle and dereference the object, then return the path */ + ObDereferenceObject(KeyBody); + NtClose(KeyHandle); + return ServicePath; +} + +VOID +NTAPI CmpLockRegistryExclusive(VOID) { /* Enter a critical region and lock the registry */ @@ -1771,3 +1928,5 @@ if (!CmFirstTime) CmpShutdownWorkers(); CmpDoFlushAll(TRUE); } + +/* EOF */ Modified: trunk/reactos/ntoskrnl/include/internal/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/cm.h [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -1520,6 +1520,40 @@ NTAPI CmSetLazyFlushState( IN BOOLEAN Enable +); + +// +// Driver List Routines +// +PUNICODE_STRING* +NTAPI +CmGetSystemDriverList( + VOID +); + +BOOLEAN +NTAPI +CmpFindDrivers( + IN PHHIVE Hive, + IN HCELL_INDEX ControlSet, + IN SERVICE_LOAD_TYPE LoadType, + IN PWSTR BootFileSystem OPTIONAL, + IN PLIST_ENTRY DriverListHead +); + + +BOOLEAN +NTAPI +CmpSortDriverList( + IN PHHIVE Hive, + IN HCELL_INDEX ControlSet, + IN PLIST_ENTRY DriverListHead +); + +BOOLEAN +NTAPI +CmpResolveDriverDependencies( + IN PLIST_ENTRY DriverListHead ); // Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -200,6 +200,7 @@ UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS"); if (ExpInTextModeSetup) return; + if (!KeLoaderBlock) return; RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE); snprintf(TextBuffer, sizeof(TextBuffer), "%s%sSystem32\\Drivers\\%wZ%s\n", @@ -1070,6 +1071,38 @@ InitializeListHead(&KeLoaderBlock->LoadOrderListHead); } +VOID +FASTCALL +IopInitializeSystemDrivers(VOID) +{ + PUNICODE_STRING *DriverList, *SavedList; + + /* No system drivers on the boot cd */ + if (KeLoaderBlock->SetupLdrBlock) return; + + /* Get the driver list */ + SavedList = DriverList = CmGetSystemDriverList(); + ASSERT(DriverList); + + /* Loop it */ + while (*DriverList) + { + /* Load the driver */ + ZwLoadDriver(*DriverList); + + /* Free the entry */ + RtlFreeUnicodeString(*DriverList); + ExFreePool(*DriverList); + + /* Next entry */ + InbvIndicateProgress(); + DriverList++; + } + + /* Free the list */ + ExFreePool(SavedList); +} + /* * IopUnloadDriver * @@ -1790,6 +1823,8 @@ } cur--; } + + IopDisplayLoadingMessage(&ServiceName); /* * Get service type. Removed: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/drvrlist…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c (removed) @@ -1,561 +1,0 @@ -/* - * PROJECT: ReactOS Kernel - * LICENSE: GPL - See COPYING in the top level directory - * FILE: ntoskrnl/io/iomgr/drvrlist.c - * PURPOSE: Driver List support for Grouping, Tagging, Sorting, etc. - * PROGRAMMERS: <UNKNOWN> - */ - -/* INCLUDES *******************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <debug.h> - -typedef struct _SERVICE_GROUP -{ - LIST_ENTRY GroupListEntry; - UNICODE_STRING GroupName; - BOOLEAN ServicesRunning; - ULONG TagCount; - PULONG TagArray; -} SERVICE_GROUP, *PSERVICE_GROUP; - -typedef struct _SERVICE -{ - LIST_ENTRY ServiceListEntry; - UNICODE_STRING ServiceName; - UNICODE_STRING RegistryPath; - UNICODE_STRING ServiceGroup; - UNICODE_STRING ImagePath; - - ULONG Start; - ULONG Type; - ULONG ErrorControl; - ULONG Tag; - -/* BOOLEAN ServiceRunning;*/ // needed ?? -} SERVICE, *PSERVICE; - -#define TAG_RTLREGISTRY 'vrqR' - -/* GLOBALS ********************************************************************/ - -LIST_ENTRY GroupListHead = {NULL, NULL}; -LIST_ENTRY ServiceListHead = {NULL, NULL}; -extern BOOLEAN NoGuiBoot; - -VOID -FASTCALL -INIT_FUNCTION -IopDisplayLoadingMessage(PUNICODE_STRING ServiceName); - -/* PRIVATE FUNCTIONS **********************************************************/ - -static NTSTATUS NTAPI -IopGetGroupOrderList(PWSTR ValueName, - ULONG ValueType, - PVOID ValueData, - ULONG ValueLength, - PVOID Context, - PVOID EntryContext) -{ - PSERVICE_GROUP Group; - - DPRINT("IopGetGroupOrderList(%S, %x, 0x%p, %x, 0x%p, 0x%p)\n", - ValueName, ValueType, ValueData, ValueLength, Context, EntryContext); - - if (ValueType == REG_BINARY && - ValueData != NULL && - ValueLength >= sizeof(ULONG) && - ValueLength >= (*(PULONG)ValueData + 1) * sizeof(ULONG)) - { - Group = (PSERVICE_GROUP)Context; - Group->TagCount = ((PULONG)ValueData)[0]; - if (Group->TagCount > 0) - { - if (ValueLength >= (Group->TagCount + 1) * sizeof(ULONG)) - { - Group->TagArray = ExAllocatePool(NonPagedPool, Group->TagCount * sizeof(ULONG)); - if (Group->TagArray == NULL) - { - Group->TagCount = 0; - return STATUS_INSUFFICIENT_RESOURCES; - } - memcpy(Group->TagArray, (PULONG)ValueData + 1, Group->TagCount * sizeof(ULONG)); - } - else - { - Group->TagCount = 0; - return STATUS_UNSUCCESSFUL; - } - } - } - return STATUS_SUCCESS; -} - -static NTSTATUS NTAPI -IopCreateGroupListEntry(PWSTR ValueName, - ULONG ValueType, - PVOID ValueData, - ULONG ValueLength, - PVOID Context, - PVOID EntryContext) -{ - PSERVICE_GROUP Group; - RTL_QUERY_REGISTRY_TABLE QueryTable[2]; - NTSTATUS Status; - - - if (ValueType == REG_SZ) - { - DPRINT("GroupName: '%S'\n", (PWCHAR)ValueData); - - Group = ExAllocatePool(NonPagedPool, - sizeof(SERVICE_GROUP)); - if (Group == NULL) - { - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlZeroMemory(Group, sizeof(SERVICE_GROUP)); - - if (!RtlCreateUnicodeString(&Group->GroupName, (PWSTR)ValueData)) - { - ExFreePool(Group); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - RtlZeroMemory(&QueryTable, sizeof(QueryTable)); - QueryTable[0].Name = (PWSTR)ValueData; - QueryTable[0].QueryRoutine = IopGetGroupOrderList; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL, - L"GroupOrderList", - QueryTable, - (PVOID)Group, - NULL); - DPRINT("%x %d %S\n", Status, Group->TagCount, (PWSTR)ValueData); - - InsertTailList(&GroupListHead, - &Group->GroupListEntry); - } - - return(STATUS_SUCCESS); -} - - -static NTSTATUS NTAPI -IopCreateServiceListEntry(PUNICODE_STRING ServiceName) -{ - RTL_QUERY_REGISTRY_TABLE QueryTable[7]; - PSERVICE Service; - NTSTATUS Status; - ULONG DefaultTag = MAXULONG; - - DPRINT("ServiceName: '%wZ'\n", ServiceName); - - /* Allocate service entry */ - Service = (PSERVICE)ExAllocatePool(NonPagedPool, sizeof(SERVICE)); - if (Service == NULL) - { - DPRINT1("ExAllocatePool() failed\n"); - return(STATUS_INSUFFICIENT_RESOURCES); - } - RtlZeroMemory(Service, sizeof(SERVICE)); - - /* Get service data */ - RtlZeroMemory(&QueryTable, - sizeof(QueryTable)); - - QueryTable[0].Name = L"Start"; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[0].EntryContext = &Service->Start; - - QueryTable[1].Name = L"Type"; - QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[1].EntryContext = &Service->Type; - - QueryTable[2].Name = L"ErrorControl"; - QueryTable[2].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[2].EntryContext = &Service->ErrorControl; - - QueryTable[3].Name = L"Group"; - QueryTable[3].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[3].EntryContext = &Service->ServiceGroup; - - QueryTable[4].Name = L"ImagePath"; - QueryTable[4].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[4].EntryContext = &Service->ImagePath; - - QueryTable[5].Name = L"Tag"; - QueryTable[5].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[5].EntryContext = &Service->Tag; - QueryTable[5].DefaultData = &DefaultTag; - QueryTable[5].DefaultType = REG_DWORD; - QueryTable[5].DefaultLength = sizeof(DefaultTag); - - Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES, - ServiceName->Buffer, - QueryTable, - NULL, - NULL); - if (!NT_SUCCESS(Status) || Service->Start > 1) - { - /* - * If something goes wrong during RtlQueryRegistryValues - * it'll just drop everything on the floor and return, - * so you have to check if the buffers were filled. - * Luckily we zerofilled the Service. - */ - if (Service->ServiceGroup.Buffer) - { - ExFreePoolWithTag(Service->ServiceGroup.Buffer, TAG_RTLREGISTRY); - } - if (Service->ImagePath.Buffer) - { - ExFreePoolWithTag(Service->ImagePath.Buffer, TAG_RTLREGISTRY); - } - ExFreePool(Service); - return(Status); - } - - /* Copy service name */ - Service->ServiceName.Length = ServiceName->Length; - Service->ServiceName.MaximumLength = ServiceName->Length + sizeof(WCHAR); - Service->ServiceName.Buffer = ExAllocatePool(NonPagedPool, - Service->ServiceName.MaximumLength); - RtlCopyMemory(Service->ServiceName.Buffer, - ServiceName->Buffer, - ServiceName->Length); - Service->ServiceName.Buffer[ServiceName->Length / sizeof(WCHAR)] = 0; - - /* Build registry path */ - Service->RegistryPath.MaximumLength = MAX_PATH * sizeof(WCHAR); - Service->RegistryPath.Buffer = ExAllocatePool(NonPagedPool, - MAX_PATH * sizeof(WCHAR)); - wcscpy(Service->RegistryPath.Buffer, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); - wcscat(Service->RegistryPath.Buffer, - Service->ServiceName.Buffer); - Service->RegistryPath.Length = wcslen(Service->RegistryPath.Buffer) * sizeof(WCHAR); - - DPRINT("ServiceName: '%wZ'\n", &Service->ServiceName); - DPRINT("RegistryPath: '%wZ'\n", &Service->RegistryPath); - DPRINT("ServiceGroup: '%wZ'\n", &Service->ServiceGroup); - DPRINT("ImagePath: '%wZ'\n", &Service->ImagePath); - DPRINT("Start %lx Type %lx Tag %lx ErrorControl %lx\n", - Service->Start, Service->Type, Service->Tag, Service->ErrorControl); - - /* Append service entry */ - InsertTailList(&ServiceListHead, - &Service->ServiceListEntry); - - return(STATUS_SUCCESS); -} - - -NTSTATUS INIT_FUNCTION -IoCreateDriverList(VOID) -{ - RTL_QUERY_REGISTRY_TABLE QueryTable[2]; - PKEY_BASIC_INFORMATION KeyInfo = NULL; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ServicesKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services"); - UNICODE_STRING SubKeyName; - HANDLE KeyHandle; - NTSTATUS Status; - ULONG Index; - - ULONG KeyInfoLength = 0; - ULONG ReturnedLength; - - DPRINT("IoCreateDriverList() called\n"); - - /* Initialize basic variables */ - InitializeListHead(&GroupListHead); - InitializeListHead(&ServiceListHead); - - /* Build group order list */ - RtlZeroMemory(&QueryTable, - sizeof(QueryTable)); - - QueryTable[0].Name = L"List"; - QueryTable[0].QueryRoutine = IopCreateGroupListEntry; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL, - L"ServiceGroupOrder", - QueryTable, - NULL, - NULL); - if (!NT_SUCCESS(Status)) - return(Status); - - /* Enumerate services and create the service list */ - InitializeObjectAttributes(&ObjectAttributes, - &ServicesKeyName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = ZwOpenKey(&KeyHandle, - KEY_ENUMERATE_SUB_KEYS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - KeyInfoLength = sizeof(KEY_BASIC_INFORMATION) + MAX_PATH * sizeof(WCHAR); - KeyInfo = ExAllocatePool(NonPagedPool, KeyInfoLength); - if (KeyInfo == NULL) - { - ZwClose(KeyHandle); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - Index = 0; - while (TRUE) - { - Status = ZwEnumerateKey(KeyHandle, - Index, - KeyBasicInformation, - KeyInfo, - KeyInfoLength, - &ReturnedLength); - if (NT_SUCCESS(Status)) - { - if (KeyInfo->NameLength < MAX_PATH * sizeof(WCHAR)) - { - - SubKeyName.Length = (USHORT)KeyInfo->NameLength; - SubKeyName.MaximumLength = (USHORT)KeyInfo->NameLength + sizeof(WCHAR); - SubKeyName.Buffer = KeyInfo->Name; - SubKeyName.Buffer[SubKeyName.Length / sizeof(WCHAR)] = 0; - - DPRINT("KeyName: '%wZ'\n", &SubKeyName); - IopCreateServiceListEntry(&SubKeyName); - } - } - - if (!NT_SUCCESS(Status)) - break; - - Index++; - } - - ExFreePool(KeyInfo); - ZwClose(KeyHandle); - - DPRINT("IoCreateDriverList() done\n"); - - return(STATUS_SUCCESS); -} - -NTSTATUS INIT_FUNCTION -IoDestroyDriverList(VOID) -{ - PSERVICE_GROUP CurrentGroup; - PSERVICE CurrentService; - PLIST_ENTRY NextEntry, TempEntry; - - DPRINT("IoDestroyDriverList() called\n"); - - /* Destroy the Group List */ - for (NextEntry = GroupListHead.Flink, TempEntry = NextEntry->Flink; - NextEntry != &GroupListHead; - NextEntry = TempEntry, TempEntry = NextEntry->Flink) - { - /* Get the entry */ - CurrentGroup = CONTAINING_RECORD(NextEntry, - SERVICE_GROUP, - GroupListEntry); - - /* Remove it from the list */ - RemoveEntryList(&CurrentGroup->GroupListEntry); - - /* Free buffers */ - ExFreePool(CurrentGroup->GroupName.Buffer); - if (CurrentGroup->TagArray) - ExFreePool(CurrentGroup->TagArray); - ExFreePool(CurrentGroup); - } - - /* Destroy the Service List */ - for (NextEntry = ServiceListHead.Flink, TempEntry = NextEntry->Flink; - NextEntry != &ServiceListHead; - NextEntry = TempEntry, TempEntry = NextEntry->Flink) - { - /* Get the entry */ - CurrentService = CONTAINING_RECORD(NextEntry, - SERVICE, - ServiceListEntry); - - /* Remove it from the list */ - RemoveEntryList(&CurrentService->ServiceListEntry); - - /* Free buffers */ - ExFreePool(CurrentService->ServiceName.Buffer); - ExFreePool(CurrentService->RegistryPath.Buffer); - if (CurrentService->ServiceGroup.Buffer) - ExFreePool(CurrentService->ServiceGroup.Buffer); - if (CurrentService->ImagePath.Buffer) - ExFreePool(CurrentService->ImagePath.Buffer); - ExFreePool(CurrentService); - } - - DPRINT("IoDestroyDriverList() done\n"); - - /* Return success */ - return STATUS_SUCCESS; -} - -static INIT_FUNCTION NTSTATUS -IopLoadDriver(PSERVICE Service) -{ - NTSTATUS Status = STATUS_UNSUCCESSFUL; - PUNICODE_STRING ImagePath = &Service->ImagePath; - PWCHAR ImageName; - UNICODE_STRING ImageNameU; - - ImageName = wcsrchr(ImagePath->Buffer, L'\\'); - if (!ImageName) - ImageName = ImagePath->Buffer; - else - ImageName++; - - RtlInitUnicodeString(&ImageNameU, ImageName); - - IopDisplayLoadingMessage(&ImageNameU); - - Status = ZwLoadDriver(&Service->RegistryPath); - IopBootLog(&Service->ImagePath, NT_SUCCESS(Status) ? TRUE : FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT("IopLoadDriver() failed (Status %lx)\n", Status); -#if 0 - if (Service->ErrorControl == 1) - { - /* Log error */ - } - else if (Service->ErrorControl == 2) - { - if (IsLastKnownGood == FALSE) - { - /* Boot last known good configuration */ - } - } - else if (Service->ErrorControl == 3) - { - if (IsLastKnownGood == FALSE) - { - /* Boot last known good configuration */ - } - else - { - /* BSOD! */ - } - } -#endif - } - return Status; -} - -/* - * IopInitializeSystemDrivers - * - * Load drivers marked as system start. - * - * Parameters - * None - * - * Return Value - * None - */ -VOID -FASTCALL -IopInitializeSystemDrivers(VOID) -{ - PSERVICE_GROUP CurrentGroup; - PSERVICE CurrentService; - NTSTATUS Status; - ULONG i; - PLIST_ENTRY NextGroupEntry, NextServiceEntry; - - DPRINT("IopInitializeSystemDrivers()\n"); - - /* Start looping */ - for (NextGroupEntry = GroupListHead.Flink; - NextGroupEntry != &GroupListHead; - NextGroupEntry = NextGroupEntry->Flink) - { - /* Get the entry */ - CurrentGroup = CONTAINING_RECORD(NextGroupEntry, - SERVICE_GROUP, - GroupListEntry); - - DPRINT("Group: %wZ\n", &CurrentGroup->GroupName); - - /* Load all drivers with a valid tag */ - for (i = 0; i < CurrentGroup->TagCount; i++) - { - /* Start looping */ - for (NextServiceEntry = ServiceListHead.Flink; - NextServiceEntry != &ServiceListHead; - NextServiceEntry = NextServiceEntry->Flink) - { - /* Get the entry */ - CurrentService = CONTAINING_RECORD(NextServiceEntry, - SERVICE, - ServiceListEntry); - - if ((!RtlCompareUnicodeString(&CurrentGroup->GroupName, - &CurrentService->ServiceGroup, - TRUE)) && - (CurrentService->Start == SERVICE_SYSTEM_START) && - (CurrentService->Tag == CurrentGroup->TagArray[i])) - - { - DPRINT(" Path: %wZ\n", &CurrentService->RegistryPath); - Status = IopLoadDriver(CurrentService); - InbvIndicateProgress(); - } - } - } - - /* Load all drivers without a tag or with an invalid tag */ - for (NextServiceEntry = ServiceListHead.Flink; - NextServiceEntry != &ServiceListHead; - NextServiceEntry = NextServiceEntry->Flink) - { - /* Get the entry */ - CurrentService = CONTAINING_RECORD(NextServiceEntry, - SERVICE, - ServiceListEntry); - - if ((!RtlCompareUnicodeString(&CurrentGroup->GroupName, - &CurrentService->ServiceGroup, - TRUE)) && - (CurrentService->Start == SERVICE_SYSTEM_START)) - { - for (i = 0; i < CurrentGroup->TagCount; i++) - { - if (CurrentGroup->TagArray[i] == CurrentService->Tag) - { - break; - } - } - - if (i >= CurrentGroup->TagCount) - { - DPRINT(" Path: %wZ\n", &CurrentService->RegistryPath); - Status = IopLoadDriver(CurrentService); - InbvIndicateProgress(); - } - - } - } - } - - DPRINT("IopInitializeSystemDrivers() done\n"); -} Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -493,9 +493,6 @@ /* Setup the group cache */ if (!NT_SUCCESS(PiInitCacheGroupInformation())) return FALSE; - /* Create the group driver list */ - IoCreateDriverList(); - /* Load boot start drivers */ IopInitializeBootDrivers(); @@ -533,9 +530,6 @@ IopInitializeSystemDrivers(); PnpSystemInit = TRUE; - /* Destroy the group driver list */ - IoDestroyDriverList(); - /* Reinitialize drivers that requested it */ IopReinitializeDrivers(); Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sat Apr 3 09:44:38 2010 @@ -244,7 +244,6 @@ <file>device.c</file> <file>deviface.c</file> <file>driver.c</file> - <file>drvrlist.c</file> <file>error.c</file> <file>file.c</file> <file>iocomp.c</file>
14 years, 8 months
1
0
0
0
[jimtabor] 46692: - Simplifying MakeInfoDC.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sat Apr 3 01:52:38 2010 New Revision: 46692 URL:
http://svn.reactos.org/svn/reactos?rev=46692&view=rev
Log: - Simplifying MakeInfoDC. Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Sat Apr 3 01:52:38 2010 @@ -606,13 +606,14 @@ pdc->dctype = DC_TYPE_INFO; pdc->dclevel.pSurface = NULL; - if (PDEV_sizl(pdc->ppdev, &sizl)->cx == pdc->dclevel.sizl.cx && - PDEV_sizl(pdc->ppdev, &sizl)->cy == pdc->dclevel.sizl.cy) + PDEV_sizl(pdc->ppdev, &sizl); + + if ( sizl.cx == pdc->dclevel.sizl.cx && + sizl.cy == pdc->dclevel.sizl.cy ) return TRUE; - pdc->dclevel.sizl.cx = PDEV_sizl(pdc->ppdev, &sizl)->cx; + pdc->dclevel.sizl.cx = sizl.cx; pdc->dclevel.sizl.cy = sizl.cy; - IntSetDefaultRegion(pdc); } else { @@ -632,9 +633,8 @@ pdc->dclevel.sizl.cx = pSurface->SurfObj.sizlBitmap.cx; pdc->dclevel.sizl.cy = pSurface->SurfObj.sizlBitmap.cy; - IntSetDefaultRegion(pdc); - } - return TRUE; + } + return IntSetDefaultRegion(pdc); } /*
14 years, 8 months
1
0
0
0
[spetreolle] 46691: Fix MP install.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Fri Apr 2 21:52:03 2010 New Revision: 46691 URL:
http://svn.reactos.org/svn/reactos?rev=46691&view=rev
Log: Fix MP install. Modified: trunk/reactos/boot/bootdata/txtsetup.sif Modified: trunk/reactos/boot/bootdata/txtsetup.sif URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/txtsetup.sif…
============================================================================== --- trunk/reactos/boot/bootdata/txtsetup.sif [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/txtsetup.sif [iso-8859-1] Fri Apr 2 21:52:03 2010 @@ -76,7 +76,7 @@ [Files.pci_mp] ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 -halmp.dll=,,,,,,,,,,hal.dll,,2 +halmps.dll=,,,,,,,,,,hal.dll,,2 [Display] ;<id> = <user friendly name>,<spare>,<service key name>,<hight>,<width>,<bpp>
14 years, 8 months
1
0
0
0
[sir_richard] 46690: [NTOS]: Rewrite boot driver loading code (not the driver code itself) to use the boot loader's BootDriverListHead, instead of parsing InOrderListHead and cherry-picking ".sys" files. This is the last incompatibility with Windows. [NTOS]: Use group prioritiy, tag numbers, and tag priority to determine the correct loading order for boot drivers, instead of just parsing the linked list. Dependencies work now! [NTOS]: Load any DLLs that are driver-dependent with MmCallDllInitial
by sir_richard@svn.reactos.org
Author: sir_richard Date: Fri Apr 2 19:57:33 2010 New Revision: 46690 URL:
http://svn.reactos.org/svn/reactos?rev=46690&view=rev
Log: [NTOS]: Rewrite boot driver loading code (not the driver code itself) to use the boot loader's BootDriverListHead, instead of parsing InOrderListHead and cherry-picking ".sys" files. This is the last incompatibility with Windows. [NTOS]: Use group prioritiy, tag numbers, and tag priority to determine the correct loading order for boot drivers, instead of just parsing the linked list. Dependencies work now! [NTOS]: Load any DLLs that are driver-dependent with MmCallDllInitialize. Previously, these .DLLS were ignored and drivers could lose dependencies. Added: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c (with props) trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c (with props) Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/iomgr/iomgr.c trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -396,6 +396,33 @@ } LOAD_UNLOAD_PARAMS, *PLOAD_UNLOAD_PARAMS; // +// Boot Driver List Entry +// +typedef struct _DRIVER_INFORMATION +{ + LIST_ENTRY Link; + PDRIVER_OBJECT DriverObject; + PBOOT_DRIVER_LIST_ENTRY DataTableEntry; + HANDLE ServiceHandle; + USHORT TagPosition; + ULONG Failed; + ULONG Processed; + NTSTATUS Status; +} DRIVER_INFORMATION, *PDRIVER_INFORMATION; + +// +// Boot Driver Node +// +typedef struct _BOOT_DRIVER_NODE +{ + BOOT_DRIVER_LIST_ENTRY ListEntry; + UNICODE_STRING Group; + UNICODE_STRING Name; + ULONG Tag; + ULONG ErrorControl; +} BOOT_DRIVER_NODE, *PBOOT_DRIVER_NODE; + +// // List of Bus Type GUIDs // typedef struct _IO_BUS_TYPE_GUID_LIST @@ -605,6 +632,43 @@ OUT PKEY_VALUE_FULL_INFORMATION *Information); +// +// PnP Routines +// +NTSTATUS +NTAPI +PiInitCacheGroupInformation( + VOID +); + +USHORT +NTAPI +PpInitGetGroupOrderIndex( + IN HANDLE ServiceHandle +); + +USHORT +NTAPI +PipGetDriverTagPriority( + IN HANDLE ServiceHandle +); + +NTSTATUS +NTAPI +PnpRegMultiSzToUnicodeStrings( + IN PKEY_VALUE_FULL_INFORMATION KeyValueInformation, + OUT PUNICODE_STRING *UnicodeStringList, + OUT PULONG UnicodeStringCount +); + +BOOLEAN +NTAPI +PnpRegSzToString( + IN PWCHAR RegSzData, + IN ULONG RegSzLength, + OUT PUSHORT StringLength OPTIONAL +); + // // Initialization Routines // Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -33,6 +33,9 @@ extern BOOLEAN ExpInTextModeSetup; extern BOOLEAN PnpSystemInit; + +USHORT IopGroupIndex; +PLIST_ENTRY IopGroupTable; /* PRIVATE FUNCTIONS **********************************************************/ @@ -880,14 +883,17 @@ FASTCALL IopInitializeBootDrivers(VOID) { - PLIST_ENTRY ListHead, NextEntry; + PLIST_ENTRY ListHead, NextEntry, NextEntry2; PLDR_DATA_TABLE_ENTRY LdrEntry; PDEVICE_NODE DeviceNode; PDRIVER_OBJECT DriverObject; LDR_DATA_TABLE_ENTRY ModuleObject; NTSTATUS Status; UNICODE_STRING DriverName; - + ULONG i, Index; + PDRIVER_INFORMATION DriverInfo, DriverInfoTag; + HANDLE KeyHandle; + PBOOT_DRIVER_LIST_ENTRY BootEntry; DPRINT("IopInitializeBootDrivers()\n"); /* Use IopRootDeviceNode for now */ @@ -931,6 +937,19 @@ return; } + /* Get highest group order index */ + IopGroupIndex = PpInitGetGroupOrderIndex(NULL); + if (IopGroupIndex == 0xFFFF) ASSERT(FALSE); + + /* Allocate the group table */ + IopGroupTable = ExAllocatePoolWithTag(PagedPool, + IopGroupIndex * sizeof(LIST_ENTRY), + TAG_IO); + if (IopGroupTable == NULL) ASSERT(FALSE); + + /* Initialize the group table lists */ + for (i = 0; i < IopGroupIndex; i++) InitializeListHead(&IopGroupTable[i]); + /* Loop the boot modules */ ListHead = &KeLoaderBlock->LoadOrderListHead; NextEntry = ListHead->Flink; @@ -940,19 +959,83 @@ LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - - /* - * HACK: Make sure we're loading a driver - * (we should be using BootDriverListHead!) - */ - if (wcsstr(_wcsupr(LdrEntry->BaseDllName.Buffer), L".SYS")) + + /* Check if the DLL needs to be initialized */ + if (LdrEntry->Flags & LDRP_DRIVER_DEPENDENT_DLL) { - /* Make sure we didn't load this driver already */ - if (!(LdrEntry->Flags & LDRP_ENTRY_INSERTED)) + /* Call its entrypoint */ + MmCallDllInitialize(LdrEntry, NULL); + } + + /* Go to the next driver */ + NextEntry = NextEntry->Flink; + } + + /* Loop the boot drivers */ + ListHead = &KeLoaderBlock->BootDriverListHead; + NextEntry = ListHead->Flink; + while (ListHead != NextEntry) + { + /* Get the entry */ + BootEntry = CONTAINING_RECORD(NextEntry, + BOOT_DRIVER_LIST_ENTRY, + Link); + + /* Get the driver loader entry */ + LdrEntry = BootEntry->LdrEntry; + + /* Allocate our internal accounting structure */ + DriverInfo = ExAllocatePoolWithTag(PagedPool, + sizeof(DRIVER_INFORMATION), + TAG_IO); + if (DriverInfo) + { + /* Zero it and initialize it */ + RtlZeroMemory(DriverInfo, sizeof(DRIVER_INFORMATION)); + InitializeListHead(&DriverInfo->Link); + DriverInfo->DataTableEntry = BootEntry; + + /* Open the registry key */ + Status = IopOpenRegistryKeyEx(&KeyHandle, + NULL, + &BootEntry->RegistryPath, + KEY_READ); + if ((NT_SUCCESS(Status)) || /* ReactOS HACK for SETUPLDR */ + ((KeLoaderBlock->SetupLdrBlock) && (KeyHandle = (PVOID)1))) { - DPRINT("Initializing bootdriver %wZ\n", &LdrEntry->BaseDllName); - /* Initialize it */ - IopInitializeBuiltinDriver(LdrEntry); + /* Save the handle */ + DriverInfo->ServiceHandle = KeyHandle; + + /* Get the group oder index */ + Index = PpInitGetGroupOrderIndex(KeyHandle); + + /* Get the tag position */ + DriverInfo->TagPosition = PipGetDriverTagPriority(KeyHandle); + + /* Insert it into the list, at the right place */ + ASSERT(Index < IopGroupIndex); + NextEntry2 = IopGroupTable[Index].Flink; + while (NextEntry2 != &IopGroupTable[Index]) + { + /* Get the driver info */ + DriverInfoTag = CONTAINING_RECORD(NextEntry2, + DRIVER_INFORMATION, + Link); + + /* Check if we found the right tag position */ + if (DriverInfoTag->TagPosition > DriverInfo->TagPosition) + { + /* We're done */ + break; + } + + /* Next entry */ + NextEntry2 = NextEntry2->Flink; + } + + /* Insert us right before the next entry */ + NextEntry2 = NextEntry2->Blink; + InsertHeadList(NextEntry2, &DriverInfo->Link); } } @@ -960,6 +1043,29 @@ NextEntry = NextEntry->Flink; } + /* Loop each group index */ + for (i = 0; i < IopGroupIndex; i++) + { + /* Loop each group table */ + NextEntry = IopGroupTable[i].Flink; + while (NextEntry != &IopGroupTable[i]) + { + /* Get the entry */ + DriverInfo = CONTAINING_RECORD(NextEntry, + DRIVER_INFORMATION, + Link); + + /* Get the driver loader entry */ + LdrEntry = DriverInfo->DataTableEntry->LdrEntry; + + /* Initialize it */ + IopInitializeBuiltinDriver(LdrEntry); + + /* Next entry */ + NextEntry = NextEntry->Flink; + } + } + /* In old ROS, the loader list became empty after this point. Simulate. */ InitializeListHead(&KeLoaderBlock->LoadOrderListHead); } Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -489,6 +489,9 @@ /* Initialize PnP manager */ PnpInit(); + + /* Setup the group cache */ + if (!NT_SUCCESS(PiInitCacheGroupInformation())) return FALSE; /* Create the group driver list */ IoCreateDriverList(); Added: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c (added) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -1,0 +1,222 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnpinit.c + * PURPOSE: PnP Initialization Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* GLOBALS ********************************************************************/ + +PUNICODE_STRING PiInitGroupOrderTable; +ULONG PiInitGroupOrderTableCount; + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +NTAPI +PiInitCacheGroupInformation(VOID) +{ + HANDLE KeyHandle; + NTSTATUS Status; + PKEY_VALUE_FULL_INFORMATION KeyValueInformation; + PUNICODE_STRING GroupTable; + ULONG Count; + UNICODE_STRING GroupString = + RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet" + L"\\Control\\ServiceGroupOrder"); + + /* ReactOS HACK for SETUPLDR */ + if (KeLoaderBlock->SetupLdrBlock) + { + /* Bogus data */ + PiInitGroupOrderTableCount = 0; + PiInitGroupOrderTable = (PVOID)0xBABEB00B; + return STATUS_SUCCESS; + } + + /* Open the registry key */ + Status = IopOpenRegistryKeyEx(&KeyHandle, + NULL, + &GroupString, + KEY_READ); + if (NT_SUCCESS(Status)) + { + /* Get the list */ + Status = IopGetRegistryValue(KeyHandle, L"List", &KeyValueInformation); + ZwClose(KeyHandle); + + /* Make sure we got it */ + if (NT_SUCCESS(Status)) + { + /* Make sure it's valid */ + if ((KeyValueInformation->Type == REG_MULTI_SZ) && + (KeyValueInformation->DataLength)) + { + /* Convert it to unicode strings */ + Status = PnpRegMultiSzToUnicodeStrings(KeyValueInformation, + &GroupTable, + &Count); + + /* Cache it for later */ + PiInitGroupOrderTable = GroupTable; + PiInitGroupOrderTableCount = Count; + } + else + { + /* Fail */ + Status = STATUS_UNSUCCESSFUL; + } + + /* Free the information */ + ExFreePool(KeyValueInformation); + } + } + + /* Return status */ + return Status; +} + +USHORT +NTAPI +PpInitGetGroupOrderIndex(IN HANDLE ServiceHandle) +{ + NTSTATUS Status; + PKEY_VALUE_FULL_INFORMATION KeyValueInformation; + ULONG i; + PVOID Buffer; + UNICODE_STRING Group; + PAGED_CODE(); + + /* Make sure we have a cache */ + if (!PiInitGroupOrderTable) return -1; + + /* If we don't have a handle, the rest is easy -- return the count */ + if (!ServiceHandle) return PiInitGroupOrderTableCount + 1; + + /* Otherwise, get the group value */ + Status = IopGetRegistryValue(ServiceHandle, L"Group", &KeyValueInformation); + if (!NT_SUCCESS(Status)) return PiInitGroupOrderTableCount; + + /* Make sure we have a valid string */ + ASSERT(KeyValueInformation->Type == REG_SZ); + ASSERT(KeyValueInformation->DataLength); + + /* Convert to unicode string */ + Buffer = (PVOID)((ULONG_PTR)KeyValueInformation + KeyValueInformation->DataOffset); + PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &Group.Length); + Group.MaximumLength = KeyValueInformation->DataLength; + Group.Buffer = Buffer; + + /* Loop the groups */ + for (i = 0; i < PiInitGroupOrderTableCount; i++) + { + /* Try to find a match */ + if (RtlEqualUnicodeString(&Group, &PiInitGroupOrderTable[i], TRUE)) break; + } + + /* We're done */ + ExFreePool(KeyValueInformation); + return i; +} + +USHORT +NTAPI +PipGetDriverTagPriority(IN HANDLE ServiceHandle) +{ + NTSTATUS Status; + HANDLE KeyHandle = NULL; + PKEY_VALUE_FULL_INFORMATION KeyValueInformation = NULL; + PKEY_VALUE_FULL_INFORMATION KeyValueInformationTag; + PKEY_VALUE_FULL_INFORMATION KeyValueInformationGroupOrderList; + PVOID Buffer; + UNICODE_STRING Group; + PULONG GroupOrder; + ULONG i = -1, Count, Tag = 0; + UNICODE_STRING GroupString = + RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet" + L"\\Control\\ServiceGroupOrder"); + + /* Open the key */ + Status = IopOpenRegistryKeyEx(&KeyHandle, NULL, &GroupString, KEY_READ); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Read the group */ + Status = IopGetRegistryValue(ServiceHandle, L"Group", &KeyValueInformation); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Make sure we have a group */ + if ((KeyValueInformation->Type == REG_SZ) && + (KeyValueInformation->DataLength)) + { + /* Convert to unicode string */ + Buffer = (PVOID)((ULONG_PTR)KeyValueInformation + KeyValueInformation->DataOffset); + PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &Group.Length); + Group.MaximumLength = KeyValueInformation->DataLength; + Group.Buffer = Buffer; + } + + /* Now read the tag */ + Status = IopGetRegistryValue(ServiceHandle, L"Tag", &KeyValueInformationTag); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Make sure we have a tag */ + if ((KeyValueInformationTag->Type == REG_DWORD) && + (KeyValueInformationTag->DataLength)) + { + /* Read it */ + Tag = *(PULONG)((ULONG_PTR)KeyValueInformationTag + + KeyValueInformationTag->DataOffset); + } + + /* We can get rid of this now */ + ExFreePool(KeyValueInformationTag); + + /* Now let's read the group's tag order */ + Status = IopGetRegistryValue(KeyHandle, + Group.Buffer, + &KeyValueInformationGroupOrderList); + + /* We can get rid of this now */ +Quickie: + if (KeyValueInformation) ExFreePool(KeyValueInformation); + if (KeyHandle) NtClose(KeyHandle); + if (!NT_SUCCESS(Status)) return -1; + + /* We're on the success path -- validate the tag order*/ + if ((KeyValueInformationGroupOrderList->Type == REG_BINARY) && + (KeyValueInformationGroupOrderList->DataLength)) + { + /* Get the order array */ + GroupOrder = (PULONG)((ULONG_PTR)KeyValueInformationGroupOrderList + + KeyValueInformationGroupOrderList->DataOffset); + + /* Get the count */ + Count = *GroupOrder; + ASSERT(((Count + 1) * sizeof(ULONG)) <= + KeyValueInformationGroupOrderList->DataLength); + + /* Now loop each tag */ + GroupOrder++; + for (i = 1; i <= Count; i++) + { + /* If we found it, we're out */ + if (Tag == *GroupOrder) break; + + /* Try the next one */ + GroupOrder++; + } + } + + /* Last buffer to free */ + ExFreePool(KeyValueInformationGroupOrderList); + return i; +} + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c ------------------------------------------------------------------------------ svn:eol-stlye = native Propchange: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnputil…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c (added) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -1,0 +1,185 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: ntoskrnl/io/pnpmgr/pnputil.c + * PURPOSE: PnP Utility Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +VOID +NTAPI +PnpFreeUnicodeStringList(IN PUNICODE_STRING UnicodeStringList, + IN ULONG StringCount) +{ + ULONG i; + + /* Go through the list */ + if (UnicodeStringList) + { + /* Go through each string */ + for (i = 0; i < StringCount; i++) + { + /* Check if it exists */ + if (UnicodeStringList[i].Buffer) + { + /* Free it */ + ExFreePool(UnicodeStringList[i].Buffer); + } + } + + /* Free the whole list */ + ExFreePool(UnicodeStringList); + } +} + +NTSTATUS +NTAPI +PnpRegMultiSzToUnicodeStrings(IN PKEY_VALUE_FULL_INFORMATION KeyValueInformation, + OUT PUNICODE_STRING *UnicodeStringList, + OUT PULONG UnicodeStringCount) +{ + PWCHAR p, pp, ps; + ULONG i = 0, n; + ULONG Count = 0; + + /* Validate the key information */ + if (KeyValueInformation->Type != REG_MULTI_SZ) return STATUS_INVALID_PARAMETER; + + /* Set the pointers */ + p = (PWCHAR)((ULONG_PTR)KeyValueInformation + + KeyValueInformation->DataOffset); + pp = (PWCHAR)((ULONG_PTR)p + KeyValueInformation->DataLength); + + /* Loop the data */ + while (p != pp) + { + /* If we find a NULL, that means one string is done */ + if (!*p) + { + /* Add to our string count */ + Count++; + + /* Check for a double-NULL, which means we're done */ + if (((p + 1) == pp) || !(*(p + 1))) break; + } + + /* Go to the next character */ + p++; + } + + /* If we looped the whole list over, we missed increment a string, do it */ + if (p == pp) Count++; + + /* Allocate the list now that we know how big it is */ + *UnicodeStringList = ExAllocatePoolWithTag(PagedPool, + sizeof(UNICODE_STRING) * Count, + 'sUpP'); + if (!(*UnicodeStringList)) return STATUS_INSUFFICIENT_RESOURCES; + + /* Set pointers for second loop */ + ps = p = (PWCHAR)((ULONG_PTR)KeyValueInformation + + KeyValueInformation->DataOffset); + + /* Loop again, to do the copy this time */ + while (p != pp) + { + /* If we find a NULL, that means one string is done */ + if (!*p) + { + /* Check how long this string is */ + n = (ULONG_PTR)p - (ULONG_PTR)ps + sizeof(UNICODE_NULL); + + /* Allocate the buffer */ + (*UnicodeStringList)[i].Buffer = ExAllocatePoolWithTag(PagedPool, + n, + 'sUpP'); + if (!(*UnicodeStringList)[i].Buffer) + { + /* Back out of everything */ + PnpFreeUnicodeStringList(*UnicodeStringList, i); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Copy the string into the buffer */ + RtlCopyMemory((*UnicodeStringList)[i].Buffer, ps, n); + + /* Set the lengths */ + (*UnicodeStringList)[i].MaximumLength = n; + (*UnicodeStringList)[i].Length = n - sizeof(UNICODE_NULL); + + /* One more entry done */ + i++; + + /* Check for a double-NULL, which means we're done */ + if (((p + 1) == pp) || !(*(p + 1))) break; + + /* New string */ + ps = p + 1; + } + + /* New string */ + p++; + } + + /* Check if we've reached the last string */ + if (p == pp) + { + /* Calculate the string length */ + n = (ULONG_PTR)p - (ULONG_PTR)ps; + + /* Allocate the buffer for it */ + (*UnicodeStringList)[i].Buffer = ExAllocatePoolWithTag(PagedPool, + n + + sizeof(UNICODE_NULL), + 'sUpP'); + if (!(*UnicodeStringList)[i].Buffer) + { + /* Back out of everything */ + PnpFreeUnicodeStringList(*UnicodeStringList, i); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Make sure there's an actual string here */ + if (n) RtlCopyMemory((*UnicodeStringList)[i].Buffer, ps, n); + + /* Null-terminate the string ourselves */ + (*UnicodeStringList)[i].Buffer[n / sizeof(WCHAR)] = UNICODE_NULL; + + /* Set the lenghts */ + (*UnicodeStringList)[i].Length = n; + (*UnicodeStringList)[i].MaximumLength = n + sizeof(UNICODE_NULL); + } + + /* And we're done */ + *UnicodeStringCount = Count; + return STATUS_SUCCESS; +} + +BOOLEAN +NTAPI +PnpRegSzToString(IN PWCHAR RegSzData, + IN ULONG RegSzLength, + OUT PUSHORT StringLength OPTIONAL) +{ + PWCHAR p, pp; + + /* Find the end */ + pp = RegSzData + RegSzLength; + for (p = RegSzData; p < pp; p++) if (!*p) break; + + /* Return it */ + if (StringLength) *StringLength = p - RegSzData; + return TRUE; +} + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c ------------------------------------------------------------------------------ svn:eol-stlye = native Propchange: trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Fri Apr 2 19:57:33 2010 @@ -267,10 +267,12 @@ <directory name="pnpmgr"> <file>plugplay.c</file> <file>pnpdma.c</file> + <file>pnpinit.c</file> <file>pnpmgr.c</file> <file>pnpnotify.c</file> <file>pnpreport.c</file> <file>pnproot.c</file> + <file>pnputil.c</file> </directory> </directory> <if property="_WINKD_" value="0">
14 years, 8 months
1
0
0
0
[ekohl] 46689: [NTOSKRNL] - Add the check for ACESSS_SYSTEM_SECURITY. - Keep the desired access rights that have not been granted yet in the variable RemainingAccess. - Handle the MAXIMUM_ALLOWED case if the DACL is empty.
by ekohl@svn.reactos.org
Author: ekohl Date: Fri Apr 2 19:46:24 2010 New Revision: 46689 URL:
http://svn.reactos.org/svn/reactos?rev=46689&view=rev
Log: [NTOSKRNL] - Add the check for ACESSS_SYSTEM_SECURITY. - Keep the desired access rights that have not been granted yet in the variable RemainingAccess. - Handle the MAXIMUM_ALLOWED case if the DACL is empty. Modified: trunk/reactos/ntoskrnl/se/semgr.c Modified: trunk/reactos/ntoskrnl/se/semgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/semgr.c?rev=46…
============================================================================== --- trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/semgr.c [iso-8859-1] Fri Apr 2 19:46:24 2010 @@ -390,6 +390,7 @@ { LUID_AND_ATTRIBUTES Privilege; ACCESS_MASK CurrentAccess, AccessMask; + ACCESS_MASK RemainingAccess; PACCESS_TOKEN Token; ULONG i; PACL Dacl; @@ -424,13 +425,42 @@ RtlMapGenericMask(&PreviouslyGrantedAccess, GenericMapping); - CurrentAccess = PreviouslyGrantedAccess; - + RemainingAccess = DesiredAccess; Token = SubjectSecurityContext->ClientToken ? SubjectSecurityContext->ClientToken : SubjectSecurityContext->PrimaryToken; + + /* Check for system security access */ + if (RemainingAccess & ACCESS_SYSTEM_SECURITY) + { + Privilege.Luid = SeSecurityPrivilege; + Privilege.Attributes = SE_PRIVILEGE_ENABLED; + + /* Fail if we do not the SeSecurityPrivilege */ + if (!SepPrivilegeCheck(Token, + &Privilege, + 1, + PRIVILEGE_SET_ALL_NECESSARY, + AccessMode)) + { + *AccessStatus = STATUS_PRIVILEGE_NOT_HELD; + return FALSE; + } + + /* Adjust access rights */ + RemainingAccess &= ~ACCESS_SYSTEM_SECURITY; + PreviouslyGrantedAccess |= ACCESS_SYSTEM_SECURITY; + + /* Succeed if there are no more rights to grant */ + if (RemainingAccess == 0) + { + *GrantedAccess = PreviouslyGrantedAccess; + *AccessStatus = STATUS_SUCCESS; + return TRUE; + } + } /* Get the DACL */ Status = RtlGetDaclSecurityDescriptor(SecurityDescriptor, @@ -474,11 +504,15 @@ PRIVILEGE_SET_ALL_NECESSARY, AccessMode)) { + /* Adjust access rights */ + RemainingAccess &= ~WRITE_OWNER; + PreviouslyGrantedAccess |= WRITE_OWNER; CurrentAccess |= WRITE_OWNER; - if ((DesiredAccess & ~VALID_INHERIT_FLAGS) == - (CurrentAccess & ~VALID_INHERIT_FLAGS)) + + /* Succeed if there are no more rights to grant */ + if (RemainingAccess == 0) { - *GrantedAccess = CurrentAccess; + *GrantedAccess = PreviouslyGrantedAccess; *AccessStatus = STATUS_SUCCESS; return TRUE; } @@ -488,9 +522,18 @@ /* Deny access if the DACL is empty */ if (Dacl->AceCount == 0) { - *GrantedAccess = 0; - *AccessStatus = STATUS_ACCESS_DENIED; - return FALSE; + if (RemainingAccess == MAXIMUM_ALLOWED && PreviouslyGrantedAccess != 0) + { + *GrantedAccess = PreviouslyGrantedAccess; + *AccessStatus = STATUS_SUCCESS; + return TRUE; + } + else + { + *GrantedAccess = 0; + *AccessStatus = STATUS_ACCESS_DENIED; + return FALSE; + } } /* Fail if DACL is absent */
14 years, 8 months
1
0
0
0
[janderwald] 46688: [PSDK] - Fix build
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Apr 2 19:19:57 2010 New Revision: 46688 URL:
http://svn.reactos.org/svn/reactos?rev=46688&view=rev
Log: [PSDK] - Fix build Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=4668…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Fri Apr 2 19:19:57 2010 @@ -744,6 +744,99 @@ KSPROPERTY_STREAM_PIPE_ID } KSPROPERTY_STREAM; +#define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_ALLOCATOR,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_QUALITY(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_QUALITY,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(KSQUALITY_MANAGER),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_DEGRADATION(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_DEGRADATION,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + 0,\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_MASTERCLOCK,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_TIMEFORMAT(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_TIMEFORMAT,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(GUID),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONTIME(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PRESENTATIONTIME,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(KSTIME),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONEXTENT(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PRESENTATIONEXTENT,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(LONGLONG),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_FRAMETIME(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_FRAMETIME,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(KSFRAMETIME),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_RATECAPABILITY(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_RATECAPABILITY,\ + (Handler),\ + sizeof(KSRATE_CAPABILITY),\ + sizeof(KSRATE),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_RATE(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_RATE,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(KSRATE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PIPE_ID,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) /* =============================================================== StreamAllocator
14 years, 8 months
1
0
0
0
[cgutman] 46687: [PCI] - Fix the Vector value of the interrupt resource - Actually set the device to use the interrupt that the PnP manager gave us
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Apr 2 19:07:38 2010 New Revision: 46687 URL:
http://svn.reactos.org/svn/reactos?rev=46687&view=rev
Log: [PCI] - Fix the Vector value of the interrupt resource - Actually set the device to use the interrupt that the PnP manager gave us Modified: trunk/reactos/drivers/bus/pci/pdo.c Modified: trunk/reactos/drivers/bus/pci/pdo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=…
============================================================================== --- trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/bus/pci/pdo.c [iso-8859-1] Fri Apr 2 19:07:38 2010 @@ -775,7 +775,7 @@ Descriptor->ShareDisposition = CmResourceShareShared; Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE; Descriptor->u.Interrupt.Level = PciConfig.u.type0.InterruptLine; - Descriptor->u.Interrupt.Vector = 0; + Descriptor->u.Interrupt.Vector = PciConfig.u.type0.InterruptLine; Descriptor->u.Interrupt.Affinity = 0xFFFFFFFF; } } @@ -1186,6 +1186,49 @@ return Status; } +static NTSTATUS +PdoStartDevice( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + PIO_STACK_LOCATION IrpSp) +{ + PCM_RESOURCE_LIST RawResList = IrpSp->Parameters.StartDevice.AllocatedResources; + PCM_FULL_RESOURCE_DESCRIPTOR RawFullDesc; + PCM_PARTIAL_RESOURCE_DESCRIPTOR RawPartialDesc; + ULONG i, ii; + PPDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + UCHAR Irq; + + /* TODO: Assign the other resources we get to the card */ + + for (i = 0; i < RawResList->Count; i++) + { + RawFullDesc = &RawResList->List[i]; + + for (ii = 0; ii < RawFullDesc->PartialResourceList.Count; ii++) + { + RawPartialDesc = &RawFullDesc->PartialResourceList.PartialDescriptors[ii]; + + if (RawPartialDesc->Type == CmResourceTypeInterrupt) + { + DPRINT1("Assigning IRQ %x to PCI device (%x, %x)\n", + RawPartialDesc->u.Interrupt.Vector, + DeviceExtension->PciDevice->SlotNumber.u.AsULONG, + DeviceExtension->PciDevice->BusNumber); + + Irq = (UCHAR)RawPartialDesc->u.Interrupt.Vector; + HalSetBusDataByOffset(PCIConfiguration, + DeviceExtension->PciDevice->BusNumber, + DeviceExtension->PciDevice->SlotNumber.u.AsULONG, + &Irq, + 0x3c /* PCI_INTERRUPT_LINE */, + sizeof(UCHAR)); + } + } + } + + return STATUS_SUCCESS; +} static NTSTATUS PdoReadConfig( @@ -1352,6 +1395,9 @@ break; case IRP_MN_START_DEVICE: + Status = PdoStartDevice(DeviceObject, Irp, IrpSp); + break; + case IRP_MN_QUERY_STOP_DEVICE: case IRP_MN_CANCEL_STOP_DEVICE: case IRP_MN_STOP_DEVICE:
14 years, 8 months
1
0
0
0
[cgutman] 46686: [FREELOADER] - Fix the ShareDisposition value of COM port interrupts - Fix the Vector value of the interrupt resources
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Apr 2 19:05:39 2010 New Revision: 46686 URL:
http://svn.reactos.org/svn/reactos?rev=46686&view=rev
Log: [FREELOADER] - Fix the ShareDisposition value of COM port interrupts - Fix the Vector value of the interrupt resources Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Fri Apr 2 19:05:39 2010 @@ -1419,10 +1419,10 @@ /* Set Interrupt */ PartialDescriptor = &PartialResourceList->PartialDescriptors[1]; PartialDescriptor->Type = CmResourceTypeInterrupt; - PartialDescriptor->ShareDisposition = CmResourceShareUndetermined; + PartialDescriptor->ShareDisposition = CmResourceShareShared; PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; PartialDescriptor->u.Interrupt.Level = Irq[i]; - PartialDescriptor->u.Interrupt.Vector = 0; + PartialDescriptor->u.Interrupt.Vector = Irq[i]; PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF; /* Set serial data (device specific) */ @@ -1529,7 +1529,7 @@ PartialDescriptor->ShareDisposition = CmResourceShareUndetermined; PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; PartialDescriptor->u.Interrupt.Level = Irq[i]; - PartialDescriptor->u.Interrupt.Vector = 0; + PartialDescriptor->u.Interrupt.Vector = Irq[i]; PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF; } @@ -1715,7 +1715,7 @@ PartialDescriptor->ShareDisposition = CmResourceShareUndetermined; PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; PartialDescriptor->u.Interrupt.Level = 1; - PartialDescriptor->u.Interrupt.Vector = 0; + PartialDescriptor->u.Interrupt.Vector = 1; PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF; /* Set IO Port 0x60 */ @@ -1887,7 +1887,7 @@ PartialResourceList.PartialDescriptors[0].ShareDisposition = CmResourceShareUndetermined; PartialResourceList.PartialDescriptors[0].Flags = CM_RESOURCE_INTERRUPT_LATCHED; PartialResourceList.PartialDescriptors[0].u.Interrupt.Level = 12; - PartialResourceList.PartialDescriptors[0].u.Interrupt.Vector = 0; + PartialResourceList.PartialDescriptors[0].u.Interrupt.Vector = 12; PartialResourceList.PartialDescriptors[0].u.Interrupt.Affinity = 0xFFFFFFFF; /* Create controller key */
14 years, 8 months
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200