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
December 2019
----- 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
18 participants
225 discussions
Start a n
N
ew thread
[reactos] 01/01: Happy New Year 2020 to everyone!!
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ba5594599e3f39f279f0…
commit 9ba5594599e3f39f279f046ba7a1f13b8989c95c Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Jan 1 00:00:00 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Jan 1 00:00:00 2020 +0100 Happy New Year 2020 to everyone!! 🎊 🎆 🍾 🥳 .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:. __, ,__) __, ,__) __, ,__) ░░▄████▄░▄███▄░▄████▄░▄███▄░░ (--|__| _ ,_ ,_ (--|\ | _ (--\ | _ _ ,_ ░░▀▀░▄██░██░██░▀▀░▄██░██░██░░ _| |(_||_)|_)(_| _| \|(/_(_|_) \|(/_(_|| ░░░▄██▀░░██░██░░▄██▀░░██░██░░ ( | | ,_| ( (__| ░░██████░▀███▀░██████░▀███▀░░ .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:. ███████████████████████████████████████████████████████████████████████████████ ██████████████████▓▒▒▒▒▒▒▓▓█████████████████████████▓▓▒▒▒▒▒▒▓██████████████████ ███████████████▒▒▒▒▓▓███▓▓▓▒▒░▒▓▓█████████████▓▒▒░▒▒▓▓████▓▓▒▒▒▓███████████████ █████████████▓░░░░░░░░░▒▒▓██████▓▒▒▒▓█████▓▒▒▒▓██████▓▒▒░░░░░░░░░▓█████████████ ███████████▒▓░▒█████████▓▓▒░▒▓███▓▓▓▓▓▓▓▓▓▓▓▓████▒▒▒▒▓▓████████▓▒░▓▓███████████ ██████████▒▒▓░▓██████████████▓▓▓▓▓█████▓▓▓▓▓▓▓▓▒▒███████████████▓░▓░▒██████████ █████████▓░▓█░▓██████████▓▒▒▒▒▓▓▓▓███████▓▓▓▓▓▓▓▓▓▒▒▓███████████▓░█▒░▓█████████ █████████▓▒██▒▒████████▒▒░░░░▒▒▓▓▓███████▓▓▓▓▓▓▓▓▓▓▓▒▒░█████████▒▒█▓▒▒█████████ █████████▓░██▓░▓█████▓▓▒▒░░░░▒▒▓▓▓▓████▓▓▓▓▓▓▓▓▒▒▓▓▓▓▓▒░░▓█████▓░▓█▓░▓█████████ ██████████░▓██▒▒▓██▓▓▓▓▓▒▒▒▒▒▒▓▓▓▓██████▓▓▓▓▓▓▒▒▒▒▒▓▓▓▓▒▒░░███▓░▒██▒░██████████ ██████████▒▒▓██▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████████▓▓▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒░░▓█▒▒██▓░▓██████████ ███████████▒▒███▒░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▒▒░▒▒▒▒▒▒▒▒▒░░░▒███▒▓███████████ ████████████▒▒█▓▓▒░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░░░▒▒░░░▒▒▒░░░▓██▒▒████████████ █████████████▒▒▒▒▒▒░▒▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▒▒░░░░░░░░░░░░░▒▒▒▓▒▒█████████████ ██████████████░░▒▒▒▒░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒░░░░░░░░░▒░░▒░▒██████████████ ██████████████▓▒░▒▒▒▒▒░░▒▒░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░░░░░▓███████████████ ██████████████▓▒▓░░▒▒▒▒░░░░░░░░░░░░░░░░░▒▒▒▒▒▒░░░░░░░░░░▒░░░░░▓▒▓▓█████████████ ███████████▓▒▓▓▓▒▒░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒░░░░░░▒▒▒█▒▒▓███████████ ██████████▓▒▒█▓▓▒▒░▒░░░░░▒░░░░░░░░░░░░░░░░░░░░░░░░░░░▒░░░░░▓▒▒▒▒██▒▒▓██████████ █████████▓▒▓██▓▒▒▒▒░░▒░░░░░▒░░░░░░░░░░░░░░░░░░░░░░░▒░░░░░▒▒▒▒▒▒▓███▓▒▓█████████ ████████▓▒▓███▓▒▒▒▒░░░▒░░░░░░▒░░░░░░░░░░░░░░░░░░░▓▒▒▒▒░▒▓▒▒▓▓▒▒▓▒▓██▓▒▓████████ ███████▓▒▓███▒▓▓▒▒▒░░░░░▒░░░░░░▒░░░░░░░░░░░░░░░▓▒▒▒▒░▒▓▒▓▓▓▓▒▒██▓▒▓██▓▒████████ ███████▒▒██▓▒▓█▓▓▒▒░░░░░░░▒░░░░░░▒░░░░░░░░░░░▓▒▒▒▒░▒▓▒▒▒▓▓▓▒▒▓███▓▒███▒▓███████ ██████▓▒▓██▒▒███▓▒▒▒░░░░░░░░▒▒░░░░░▒▒░░░░░░░░▒▒░░▒▓▓▓▓▒▒▒▒▒▒▓█████▒▒██▓░▓██████ ██████▒▒██▒▒█████▓▒▒▒░░░░░░░░░▒░░░░░░░▒░░░░▒▒░░▒▓▒▒▒▒▒▒▒▒▒▒████████▒▒██▒▒██████ ██████▒▓██░▓██████▓▓▒▒▒░░░░░░░░░░▒░░░░░░░▒░░░░▒▒▒▒▒▒▒▓▓▒▒██████████▒░██▒▒██████ ██████▒▒▓▓▒█████████▓▓▒▒▒░░░░░░░░░░▒▒░░░░▒▒▒▓░░░▒▒▒▒▒▓▓████████████▓▒▓▓░▒██████ ██████▓░▒▒▒███████████▓▓▒▒░░░░▒▒▒░▒░▒▒▒▒░░▒▒▒▒▒▓▒░░▒▒██████████████▓░▒▒▒███████ ███████▓▒░░▒█████████▓▒▒░░▒▓▓▒▒▒░░░░▒▒▒▓▒▓▒░░▒▒▓▓██▓▓▒░▒▒▓█████████▒░░▒████████ ██████████▒░░░░░░░▒▒▓▓█████▓▓▒░░▒▓██▓▓████████▒░▒▒▓██████▓▓▒▒░░░░░░░▒██████████ ███████████▓▒▒▒▓▓████▓▓▒▒▒░▒▒█████████████████████▒▒░▒▒▓▓▓███▓▓▒▒▒▒████████████ ████████████████▓▓▓▓▓▓███████████████████████████████████▓▓▓▓▓▓████████████████ ███████████████████████████████████████████████████████████████████████████████ ███████████████████████████████████████████████████████████████████████████████ ██████████████████████████████████████████████████████████▓░░▓████████░░░▓█████ ███▒░░░░▒▓███████████████████████████████████████▒█████▓▒▒▓██▓▒▒▓████▓░█▓░▓████ ███▒█████░▒███▓▒▒▒▒▒▓████▓▒▒▒▒▒▓█▓███▓▒▒▒▒▒▒▓██▓▒░▒▒▓▒▓█████████▓▒██▓▒█████████ ███▒█████░▒█▓▒▒█████▒▒██▒▒▓████▓░▒██▒▒▓████▓▒▓██▓░▓██▓███████████▓▓██▓░░░▒█████ ███▒█▓░░▒▓█▓▒▒▓▒░░▒▓▒░▒▓▒███████▒▒██▒████████████░███▓███████████▓▓██████░▒████ ███▒██░▓███▓▒▓█████████▓▒███████▒▒██▒████████████░███▒▓██████████▓████████░▓███ ███▒███░▒▓██▓▒▒████▓▒▓██▓▒▒▓██▓▒░▒██▓▒▒▓███▓▒▓███░████▓▒▒█████▒▒▓███▓▒▓██░▓████ ███▒████▓░▓████▒▒▒▒▒██████▓▒▒▒▒▓█▓████▓▒▒▒▒▓█████▒███████▓▒▒▒▒▓███████▒▒▒▓█████ ███████████████████████████████████████████████████████████████████████████████ --- dll/win32/msgina/resources/reactos.bmp | Bin 89334 -> 89334 bytes dll/win32/msgina/resources/reactos.svg | 2 +- dll/win32/shell32/res/bitmaps/reactos.bmp | Bin 89334 -> 89334 bytes ntoskrnl/inbv/resources/copyright.bmp | Bin 1712 -> 1852 bytes sdk/include/reactos/version.cmake | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/msgina/resources/reactos.bmp b/dll/win32/msgina/resources/reactos.bmp index b069af6c876..bfee4ff308f 100644 Binary files a/dll/win32/msgina/resources/reactos.bmp and b/dll/win32/msgina/resources/reactos.bmp differ diff --git a/dll/win32/msgina/resources/reactos.svg b/dll/win32/msgina/resources/reactos.svg index 61aa38640d1..5edfb2604e4 100644 --- a/dll/win32/msgina/resources/reactos.svg +++ b/dll/win32/msgina/resources/reactos.svg @@ -1930,7 +1930,7 @@ x="5.59375" y="1047.7255" style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#1e2122;fill-opacity:1;font-family:Lucida Sans Unicode;-inkscape-font-specification:Lucida Sans Unicode" - id="tspan3618">Copyright © 1996-2019 ReactOS Team & Contributors</tspan></text> + id="tspan3618">Copyright © 1996-2020 ReactOS Team & Contributors</tspan></text> <g transform="matrix(0.16958533,0,0,0.16958533,89.849943,981.79073)" id="g15501"> diff --git a/dll/win32/shell32/res/bitmaps/reactos.bmp b/dll/win32/shell32/res/bitmaps/reactos.bmp index b069af6c876..bfee4ff308f 100644 Binary files a/dll/win32/shell32/res/bitmaps/reactos.bmp and b/dll/win32/shell32/res/bitmaps/reactos.bmp differ diff --git a/ntoskrnl/inbv/resources/copyright.bmp b/ntoskrnl/inbv/resources/copyright.bmp index 080e462c659..1226788f7f7 100644 Binary files a/ntoskrnl/inbv/resources/copyright.bmp and b/ntoskrnl/inbv/resources/copyright.bmp differ diff --git a/sdk/include/reactos/version.cmake b/sdk/include/reactos/version.cmake index 4ccb3e79e65..af97b8fb45c 100644 --- a/sdk/include/reactos/version.cmake +++ b/sdk/include/reactos/version.cmake @@ -3,7 +3,7 @@ string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC) set(KERNEL_VERSION_MAJOR "0") set(KERNEL_VERSION_MINOR "4") set(KERNEL_VERSION_PATCH_LEVEL "14") -set(COPYRIGHT_YEAR "2019") +set(COPYRIGHT_YEAR "2020") # KERNEL_VERSION_BUILD_TYPE is "dev" for Git builds # or "RC1", "RC2", "" for releases.
4 years, 11 months
1
0
0
0
[reactos] 01/01: [ADVAPI32] OpenSCManagerA/W: Set the last error even in case of success
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d3fe05505781e3d5add6…
commit 5d3fe05505781e3d5add6afc1b64aa062fa7c0db Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Tue Dec 31 23:23:23 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Tue Dec 31 23:23:23 2019 +0100 [ADVAPI32] OpenSCManagerA/W: Set the last error even in case of success This fixes a failure in the QueryServiceConfig2 api test. --- dll/win32/advapi32/service/scm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index 0588caef19e..f373f311add 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -1989,10 +1989,10 @@ OpenSCManagerA(LPCSTR lpMachineName, } RpcEndExcept; + SetLastError(dwError); if (dwError != ERROR_SUCCESS) { TRACE("ROpenSCManagerA() failed (Error %lu)\n", dwError); - SetLastError(dwError); return NULL; } @@ -2033,10 +2033,10 @@ OpenSCManagerW(LPCWSTR lpMachineName, } RpcEndExcept; + SetLastError(dwError); if (dwError != ERROR_SUCCESS) { TRACE("ROpenSCManagerW() failed (Error %lu)\n", dwError); - SetLastError(dwError); return NULL; }
4 years, 11 months
1
0
0
0
[reactos] 01/01: [LSASRV] LsarLookupSids: Return proper domain information for nameless domains
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=17864b49e33d5da8f067a…
commit 17864b49e33d5da8f067aa043d4dcb3a19e33cde Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Tue Dec 31 17:59:10 2019 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Tue Dec 31 17:59:10 2019 +0100 [LSASRV] LsarLookupSids: Return proper domain information for nameless domains --- dll/win32/lsasrv/lookup.c | 76 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/dll/win32/lsasrv/lookup.c b/dll/win32/lsasrv/lookup.c index 79cbffca57c..f593f2b86ae 100644 --- a/dll/win32/lsasrv/lookup.c +++ b/dll/win32/lsasrv/lookup.c @@ -940,6 +940,57 @@ LsapAddDomainToDomainsList(PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains, } +static NTSTATUS +LsapAddAuthorityToDomainsList( + PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains, + PSID Sid, + PULONG Index) +{ + SID AuthoritySid; + ULONG i; + + RtlInitializeSid(&AuthoritySid, + RtlIdentifierAuthoritySid(Sid), + 0); + + i = 0; + while (i < ReferencedDomains->Entries && + ReferencedDomains->Domains[i].Sid != NULL) + { + if (RtlEqualSid(&AuthoritySid, ReferencedDomains->Domains[i].Sid)) + { + *Index = i; + return STATUS_SUCCESS; + } + + i++; + } + + ReferencedDomains->Domains[i].Sid = MIDL_user_allocate(RtlLengthSid(&AuthoritySid)); + if (ReferencedDomains->Domains[i].Sid == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlCopySid(RtlLengthSid(&AuthoritySid), ReferencedDomains->Domains[i].Sid, &AuthoritySid); + + ReferencedDomains->Domains[i].Name.Length = 0; + ReferencedDomains->Domains[i].Name.MaximumLength = sizeof(WCHAR); + ReferencedDomains->Domains[i].Name.Buffer = MIDL_user_allocate(sizeof(WCHAR)); + if (ReferencedDomains->Domains[i].Name.Buffer == NULL) + { + MIDL_user_free(ReferencedDomains->Domains[i].Sid); + ReferencedDomains->Domains[i].Sid = NULL; + return STATUS_INSUFFICIENT_RESOURCES; + } + + ReferencedDomains->Domains[i].Name.Buffer[0] = UNICODE_NULL; + + ReferencedDomains->Entries++; + *Index = i; + + return STATUS_SUCCESS; +} + + static BOOLEAN LsapIsPrefixSid(IN PSID PrefixSid, IN PSID Sid) @@ -2033,18 +2084,31 @@ LsapLookupWellKnownSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength); - ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); - if (ptr2 != NULL) + if (ptr->DomainName.Length == 0) { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->AccountName, - ptr2->Sid, - &DomainIndex); + Status = LsapAddAuthorityToDomainsList(DomainsBuffer, + SidEnumBuffer->SidInfo[i].Sid, + &DomainIndex); if (!NT_SUCCESS(Status)) goto done; NamesBuffer[i].DomainIndex = DomainIndex; } + else + { + ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); + if (ptr2 != NULL) + { + Status = LsapAddDomainToDomainsList(DomainsBuffer, + &ptr2->AccountName, + ptr2->Sid, + &DomainIndex); + if (!NT_SUCCESS(Status)) + goto done; + + NamesBuffer[i].DomainIndex = DomainIndex; + } + } TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name);
4 years, 11 months
1
0
0
0
[reactos] 01/01: [FREELDR] Obtain Xbox memory map via multiboot spec (#1971)
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96692636e461b5cc4d0f5…
commit 96692636e461b5cc4d0f5e9fe4e937eb3fcb8d84 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Tue Dec 31 18:10:34 2019 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Dec 31 16:10:34 2019 +0100 [FREELDR] Obtain Xbox memory map via multiboot spec (#1971) - Also obtain framebuffer memory size the same way. References:
https://wiki.osdev.org/Detecting_Memory_(x86)#Memory_Map_Via_GRUB
https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-info…
CORE-16216 CORE-16300 --- boot/freeldr/freeldr/arch/i386/multiboot.S | 43 ++++++++++++ boot/freeldr/freeldr/arch/i386/xboxmem.c | 106 +++++++++++++++++++++++++---- boot/freeldr/freeldr/arch/i386/xboxvideo.c | 50 +++++++++++++- boot/freeldr/freeldr/include/multiboot.h | 21 ++++++ 4 files changed, 204 insertions(+), 16 deletions(-) diff --git a/boot/freeldr/freeldr/arch/i386/multiboot.S b/boot/freeldr/freeldr/arch/i386/multiboot.S index 6094000a0e0..296ce0de73f 100644 --- a/boot/freeldr/freeldr/arch/i386/multiboot.S +++ b/boot/freeldr/freeldr/arch/i386/multiboot.S @@ -29,9 +29,13 @@ * the header signature and uses the header to load it. */ +#define MB_INFO_SIZE 60 /* sizeof(multiboot_info_t) */ #define MB_INFO_FLAGS_OFFSET 0 #define MB_INFO_BOOT_DEVICE_OFFSET 12 #define MB_INFO_COMMAND_LINE_OFFSET 16 +#define MB_INFO_MMAP_LEN_OFFSET 44 +#define MB_INFO_MMAP_ADDR_OFFSET 48 +#define MB_MMAP_SIZE 480 /* 20 * sizeof(memory_map_t) - up to 20 entries */ #define CMDLINE_SIZE 256 /* @@ -91,6 +95,35 @@ MultibootEntry: cmp eax, MULTIBOOT_BOOTLOADER_MAGIC jne mbfail + /* Save multiboot info structure */ + mov esi, ebx + mov edi, offset MultibootInfo + INITIAL_BASE - FREELDR_BASE + mov ecx, (MB_INFO_SIZE / 4) + rep movsd + mov dword ptr ds:[MultibootInfo + INITIAL_BASE - FREELDR_BASE + MB_INFO_MMAP_ADDR_OFFSET], 0 + mov dword ptr ds:[_MultibootInfoPtr + INITIAL_BASE - FREELDR_BASE], offset MultibootInfo + + /* See if the memory map was passed in */ + test dword ptr ds:[ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_MEMORY_MAP + jz mbchk_command_line + /* Check memory map length */ + mov ecx, dword ptr ds:[ebx + MB_INFO_MMAP_LEN_OFFSET] + test ecx, ecx + jz mbchk_command_line + cmp ecx, MB_MMAP_SIZE + jg mbchk_command_line + /* Check memory map address */ + mov esi, dword ptr ds:[ebx + MB_INFO_MMAP_ADDR_OFFSET] + test esi, esi + jz mbchk_command_line + /* Save memory map structure */ + mov edi, offset MultibootMemoryMap + INITIAL_BASE - FREELDR_BASE + shr ecx, 2 + rep movsd + /* Relocate memory map address */ + mov dword ptr ds:[MultibootInfo + INITIAL_BASE - FREELDR_BASE + MB_INFO_MMAP_ADDR_OFFSET], offset MultibootMemoryMap + +mbchk_command_line: /* Save command line */ test dword ptr ds:[ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE jz mb2 @@ -171,6 +204,16 @@ gdtptr: .word HEX(17) /* Limit */ .long gdt /* Base Address */ +PUBLIC _MultibootInfoPtr +_MultibootInfoPtr: + .long 0 + +MultibootInfo: + .space MB_INFO_SIZE + +MultibootMemoryMap: + .space MB_MMAP_SIZE + PUBLIC cmdline cmdline: .space CMDLINE_SIZE diff --git a/boot/freeldr/freeldr/arch/i386/xboxmem.c b/boot/freeldr/freeldr/arch/i386/xboxmem.c index bf7721dc32c..e8ea7b016ea 100644 --- a/boot/freeldr/freeldr/arch/i386/xboxmem.c +++ b/boot/freeldr/freeldr/arch/i386/xboxmem.c @@ -26,6 +26,7 @@ DBG_DEFAULT_CHANNEL(MEMORY); static ULONG InstalledMemoryMb = 0; static ULONG AvailableMemoryMb = 0; +extern multiboot_info_t * MultibootInfoPtr; extern PVOID FrameBuffer; extern ULONG FrameBufferSize; @@ -98,30 +99,107 @@ XboxMemInit(VOID) AvailableMemoryMb = InstalledMemoryMb; } +memory_map_t * +XboxGetMultibootMemoryMap(INT * Count) +{ + memory_map_t * MemoryMap; + + if (!MultibootInfoPtr) + { + ERR("Multiboot info structure not found!\n"); + return NULL; + } + + if (!(MultibootInfoPtr->flags & MB_INFO_FLAG_MEMORY_MAP)) + { + ERR("Multiboot memory map is not passed!\n"); + return NULL; + } + + MemoryMap = (memory_map_t *)MultibootInfoPtr->mmap_addr; + + if (!MemoryMap || + MultibootInfoPtr->mmap_length == 0 || + MultibootInfoPtr->mmap_length % sizeof(memory_map_t) != 0) + { + ERR("Multiboot memory map structure is malformed!\n"); + return NULL; + } + + *Count = MultibootInfoPtr->mmap_length / sizeof(memory_map_t); + return MemoryMap; +} + +TYPE_OF_MEMORY +XboxMultibootMemoryType(ULONG Type) +{ + switch (Type) + { + case 0: // Video RAM + return LoaderFirmwarePermanent; + case 1: // Available RAM + return LoaderFree; + case 3: // ACPI area + return LoaderFirmwareTemporary; + case 4: // Hibernation area + return LoaderSpecialMemory; + case 5: // Reserved or invalid memory + return LoaderSpecialMemory; + default: + return LoaderFirmwarePermanent; + } +} + FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS + 1]; PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize) { + memory_map_t * MbMap; + INT Count, i; + TRACE("XboxMemGetMemoryMap()\n"); - /* FIXME: Obtain memory map via multiboot spec */ - /* Synthesize memory map */ + MbMap = XboxGetMultibootMemoryMap(&Count); + if (MbMap) + { + /* Obtain memory map via multiboot spec */ - /* Available RAM block */ - SetMemory(XboxMemoryMap, - 0, - AvailableMemoryMb * 1024 * 1024, - LoaderFree); + for (i = 0; i < Count; i++, MbMap++) + { + TRACE("i = %d, base_addr_low = 0x%p, length_low = 0x%p\n", i, MbMap->base_addr_low, MbMap->length_low); - if (FrameBufferSize != 0) + if (MbMap->base_addr_high > 0 || MbMap->length_high > 0) + { + ERR("Memory descriptor base or size is greater than 4 GB, should not happen on Xbox!\n"); + ASSERT(FALSE); + } + + SetMemory(XboxMemoryMap, + MbMap->base_addr_low, + MbMap->length_low, + XboxMultibootMemoryType(MbMap->type)); + } + } + else { - /* Video memory */ - ReserveMemory(XboxMemoryMap, - (ULONG_PTR)FrameBuffer, - FrameBufferSize, - LoaderFirmwarePermanent, - "Video memory"); + /* Synthesize memory map */ + + /* Available RAM block */ + SetMemory(XboxMemoryMap, + 0, + AvailableMemoryMb * 1024 * 1024, + LoaderFree); + + if (FrameBufferSize != 0) + { + /* Video memory */ + ReserveMemory(XboxMemoryMap, + (ULONG_PTR)FrameBuffer, + FrameBufferSize, + LoaderFirmwarePermanent, + "Video memory"); + } } *MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap); diff --git a/boot/freeldr/freeldr/arch/i386/xboxvideo.c b/boot/freeldr/freeldr/arch/i386/xboxvideo.c index d5839024d43..ffc2144d408 100644 --- a/boot/freeldr/freeldr/arch/i386/xboxvideo.c +++ b/boot/freeldr/freeldr/arch/i386/xboxvideo.c @@ -30,6 +30,7 @@ static ULONG ScreenWidth; static ULONG ScreenHeight; static ULONG BytesPerPixel; static ULONG Delta; +extern multiboot_info_t * MultibootInfoPtr; #define CHAR_WIDTH 8 #define CHAR_HEIGHT 16 @@ -127,6 +128,46 @@ NvGetCrtc(UCHAR Index) return *((PUCHAR) NV2A_CRTC_REGISTER_VALUE); } +ULONG +XboxGetFramebufferSize(PVOID Offset) +{ + memory_map_t * MemoryMap; + INT Count, i; + + if (!MultibootInfoPtr) + { + return 0; + } + + if (!(MultibootInfoPtr->flags & MB_INFO_FLAG_MEMORY_MAP)) + { + return 0; + } + + MemoryMap = (memory_map_t *)MultibootInfoPtr->mmap_addr; + + if (!MemoryMap || + MultibootInfoPtr->mmap_length == 0 || + MultibootInfoPtr->mmap_length % sizeof(memory_map_t) != 0) + { + return 0; + } + + Count = MultibootInfoPtr->mmap_length / sizeof(memory_map_t); + for (i = 0; i < Count; i++, MemoryMap++) + { + TRACE("i = %d, base_addr_low = 0x%p, MemoryMap->length_low = 0x%p\n", i, MemoryMap->base_addr_low, MemoryMap->length_low); + + if (MemoryMap->base_addr_low == (ULONG)Offset && MemoryMap->base_addr_high == 0) + { + TRACE("Video memory found\n"); + return MemoryMap->length_low; + } + } + ERR("Video memory not found!\n"); + return 0; +} + VOID XboxVideoInit(VOID) { @@ -135,8 +176,13 @@ XboxVideoInit(VOID) /* Verify that framebuffer address is page-aligned */ ASSERT((ULONG_PTR)FrameBuffer % PAGE_SIZE == 0); - /* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM) */ - FrameBufferSize = 4 * 1024 * 1024; + /* Obtain framebuffer memory size from multiboot memory map */ + if ((FrameBufferSize = XboxGetFramebufferSize(FrameBuffer)) == 0) + { + /* Fallback to Cromwell standard which reserves high 4 MB of RAM */ + FrameBufferSize = 4 * 1024 * 1024; + WARN("Could not detect framebuffer memory size, fallback to 4 MB\n"); + } ScreenWidth = *((PULONG) NV2A_RAMDAC_FP_HVALID_END) + 1; ScreenHeight = *((PULONG) NV2A_RAMDAC_FP_VVALID_END) + 1; diff --git a/boot/freeldr/freeldr/include/multiboot.h b/boot/freeldr/freeldr/include/multiboot.h index 732e5c89b53..b5627d6db89 100644 --- a/boot/freeldr/freeldr/include/multiboot.h +++ b/boot/freeldr/freeldr/include/multiboot.h @@ -90,6 +90,27 @@ typedef struct elf_section_header_table unsigned long shndx; } elf_section_header_table_t; +/* The Multiboot information. */ +typedef struct multiboot_info +{ + unsigned long flags; + unsigned long mem_lower; + unsigned long mem_upper; + unsigned long boot_device; + unsigned long cmdline; + unsigned long mods_count; + unsigned long mods_addr; + union + { + aout_symbol_table_t aout_sym; + elf_section_header_table_t elf_sec; + } u; + unsigned long mmap_length; + unsigned long mmap_addr; + unsigned long drives_length; + unsigned long drives_addr; +} multiboot_info_t; + /* The memory map. Be careful that the offset 0 is base_addr_low but no size. */ typedef struct memory_map
4 years, 11 months
1
0
0
0
[reactos] 01/01: [NTOS:KE] Rename some locking functions to reflect the IRQL level changes
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7523a7b13880b47d21f2e…
commit 7523a7b13880b47d21f2ef17761450e5893e6f49 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Mon Dec 30 15:34:38 2019 +0100 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Tue Dec 31 15:30:27 2019 +0100 [NTOS:KE] Rename some locking functions to reflect the IRQL level changes * KiAcquireApcLock -> KiAcquireApcLockRaiseToSynch * KiAcquireApcLockAtDpcLevel -> KiAcquireApcLockAtSynchLevel * KiReleaseApcLockFromDpcLevel -> KiReleaseApcLockFromSynchLevel * KiAcquireApcLockAtApcLevel -> KiAcquireApcLockRaiseToDpc * KiAcquireProcessLock -> KiAcquireProcessLockRaiseToSynch * KiReleaseProcessLockFromDpcLevel -> KiReleaseProcessLockFromSynchLevel * KiAcquireDispatcherLockAtDpcLevel -> KiAcquireDispatcherLockAtSynchLevel * KiReleaseDispatcherLockFromDpcLevel -> KiReleaseDispatcherLockFromSynchLevel * Add some ASSERTs --- ntoskrnl/include/internal/ke_x.h | 34 +++++++++-------- ntoskrnl/ke/apc.c | 22 +++++------ ntoskrnl/ke/gate.c | 14 +++---- ntoskrnl/ke/procobj.c | 48 +++++++++++------------ ntoskrnl/ke/queue.c | 12 +++--- ntoskrnl/ke/thrdobj.c | 82 ++++++++++++++++++++-------------------- ntoskrnl/ke/timerobj.c | 6 +-- ntoskrnl/ke/wait.c | 16 ++++---- ntoskrnl/mm/ARM3/pagfault.c | 2 +- 9 files changed, 120 insertions(+), 116 deletions(-) diff --git a/ntoskrnl/include/internal/ke_x.h b/ntoskrnl/include/internal/ke_x.h index 3aa3e7ab74c..84cb68e2c76 100644 --- a/ntoskrnl/include/internal/ke_x.h +++ b/ntoskrnl/include/internal/ke_x.h @@ -157,17 +157,18 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql) FORCEINLINE VOID -KiAcquireDispatcherLockAtDpcLevel(VOID) +KiAcquireDispatcherLockAtSynchLevel(VOID) { - /* This is a no-op at DPC Level for UP systems */ + /* This is a no-op at SYNCH_LEVEL for UP systems */ + ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL); return; } FORCEINLINE VOID -KiReleaseDispatcherLockFromDpcLevel(VOID) +KiReleaseDispatcherLockFromSynchLevel(VOID) { - /* This is a no-op at DPC Level for UP systems */ + /* This is a no-op at SYNCH_LEVEL for UP systems */ return; } @@ -360,16 +361,17 @@ KiReleaseDispatcherLock(IN KIRQL OldIrql) FORCEINLINE VOID -KiAcquireDispatcherLockAtDpcLevel(VOID) +KiAcquireDispatcherLockAtSynchLevel(VOID) { /* Acquire the dispatcher lock */ + ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL); KeAcquireQueuedSpinLockAtDpcLevel(&KeGetCurrentPrcb()-> LockQueue[LockQueueDispatcherLock]); } FORCEINLINE VOID -KiReleaseDispatcherLockFromDpcLevel(VOID) +KiReleaseDispatcherLockFromSynchLevel(VOID) { /* Release the dispatcher lock */ KeReleaseQueuedSpinLockFromDpcLevel(&KeGetCurrentPrcb()-> @@ -597,7 +599,7 @@ KiReleaseTimerLock(IN PKSPIN_LOCK_QUEUE LockQueue) FORCEINLINE VOID -KiAcquireApcLock(IN PKTHREAD Thread, +KiAcquireApcLockRaiseToSynch(IN PKTHREAD Thread, IN PKLOCK_QUEUE_HANDLE Handle) { /* Acquire the lock and raise to synchronization level */ @@ -606,16 +608,17 @@ KiAcquireApcLock(IN PKTHREAD Thread, FORCEINLINE VOID -KiAcquireApcLockAtDpcLevel(IN PKTHREAD Thread, +KiAcquireApcLockAtSynchLevel(IN PKTHREAD Thread, IN PKLOCK_QUEUE_HANDLE Handle) { /* Acquire the lock */ + ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL); KeAcquireInStackQueuedSpinLockAtDpcLevel(&Thread->ApcQueueLock, Handle); } FORCEINLINE VOID -KiAcquireApcLockAtApcLevel(IN PKTHREAD Thread, +KiAcquireApcLockRaiseToDpc(IN PKTHREAD Thread, IN PKLOCK_QUEUE_HANDLE Handle) { /* Acquire the lock */ @@ -632,7 +635,7 @@ KiReleaseApcLock(IN PKLOCK_QUEUE_HANDLE Handle) FORCEINLINE VOID -KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) +KiReleaseApcLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle) { /* Release the lock */ KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle); @@ -640,7 +643,7 @@ KiReleaseApcLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) FORCEINLINE VOID -KiAcquireProcessLock(IN PKPROCESS Process, +KiAcquireProcessLockRaiseToSynch(IN PKPROCESS Process, IN PKLOCK_QUEUE_HANDLE Handle) { /* Acquire the lock and raise to synchronization level */ @@ -651,15 +654,15 @@ FORCEINLINE VOID KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle) { - /* Release the lock */ + /* Release the lock and restore previous IRQL */ KeReleaseInStackQueuedSpinLock(Handle); } FORCEINLINE VOID -KiReleaseProcessLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle) +KiReleaseProcessLockFromSynchLevel(IN PKLOCK_QUEUE_HANDLE Handle) { - /* Release the lock */ + /* Release the lock without lowering IRQL */ KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle); } @@ -916,10 +919,11 @@ KxInsertTimer(IN PKTIMER Timer, IN ULONG Hand) { PKSPIN_LOCK_QUEUE LockQueue; + ASSERT(KeGetCurrentIrql() >= SYNCH_LEVEL); /* Acquire the lock and release the dispatcher lock */ LockQueue = KiAcquireTimerLock(Hand); - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Try to insert the timer */ if (KiInsertTimerTable(Timer, Hand)) diff --git a/ntoskrnl/ke/apc.c b/ntoskrnl/ke/apc.c index c4bab2a4c02..65169ca3c56 100644 --- a/ntoskrnl/ke/apc.c +++ b/ntoskrnl/ke/apc.c @@ -264,7 +264,7 @@ KiInsertQueueApc(IN PKAPC Apc, } /* Release dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Check if an interrupt was requested */ KiRequestApcInterrupt(RequestInterrupt, Thread->NextProcessor); @@ -330,7 +330,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, while (!IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) { /* Lock the APC Queue */ - KiAcquireApcLockAtApcLevel(Thread, &ApcLock); + KiAcquireApcLockRaiseToDpc(Thread, &ApcLock); /* Check if the list became empty now */ if (IsListEmpty(&Thread->ApcState.ApcListHead[KernelMode])) @@ -441,7 +441,7 @@ KiDeliverApc(IN KPROCESSOR_MODE DeliveryMode, (Thread->ApcState.UserApcPending)) { /* Lock the APC Queue */ - KiAcquireApcLockAtApcLevel(Thread, &ApcLock); + KiAcquireApcLockRaiseToDpc(Thread, &ApcLock); /* It's not pending anymore */ Thread->ApcState.UserApcPending = FALSE; @@ -744,7 +744,7 @@ KeInsertQueueApc(IN PKAPC Apc, ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Get the APC lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Make sure we can Queue APCs and that this one isn't already inserted */ if (!(Thread->ApcQueueable) || (Apc->Inserted)) @@ -764,7 +764,7 @@ KeInsertQueueApc(IN PKAPC Apc, } /* Release the APC lock and return success */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); return State; } @@ -802,7 +802,7 @@ KeFlushQueueApc(IN PKTHREAD Thread, if (PreviousMode == UserMode) { /* Get the APC lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Select user list and check if it's empty */ if (IsListEmpty(&Thread->ApcState.ApcListHead[UserMode])) @@ -822,7 +822,7 @@ KeFlushQueueApc(IN PKTHREAD Thread, } /* Otherwise, acquire the APC lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); } /* Get the first entry and check if the list is empty now */ @@ -892,8 +892,8 @@ KeRemoveQueueApc(IN PKAPC Apc) ASSERT_APC(Apc); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); - /* Get the APC lock */ - KiAcquireApcLock(Thread, &ApcLock); + /* Get the APC lock (this raises IRQL to SYNCH_LEVEL) */ + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Check if it's inserted */ Inserted = Apc->Inserted; @@ -904,7 +904,7 @@ KeRemoveQueueApc(IN PKAPC Apc) ApcState = Thread->ApcStatePointer[(UCHAR)Apc->ApcStateIndex]; /* Acquire the dispatcher lock and remove it from the list */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); if (RemoveEntryList(&Apc->ApcListEntry)) { /* Set the correct state based on the APC Mode */ @@ -921,7 +921,7 @@ KeRemoveQueueApc(IN PKAPC Apc) } /* Release dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Release the lock and return */ diff --git a/ntoskrnl/ke/gate.c b/ntoskrnl/ke/gate.c index 12f8a02e096..f078f929001 100644 --- a/ntoskrnl/ke/gate.c +++ b/ntoskrnl/ke/gate.c @@ -44,7 +44,7 @@ KeWaitForGate(IN PKGATE Gate, do { /* Acquire the APC lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Check if a kernel APC is pending and we're below APC_LEVEL */ if ((Thread->ApcState.KernelApcPending) && @@ -58,7 +58,7 @@ KeWaitForGate(IN PKGATE Gate, { /* Check if we have a queue and lock the dispatcher if so */ Queue = Thread->Queue; - if (Queue) KiAcquireDispatcherLockAtDpcLevel(); + if (Queue) KiAcquireDispatcherLockAtSynchLevel(); /* Lock the thread */ KiAcquireThreadLock(Thread); @@ -77,7 +77,7 @@ KeWaitForGate(IN PKGATE Gate, KiReleaseThreadLock(Thread); /* Release the gate lock */ - if (Queue) KiReleaseDispatcherLockFromDpcLevel(); + if (Queue) KiReleaseDispatcherLockFromSynchLevel(); /* Release the APC lock and return */ KiReleaseApcLock(&ApcLock); @@ -116,11 +116,11 @@ KeWaitForGate(IN PKGATE Gate, KiActivateWaiterQueue(Queue); /* Release the dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Release the APC lock but stay at DPC level */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); /* Find a new thread to run */ Status = KiSwapThread(Thread, KeGetCurrentPrcb()); @@ -203,7 +203,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate) if (WaitThread->Queue) { /* Acquire the dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Check if we still have one */ if (WaitThread->Queue) @@ -213,7 +213,7 @@ KeSignalGateBoostPriority(IN PKGATE Gate) } /* Release lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Make the thread ready */ diff --git a/ntoskrnl/ke/procobj.c b/ntoskrnl/ke/procobj.c index 865d7881f81..abf5a4f3fc4 100644 --- a/ntoskrnl/ke/procobj.c +++ b/ntoskrnl/ke/procobj.c @@ -92,10 +92,10 @@ KiAttachProcess(IN PKTHREAD Thread, #endif /* Release dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Release lock */ - KiReleaseApcLockFromDpcLevel(ApcLock); + KiReleaseApcLockFromSynchLevel(ApcLock); /* Swap Processes */ KiSwapProcess(Process, SavedApcState->Process); @@ -236,7 +236,7 @@ KeSetQuantumProcess(IN PKPROCESS Process, ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the process */ - KiAcquireProcessLock(Process, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock); /* Set new quantum */ Process->QuantumReset = Quantum; @@ -275,10 +275,10 @@ KeSetAffinityProcess(IN PKPROCESS Process, ASSERT((Affinity & KeActiveProcessors) != 0); /* Lock the process */ - KiAcquireProcessLock(Process, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock); /* Acquire the dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Capture old affinity and update it */ OldAffinity = Process->Affinity; @@ -298,10 +298,10 @@ KeSetAffinityProcess(IN PKPROCESS Process, } /* Release Dispatcher Database */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Release the process lock */ - KiReleaseProcessLockFromDpcLevel(&ProcessLock); + KiReleaseProcessLockFromSynchLevel(&ProcessLock); KiExitDispatcher(ProcessLock.OldIrql); /* Return previous affinity */ @@ -365,7 +365,7 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process, if (!Priority) Priority = LOW_PRIORITY + 1; /* Lock the process */ - KiAcquireProcessLock(Process, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock); /* Check if we are modifying the quantum too */ if (Quantum) Process->QuantumReset = Quantum; @@ -507,10 +507,10 @@ KeSetPriorityAndQuantumProcess(IN PKPROCESS Process, } /* Release Dispatcher Database */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Release the process lock */ - KiReleaseProcessLockFromDpcLevel(&ProcessLock); + KiReleaseProcessLockFromSynchLevel(&ProcessLock); KiExitDispatcher(ProcessLock.OldIrql); /* Return previous priority */ @@ -531,7 +531,7 @@ KeQueryValuesProcess(IN PKPROCESS Process, ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL); /* Lock the process */ - KiAcquireProcessLock(Process, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock); /* Initialize user and kernel times */ TotalKernel = Process->KernelTime; @@ -600,10 +600,10 @@ KeAttachProcess(IN PKPROCESS Process) else { /* Acquire APC Lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Acquire the dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Legit attach attempt: do it! */ KiAttachProcess(Thread, Process, &ApcLock, &Thread->SavedApcState); @@ -626,7 +626,7 @@ KeDetachProcess(VOID) if (Thread->ApcStateIndex == OriginalApcEnvironment) return; /* Acquire APC Lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Check for invalid attach attempts */ if ((Thread->ApcState.KernelApcInProgress) || @@ -641,7 +641,7 @@ KeDetachProcess(VOID) Process = Thread->ApcState.Process; /* Acquire dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Decrease the stack count */ ASSERT(Process->StackCount != 0); @@ -655,7 +655,7 @@ KeDetachProcess(VOID) } /* Release dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Restore the APC State */ KiMoveApcState(&Thread->SavedApcState, &Thread->ApcState); @@ -665,7 +665,7 @@ KeDetachProcess(VOID) Thread->ApcStateIndex = OriginalApcEnvironment; /* Release lock */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); /* Swap Processes */ KiSwapProcess(Thread->ApcState.Process, Process); @@ -726,10 +726,10 @@ KeStackAttachProcess(IN PKPROCESS Process, } /* Acquire APC Lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Acquire dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Check if the Current Thread is already attached */ if (Thread->ApcStateIndex != OriginalApcEnvironment) @@ -764,7 +764,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState) for (;;) { /* Acquire APC Lock */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Check if a kernel APC is pending */ if (Thread->ApcState.KernelApcPending) @@ -799,7 +799,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState) Process = Thread->ApcState.Process; /* Acquire dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Decrease the stack count */ ASSERT(Process->StackCount != 0); @@ -813,7 +813,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState) } /* Release dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Check if there's an APC state to restore */ if (ApcState->Process) @@ -832,7 +832,7 @@ KeUnstackDetachProcess(IN PRKAPC_STATE ApcState) } /* Release lock */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); /* Swap Processes */ KiSwapProcess(Thread->ApcState.Process, Process); @@ -869,7 +869,7 @@ KeQueryRuntimeProcess(IN PKPROCESS Process, TotalKernel = Process->KernelTime; /* Lock the process */ - KiAcquireProcessLock(Process, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(Process, &ProcessLock); /* Loop all child threads and sum up their times */ ListHead = &Process->ThreadListHead; diff --git a/ntoskrnl/ke/queue.c b/ntoskrnl/ke/queue.c index 0ddbfa6a88a..1b02a88aeed 100644 --- a/ntoskrnl/ke/queue.c +++ b/ntoskrnl/ke/queue.c @@ -265,7 +265,7 @@ KeRemoveQueue(IN PKQUEUE Queue, /* Raise IRQL to synch, prepare the wait, then lock the database */ Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); KxQueueThreadWait(); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); } /* @@ -339,7 +339,7 @@ KeRemoveQueue(IN PKQUEUE Queue, { /* Increment the count and unlock the dispatcher */ Queue->CurrentCount++; - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); KiExitDispatcher(Thread->WaitIrql); } else @@ -394,7 +394,7 @@ KeRemoveQueue(IN PKQUEUE Queue, else { /* Otherwise, unlock the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Do the actual swap */ @@ -419,13 +419,13 @@ KeRemoveQueue(IN PKQUEUE Queue, /* Start another wait */ Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); KxQueueThreadWait(); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); Queue->CurrentCount--; } } /* Unlock Database and return */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); KiExitDispatcher(Thread->WaitIrql); return QueueEntry; } @@ -477,7 +477,7 @@ KeRundownQueue(IN PKQUEUE Queue) } /* Release the dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Exit the dispatcher and return the first entry (if any) */ KiExitDispatcher(OldIrql); diff --git a/ntoskrnl/ke/thrdobj.c b/ntoskrnl/ke/thrdobj.c index 142ff18291a..627f42c7395 100644 --- a/ntoskrnl/ke/thrdobj.c +++ b/ntoskrnl/ke/thrdobj.c @@ -138,8 +138,8 @@ KeAlertResumeThread(IN PKTHREAD Thread) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the Dispatcher Database and the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); + KiAcquireDispatcherLockAtSynchLevel(); /* Return if Thread is already alerted. */ if (!Thread->Alerted[KernelMode]) @@ -174,8 +174,8 @@ KeAlertResumeThread(IN PKTHREAD Thread) } /* Release Locks and return the Old State */ - KiReleaseDispatcherLockFromDpcLevel(); - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseDispatcherLockFromSynchLevel(); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); return PreviousCount; } @@ -191,8 +191,8 @@ KeAlertThread(IN PKTHREAD Thread, ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the Dispatcher Database and the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); + KiAcquireDispatcherLockAtSynchLevel(); /* Save the Previous State */ PreviousState = Thread->Alerted[AlertMode]; @@ -216,8 +216,8 @@ KeAlertThread(IN PKTHREAD Thread, } /* Release the Dispatcher Lock */ - KiReleaseDispatcherLockFromDpcLevel(); - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseDispatcherLockFromSynchLevel(); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); /* Return the old state */ @@ -281,7 +281,7 @@ KeForceResumeThread(IN PKTHREAD Thread) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Save the old Suspend Count */ PreviousCount = Thread->SuspendCount + Thread->FreezeCount; @@ -294,18 +294,18 @@ KeForceResumeThread(IN PKTHREAD Thread) Thread->FreezeCount = 0; /* Lock the dispatcher */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Signal and satisfy */ Thread->SuspendSemaphore.Header.SignalState++; KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT); /* Release the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Release Lock and return the Old State */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); return PreviousCount; } @@ -322,14 +322,14 @@ KeFreezeAllThreads(VOID) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the process */ - KiAcquireProcessLock(Process, &LockHandle); + KiAcquireProcessLockRaiseToSynch(Process, &LockHandle); /* If someone is already trying to free us, try again */ while (CurrentThread->FreezeCount) { /* Release and re-acquire the process lock so the APC will go through */ KiReleaseProcessLock(&LockHandle); - KiAcquireProcessLock(Process, &LockHandle); + KiAcquireProcessLockRaiseToSynch(Process, &LockHandle); } /* Enter a critical region */ @@ -344,7 +344,7 @@ KeFreezeAllThreads(VOID) Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry); /* Lock it */ - KiAcquireApcLockAtDpcLevel(Current, &ApcLock); + KiAcquireApcLockAtSynchLevel(Current, &ApcLock); /* Make sure it's not ours, and check if APCs are enabled */ if ((Current != CurrentThread) && (Current->ApcQueueable)) @@ -369,26 +369,26 @@ KeFreezeAllThreads(VOID) else { /* Lock the dispatcher */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Unsignal the semaphore, the APC was already inserted */ Current->SuspendSemaphore.Header.SignalState--; /* Release the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } } } /* Release the APC lock */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); /* Move to the next thread */ NextEntry = NextEntry->Flink; } while (NextEntry != ListHead); /* Release the process lock and exit the dispatcher */ - KiReleaseProcessLockFromDpcLevel(&LockHandle); + KiReleaseProcessLockFromSynchLevel(&LockHandle); KiExitDispatcher(LockHandle.OldIrql); } @@ -402,7 +402,7 @@ KeResumeThread(IN PKTHREAD Thread) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Save the Old Count */ PreviousCount = Thread->SuspendCount; @@ -417,19 +417,19 @@ KeResumeThread(IN PKTHREAD Thread) if ((!Thread->SuspendCount) && (!Thread->FreezeCount)) { /* Acquire the dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Signal the Suspend Semaphore */ Thread->SuspendSemaphore.Header.SignalState++; KiWaitTest(&Thread->SuspendSemaphore.Header, IO_NO_INCREMENT); /* Release the dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } } /* Release APC Queue lock and return the Old State */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); return PreviousCount; } @@ -516,7 +516,7 @@ KeStartThread(IN OUT PKTHREAD Thread) Thread->SystemAffinityActive = FALSE; /* Lock the process */ - KiAcquireProcessLock(Process, &LockHandle); + KiAcquireProcessLockRaiseToSynch(Process, &LockHandle); /* Setup volatile data */ Thread->Priority = Process->BasePriority; @@ -553,7 +553,7 @@ KeStartThread(IN OUT PKTHREAD Thread) Thread->UserIdealProcessor = IdealProcessor; /* Lock the Dispatcher Database */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Insert the thread into the process list */ InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry); @@ -563,7 +563,7 @@ KeStartThread(IN OUT PKTHREAD Thread) Process->StackCount++; /* Release locks and return */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); KiReleaseProcessLock(&LockHandle); } @@ -615,7 +615,7 @@ KeSuspendThread(PKTHREAD Thread) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Save the Old Count */ PreviousCount = Thread->SuspendCount; @@ -647,19 +647,19 @@ KeSuspendThread(PKTHREAD Thread) else { /* Lock the dispatcher */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Unsignal the semaphore, the APC was already inserted */ Thread->SuspendSemaphore.Header.SignalState--; /* Release the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } } } /* Release Lock and return the Old State */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); KiExitDispatcher(ApcLock.OldIrql); return PreviousCount; } @@ -676,7 +676,7 @@ KeThawAllThreads(VOID) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the process */ - KiAcquireProcessLock(Process, &LockHandle); + KiAcquireProcessLockRaiseToSynch(Process, &LockHandle); /* Loop the Process's Threads */ ListHead = &Process->ThreadListHead; @@ -687,7 +687,7 @@ KeThawAllThreads(VOID) Current = CONTAINING_RECORD(NextEntry, KTHREAD, ThreadListEntry); /* Lock it */ - KiAcquireApcLockAtDpcLevel(Current, &ApcLock); + KiAcquireApcLockAtSynchLevel(Current, &ApcLock); /* Make sure we are frozen */ OldCount = Current->FreezeCount; @@ -700,26 +700,26 @@ KeThawAllThreads(VOID) if (!(Current->SuspendCount) && (!Current->FreezeCount)) { /* Lock the dispatcher */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Signal the suspend semaphore and wake it */ Current->SuspendSemaphore.Header.SignalState++; KiWaitTest(&Current->SuspendSemaphore, 0); /* Unlock the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } } /* Release the APC lock */ - KiReleaseApcLockFromDpcLevel(&ApcLock); + KiReleaseApcLockFromSynchLevel(&ApcLock); /* Go to the next one */ NextEntry = NextEntry->Flink; } while (NextEntry != ListHead); /* Release the process lock and exit the dispatcher */ - KiReleaseProcessLockFromDpcLevel(&LockHandle); + KiReleaseProcessLockFromSynchLevel(&LockHandle); KiExitDispatcher(LockHandle.OldIrql); /* Leave the critical region */ @@ -737,7 +737,7 @@ KeTestAlertThread(IN KPROCESSOR_MODE AlertMode) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the Dispatcher Database and the APC Queue */ - KiAcquireApcLock(Thread, &ApcLock); + KiAcquireApcLockRaiseToSynch(Thread, &ApcLock); /* Save the old State */ OldState = Thread->Alerted[AlertMode]; @@ -1383,7 +1383,7 @@ KeTerminateThread(IN KPRIORITY Increment) ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); /* Lock the process */ - KiAcquireProcessLock(Process, &LockHandle); + KiAcquireProcessLockRaiseToSynch(Process, &LockHandle); /* Make sure we won't get Swapped */ KiSetThreadSwapBusy(Thread); @@ -1415,7 +1415,7 @@ KeTerminateThread(IN KPRIORITY Increment) } while (Entry != SavedEntry); /* Acquire the dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Check if the reaper wasn't active */ if (!Entry) @@ -1446,7 +1446,7 @@ KeTerminateThread(IN KPRIORITY Increment) RemoveEntryList(&Thread->ThreadListEntry); /* Release the process lock */ - KiReleaseProcessLockFromDpcLevel(&LockHandle); + KiReleaseProcessLockFromSynchLevel(&LockHandle); /* Set us as terminated, decrease the Process's stack count */ Thread->State = Terminated; @@ -1464,6 +1464,6 @@ KeTerminateThread(IN KPRIORITY Increment) KiRundownThread(Thread); /* Swap to a new thread */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); KiSwapThread(Thread, KeGetCurrentPrcb()); } diff --git a/ntoskrnl/ke/timerobj.c b/ntoskrnl/ke/timerobj.c index 43a348ec008..26f12720dda 100644 --- a/ntoskrnl/ke/timerobj.c +++ b/ntoskrnl/ke/timerobj.c @@ -184,13 +184,13 @@ KiCompleteTimer(IN PKTIMER Timer, KiReleaseTimerLock(LockQueue); /* Acquire dispatcher lock */ - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); /* Signal the timer if it's still on our list */ if (!IsListEmpty(&ListHead)) RequestInterrupt = KiSignalTimer(Timer); /* Release the dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Request a DPC if needed */ if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL); @@ -321,7 +321,7 @@ KeSetTimerEx(IN OUT PKTIMER Timer, RequestInterrupt = KiSignalTimer(Timer); /* Release the dispatcher lock */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Check if we need to do an interrupt */ if (RequestInterrupt) HalRequestSoftwareInterrupt(DISPATCH_LEVEL); diff --git a/ntoskrnl/ke/wait.c b/ntoskrnl/ke/wait.c index bae1e8fcd60..3863b8e4779 100644 --- a/ntoskrnl/ke/wait.c +++ b/ntoskrnl/ke/wait.c @@ -386,7 +386,7 @@ WaitStart: /* Setup a new wait */ Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); KxDelayThreadWait(); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); } /* We're done! */ @@ -403,7 +403,7 @@ NoWait: } /* Unlock the dispatcher and adjust the quantum for a no-wait */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); KiAdjustQuantumThread(Thread); return STATUS_SUCCESS; } @@ -540,7 +540,7 @@ KeWaitForSingleObject(IN PVOID Object, else { /* Otherwise, unlock the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Do the actual swap */ @@ -562,7 +562,7 @@ WaitStart: /* Setup a new wait */ Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); KxSingleThreadWait(); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); } /* Wait complete */ @@ -571,7 +571,7 @@ WaitStart: DontWait: /* Release dispatcher lock but maintain high IRQL */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Adjust the Quantum and return the wait status */ KiAdjustQuantumThread(Thread); @@ -835,7 +835,7 @@ KeWaitForMultipleObjects(IN ULONG Count, else { /* Otherwise, unlock the dispatcher */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); } /* Swap the thread */ @@ -858,7 +858,7 @@ WaitStart: /* Setup a new wait */ Thread->WaitIrql = KeRaiseIrqlToSynchLevel(); KxMultiThreadWait(); - KiAcquireDispatcherLockAtDpcLevel(); + KiAcquireDispatcherLockAtSynchLevel(); } /* We are done */ @@ -867,7 +867,7 @@ WaitStart: DontWait: /* Release dispatcher lock but maintain high IRQL */ - KiReleaseDispatcherLockFromDpcLevel(); + KiReleaseDispatcherLockFromSynchLevel(); /* Adjust the Quantum and return the wait status */ KiAdjustQuantumThread(Thread); diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c index de642510df0..1ab109e9f65 100644 --- a/ntoskrnl/mm/ARM3/pagfault.c +++ b/ntoskrnl/mm/ARM3/pagfault.c @@ -2576,7 +2576,7 @@ MmSetExecuteOptions(IN ULONG ExecuteOptions) } /* Change the NX state in the process lock */ - KiAcquireProcessLock(CurrentProcess, &ProcessLock); + KiAcquireProcessLockRaiseToSynch(CurrentProcess, &ProcessLock); /* Don't change anything if the permanent flag was set */ if (!CurrentProcess->Flags.Permanent)
4 years, 11 months
1
0
0
0
[reactos] 05/05: [NTDLL_APITEST] Add a test for NtUnloadDriver.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3b430eefddf79bd524f04…
commit 3b430eefddf79bd524f040cb79ad8b63a591b422 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Dec 29 13:49:18 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Dec 31 15:18:59 2019 +0100 [NTDLL_APITEST] Add a test for NtUnloadDriver. --- modules/rostests/apitests/ntdll/CMakeLists.txt | 1 + modules/rostests/apitests/ntdll/NtUnloadDriver.c | 108 +++++++++++++++++++++++ modules/rostests/apitests/ntdll/testlist.c | 2 + 3 files changed, 111 insertions(+) diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt b/modules/rostests/apitests/ntdll/CMakeLists.txt index cf0bbb4e284..0cce35587ed 100644 --- a/modules/rostests/apitests/ntdll/CMakeLists.txt +++ b/modules/rostests/apitests/ntdll/CMakeLists.txt @@ -35,6 +35,7 @@ list(APPEND SOURCE NtSetInformationFile.c NtSetValueKey.c NtSetVolumeInformationFile.c + NtUnloadDriver.c NtWriteFile.c RtlAllocateHeap.c RtlBitmap.c diff --git a/modules/rostests/apitests/ntdll/NtUnloadDriver.c b/modules/rostests/apitests/ntdll/NtUnloadDriver.c new file mode 100644 index 00000000000..5b827053f4a --- /dev/null +++ b/modules/rostests/apitests/ntdll/NtUnloadDriver.c @@ -0,0 +1,108 @@ +/* + * PROJECT: ReactOS API Tests + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Test for NtUnloadDriver + * COPYRIGHT: Copyright 2019 Thomas Faber (thomas.faber(a)reactos.org) + */ + +#include "precomp.h" + +START_TEST(NtUnloadDriver) +{ + NTSTATUS Status; + BOOLEAN OldPrivilege, OldPrivilege2; + UNICODE_STRING ServiceName; + PWCHAR Buffer = NULL; + + Status = RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, FALSE, FALSE, &OldPrivilege); + if (!NT_SUCCESS(Status)) + { + skip("Failed to drop driver load privilege\n"); + return; + } + + Status = NtUnloadDriver(NULL); + ok_hex(Status, STATUS_PRIVILEGE_NOT_HELD); + + Status = RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, TRUE, FALSE, &OldPrivilege2); + if (!NT_SUCCESS(Status)) + { + skip("Failed to acquire driver load privilege\n"); + goto Exit; + } + + Status = NtUnloadDriver(NULL); + ok_hex(Status, STATUS_ACCESS_VIOLATION); + + RtlInitEmptyUnicodeString(&ServiceName, NULL, 0); + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_INVALID_PARAMETER); + + Buffer = AllocateGuarded(0x10000); + if (!Buffer) + { + skip("Failed to allocate memory\n"); + goto Exit; + } + + RtlFillMemoryUlong(Buffer, 0x10000, 'A' << 16 | 'A'); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFF; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_NAME_INVALID); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFE; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_NAME_INVALID); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFD; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_NAME_INVALID); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFC; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_PATH_SYNTAX_BAD); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 0x1000; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_PATH_SYNTAX_BAD); + + ServiceName.Buffer = Buffer; + ServiceName.Length = 1; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_NAME_INVALID); + + Buffer[0xFFFC / sizeof(WCHAR)] = L'\\'; + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFC; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_PATH_SYNTAX_BAD); + + Buffer[0xFFFC / sizeof(WCHAR) - 1] = L'\\'; + ServiceName.Buffer = Buffer; + ServiceName.Length = 0xFFFC; + ServiceName.MaximumLength = MAXUSHORT; + Status = NtUnloadDriver(&ServiceName); + ok_hex(Status, STATUS_OBJECT_PATH_SYNTAX_BAD); + +Exit: + if (Buffer != NULL) + { + FreeGuarded(Buffer); + } + + Status = RtlAdjustPrivilege(SE_LOAD_DRIVER_PRIVILEGE, OldPrivilege, FALSE, &OldPrivilege2); + ok_hex(Status, STATUS_SUCCESS); +} diff --git a/modules/rostests/apitests/ntdll/testlist.c b/modules/rostests/apitests/ntdll/testlist.c index cfcf8cefe04..9359f36808b 100644 --- a/modules/rostests/apitests/ntdll/testlist.c +++ b/modules/rostests/apitests/ntdll/testlist.c @@ -34,6 +34,7 @@ extern void func_NtSetInformationFile(void); extern void func_NtSetValueKey(void); extern void func_NtSetVolumeInformationFile(void); extern void func_NtSystemInformation(void); +extern void func_NtUnloadDriver(void); extern void func_NtWriteFile(void); extern void func_RtlAllocateHeap(void); extern void func_RtlBitmap(void); @@ -99,6 +100,7 @@ const struct test winetest_testlist[] = { "NtSetValueKey", func_NtSetValueKey}, { "NtSetVolumeInformationFile", func_NtSetVolumeInformationFile }, { "NtSystemInformation", func_NtSystemInformation }, + { "NtUnloadDriver", func_NtUnloadDriver }, { "NtWriteFile", func_NtWriteFile }, { "RtlAllocateHeap", func_RtlAllocateHeap }, { "RtlBitmapApi", func_RtlBitmap },
4 years, 11 months
1
0
0
0
[reactos] 04/05: [APITESTS] Centrally define AllocateGuarded/FreeGuarded instead of duplicating them.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=787b2c76604a96444c5ff…
commit 787b2c76604a96444c5fffe206b3c3fb5dcdedee Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Wed Jul 10 12:25:36 2019 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Dec 31 15:18:41 2019 +0100 [APITESTS] Centrally define AllocateGuarded/FreeGuarded instead of duplicating them. --- modules/rostests/apitests/crt/sprintf.c | 48 +------------ modules/rostests/apitests/include/apitest_guard.h | 79 ++++++++++++++++++++++ modules/rostests/apitests/ntdll/RtlBitmap.c | 47 ------------- modules/rostests/apitests/ntdll/RtlDeleteAce.c | 47 ------------- .../apitests/ntdll/RtlDetermineDosPathNameType.c | 69 ------------------- modules/rostests/apitests/ntdll/RtlFirstFreeAce.c | 47 ------------- modules/rostests/apitests/ntdll/RtlImageRvaToVa.c | 47 ------------- modules/rostests/apitests/ntdll/precomp.h | 1 + .../apitests/user32/GetUserObjectInformation.c | 48 +------------ modules/rostests/apitests/ws2_32/WSAStartup.c | 48 +------------ 10 files changed, 83 insertions(+), 398 deletions(-) diff --git a/modules/rostests/apitests/crt/sprintf.c b/modules/rostests/apitests/crt/sprintf.c index b612d6d993f..8d42148142c 100644 --- a/modules/rostests/apitests/crt/sprintf.c +++ b/modules/rostests/apitests/crt/sprintf.c @@ -6,6 +6,7 @@ */ #include <apitest.h> +#include <apitest_guard.h> #define WIN32_NO_STATUS #include <stdio.h> @@ -25,53 +26,6 @@ #endif #endif -static -PVOID -AllocateGuarded( - SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - /* NOTE: This test is not only used for all the CRT apitests, but also for * user32's wsprintf. Make sure to test them all */ START_TEST(sprintf) diff --git a/modules/rostests/apitests/include/apitest_guard.h b/modules/rostests/apitests/include/apitest_guard.h new file mode 100644 index 00000000000..26b8ea0adf1 --- /dev/null +++ b/modules/rostests/apitests/include/apitest_guard.h @@ -0,0 +1,79 @@ +#ifndef _APITEST_GUARD_H +#define _APITEST_GUARD_H + +#include <ndk/mmfuncs.h> +#include <ndk/psfuncs.h> + +static +inline +PVOID +AllocateGuarded( + _In_ SIZE_T SizeRequested) +{ + NTSTATUS Status; + SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); + PVOID VirtualMemory = NULL; + PCHAR StartOfBuffer; + + Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); + + if (!NT_SUCCESS(Status)) + return NULL; + + Size -= PAGE_SIZE; + if (Size) + { + Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + Size = 0; + Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); + ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); + return NULL; + } + } + + StartOfBuffer = VirtualMemory; + StartOfBuffer += Size - SizeRequested; + + return StartOfBuffer; +} + +static +inline +VOID +FreeGuarded( + _In_ PVOID Pointer) +{ + NTSTATUS Status; + PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); + SIZE_T Size = 0; + + Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); + ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); +} + +static +inline +VOID +MakeReadOnly( + PVOID Pointer, + SIZE_T SizeRequested) +{ + NTSTATUS Status; + SIZE_T Size = PAGE_ROUND_UP(SizeRequested); + PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); + + if (Size) + { + Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); + if (!NT_SUCCESS(Status)) + { + Size = 0; + Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); + ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); + } + } +} + +#endif /* _APITEST_GUARD_H */ diff --git a/modules/rostests/apitests/ntdll/RtlBitmap.c b/modules/rostests/apitests/ntdll/RtlBitmap.c index e524872b64c..355ccee0aff 100644 --- a/modules/rostests/apitests/ntdll/RtlBitmap.c +++ b/modules/rostests/apitests/ntdll/RtlBitmap.c @@ -4,53 +4,6 @@ static BOOL IsBroken = FALSE; -static -PVOID -AllocateGuarded( - _In_ SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - _In_ PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - void Test_RtlFindMostSignificantBit(void) { diff --git a/modules/rostests/apitests/ntdll/RtlDeleteAce.c b/modules/rostests/apitests/ntdll/RtlDeleteAce.c index 4c4aaf58cdb..327247c728c 100644 --- a/modules/rostests/apitests/ntdll/RtlDeleteAce.c +++ b/modules/rostests/apitests/ntdll/RtlDeleteAce.c @@ -7,53 +7,6 @@ #include "precomp.h" -static -PVOID -AllocateGuarded( - _In_ SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - _In_ PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - static PACL MakeAcl( diff --git a/modules/rostests/apitests/ntdll/RtlDetermineDosPathNameType.c b/modules/rostests/apitests/ntdll/RtlDetermineDosPathNameType.c index 3f99a38a9bd..ed197720302 100644 --- a/modules/rostests/apitests/ntdll/RtlDetermineDosPathNameType.c +++ b/modules/rostests/apitests/ntdll/RtlDetermineDosPathNameType.c @@ -30,75 +30,6 @@ ULONG //= (PVOID)0x7c830669; ; -static -PVOID -AllocateGuarded( - SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -MakeReadOnly( - PVOID Pointer, - SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested); - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - } - } -} - -static -VOID -FreeGuarded( - PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - START_TEST(RtlDetermineDosPathNameType) { RTL_PATH_TYPE PathType; diff --git a/modules/rostests/apitests/ntdll/RtlFirstFreeAce.c b/modules/rostests/apitests/ntdll/RtlFirstFreeAce.c index 0022945e416..654fdb09363 100644 --- a/modules/rostests/apitests/ntdll/RtlFirstFreeAce.c +++ b/modules/rostests/apitests/ntdll/RtlFirstFreeAce.c @@ -7,53 +7,6 @@ #include "precomp.h" -static -PVOID -AllocateGuarded( - _In_ SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - _In_ PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - static PACL MakeAcl( diff --git a/modules/rostests/apitests/ntdll/RtlImageRvaToVa.c b/modules/rostests/apitests/ntdll/RtlImageRvaToVa.c index 9d15c58e717..ba9f75d7d7a 100644 --- a/modules/rostests/apitests/ntdll/RtlImageRvaToVa.c +++ b/modules/rostests/apitests/ntdll/RtlImageRvaToVa.c @@ -7,53 +7,6 @@ #include "precomp.h" -static -PVOID -AllocateGuarded( - _In_ SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - _In_ PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - START_TEST(RtlImageRvaToVa) { PIMAGE_NT_HEADERS NtHeader; diff --git a/modules/rostests/apitests/ntdll/precomp.h b/modules/rostests/apitests/ntdll/precomp.h index 39ff188224d..82d3e0733b0 100644 --- a/modules/rostests/apitests/ntdll/precomp.h +++ b/modules/rostests/apitests/ntdll/precomp.h @@ -8,6 +8,7 @@ #define COM_NO_WINDOWS_H #include <apitest.h> +#include <apitest_guard.h> #include <ndk/ntndk.h> #include <strsafe.h> diff --git a/modules/rostests/apitests/user32/GetUserObjectInformation.c b/modules/rostests/apitests/user32/GetUserObjectInformation.c index 71c441fc852..423e3e649bf 100644 --- a/modules/rostests/apitests/user32/GetUserObjectInformation.c +++ b/modules/rostests/apitests/user32/GetUserObjectInformation.c @@ -6,6 +6,7 @@ */ #include "precomp.h" +#include <apitest_guard.h> #include <ndk/mmfuncs.h> #include <ndk/pstypes.h> @@ -30,53 +31,6 @@ CheckBuffer( return TRUE; } -static -PVOID -AllocateGuarded( - SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} - #define xok ok // Make the test succeed on Win2003 //#define xok(...) // This should make the test succeed on all Windows versions #define NOTSET 1234 diff --git a/modules/rostests/apitests/ws2_32/WSAStartup.c b/modules/rostests/apitests/ws2_32/WSAStartup.c index 11e731a805e..d3b203f2393 100644 --- a/modules/rostests/apitests/ws2_32/WSAStartup.c +++ b/modules/rostests/apitests/ws2_32/WSAStartup.c @@ -6,53 +6,7 @@ */ #include "ws2_32.h" - -static -PVOID -AllocateGuarded( - SIZE_T SizeRequested) -{ - NTSTATUS Status; - SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE); - PVOID VirtualMemory = NULL; - PCHAR StartOfBuffer; - - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS); - - if (!NT_SUCCESS(Status)) - return NULL; - - Size -= PAGE_SIZE; - if (Size) - { - Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - Size = 0; - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); - return NULL; - } - } - - StartOfBuffer = VirtualMemory; - StartOfBuffer += Size - SizeRequested; - - return StartOfBuffer; -} - -static -VOID -FreeGuarded( - PVOID Pointer) -{ - NTSTATUS Status; - PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer); - SIZE_T Size = 0; - - Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE); - ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status); -} +#include <apitest_guard.h> static BOOLEAN
4 years, 11 months
1
0
0
0
[reactos] 03/05: [NTOS:IO] Use UNICODE_STRING operations in IopUnloadDriver.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c904983b49ee7b755f5c9…
commit c904983b49ee7b755f5c926c17b3b99e4042f72f Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Dec 29 13:47:40 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Dec 31 15:18:17 2019 +0100 [NTOS:IO] Use UNICODE_STRING operations in IopUnloadDriver. Fixes several overflow vulnerabilities. --- ntoskrnl/io/iomgr/driver.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c index f636dc35627..8e0bea4092f 100644 --- a/ntoskrnl/io/iomgr/driver.c +++ b/ntoskrnl/io/iomgr/driver.c @@ -1186,6 +1186,7 @@ IopInitializeSystemDrivers(VOID) NTSTATUS NTAPI IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers) { + UNICODE_STRING Backslash = RTL_CONSTANT_STRING(L"\\"); RTL_QUERY_REGISTRY_TABLE QueryTable[2]; UNICODE_STRING ImagePath; UNICODE_STRING ServiceName; @@ -1194,7 +1195,7 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers) PDEVICE_OBJECT DeviceObject; PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; NTSTATUS Status; - PWSTR Start; + USHORT LastBackslash; BOOLEAN SafeToUnload = TRUE; KPROCESSOR_MODE PreviousMode; UNICODE_STRING CapturedServiceName; @@ -1230,19 +1231,34 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers) /* * Get the service name from the registry key name */ - Start = wcsrchr(CapturedServiceName.Buffer, L'\\'); - if (Start == NULL) - Start = CapturedServiceName.Buffer; + Status = RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END, + &CapturedServiceName, + &Backslash, + &LastBackslash); + if (NT_SUCCESS(Status)) + { + NT_ASSERT(CapturedServiceName.Length >= LastBackslash + sizeof(WCHAR)); + ServiceName.Buffer = &CapturedServiceName.Buffer[LastBackslash / sizeof(WCHAR) + 1]; + ServiceName.Length = CapturedServiceName.Length - LastBackslash - sizeof(WCHAR); + ServiceName.MaximumLength = CapturedServiceName.MaximumLength - LastBackslash - sizeof(WCHAR); + } else - Start++; - - RtlInitUnicodeString(&ServiceName, Start); + { + ServiceName = CapturedServiceName; + } /* * Construct the driver object name */ - ObjectName.Length = ((USHORT)wcslen(Start) + 8) * sizeof(WCHAR); - ObjectName.MaximumLength = ObjectName.Length + sizeof(WCHAR); + Status = RtlUShortAdd(sizeof(DRIVER_ROOT_NAME), + ServiceName.Length, + &ObjectName.MaximumLength); + if (!NT_SUCCESS(Status)) + { + ReleaseCapturedUnicodeString(&CapturedServiceName, PreviousMode); + return Status; + } + ObjectName.Length = 0; ObjectName.Buffer = ExAllocatePoolWithTag(PagedPool, ObjectName.MaximumLength, TAG_IO); @@ -1251,9 +1267,8 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers) ReleaseCapturedUnicodeString(&CapturedServiceName, PreviousMode); return STATUS_INSUFFICIENT_RESOURCES; } - wcscpy(ObjectName.Buffer, DRIVER_ROOT_NAME); - memcpy(ObjectName.Buffer + 8, Start, ObjectName.Length - 8 * sizeof(WCHAR)); - ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = UNICODE_NULL; + NT_VERIFY(NT_SUCCESS(RtlAppendUnicodeToString(&ObjectName, DRIVER_ROOT_NAME))); + NT_VERIFY(NT_SUCCESS(RtlAppendUnicodeStringToString(&ObjectName, &ServiceName))); /* * Find the driver object
4 years, 11 months
1
0
0
0
[reactos] 02/05: [NTOS] Make RtlFindCharInUnicodeString available in the kernel.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2a91ea855a192b429cb74…
commit 2a91ea855a192b429cb7428161205cc845468152 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Dec 29 13:46:15 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Dec 31 15:17:59 2019 +0100 [NTOS] Make RtlFindCharInUnicodeString available in the kernel. --- ntoskrnl/include/internal/rtl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ntoskrnl/include/internal/rtl.h b/ntoskrnl/include/internal/rtl.h index 597134a8b8c..c38886c7cab 100644 --- a/ntoskrnl/include/internal/rtl.h +++ b/ntoskrnl/include/internal/rtl.h @@ -22,4 +22,16 @@ RtlInitializeRangeListPackage( VOID ); +#define RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END 1 +#define RTL_FIND_CHAR_IN_UNICODE_STRING_COMPLEMENT_CHAR_SET 2 +#define RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE 4 +NTSTATUS +NTAPI +RtlFindCharInUnicodeString( + _In_ ULONG Flags, + _In_ PCUNICODE_STRING SearchString, + _In_ PCUNICODE_STRING MatchString, + _Out_ PUSHORT Position +); + /* EOF */
4 years, 11 months
1
0
0
0
[reactos] 01/05: [NDK] RtlFindCharInUnicodeString is only available in user mode.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=053510467f9340e68b1ef…
commit 053510467f9340e68b1ef18c454c544162e2a9a8 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Dec 29 13:44:59 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Dec 31 15:17:53 2019 +0100 [NDK] RtlFindCharInUnicodeString is only available in user mode. --- sdk/include/ndk/rtlfuncs.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/include/ndk/rtlfuncs.h b/sdk/include/ndk/rtlfuncs.h index 005d761ae73..4809b4a0d65 100644 --- a/sdk/include/ndk/rtlfuncs.h +++ b/sdk/include/ndk/rtlfuncs.h @@ -2106,6 +2106,16 @@ RtlDuplicateUnicodeString( _Out_ PUNICODE_STRING DestinationString ); +NTSYSAPI +NTSTATUS +NTAPI +RtlFindCharInUnicodeString( + _In_ ULONG Flags, + _In_ PCUNICODE_STRING SearchString, + _In_ PCUNICODE_STRING MatchString, + _Out_ PUSHORT Position +); + // // Memory Functions // @@ -2165,16 +2175,6 @@ RtlEqualUnicodeString( BOOLEAN CaseInsensitive ); -NTSYSAPI -NTSTATUS -NTAPI -RtlFindCharInUnicodeString( - _In_ ULONG Flags, - _In_ PCUNICODE_STRING SearchString, - _In_ PCUNICODE_STRING MatchString, - _Out_ PUSHORT Position -); - _IRQL_requires_max_(PASSIVE_LEVEL) NTSYSAPI VOID
4 years, 11 months
1
0
0
0
← Newer
1
2
3
4
...
23
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
Results per page:
10
25
50
100
200