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
September 2012
----- 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
17 participants
236 discussions
Start a n
N
ew thread
[tfaber] 57337: [BOOTDATA] - Re-enable /KDSERIAL
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 19 12:51:37 2012 New Revision: 57337 URL:
http://svn.reactos.org/svn/reactos?rev=57337&view=rev
Log: [BOOTDATA] - Re-enable /KDSERIAL 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] Wed Sep 19 12:51:37 2012 @@ -118,7 +118,7 @@ [SetupData] DefaultPath = \ReactOS OsLoadOptions = "/NOGUIBOOT /NODEBUG" -DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /FIRSTCHANCE" +DbgOsLoadOptions = "/NOGUIBOOT /KDSERIAL /DEBUGPORT=COM1 /FIRSTCHANCE" ;DbgOsLoadOptions = "/SOS /DEBUGPORT=SCREEN" ;DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
12 years, 3 months
1
0
0
0
[tfaber] 57336: [BOOTDATA] - Disable /KDSERIAL for a quick test CORE-6678
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 19 12:51:13 2012 New Revision: 57336 URL:
http://svn.reactos.org/svn/reactos?rev=57336&view=rev
Log: [BOOTDATA] - Disable /KDSERIAL for a quick test CORE-6678 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] Wed Sep 19 12:51:13 2012 @@ -118,7 +118,7 @@ [SetupData] DefaultPath = \ReactOS OsLoadOptions = "/NOGUIBOOT /NODEBUG" -DbgOsLoadOptions = "/NOGUIBOOT /KDSERIAL /DEBUGPORT=COM1 /FIRSTCHANCE" +DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /FIRSTCHANCE" ;DbgOsLoadOptions = "/SOS /DEBUGPORT=SCREEN" ;DbgOsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
12 years, 3 months
1
0
0
0
[ekohl] 57335: [LSASRV] Revert accidential changes from r57331.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Sep 19 12:26:22 2012 New Revision: 57335 URL:
http://svn.reactos.org/svn/reactos?rev=57335&view=rev
Log: [LSASRV] Revert accidential changes from r57331. Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.c Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] Wed Sep 19 12:26:22 2012 @@ -32,7 +32,7 @@ /* Start the RPC server */ LsarStartRpcServer(); - DbgPrint("Creating notification event!\n"); + TRACE("Creating notification event!\n"); /* Notify the service manager */ hEvent = CreateEventW(NULL, TRUE, @@ -41,7 +41,7 @@ if (hEvent == NULL) { dwError = GetLastError(); - DbgPrint("Failed to create the notication event (Error %lu)\n", dwError); + TRACE("Failed to create the notication event (Error %lu)\n", dwError); if (dwError == ERROR_ALREADY_EXISTS) { @@ -50,13 +50,13 @@ L"LSA_RPC_SERVER_ACTIVE"); if (hEvent == NULL) { - DbgPrint("Could not open the notification event (Error %lu)\n", GetLastError()); + ERR("Could not open the notification event (Error %lu)\n", GetLastError()); return STATUS_UNSUCCESSFUL; } } } - DbgPrint("Set notification event!\n"); + TRACE("Set notification event!\n"); SetEvent(hEvent); /* NOTE: Do not close the event handle!!!! */
12 years, 3 months
1
0
0
0
[ekohl] 57334: [FORMATTING] Fix indentation and coding style. No code changes!
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Sep 19 12:20:39 2012 New Revision: 57334 URL:
http://svn.reactos.org/svn/reactos?rev=57334&view=rev
Log: [FORMATTING] Fix indentation and coding style. No code changes! Modified: trunk/reactos/lib/rtl/mem.c trunk/reactos/lib/rtl/sd.c trunk/reactos/lib/rtl/security.c trunk/reactos/lib/rtl/sid.c trunk/reactos/lib/rtl/time.c trunk/reactos/lib/rtl/timezone.c trunk/reactos/lib/rtl/version.c trunk/reactos/lib/rtl/wait.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/lib/rtl/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=57334&r1…
Modified: trunk/reactos/lib/rtl/sd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sd.c?rev=57334&r1=…
Modified: trunk/reactos/lib/rtl/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/security.c?rev=573…
Modified: trunk/reactos/lib/rtl/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sid.c?rev=57334&r1…
Modified: trunk/reactos/lib/rtl/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/time.c?rev=57334&r…
Modified: trunk/reactos/lib/rtl/timezone.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/timezone.c?rev=573…
Modified: trunk/reactos/lib/rtl/version.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/version.c?rev=5733…
Modified: trunk/reactos/lib/rtl/wait.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/wait.c?rev=57334&r…
12 years, 3 months
1
0
0
0
[tfaber] 57333: [NTOSKRNL] - Correctly show the amount of available memory in the serial debug log. Patch by Hermès Bélusca (2/2) CORE-6635 #comment Committed. Thanks. #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 19 06:54:42 2012 New Revision: 57333 URL:
http://svn.reactos.org/svn/reactos?rev=57333&view=rev
Log: [NTOSKRNL] - Correctly show the amount of available memory in the serial debug log. Patch by Hermès Bélusca (2/2) CORE-6635 #comment Committed. Thanks. #resolve Modified: trunk/reactos/ntoskrnl/kd/kdio.c Modified: trunk/reactos/ntoskrnl/kd/kdio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdio.c?rev=573…
============================================================================== --- trunk/reactos/ntoskrnl/kd/kdio.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kd/kdio.c [iso-8859-1] Wed Sep 19 06:54:42 2012 @@ -42,6 +42,55 @@ volatile ULONG KdbDmesgTotalWritten = 0; KSPIN_LOCK KdpDmesgLogSpinLock; volatile BOOLEAN KdbpIsInDmesgMode = FALSE; + +/* UTILITY FUNCTIONS *********************************************************/ + +/* + * Get the total size of the memory before + * Mm is initialized, by counting the number + * of physical pages. Useful for debug logging. + * + * Strongly inspired by: + * mm\ARM3\mminit.c : MiScanMemoryDescriptors(...) + */ +SIZE_T +NTAPI +KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PLIST_ENTRY ListEntry; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; + SIZE_T NumberOfPhysicalPages = 0; + + /* Loop the memory descriptors */ + for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink; + ListEntry != &LoaderBlock->MemoryDescriptorListHead; + ListEntry = ListEntry->Flink) + { + /* Get the descriptor */ + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Check if this is invisible memory */ + if ((Descriptor->MemoryType == LoaderFirmwarePermanent) || + (Descriptor->MemoryType == LoaderSpecialMemory) || + (Descriptor->MemoryType == LoaderHALCachedMemory) || + (Descriptor->MemoryType == LoaderBBTMemory)) + { + /* Skip this descriptor */ + continue; + } + + /* Check if this is bad memory */ + if (Descriptor->MemoryType != LoaderBad) + { + /* Count this in the total of pages */ + NumberOfPhysicalPages += Descriptor->PageCount; + } + } + + return NumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; +} /* FILE DEBUG LOG FUNCTIONS **************************************************/ @@ -325,7 +374,7 @@ /* Display separator + ReactOS version at start of the debug log */ DPRINT1("-----------------------------------------------------\n"); DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); - MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; + MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock); DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName,
12 years, 3 months
1
0
0
0
[tfaber] 57332: [NTOSKRNL] - Fix indentation in kdio.c. No code changes. Patch by Hermès Bélusca (1/2) CORE-6635
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 19 06:09:22 2012 New Revision: 57332 URL:
http://svn.reactos.org/svn/reactos?rev=57332&view=rev
Log: [NTOSKRNL] - Fix indentation in kdio.c. No code changes. Patch by Hermès Bélusca (1/2) CORE-6635 Modified: trunk/reactos/ntoskrnl/kd/kdio.c Modified: trunk/reactos/ntoskrnl/kd/kdio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdio.c?rev=573…
============================================================================== --- trunk/reactos/ntoskrnl/kd/kdio.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kd/kdio.c [iso-8859-1] Wed Sep 19 06:09:22 2012 @@ -426,7 +426,7 @@ /* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize); * set num to min(KdpDmesgFreeBytes, Length). */ - num = (Length < KdpDmesgFreeBytes) ? Length : KdpDmesgFreeBytes; + num = (Length < KdpDmesgFreeBytes) ? Length : KdpDmesgFreeBytes; beg = KdpDmesgCurrentPosition; if (num != 0) { @@ -477,36 +477,36 @@ } else if (BootPhase == 1) { - /* Allocate a buffer for dmesg log buffer. +1 for terminating null, - * see kdbp_cli.c:KdbpCmdDmesg()/2 - */ - KdpDmesgBuffer = ExAllocatePool(NonPagedPool, KdpDmesgBufferSize + 1); - RtlZeroMemory(KdpDmesgBuffer, KdpDmesgBufferSize + 1); - KdpDmesgFreeBytes = KdpDmesgBufferSize; - KdbDmesgTotalWritten = 0; - - /* Take control of the display */ - InbvAcquireDisplayOwnership(); - InbvResetDisplay(); - InbvSolidColorFill(0, 0, 639, 479, 0); - InbvSetTextColor(15); - InbvSetScrollRegion(0, 0, 639, 479); - InbvInstallDisplayStringFilter(NULL); - InbvEnableDisplayString(TRUE); - - /* Initialize spinlock */ - KeInitializeSpinLock(&KdpDmesgLogSpinLock); - - /* Display separator + ReactOS version at start of the debug log */ - DPRINT1("-----------------------------------------------------\n"); - DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); - MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; - DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); - DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); - DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, - KeLoaderBlock->NtHalPathName, - KeLoaderBlock->ArcHalDeviceName, - KeLoaderBlock->NtBootPathName); + /* Allocate a buffer for dmesg log buffer. +1 for terminating null, + * see kdbp_cli.c:KdbpCmdDmesg()/2 + */ + KdpDmesgBuffer = ExAllocatePool(NonPagedPool, KdpDmesgBufferSize + 1); + RtlZeroMemory(KdpDmesgBuffer, KdpDmesgBufferSize + 1); + KdpDmesgFreeBytes = KdpDmesgBufferSize; + KdbDmesgTotalWritten = 0; + + /* Take control of the display */ + InbvAcquireDisplayOwnership(); + InbvResetDisplay(); + InbvSolidColorFill(0, 0, 639, 479, 0); + InbvSetTextColor(15); + InbvSetScrollRegion(0, 0, 639, 479); + InbvInstallDisplayStringFilter(NULL); + InbvEnableDisplayString(TRUE); + + /* Initialize spinlock */ + KeInitializeSpinLock(&KdpDmesgLogSpinLock); + + /* Display separator + ReactOS version at start of the debug log */ + DPRINT1("-----------------------------------------------------\n"); + DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); + MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; + DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); + DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); + DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, + KeLoaderBlock->NtHalPathName, + KeLoaderBlock->ArcHalDeviceName, + KeLoaderBlock->NtBootPathName); } else if (BootPhase == 2) {
12 years, 3 months
1
0
0
0
[ion] 57331: [RTL]: Cleanup all the ACL functions. Mostly refactoring, commenting and styling, but there are a few important changes. First, RtlValidateAcl actually does the whole ACL validation al...
by ion@svn.reactos.org
Author: ion Date: Wed Sep 19 02:32:58 2012 New Revision: 57331 URL:
http://svn.reactos.org/svn/reactos?rev=57331&view=rev
Log: [RTL]: Cleanup all the ACL functions. Mostly refactoring, commenting and styling, but there are a few important changes. First, RtlValidateAcl actually does the whole ACL validation algorithm. Second, mandatory label ACEs are not supported, because we shouldn't lie about Vista features in ntdll/kernel code. Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/dll/win32/advapi32/advapi32.spec trunk/reactos/dll/win32/advapi32/sec/ac.c trunk/reactos/dll/win32/lsasrv/lsasrv.c trunk/reactos/lib/rtl/acl.c Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Wed Sep 19 02:32:58 2012 @@ -435,7 +435,7 @@ ;@ stdcall RtlAddCompoundAce ;@ stdcall RtlAddRange ; 5.0 and 5.1 only @ stdcall -arch=x86_64 RtlAddFunctionTable(ptr long long) -@ stdcall RtlAddMandatoryAce(ptr long long long long ptr) +;@ stdcall RtlAddMandatoryAce(ptr long long long long ptr) @ stdcall RtlAddRefActivationContext(ptr) ;@ stdcall RtlAddRefMemoryStream @ stdcall RtlAddVectoredContinueHandler(long ptr) Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
============================================================================== --- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Wed Sep 19 02:32:58 2012 @@ -24,7 +24,7 @@ @ stdcall AddAuditAccessAce(ptr long long ptr long long) @ stdcall AddAuditAccessAceEx(ptr long long long ptr long long) @ stdcall AddAuditAccessObjectAce(ptr long long long ptr ptr ptr long long) -@ stdcall AddMandatoryAce(ptr long long long ptr) +;@ stdcall AddMandatoryAce(ptr long long long ptr) @ stdcall AddUsersToEncryptedFile(wstr ptr) @ stdcall AdjustTokenGroups(long long ptr long ptr ptr) @ stdcall AdjustTokenPrivileges(long long ptr long ptr ptr) Modified: trunk/reactos/dll/win32/advapi32/sec/ac.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/ac.…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/ac.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/ac.c [iso-8859-1] Wed Sep 19 02:32:58 2012 @@ -393,36 +393,6 @@ return TRUE; } - - -/* - * @implemented - */ -BOOL -WINAPI -AddMandatoryAce(IN OUT PACL pAcl, - IN DWORD dwAceRevision, - IN DWORD AceFlags, - IN DWORD MandatoryPolicy, - IN PSID pLabelSid) -{ - NTSTATUS Status; - - Status = RtlAddMandatoryAce(pAcl, - dwAceRevision, - AceFlags, - MandatoryPolicy, - SYSTEM_MANDATORY_LABEL_ACE_TYPE, - pLabelSid); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - /* * @implemented Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] Wed Sep 19 02:32:58 2012 @@ -32,7 +32,7 @@ /* Start the RPC server */ LsarStartRpcServer(); - TRACE("Creating notification event!\n"); + DbgPrint("Creating notification event!\n"); /* Notify the service manager */ hEvent = CreateEventW(NULL, TRUE, @@ -41,7 +41,7 @@ if (hEvent == NULL) { dwError = GetLastError(); - TRACE("Failed to create the notication event (Error %lu)\n", dwError); + DbgPrint("Failed to create the notication event (Error %lu)\n", dwError); if (dwError == ERROR_ALREADY_EXISTS) { @@ -50,13 +50,13 @@ L"LSA_RPC_SERVER_ACTIVE"); if (hEvent == NULL) { - ERR("Could not open the notification event (Error %lu)\n", GetLastError()); + DbgPrint("Could not open the notification event (Error %lu)\n", GetLastError()); return STATUS_UNSUCCESSFUL; } } } - TRACE("Set notification event!\n"); + DbgPrint("Set notification event!\n"); SetEvent(hEvent); /* NOTE: Do not close the event handle!!!! */ Modified: trunk/reactos/lib/rtl/acl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/acl.c?rev=57331&r1…
============================================================================== --- trunk/reactos/lib/rtl/acl.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/acl.c [iso-8859-1] Wed Sep 19 02:32:58 2012 @@ -8,885 +8,958 @@ /* INCLUDES *****************************************************************/ #include <rtl.h> - +#include <../../ntoskrnl/include/internal/se.h> #define NDEBUG #include <debug.h> -/* FUNCTIONS ***************************************************************/ +/* PRIVATE FUNCTIONS **********************************************************/ BOOLEAN NTAPI -RtlFirstFreeAce( - PACL Acl, - PACE* Ace) +RtlFirstFreeAce(IN PACL Acl, + OUT PACE* FirstFreeAce) { PACE Current; ULONG_PTR AclEnd; ULONG i; PAGED_CODE_RTL(); + /* Assume failure */ + *FirstFreeAce = NULL; + + /* Get the start and end pointers */ Current = (PACE)(Acl + 1); - *Ace = NULL; - - if (Acl->AceCount == 0) - { - *Ace = Current; - return TRUE; - } - - i = 0; AclEnd = (ULONG_PTR)Acl + Acl->AclSize; - do - { - if ((ULONG_PTR)Current >= AclEnd) - { - return FALSE; - } - if (Current->Header.AceType == ACCESS_ALLOWED_COMPOUND_ACE_TYPE && - Acl->AclRevision < ACL_REVISION3) - { - return FALSE; - } + + /* Loop all the ACEs */ + for (i = 0; i < Acl->AceCount; i++) + { + /* If any is beyond the DACL, bail out, otherwise keep going */ + if ((ULONG_PTR)Current >= AclEnd) return FALSE; Current = (PACE)((ULONG_PTR)Current + Current->Header.AceSize); } - while (++i < Acl->AceCount); - - if ((ULONG_PTR)Current < AclEnd) - { - *Ace = Current; - } - + + /* If the last spot is empty and still valid, return it */ + if ((ULONG_PTR)Current < AclEnd) *FirstFreeAce = Current; return TRUE; } - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlGetAce( - PACL Acl, - ULONG AceIndex, - PVOID *Ace) +VOID +NTAPI +RtlpAddData(IN PVOID AceList, + IN ULONG AceListLength, + IN PVOID Ace, + IN ULONG Offset) +{ + /* Shift the buffer down */ + if (Offset > 0) + { + RtlCopyMemory((PVOID)((ULONG_PTR)Ace + AceListLength), + Ace, + Offset); + } + + /* Copy the new data in */ + if (AceListLength) RtlCopyMemory(Ace, AceList, AceListLength); +} + +VOID +NTAPI +RtlpDeleteData(IN PVOID Ace, + IN ULONG AceSize, + IN ULONG Offset) +{ + /* Move the data up */ + if (AceSize < Offset) + { + RtlMoveMemory(Ace, + (PVOID)((ULONG_PTR)Ace + AceSize), + Offset - AceSize); + } + + /* Zero the rest */ + if ((Offset - AceSize) < Offset) + { + RtlZeroMemory((PVOID)((ULONG_PTR)Ace + Offset - AceSize), AceSize); + } +} + +NTSTATUS +NTAPI +RtlpAddKnownAce(IN PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN PSID Sid, + IN UCHAR Type) +{ + PKNOWN_ACE Ace; + ULONG AceSize, InvalidFlags; + PAGED_CODE_RTL(); + + /* Check the validity of the SID */ + if (!RtlValidSid(Sid)) return STATUS_INVALID_SID; + + /* Check the validity of the revision */ + if ((Acl->AclRevision > ACL_REVISION4) || (Revision > ACL_REVISION4)) + { + return STATUS_REVISION_MISMATCH; + } + + /* Pick the smallest of the revisions */ + if (Revision < Acl->AclRevision) Revision = Acl->AclRevision; + + /* Validate the flags */ + if (Type == SYSTEM_AUDIT_ACE_TYPE) + { + InvalidFlags = Flags & ~(VALID_INHERIT_FLAGS | + SUCCESSFUL_ACCESS_ACE_FLAG | + FAILED_ACCESS_ACE_FLAG); + } + else + { + InvalidFlags = Flags & ~VALID_INHERIT_FLAGS; + } + + /* If flags are invalid, bail out */ + if (InvalidFlags != 0) return STATUS_INVALID_PARAMETER; + + /* If ACL is invalid, bail out */ + if (!RtlValidAcl(Acl)) return STATUS_INVALID_ACL; + + /* If there's no free ACE, bail out */ + if (!RtlFirstFreeAce(Acl, (PACE*)&Ace)) return STATUS_INVALID_ACL; + + /* Calculate the size of the ACE and bail out if it's too small */ + AceSize = RtlLengthSid(Sid) + sizeof(ACE); + if (!(Ace) || ((ULONG_PTR)Ace + AceSize > (ULONG_PTR)Acl + Acl->AclSize)) + { + return STATUS_ALLOTTED_SPACE_EXCEEDED; + } + + /* Initialize the header and common fields */ + Ace->Header.AceFlags = (BYTE)Flags; + Ace->Header.AceType = Type; + Ace->Header.AceSize = (WORD)AceSize; + Ace->Mask = AccessMask; + + /* Copy the SID */ + RtlCopySid(RtlLengthSid(Sid), &Ace->SidStart, Sid); + + /* Fill out the ACL header and return */ + Acl->AceCount++; + Acl->AclRevision = (BYTE)Revision; + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +RtlpAddKnownObjectAce(IN PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN GUID *ObjectTypeGuid OPTIONAL, + IN GUID *InheritedObjectTypeGuid OPTIONAL, + IN PSID Sid, + IN UCHAR Type) +{ + PKNOWN_OBJECT_ACE Ace; + ULONG_PTR SidStart; + ULONG AceSize, InvalidFlags, AceObjectFlags = 0; + PAGED_CODE_RTL(); + + /* Check the validity of the SID */ + if (!RtlValidSid(Sid)) return STATUS_INVALID_SID; + + /* Check the validity of the revision */ + if ((Acl->AclRevision > ACL_REVISION4) || (Revision > ACL_REVISION4)) + { + return STATUS_REVISION_MISMATCH; + } + + /* Pick the smallest of the revisions */ + if (Revision < Acl->AclRevision) Revision = Acl->AclRevision; + + /* Validate the flags */ + if ((Type == SYSTEM_AUDIT_OBJECT_ACE_TYPE) || + (Type == SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE)) + { + InvalidFlags = Flags & ~(VALID_INHERIT_FLAGS | + SUCCESSFUL_ACCESS_ACE_FLAG | FAILED_ACCESS_ACE_FLAG); + } + else + { + InvalidFlags = Flags & ~VALID_INHERIT_FLAGS; + } + + /* If flags are invalid, bail out */ + if (InvalidFlags != 0) return STATUS_INVALID_PARAMETER; + + /* If ACL is invalid, bail out */ + if (!RtlValidAcl(Acl)) return STATUS_INVALID_ACL; + + /* If there's no free ACE, bail out */ + if (!RtlFirstFreeAce(Acl, (PACE*)&Ace)) return STATUS_INVALID_ACL; + + /* Calculate the size of the ACE */ + AceSize = RtlLengthSid(Sid) + sizeof(ACE) + sizeof(ULONG); + + /* Add-in the size of the GUIDs if any and update flags as needed */ + if (ObjectTypeGuid) + { + AceObjectFlags |= ACE_OBJECT_TYPE_PRESENT; + AceSize += sizeof(GUID); + } + if (InheritedObjectTypeGuid) + { + AceObjectFlags |= ACE_INHERITED_OBJECT_TYPE_PRESENT; + AceSize += sizeof(GUID); + } + + /* Bail out if there's not enough space in the ACL */ + if (!(Ace) || ((ULONG_PTR)Ace + AceSize > (ULONG_PTR)Acl + Acl->AclSize)) + { + return STATUS_ALLOTTED_SPACE_EXCEEDED; + } + + /* Initialize the header and common fields */ + Ace->Header.AceFlags = (BYTE)Flags; + Ace->Header.AceType = Type; + Ace->Header.AceSize = (WORD)AceSize; + Ace->Mask = AccessMask; + Ace->Flags = AceObjectFlags; + + /* Copy the GUIDs */ + SidStart = (ULONG_PTR)&Ace->SidStart; + if (ObjectTypeGuid ) + { + RtlCopyMemory((PVOID)SidStart, ObjectTypeGuid, sizeof(GUID)); + SidStart += sizeof(GUID); + } + if (InheritedObjectTypeGuid) + { + RtlCopyMemory((PVOID)SidStart, InheritedObjectTypeGuid, sizeof(GUID)); + SidStart += sizeof(GUID); + } + + /* Copy the SID */ + RtlCopySid(RtlLengthSid(Sid), (PSID)SidStart, Sid); + + /* Fill out the ACL header and return */ + Acl->AceCount++; + Acl->AclRevision = (BYTE)Revision; + return STATUS_SUCCESS; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessAllowedAce(IN OUT PACL Acl, + IN ULONG Revision, + IN ACCESS_MASK AccessMask, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Call the worker function */ + return RtlpAddKnownAce(Acl, + Revision, + 0, + AccessMask, + Sid, + ACCESS_ALLOWED_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessAllowedAceEx(IN OUT PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Call the worker function */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + ACCESS_ALLOWED_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessAllowedObjectAce(IN OUT PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN GUID *ObjectTypeGuid OPTIONAL, + IN GUID *InheritedObjectTypeGuid OPTIONAL, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Is there no object data? */ + if (!(ObjectTypeGuid) && !(InheritedObjectTypeGuid)) + { + /* Use the usual routine */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + ACCESS_ALLOWED_ACE_TYPE); + } + + /* Use the object routine */ + return RtlpAddKnownObjectAce(Acl, + Revision, + Flags, + AccessMask, + ObjectTypeGuid, + InheritedObjectTypeGuid, + Sid, + ACCESS_ALLOWED_OBJECT_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessDeniedAce(IN PACL Acl, + IN ULONG Revision, + IN ACCESS_MASK AccessMask, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Call the worker function */ + return RtlpAddKnownAce(Acl, + Revision, + 0, + AccessMask, + Sid, + ACCESS_DENIED_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessDeniedAceEx(IN OUT PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Call the worker function */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + ACCESS_DENIED_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAccessDeniedObjectAce(IN OUT PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN GUID *ObjectTypeGuid OPTIONAL, + IN GUID *InheritedObjectTypeGuid OPTIONAL, + IN PSID Sid) +{ + PAGED_CODE_RTL(); + + /* Is there no object data? */ + if (!(ObjectTypeGuid) && !(InheritedObjectTypeGuid)) + { + /* Use the usual routine */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + ACCESS_DENIED_ACE_TYPE); + } + + /* There's object data, use the object routine */ + return RtlpAddKnownObjectAce(Acl, + Revision, + Flags, + AccessMask, + ObjectTypeGuid, + InheritedObjectTypeGuid, + Sid, + ACCESS_DENIED_OBJECT_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAuditAccessAce(IN PACL Acl, + IN ULONG Revision, + IN ACCESS_MASK AccessMask, + IN PSID Sid, + IN BOOLEAN Success, + IN BOOLEAN Failure) +{ + ULONG Flags = 0; + PAGED_CODE_RTL(); + + /* Add flags */ + if (Success) Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; + if (Failure) Flags |= FAILED_ACCESS_ACE_FLAG; + + /* Call the worker routine */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + SYSTEM_AUDIT_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAuditAccessAceEx(IN PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN PSID Sid, + IN BOOLEAN Success, + IN BOOLEAN Failure) +{ + PAGED_CODE_RTL(); + + /* Add flags */ + if (Success) Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; + if (Failure) Flags |= FAILED_ACCESS_ACE_FLAG; + + /* Call the worker routine */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + SYSTEM_AUDIT_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAuditAccessObjectAce(IN PACL Acl, + IN ULONG Revision, + IN ULONG Flags, + IN ACCESS_MASK AccessMask, + IN GUID *ObjectTypeGuid OPTIONAL, + IN GUID *InheritedObjectTypeGuid OPTIONAL, + IN PSID Sid, + IN BOOLEAN Success, + IN BOOLEAN Failure) +{ + /* Add flags */ + if (Success) Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; + if (Failure) Flags |= FAILED_ACCESS_ACE_FLAG; + + /* Is there no object data? */ + if (!(ObjectTypeGuid) && !(InheritedObjectTypeGuid)) + { + /* Call the normal routine */ + return RtlpAddKnownAce(Acl, + Revision, + Flags, + AccessMask, + Sid, + SYSTEM_AUDIT_ACE_TYPE); + } + + /* There's object data, use the object routine */ + return RtlpAddKnownObjectAce(Acl, + Revision, + Flags, + AccessMask, + ObjectTypeGuid, + InheritedObjectTypeGuid, + Sid, + SYSTEM_AUDIT_OBJECT_ACE_TYPE); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlGetAce(IN PACL Acl, + IN ULONG AceIndex, + OUT PVOID *Ace) { ULONG i; PAGED_CODE_RTL(); - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION || - AceIndex >= Acl->AceCount) + /* Bail out if the revision or the index are invalid */ + if ((Acl->AclRevision < MIN_ACL_REVISION) || + (Acl->AclRevision > MAX_ACL_REVISION) || + (AceIndex >= Acl->AceCount)) { return STATUS_INVALID_PARAMETER; } + /* Loop through the ACEs */ *Ace = (PVOID)((PACE)(Acl + 1)); - for (i = 0; i < AceIndex; i++) { + /* Bail out if an invalid ACE is ever found */ if ((ULONG_PTR)*Ace >= (ULONG_PTR)Acl + Acl->AclSize) { return STATUS_INVALID_PARAMETER; } + + /* Keep going */ *Ace = (PVOID)((PACE)((ULONG_PTR)(*Ace) + ((PACE)(*Ace))->Header.AceSize)); } + /* Check if the last ACE is still valid */ if ((ULONG_PTR)*Ace >= (ULONG_PTR)Acl + Acl->AclSize) { return STATUS_INVALID_PARAMETER; } + /* All good, return */ return STATUS_SUCCESS; } - -static -NTSTATUS -RtlpAddKnownAce( - PACL Acl, - ULONG Revision, - ULONG Flags, - ACCESS_MASK AccessMask, - GUID *ObjectTypeGuid OPTIONAL, - GUID *InheritedObjectTypeGuid OPTIONAL, - PSID Sid, - UCHAR Type) -{ - PACE Ace; - PSID SidStart; - ULONG AceSize, InvalidFlags; - ULONG AceObjectFlags = 0; - PAGED_CODE_RTL(); - -#if DBG - /* check if RtlpAddKnownAce was called incorrectly */ - if (ObjectTypeGuid != NULL || InheritedObjectTypeGuid != NULL) - { - ASSERT(Type == ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE || - Type == ACCESS_ALLOWED_OBJECT_ACE_TYPE || - Type == ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE || - Type == ACCESS_DENIED_OBJECT_ACE_TYPE || - Type == SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE || - Type == SYSTEM_AUDIT_OBJECT_ACE_TYPE); - } - else - { - ASSERT(Type != ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE && - Type != ACCESS_ALLOWED_OBJECT_ACE_TYPE && - Type != ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE && - Type != ACCESS_DENIED_OBJECT_ACE_TYPE && - Type != SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE && - Type != SYSTEM_AUDIT_OBJECT_ACE_TYPE); - } -#endif - - if (!RtlValidSid(Sid)) - { - return STATUS_INVALID_SID; - } - - if (Type == SYSTEM_MANDATORY_LABEL_ACE_TYPE) - { - static const SID_IDENTIFIER_AUTHORITY MandatoryLabelAuthority = {SECURITY_MANDATORY_LABEL_AUTHORITY}; - - /* The SID's identifier authority must be SECURITY_MANDATORY_LABEL_AUTHORITY! */ - if (RtlCompareMemory(&((PISID)Sid)->IdentifierAuthority, - &MandatoryLabelAuthority, - sizeof(MandatoryLabelAuthority)) != sizeof(MandatoryLabelAuthority)) +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlAddAce(IN PACL Acl, + IN ULONG AclRevision, + IN ULONG StartingIndex, + IN PVOID AceList, + IN ULONG AceListLength) +{ + PACE Ace, FreeAce; + USHORT NewAceCount; + ULONG Index; + PAGED_CODE_RTL(); + + /* Bail out if the ACL is invalid */ + if (!RtlValidAcl(Acl)) return STATUS_INVALID_PARAMETER; + + /* Bail out if there's no space */ + if (!RtlFirstFreeAce(Acl, &FreeAce)) return STATUS_INVALID_PARAMETER; + + /* Always use the smaller revision */ + if (Acl->AclRevision <= AclRevision) AclRevision = Acl->AclRevision; + + /* Loop over all the ACEs, keeping track of new ACEs as we go along */ + for (Ace = AceList, NewAceCount = 0; + Ace < (PACE)((ULONG_PTR)AceList + AceListLength); + NewAceCount++) + { + /* Make sure that the revision of this ACE is valid in this list */ + if (Ace->Header.AceType <= ACCESS_MAX_MS_V3_ACE_TYPE) { - return STATUS_INVALID_PARAMETER; + if (AclRevision < ACL_REVISION3) return STATUS_INVALID_PARAMETER; } - } - - if (Acl->AclRevision > MAX_ACL_REVISION || - Revision > MAX_ACL_REVISION) - { - return STATUS_UNKNOWN_REVISION; - } - - if (Revision < Acl->AclRevision) - { - Revision = Acl->AclRevision; - } - - /* Validate the flags */ - if (Type == SYSTEM_AUDIT_ACE_TYPE || - Type == SYSTEM_AUDIT_OBJECT_ACE_TYPE || - Type == SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE) - { - InvalidFlags = Flags & ~(VALID_INHERIT_FLAGS | - SUCCESSFUL_ACCESS_ACE_FLAG | FAILED_ACCESS_ACE_FLAG); - } - else - { - InvalidFlags = Flags & ~VALID_INHERIT_FLAGS; - } - - if (InvalidFlags != 0) + else if (Ace->Header.AceType <= ACCESS_MAX_MS_V4_ACE_TYPE) + { + if (AclRevision < ACL_REVISION4) return STATUS_INVALID_PARAMETER; + } + + /* Move to the next ACE */ + Ace = (PACE)((ULONG_PTR)Ace + Ace->Header.AceSize); + } + + /* Bail out if there's no more space for us */ + if ((ULONG_PTR)Ace > ((ULONG_PTR)AceList + AceListLength)) { return STATUS_INVALID_PARAMETER; } - if (!RtlFirstFreeAce(Acl, &Ace)) - { - return STATUS_INVALID_ACL; - } - if (Ace == NULL) - { - return STATUS_ALLOTTED_SPACE_EXCEEDED; - } - - /* Calculate the size of the ACE */ - AceSize = RtlLengthSid(Sid) + sizeof(ACE); - if (ObjectTypeGuid != NULL) - { - AceObjectFlags |= ACE_OBJECT_TYPE_PRESENT; - AceSize += sizeof(GUID); - } - if (InheritedObjectTypeGuid != NULL) - { - AceObjectFlags |= ACE_INHERITED_OBJECT_TYPE_PRESENT; - AceSize += sizeof(GUID); - } - - if (AceObjectFlags != 0) - { - /* Don't forget the ACE object flags - (corresponds to the Flags field in the *_OBJECT_ACE structures) */ - AceSize += sizeof(ULONG); - } - - if ((ULONG_PTR)Ace + AceSize > - (ULONG_PTR)Acl + Acl->AclSize) - { - return STATUS_ALLOTTED_SPACE_EXCEEDED; - } - - /* initialize the header and common fields */ - Ace->Header.AceFlags = (BYTE)Flags; - Ace->Header.AceType = Type; - Ace->Header.AceSize = (WORD)AceSize; - Ace->AccessMask = AccessMask; - - if (AceObjectFlags != 0) - { - /* Write the ACE flags to the ACE - (corresponds to the Flags field in the *_OBJECT_ACE structures) */ - *(PULONG)(Ace + 1) = AceObjectFlags; - SidStart = (PSID)((ULONG_PTR)(Ace + 1) + sizeof(ULONG)); - } - else - SidStart = (PSID)(Ace + 1); - - /* copy the GUIDs */ - if (ObjectTypeGuid != NULL) - { - RtlCopyMemory(SidStart, ObjectTypeGuid, sizeof(GUID)); - SidStart = (PSID)((ULONG_PTR)SidStart + sizeof(GUID)); - } - if (InheritedObjectTypeGuid != NULL) - { - RtlCopyMemory(SidStart, InheritedObjectTypeGuid, sizeof(GUID)); - SidStart = (PSID)((ULONG_PTR)SidStart + sizeof(GUID)); - } - - /* copy the SID */ - RtlCopySid(RtlLengthSid(Sid), SidStart, Sid); - Acl->AceCount++; - Acl->AclRevision = (BYTE)Revision; - - return STATUS_SUCCESS; -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessAllowedAce( - IN OUT PACL Acl, - IN ULONG Revision, - IN ACCESS_MASK AccessMask, - IN PSID Sid) -{ - PAGED_CODE_RTL(); - - return RtlpAddKnownAce(Acl, - Revision, - 0, - AccessMask, - NULL, - NULL, - Sid, - ACCESS_ALLOWED_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessAllowedAceEx( - IN OUT PACL Acl, - IN ULONG Revision, - IN ULONG Flags, - IN ACCESS_MASK AccessMask, - IN PSID Sid) -{ - PAGED_CODE_RTL(); - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - NULL, - NULL, - Sid, - ACCESS_ALLOWED_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessAllowedObjectAce( - IN OUT PACL Acl, - IN ULONG Revision, - IN ULONG Flags, - IN ACCESS_MASK AccessMask, - IN GUID *ObjectTypeGuid OPTIONAL, - IN GUID *InheritedObjectTypeGuid OPTIONAL, - IN PSID Sid) -{ - UCHAR Type; - PAGED_CODE_RTL(); - - /* make sure we call RtlpAddKnownAce correctly */ - if (ObjectTypeGuid != NULL || InheritedObjectTypeGuid != NULL) - Type = ACCESS_ALLOWED_OBJECT_ACE_TYPE; - else - Type = ACCESS_ALLOWED_ACE_TYPE; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - ObjectTypeGuid, - InheritedObjectTypeGuid, - Sid, - Type); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessDeniedAce( - PACL Acl, - ULONG Revision, - ACCESS_MASK AccessMask, - PSID Sid) -{ - PAGED_CODE_RTL(); - - return RtlpAddKnownAce(Acl, - Revision, - 0, - AccessMask, - NULL, - NULL, - Sid, - ACCESS_DENIED_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessDeniedAceEx( - IN OUT PACL Acl, - IN ULONG Revision, - IN ULONG Flags, - IN ACCESS_MASK AccessMask, - IN PSID Sid) -{ - PAGED_CODE_RTL(); - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - NULL, - NULL, - Sid, - ACCESS_DENIED_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAccessDeniedObjectAce( - IN OUT PACL Acl, - IN ULONG Revision, - IN ULONG Flags, - IN ACCESS_MASK AccessMask, - IN GUID *ObjectTypeGuid OPTIONAL, - IN GUID *InheritedObjectTypeGuid OPTIONAL, - IN PSID Sid) -{ - UCHAR Type; - PAGED_CODE_RTL(); - - /* make sure we call RtlpAddKnownAce correctly */ - if (ObjectTypeGuid != NULL || InheritedObjectTypeGuid != NULL) - Type = ACCESS_DENIED_OBJECT_ACE_TYPE; - else - Type = ACCESS_DENIED_ACE_TYPE; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - ObjectTypeGuid, - InheritedObjectTypeGuid, - Sid, - Type); -} - - -static -VOID -RtlpAddData( - PVOID AceList, - ULONG AceListLength, - PVOID Ace, - ULONG Offset) -{ - if (Offset > 0) - { - RtlCopyMemory((PVOID)((ULONG_PTR)Ace + AceListLength), - Ace, - Offset); - } - - if (AceListLength != 0) - { - RtlCopyMemory(Ace, AceList, AceListLength); - } -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAce( - PACL Acl, - ULONG AclRevision, - ULONG StartingIndex, - PVOID AceList, - ULONG AceListLength) -{ - PACE Ace; - PACE Current; - WORD NewAceCount; - ULONG Index; - PAGED_CODE_RTL(); - - /* Make sure, the ACL is valid */ - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION || - !RtlFirstFreeAce(Acl, &Ace)) - { - return STATUS_INVALID_PARAMETER; - } - - /* Check if the ACL revision is smaller than the given one */ - if (Acl->AclRevision <= AclRevision) - { - /* Update the revision to the given one */ - AclRevision = Acl->AclRevision; - } - - if (((ULONG_PTR)AceList + AceListLength) <= (ULONG_PTR)AceList) - { - return STATUS_INVALID_PARAMETER; - } - - for (Current = AceList, NewAceCount = 0; - (ULONG_PTR)Current < ((ULONG_PTR)AceList + AceListLength); - Current = (PACE)((ULONG_PTR)Current + Current->Header.AceSize), - ++NewAceCount) - { - if (((PACE)AceList)->Header.AceType == ACCESS_ALLOWED_COMPOUND_ACE_TYPE && - AclRevision < ACL_REVISION3) - { - return STATUS_INVALID_PARAMETER; - } - } - - if (Ace == NULL || - ((ULONG_PTR)Ace + AceListLength) > ((ULONG_PTR)Acl + Acl->AclSize)) + /* Bail out if there's no free ACE spot, or if we would overflow it */ + if (!(FreeAce) || + ((ULONG_PTR)FreeAce + AceListLength > (ULONG_PTR)Acl + Acl->AclSize)) { return STATUS_BUFFER_TOO_SMALL; } - Current = (PACE)(Acl + 1); - for (Index = 0; Index < StartingIndex && Index < Acl->AceCount; Index++) - { - Current = (PACE)((ULONG_PTR)Current + Current->Header.AceSize); - } - + /* Go down the list until we find our index */ + Ace = (PACE)(Acl + 1); + for (Index = 0; (Index < StartingIndex) && (Index < Acl->AceCount); Index++) + { + Ace = (PACE)((ULONG_PTR)Ace + Ace->Header.AceSize); + } + + /* Found where we want to do, add us to the list */ RtlpAddData(AceList, AceListLength, - Current, - (ULONG)((ULONG_PTR)Ace - (ULONG_PTR)Current)); - + Ace, + (ULONG_PTR)FreeAce - (ULONG_PTR)Ace); + + /* Fill out the header and return */ Acl->AceCount = Acl->AceCount + NewAceCount; - Acl->AclRevision = (BYTE)AclRevision; - + Acl->AclRevision = (UCHAR)AclRevision; return STATUS_SUCCESS; } - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAuditAccessAce( - PACL Acl, - ULONG Revision, - ACCESS_MASK AccessMask, - PSID Sid, - BOOLEAN Success, - BOOLEAN Failure) -{ - ULONG Flags = 0; - PAGED_CODE_RTL(); - - if (Success) Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; - if (Failure) Flags |= FAILED_ACCESS_ACE_FLAG; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - NULL, - NULL, - Sid, - SYSTEM_AUDIT_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAuditAccessAceEx( - PACL Acl, - ULONG Revision, - ULONG Flags, - ACCESS_MASK AccessMask, - PSID Sid, - BOOLEAN Success, - BOOLEAN Failure) -{ - if (Success) Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; - if (Failure) Flags |= FAILED_ACCESS_ACE_FLAG; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - NULL, - NULL, - Sid, - SYSTEM_AUDIT_ACE_TYPE); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddAuditAccessObjectAce( - PACL Acl, - ULONG Revision, - ULONG Flags, - ACCESS_MASK AccessMask, - IN GUID *ObjectTypeGuid OPTIONAL, - IN GUID *InheritedObjectTypeGuid OPTIONAL, - PSID Sid, - BOOLEAN Success, - BOOLEAN Failure) -{ - UCHAR Type; - - if (Success) - { - Flags |= SUCCESSFUL_ACCESS_ACE_FLAG; - } - - if (Failure) - { - Flags |= FAILED_ACCESS_ACE_FLAG; - } - - /* make sure we call RtlpAddKnownAce correctly */ - if (ObjectTypeGuid != NULL || InheritedObjectTypeGuid != NULL) - Type = SYSTEM_AUDIT_OBJECT_ACE_TYPE; - else - Type = SYSTEM_AUDIT_ACE_TYPE; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - AccessMask, - ObjectTypeGuid, - InheritedObjectTypeGuid, - Sid, - Type); -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlAddMandatoryAce( - IN OUT PACL Acl, - IN ULONG Revision, - IN ULONG Flags, - IN ULONG MandatoryFlags, - IN UCHAR AceType, - IN PSID LabelSid) -{ - if (MandatoryFlags & ~SYSTEM_MANDATORY_LABEL_VALID_MASK) +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlDeleteAce(IN PACL Acl, + IN ULONG AceIndex) +{ + PACE FreeAce, Ace; + PAGED_CODE_RTL(); + + /* Bail out if the ACL is invalid */ + if (!RtlValidAcl(Acl)) return STATUS_INVALID_PARAMETER; + + /* Bail out if there's no space or if we're full */ + if ((Acl->AceCount <= AceIndex) || !(RtlFirstFreeAce(Acl, &FreeAce))) + { return STATUS_INVALID_PARAMETER; - - if (AceType != SYSTEM_MANDATORY_LABEL_ACE_TYPE) + } + + /* Enumerate until the indexed ACE is reached */ + Ace = (PACE)(Acl + 1); + while (AceIndex--) Ace = (PACE)((ULONG_PTR)Ace + Ace->Header.AceSize); + + /* Delete this ACE */ + RtlpDeleteData(Ace, + Ace->Header.AceSize, + (ULONG)((ULONG_PTR)FreeAce - (ULONG_PTR)Ace)); + + /* Decrease an ACE and return success */ + Acl->AceCount--; + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlCreateAcl(IN PACL Acl, + IN ULONG AclSize, + IN ULONG AclRevision) +{ + PAGED_CODE_RTL(); + + /* Bail out if too small */ + if (AclSize < sizeof(ACL)) return STATUS_BUFFER_TOO_SMALL; + + /* Bail out if too large or invalid revision */ + if ((AclRevision < MIN_ACL_REVISION) || + (AclRevision > MAX_ACL_REVISION) || + (AclSize > MAXUSHORT)) + { return STATUS_INVALID_PARAMETER; - - return RtlpAddKnownAce(Acl, - Revision, - Flags, - (ACCESS_MASK)MandatoryFlags, - NULL, - NULL, - LabelSid, - AceType); -} - - -static -VOID -RtlpDeleteData( - PVOID Ace, - ULONG AceSize, - ULONG Offset) -{ - if (AceSize < Offset) - { - RtlMoveMemory(Ace, - (PVOID)((ULONG_PTR)Ace + AceSize), - Offset - AceSize); - } - - if (Offset - AceSize < Offset) - { - RtlZeroMemory((PVOID)((ULONG_PTR)Ace + Offset - AceSize), AceSize); - } -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlDeleteAce( - PACL Acl, - ULONG AceIndex) -{ - PACE Ace; - PACE Current; - PAGED_CODE_RTL(); - - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION || - Acl->AceCount <= AceIndex || - !RtlFirstFreeAce(Acl, &Ace)) - { - return STATUS_INVALID_PARAMETER; - } - - Current = (PACE)(Acl + 1); - - while(AceIndex--) - { - Current = (PACE)((ULONG_PTR)Current + Current->Header.AceSize); - } - - RtlpDeleteData(Current, - Current->Header.AceSize, - (ULONG)((ULONG_PTR)Ace - (ULONG_PTR)Current)); - Acl->AceCount--; - - return STATUS_SUCCESS; -} - - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlCreateAcl( - PACL Acl, - ULONG AclSize, - ULONG AclRevision) -{ - PAGED_CODE_RTL(); - - if (AclSize < sizeof(ACL)) - { - return STATUS_BUFFER_TOO_SMALL; - } - - if (AclRevision < MIN_ACL_REVISION || - AclRevision > MAX_ACL_REVISION || - AclSize > 0xffff) - { - return STATUS_INVALID_PARAMETER; - } - - AclSize = ROUND_UP(AclSize, 4); - Acl->AclSize = (WORD)AclSize; - Acl->AclRevision = (BYTE)AclRevision; + } + + /* Setup the header */ + Acl->AclSize = (USHORT)ROUND_UP(AclSize, 4); + Acl->AclRevision = (UCHAR)AclRevision; Acl->AceCount = 0; Acl->Sbz1 = 0; Acl->Sbz2 = 0; - return STATUS_SUCCESS; } - -/* - * @implemented - */ -NTSTATUS -NTAPI -RtlQueryInformationAcl( - PACL Acl, - PVOID Information, - ULONG InformationLength, - ACL_INFORMATION_CLASS InformationClass) +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlQueryInformationAcl(IN PACL Acl, + IN PVOID Information, + IN ULONG InformationLength, + IN ACL_INFORMATION_CLASS InformationClass) { PACE Ace; - PAGED_CODE_RTL(); - - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION) + PACL_REVISION_INFORMATION RevisionInfo; + PACL_SIZE_INFORMATION SizeInfo; + PAGED_CODE_RTL(); + + /* Validate the ACL revision */ + if ((Acl->AclRevision < MIN_ACL_REVISION) || + (Acl->AclRevision > MAX_ACL_REVISION)) { return STATUS_INVALID_PARAMETER; } + /* Check what the caller is querying */ switch (InformationClass) { + /* Revision data */ case AclRevisionInformation: + + /* Bail out if the buffer is too small */ + if (InformationLength < sizeof(ACL_REVISION_INFORMATION)) + { + return STATUS_BUFFER_TOO_SMALL; + } + + /* Return the current revision */ + RevisionInfo = (PACL_REVISION_INFORMATION)Information; + RevisionInfo->AclRevision = Acl->AclRevision; + break; + + /* Size data */ + case AclSizeInformation: + + /* Bail out if the buffer is too small */ + if (InformationLength < sizeof(ACL_SIZE_INFORMATION)) + { + return STATUS_BUFFER_TOO_SMALL; + } + + /* Bail out if there's no space in the ACL */ + if (!RtlFirstFreeAce(Acl, &Ace)) return STATUS_INVALID_PARAMETER; + + /* Read the number of ACEs and check if there was a free ACE */ + SizeInfo = (PACL_SIZE_INFORMATION)Information; + SizeInfo->AceCount = Acl->AceCount; + if (Ace) + { + /* Return how much space there is in the ACL */ + SizeInfo->AclBytesInUse = (ULONG_PTR)Ace - (ULONG_PTR)Acl; + SizeInfo->AclBytesFree = Acl->AclSize - SizeInfo->AclBytesInUse; + } + else + { + /* No free ACE, means the whole ACL is full */ + SizeInfo->AclBytesInUse = Acl->AclSize; + SizeInfo->AclBytesFree = 0; + } + break; + + default: + /* Anything else is illegal */ + return STATUS_INVALID_INFO_CLASS; + } + + /* All done */ + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlSetInformationAcl(IN PACL Acl, + IN PVOID Information, + IN ULONG InformationLength, + IN ACL_INFORMATION_CLASS InformationClass) +{ + PACL_REVISION_INFORMATION Info ; + PAGED_CODE_RTL(); + + /* Validate the ACL revision */ + if ((Acl->AclRevision < MIN_ACL_REVISION) || + (Acl->AclRevision > MAX_ACL_REVISION)) + { + return STATUS_INVALID_PARAMETER; + } + + /* What is the caller trying to set? */ + switch (InformationClass) + { + /* This is the only info class */ + case AclRevisionInformation: + + /* Make sure the buffer is large enough */ + if (InformationLength < sizeof(ACL_REVISION_INFORMATION)) + { + return STATUS_BUFFER_TOO_SMALL; + } + + /* Make sure the new revision is within the acceptable bounds*/ + Info = (PACL_REVISION_INFORMATION)Information; + if (Acl->AclRevision >= Info->AclRevision) + { + return STATUS_INVALID_PARAMETER; + } + + /* Set the new revision */ + Acl->AclRevision = (BYTE)Info->AclRevision; + break; + + default: + /* Anything else is invalid */ + return STATUS_INVALID_INFO_CLASS; + } + + /* All good */ + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlValidAcl(IN PACL Acl) +{ + PACE_HEADER Ace; + PISID Sid; + ULONG i; + PAGED_CODE_RTL(); + + _SEH2_TRY + { + /* First, validate the revision */ + if ((Acl->AclRevision < MIN_ACL_REVISION) || + (Acl->AclRevision > MAX_ACL_REVISION)) { - PACL_REVISION_INFORMATION Info = (PACL_REVISION_INFORMATION)Information; - - if (InformationLength < sizeof(ACL_REVISION_INFORMATION)) - { - return STATUS_BUFFER_TOO_SMALL; - } - Info->AclRevision = Acl->AclRevision; + DPRINT1("Invalid ACL revision\n"); + return FALSE; } - break; - - case AclSizeInformation: + + /* Next, validate that the ACL is USHORT-aligned */ + if (ROUND_DOWN(Acl->AclSize, sizeof(USHORT)) != Acl->AclSize) { - PACL_SIZE_INFORMATION Info = (PACL_SIZE_INFORMATION)Information; - - if (InformationLength < sizeof(ACL_SIZE_INFORMATION)) - { - return STATUS_BUFFER_TOO_SMALL; - } - - if (!RtlFirstFreeAce(Acl, &Ace)) - { - return STATUS_INVALID_PARAMETER; - } - - Info->AceCount = Acl->AceCount; - if (Ace != NULL) - { - Info->AclBytesInUse = (DWORD)((ULONG_PTR)Ace - (ULONG_PTR)Acl); - Info->AclBytesFree = Acl->AclSize - Info->AclBytesInUse; + DPRINT1("Invalid ACL size\n"); + return FALSE; + } + + /* And that it's big enough */ + if (Acl->AclSize < sizeof(ACL)) + { + DPRINT1("Invalid ACL size\n"); + return FALSE; + } + + /* Loop each ACE */ + Ace = (PACE_HEADER)((ULONG_PTR)Acl + sizeof(ACL)); + for (i = 0; i < Acl->AceCount; i++) + { + /* Validate we have space for this ACE header */ + if (((ULONG_PTR)Ace + sizeof(ACE_HEADER)) >= ((ULONG_PTR)Acl + Acl->AclSize)) + { + DPRINT1("Invalid ACE size\n"); + return FALSE; + } + + /* Validate the length of this ACE */ + if (ROUND_DOWN(Ace->AceSize, sizeof(USHORT)) != Ace->AceSize) + { + DPRINT1("Invalid ACE size: %lx\n", Ace->AceSize); + return FALSE; + } + + /* Validate we have space for the entire ACE */ + if (((ULONG_PTR)Ace + Ace->AceSize) > ((ULONG_PTR)Acl + Acl->AclSize)) + { + DPRINT1("Invalid ACE size %lx %lx\n", Ace->AceSize, Acl->AclSize); + return FALSE; + } + + /* Check what kind of ACE this is */ + if ((Ace->AceType >= ACCESS_MIN_MS_ACE_TYPE) || + (Ace->AceType <= ACCESS_MAX_MS_V2_ACE_TYPE)) + { + /* Validate the length of this ACE */ + if (ROUND_DOWN(Ace->AceSize, sizeof(ULONG)) != Ace->AceSize) + { + DPRINT1("Invalid ACE size\n"); + return FALSE; + } + + /* The ACE size should at least have enough for the header */ + if (Ace->AceSize < sizeof(ACE_HEADER)) + { + DPRINT1("Invalid ACE size: %lx %lx\n", Ace->AceSize, sizeof(ACE_HEADER)); + return FALSE; + } + + /* Check if the SID revision is valid */ + Sid = (PISID)&((PKNOWN_ACE)Ace)->SidStart; + if (Sid->Revision != SID_REVISION) + { + DPRINT1("Invalid SID\n"); + return FALSE; + } + + /* Check if the SID is out of bounds */ + if (Sid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES) + { + DPRINT1("Invalid SID\n"); + return FALSE; + } + + /* The ACE size should at least have enough for the header and SID */ + if (Ace->AceSize < (sizeof(ACE_HEADER) + RtlLengthSid(Sid))) + { + DPRINT1("Invalid ACE size\n"); + return FALSE; + } + } + else if (Ace->AceType == ACCESS_ALLOWED_COMPOUND_ACE_TYPE) + { + DPRINT1("Unsupported ACE in ReactOS, assuming valid\n"); + } + else if ((Ace->AceType >= ACCESS_MIN_MS_ACE_TYPE) || + (Ace->AceType <= ACCESS_MAX_MS_V2_ACE_TYPE)) + { + DPRINT1("Unsupported ACE in ReactOS, assuming valid\n"); } else { - Info->AclBytesInUse = Acl->AclSize; - Info->AclBytesFree = 0; - } + /* Unknown ACE, see if it's as big as a header at least */ + if (Ace->AceSize < sizeof(ACE_HEADER)) + { + DPRINT1("Unknown ACE\n"); + return FALSE; + } + } + + /* Move to the next ace */ + Ace = (PACE_HEADER)((ULONG_PTR)Ace + Ace->AceSize); } - break; - - default: - return STATUS_INVALID_INFO_CLASS; - } - - return STATUS_SUCCESS; -} - - -/* - * @implemented - */ -NTSTATUS NTAPI -RtlSetInformationAcl(PACL Acl, - PVOID Information, - ULONG InformationLength, - ACL_INFORMATION_CLASS InformationClass) -{ - PAGED_CODE_RTL(); - - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION) - { - return STATUS_INVALID_PARAMETER; - } - - switch (InformationClass) - { - case AclRevisionInformation: - { - PACL_REVISION_INFORMATION Info = (PACL_REVISION_INFORMATION)Information; - - if (InformationLength < sizeof(ACL_REVISION_INFORMATION)) - { - return STATUS_BUFFER_TOO_SMALL; - } - - if (Acl->AclRevision >= Info->AclRevision) - { - return STATUS_INVALID_PARAMETER; - } - - Acl->AclRevision = (BYTE)Info->AclRevision; - } - break; - - default: - return STATUS_INVALID_INFO_CLASS; - } - - return STATUS_SUCCESS; -} - - -/* - * @implemented - */ -BOOLEAN -NTAPI -RtlValidAcl(PACL Acl) -{ - PACE Ace; - USHORT Size; - PAGED_CODE_RTL(); - - Size = ROUND_UP(Acl->AclSize, 4); - - if (Acl->AclRevision < MIN_ACL_REVISION || - Acl->AclRevision > MAX_ACL_REVISION) - { + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Something was invalid, fail */ return FALSE; } - - if (Size != Acl->AclSize) - { - return FALSE; - } - - return RtlFirstFreeAce(Acl, &Ace); + _SEH2_END; + + /* The ACL looks ok */ + return TRUE; } /* EOF */
12 years, 3 months
1
0
0
0
[ion] 57330: [WIN32K]: And all along I thought I had committed this... I guess it must work pretty well if I never noticed the difference :). This patch makes Win32k use session space instead of sy...
by ion@svn.reactos.org
Author: ion Date: Wed Sep 19 01:56:28 2012 New Revision: 57330 URL:
http://svn.reactos.org/svn/reactos?rev=57330&view=rev
Log: [WIN32K]: And all along I thought I had committed this... I guess it must work pretty well if I never noticed the difference :). This patch makes Win32k use session space instead of system space, now that we've had session space for a while. tkreuzer: review? Modified: trunk/reactos/win32ss/gdi/eng/mapping.c trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c trunk/reactos/win32ss/user/ntuser/misc/usrheap.c Modified: trunk/reactos/win32ss/gdi/eng/mapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mapping.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/mapping.c [iso-8859-1] Wed Sep 19 01:56:28 2012 @@ -10,10 +10,6 @@ #define NDEBUG #include <debug.h> - -// HACK!!! -#define MmMapViewInSessionSpace MmMapViewInSystemSpace -#define MmUnmapViewInSessionSpace MmUnmapViewInSystemSpace HANDLE ghSystem32Directory; HANDLE ghRootDirectory; @@ -127,6 +123,48 @@ return pSection; } + +PVOID +NTAPI +EngCreateSectionHack( + IN ULONG fl, + IN SIZE_T cjSize, + IN ULONG ulTag) +{ + NTSTATUS Status; + PENGSECTION pSection; + PVOID pvSectionObject; + LARGE_INTEGER liSize; + + /* Allocate a section object */ + pSection = EngAllocMem(0, sizeof(ENGSECTION), 'stsU'); + if (!pSection) return NULL; + + liSize.QuadPart = cjSize; + Status = MmCreateSection(&pvSectionObject, + SECTION_ALL_ACCESS, + NULL, + &liSize, + PAGE_READWRITE, + SEC_COMMIT | 1, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create a section Status=0x%x\n", Status); + EngFreeMem(pSection); + return NULL; + } + + /* Set the fields of the section */ + pSection->ulTag = ulTag; + pSection->pvSectionObject = pvSectionObject; + pSection->pvMappedBase = NULL; + pSection->cjViewSize = cjSize; + + return pSection; +} + BOOL @@ -250,7 +288,7 @@ if (cjSize == 0) return NULL; /* Allocate a section object */ - pSection = EngCreateSection(fl, cjSize, ulTag); + pSection = EngCreateSectionHack(fl, cjSize, ulTag); if (!pSection) { *ppvSection = NULL; @@ -408,10 +446,10 @@ pFileView->cjView = 0; - /* Map the section in session space */ - Status = MmMapViewInSessionSpace(pFileView->pSection, - &pFileView->pvKView, - &pFileView->cjView); + /* FIXME: Use system space because ARM3 doesn't support executable sections yet */ + Status = MmMapViewInSystemSpace(pFileView->pSection, + &pFileView->pvKView, + &pFileView->cjView); if (!NT_SUCCESS(Status)) { DPRINT1("Failed to map a section Status=0x%x\n", Status); @@ -430,8 +468,8 @@ PFILEVIEW pFileView = (PFILEVIEW)h; NTSTATUS Status; - /* Unmap the section */ - Status = MmUnmapViewInSessionSpace(pFileView->pvKView); + /* FIXME: Use system space because ARM3 doesn't support executable sections yet */ + Status = MmUnmapViewInSystemSpace(pFileView->pvKView); if (!NT_SUCCESS(Status)) { DPRINT1("MmUnmapViewInSessionSpace failed: 0x%lx\n", Status); Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Wed Sep 19 01:56:28 2012 @@ -59,8 +59,6 @@ #define ASSERT_SHARED_OBJECT_TYPE(objt) #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt) #endif - -#define MmMapViewInSessionSpace MmMapViewInSystemSpace #if defined(_M_IX86) || defined(_M_AMD64) #define InterlockedOr16 _InterlockedOr16 @@ -166,7 +164,7 @@ NULL, &liSize, PAGE_READWRITE, - SEC_COMMIT, + SEC_COMMIT | 0x1, NULL, NULL); if (!NT_SUCCESS(status)) Modified: trunk/reactos/win32ss/user/ntuser/misc/usrheap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/u…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/usrheap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/usrheap.c [iso-8859-1] Wed Sep 19 01:56:28 2012 @@ -188,7 +188,7 @@ NULL, &SizeHeap, PAGE_EXECUTE_READWRITE, /* Would prefer PAGE_READWRITE, but thanks to RTL heaps... */ - SEC_RESERVE, + SEC_RESERVE | 1, NULL, NULL); @@ -198,9 +198,9 @@ return FALSE; } - Status = MmMapViewInSystemSpace(*SectionObject, - SystemBase, - &HeapSize); + Status = MmMapViewInSessionSpace(*SectionObject, + SystemBase, + &HeapSize); if (!NT_SUCCESS(Status)) { ObDereferenceObject(*SectionObject);
12 years, 3 months
1
0
0
0
[tkreuzer] 57329: [WIN32K] make sure at least one rect is allocated in REGION_PtsToRegion. Fixes failed assertion when starting pacman4000 (the game itself doesn't work though) CORE-5431 #resolve
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Sep 18 22:01:38 2012 New Revision: 57329 URL:
http://svn.reactos.org/svn/reactos?rev=57329&view=rev
Log: [WIN32K] make sure at least one rect is allocated in REGION_PtsToRegion. Fixes failed assertion when starting pacman4000 (the game itself doesn't work though) CORE-5431 #resolve Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c Modified: trunk/reactos/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/region.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/region.c [iso-8859-1] Tue Sep 18 22:01:38 2012 @@ -2911,6 +2911,12 @@ numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; + /* Make sure, we have at least one rect */ + if (numRects == 0) + { + numRects = 1; + } + if (!(temp = ExAllocatePoolWithTag(PagedPool, numRects * sizeof(RECT), TAG_REGION))) { return 0;
12 years, 3 months
1
0
0
0
[ekohl] 57328: [ADVAPI32/SERVICES] This patch fixes various things, from Coverity code defects to conversion warnings : - CID 715948 (logically dead code @ services/rpcserver.c) - try to fix CID 71...
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Sep 18 21:54:43 2012 New Revision: 57328 URL:
http://svn.reactos.org/svn/reactos?rev=57328&view=rev
Log: [ADVAPI32/SERVICES] This patch fixes various things, from Coverity code defects to conversion warnings : - CID 715948 (logically dead code @ services/rpcserver.c) - try to fix CID 716332/3 (resource leaks) by rewriting the ScmReadString function (@ services/config.c) - zero out the freshly allocated memory (@ services) - try to fix CID 716126/7/8 (untrusted value as argument @ advapi32/services/sctrl.c) Fix also some "size_t to DWORD" warnings on x64 build (@ advapi32/services/scm.c). Patch by Hermes BELUSCA - MAITO. Fixes CORE-6606. Modified: trunk/reactos/base/system/services/config.c trunk/reactos/base/system/services/database.c trunk/reactos/base/system/services/rpcserver.c trunk/reactos/base/system/services/services.h trunk/reactos/dll/win32/advapi32/service/scm.c trunk/reactos/dll/win32/advapi32/service/sctrl.c Modified: trunk/reactos/base/system/services/config.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/confi…
============================================================================== --- trunk/reactos/base/system/services/config.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/config.c [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -246,19 +246,17 @@ DWORD ScmReadString(HKEY hServiceKey, - LPWSTR lpValueName, + LPCWSTR lpValueName, LPWSTR *lpValue) { - DWORD dwError; - DWORD dwSize; - DWORD dwType; - DWORD dwSizeNeeded; + DWORD dwError = 0; + DWORD dwSize = 0; + DWORD dwType = 0; + LPWSTR ptr = NULL; LPWSTR expanded = NULL; - LPWSTR ptr = NULL; *lpValue = NULL; - dwSize = 0; dwError = RegQueryValueExW(hServiceKey, lpValueName, 0, @@ -268,7 +266,7 @@ if (dwError != ERROR_SUCCESS) return dwError; - ptr = HeapAlloc(GetProcessHeap(), 0, dwSize); + ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize); if (ptr == NULL) return ERROR_NOT_ENOUGH_MEMORY; @@ -279,38 +277,46 @@ (LPBYTE)ptr, &dwSize); if (dwError != ERROR_SUCCESS) - goto done; + { + HeapFree(GetProcessHeap(), 0, ptr); + return dwError; + } if (dwType == REG_EXPAND_SZ) { /* Expand the value... */ - dwSizeNeeded = ExpandEnvironmentStringsW((LPCWSTR)ptr, NULL, 0); - if (dwSizeNeeded == 0) + dwSize = ExpandEnvironmentStringsW(ptr, NULL, 0); + if (dwSize > 0) + { + expanded = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize * sizeof(WCHAR)); + if (expanded) + { + if (dwSize == ExpandEnvironmentStringsW(ptr, expanded, dwSize)) + { + *lpValue = expanded; + dwError = ERROR_SUCCESS; + } + else + { + dwError = GetLastError(); + HeapFree(GetProcessHeap(), 0, expanded); + } + } + else + { + dwError = ERROR_NOT_ENOUGH_MEMORY; + } + } + else { dwError = GetLastError(); - goto done; - } - expanded = HeapAlloc(GetProcessHeap(), 0, dwSizeNeeded * sizeof(WCHAR)); - if (dwSizeNeeded < ExpandEnvironmentStringsW((LPCWSTR)ptr, expanded, dwSizeNeeded)) - { - dwError = GetLastError(); - goto done; - } - *lpValue = expanded; + } + HeapFree(GetProcessHeap(), 0, ptr); - dwError = ERROR_SUCCESS; } else { *lpValue = ptr; - } - -done: - if (dwError != ERROR_SUCCESS) - { - HeapFree(GetProcessHeap(), 0, ptr); - if (expanded) - HeapFree(GetProcessHeap(), 0, expanded); } return dwError; Modified: trunk/reactos/base/system/services/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
============================================================================== --- trunk/reactos/base/system/services/database.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/database.c [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -591,7 +591,7 @@ if (dwMaxSubkeyLen > sizeof(szNameBuf) / sizeof(WCHAR)) { /* Name too big: alloc a buffer for it */ - lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen * sizeof(WCHAR)); + lpszName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwMaxSubkeyLen * sizeof(WCHAR)); } if (!lpszName) Modified: trunk/reactos/base/system/services/rpcserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
============================================================================== --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -301,7 +301,7 @@ if (dwError != ERROR_SUCCESS && dwError != ERROR_MORE_DATA) goto findFreeTag; - pdwGroupTags = HeapAlloc(GetProcessHeap(), 0, cbDataSize); + pdwGroupTags = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbDataSize); if (!pdwGroupTags) { dwError = ERROR_NOT_ENOUGH_MEMORY; @@ -1635,11 +1635,6 @@ } lpService = (PSERVICE)hServiceStatus; - if (lpService == NULL) - { - DPRINT("lpService == NULL!\n"); - return ERROR_INVALID_HANDLE; - } /* Check current state */ if (!ScmIsValidServiceState(lpServiceStatus->dwCurrentState)) @@ -1819,7 +1814,7 @@ /* Update the display name */ lpDisplayNameW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (wcslen(lpDisplayName) + 1) * sizeof(WCHAR)); if (lpDisplayNameW == NULL) { @@ -2142,7 +2137,8 @@ *lpDisplayName != 0 && _wcsicmp(lpService->lpDisplayName, lpDisplayName) != 0) { - lpService->lpDisplayName = HeapAlloc(GetProcessHeap(), 0, + lpService->lpDisplayName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, (wcslen(lpDisplayName) + 1) * sizeof(WCHAR)); if (lpService->lpDisplayName == NULL) { @@ -2424,7 +2420,7 @@ /* Allocate memory for array of service pointers */ lpServicesArray = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (dwServicesReturned + 1) * sizeof(PSERVICE)); if (!lpServicesArray) { @@ -2447,7 +2443,7 @@ goto Done; } - lpServicesPtr = (LPENUM_SERVICE_STATUSW) lpServices; + lpServicesPtr = (LPENUM_SERVICE_STATUSW)lpServices; lpStr = (LPWSTR)(lpServices + (dwServicesReturned * sizeof(ENUM_SERVICE_STATUSW))); /* Copy EnumDepenedentService to Buffer */ @@ -2470,7 +2466,7 @@ lpServicesPtr->lpServiceName = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServices); lpStr += (wcslen(lpService->lpServiceName) + 1); - lpServicesPtr ++; + lpServicesPtr++; } *lpServicesReturned = dwServicesReturned; @@ -3190,7 +3186,7 @@ { /* Set the display name */ lpDisplayNameW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (strlen(lpDisplayName) + 1) * sizeof(WCHAR)); if (lpDisplayNameW == NULL) { @@ -3268,7 +3264,7 @@ { /* Set the image path */ lpBinaryPathNameW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (strlen(lpBinaryPathName) + 1) * sizeof(WCHAR)); if (lpBinaryPathNameW == NULL) { @@ -3314,7 +3310,7 @@ if (lpLoadOrderGroup != NULL && *lpLoadOrderGroup != 0) { lpLoadOrderGroupW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (strlen(lpLoadOrderGroup) + 1) * sizeof(WCHAR)); if (lpLoadOrderGroupW == NULL) { @@ -3372,7 +3368,7 @@ if (lpDependencies != NULL && *lpDependencies != 0) { lpDependenciesW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (strlen((LPSTR)lpDependencies) + 1) * sizeof(WCHAR)); if (lpDependenciesW == NULL) { @@ -3446,7 +3442,7 @@ if (lpServiceName) { len = MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, NULL, 0); - lpServiceNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpServiceNameW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (!lpServiceNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3458,7 +3454,7 @@ if (lpDisplayName) { len = MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, NULL, 0); - lpDisplayNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpDisplayNameW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (!lpDisplayNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3470,7 +3466,7 @@ if (lpBinaryPathName) { len = MultiByteToWideChar(CP_ACP, 0, lpBinaryPathName, -1, NULL, 0); - lpBinaryPathNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpBinaryPathNameW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (!lpBinaryPathNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3482,7 +3478,7 @@ if (lpLoadOrderGroup) { len = MultiByteToWideChar(CP_ACP, 0, lpLoadOrderGroup, -1, NULL, 0); - lpLoadOrderGroupW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpLoadOrderGroupW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (!lpLoadOrderGroupW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3502,7 +3498,7 @@ } dwDependenciesLength++; - lpDependenciesW = HeapAlloc(GetProcessHeap(), 0, dwDependenciesLength * sizeof(WCHAR)); + lpDependenciesW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDependenciesLength * sizeof(WCHAR)); if (!lpDependenciesW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3514,7 +3510,7 @@ if (lpServiceStartName) { len = MultiByteToWideChar(CP_ACP, 0, lpServiceStartName, -1, NULL, 0); - lpServiceStartNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpServiceStartNameW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); if (!lpServiceStartNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3638,7 +3634,7 @@ /* Allocate memory for array of service pointers */ lpServicesArray = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, (dwServicesReturned + 1) * sizeof(PSERVICE)); if (!lpServicesArray) { @@ -3698,7 +3694,7 @@ lpServicesPtr->lpServiceName = (LPSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpServices); lpStr += strlen(lpStr) + 1; - lpServicesPtr ++; + lpServicesPtr++; } *lpServicesReturned = dwServicesReturned; @@ -4755,7 +4751,7 @@ dwLength = (DWORD)((strlen(Info.lpDescription) + 1) * sizeof(WCHAR)); lpServiceDescriptonW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, dwLength + sizeof(SERVICE_DESCRIPTIONW)); if (!lpServiceDescriptonW) { @@ -4797,7 +4793,7 @@ dwLength = dwRebootLen + dwCommandLen + sizeof(SERVICE_FAILURE_ACTIONSW); lpServiceFailureActionsW = HeapAlloc(GetProcessHeap(), - 0, + HEAP_ZERO_MEMORY, dwLength); if (!lpServiceFailureActionsW) { Modified: trunk/reactos/base/system/services/services.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
============================================================================== --- trunk/reactos/base/system/services/services.h [iso-8859-1] (original) +++ trunk/reactos/base/system/services/services.h [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -106,7 +106,7 @@ BOOL ScmIsDeleteFlagSet(HKEY hServiceKey); DWORD ScmReadString(HKEY hServiceKey, - LPWSTR lpValueName, + LPCWSTR lpValueName, LPWSTR *lpValue); DWORD Modified: trunk/reactos/dll/win32/advapi32/service/scm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -287,7 +287,7 @@ { DWORD dwError; DWORD dwDependenciesLength = 0; - DWORD dwLength; + SIZE_T cchLength; LPCSTR lpStr; DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; @@ -300,16 +300,16 @@ lpStr = lpDependencies; while (*lpStr) { - dwLength = strlen(lpStr) + 1; - dwDependenciesLength += dwLength; - lpStr = lpStr + dwLength; + cchLength = strlen(lpStr) + 1; + dwDependenciesLength += (DWORD)cchLength; + lpStr = lpStr + cchLength; } dwDependenciesLength++; } /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); + dwPasswordLength = (DWORD)(lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); RpcTryExcept { @@ -365,7 +365,7 @@ { DWORD dwError; DWORD dwDependenciesLength = 0; - DWORD dwLength; + SIZE_T cchLength; LPCWSTR lpStr; DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; @@ -378,11 +378,12 @@ lpStr = lpDependencies; while (*lpStr) { - dwLength = wcslen(lpStr) + 1; - dwDependenciesLength += dwLength; - lpStr = lpStr + dwLength; + cchLength = wcslen(lpStr) + 1; + dwDependenciesLength += (DWORD)cchLength; + lpStr = lpStr + cchLength; } dwDependenciesLength++; + dwDependenciesLength *= sizeof(WCHAR); } /* FIXME: Encrypt the password */ @@ -547,7 +548,7 @@ SC_HANDLE hService = NULL; DWORD dwDependenciesLength = 0; DWORD dwError; - DWORD dwLength; + SIZE_T cchLength; LPCSTR lpStr; DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; @@ -568,16 +569,16 @@ lpStr = lpDependencies; while (*lpStr) { - dwLength = strlen(lpStr) + 1; - dwDependenciesLength += dwLength; - lpStr = lpStr + dwLength; + cchLength = strlen(lpStr) + 1; + dwDependenciesLength += (DWORD)cchLength; + lpStr = lpStr + cchLength; } dwDependenciesLength++; } /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); + dwPasswordLength = (DWORD)(lpPassword ? (strlen(lpPassword) + 1) * sizeof(CHAR) : 0); RpcTryExcept { @@ -639,7 +640,7 @@ SC_HANDLE hService = NULL; DWORD dwDependenciesLength = 0; DWORD dwError; - DWORD dwLength; + SIZE_T cchLength; LPCWSTR lpStr; DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; @@ -660,18 +661,17 @@ lpStr = lpDependencies; while (*lpStr) { - dwLength = wcslen(lpStr) + 1; - dwDependenciesLength += dwLength; - lpStr = lpStr + dwLength; + cchLength = wcslen(lpStr) + 1; + dwDependenciesLength += (DWORD)cchLength; + lpStr = lpStr + cchLength; } dwDependenciesLength++; - dwDependenciesLength *= sizeof(WCHAR); } /* FIXME: Encrypt the password */ lpEncryptedPassword = (LPBYTE)lpPassword; - dwPasswordLength = (lpPassword ? (wcslen(lpPassword) + 1) * sizeof(WCHAR) : 0); + dwPasswordLength = (DWORD)(lpPassword ? (wcslen(lpPassword) + 1) * sizeof(WCHAR) : 0); RpcTryExcept { Modified: trunk/reactos/dll/win32/advapi32/service/sctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/sctrl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/service/sctrl.c [iso-8859-1] Tue Sep 18 21:54:43 2012 @@ -290,6 +290,9 @@ LPWSTR *lpArg; DWORD i; + if (ControlPacket == NULL || lpArgCount == NULL || lpArgVector == NULL) + return ERROR_INVALID_PARAMETER; + *lpArgCount = 0; *lpArgVector = NULL; @@ -334,6 +337,9 @@ DWORD dwAnsiSize; DWORD i; + if (ControlPacket == NULL || lpArgCount == NULL || lpArgVector == NULL) + return ERROR_INVALID_PARAMETER; + *lpArgCount = 0; *lpArgVector = NULL; @@ -398,6 +404,9 @@ HANDLE ThreadHandle; DWORD ThreadId; DWORD dwError; + + if (lpService == NULL || ControlPacket == NULL) + return ERROR_INVALID_PARAMETER; TRACE("ScStartService() called\n"); TRACE("Size: %lu\n", ControlPacket->dwSize); @@ -470,6 +479,9 @@ ScControlService(PACTIVE_SERVICE lpService, PSCM_CONTROL_PACKET ControlPacket) { + if (lpService == NULL || ControlPacket == NULL) + return ERROR_INVALID_PARAMETER; + TRACE("ScControlService() called\n"); TRACE("Size: %lu\n", ControlPacket->dwSize); TRACE("Service: %S\n", (PWSTR)((PBYTE)ControlPacket + ControlPacket->dwServiceNameOffset)); @@ -504,6 +516,9 @@ DWORD dwError; TRACE("ScDispatcherLoop() called\n"); + + if (ControlPacket == NULL || dwBufferSize < sizeof(SCM_CONTROL_PACKET)) + return FALSE; while (TRUE) {
12 years, 3 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
24
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
Results per page:
10
25
50
100
200