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
May 2013
----- 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
16 participants
234 discussions
Start a n
N
ew thread
[tfaber] 58940: [KMTESTS:MM] - Fix 64-bit warnings. Patch by Nikolay Borisov. ROSTESTS-112 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sun May 5 12:18:49 2013 New Revision: 58940 URL:
http://svn.reactos.org/svn/reactos?rev=58940&view=rev
Log: [KMTESTS:MM] - Fix 64-bit warnings. Patch by Nikolay Borisov. ROSTESTS-112 #resolve Modified: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c Modified: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwAllocat…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] Sun May 5 12:18:49 2013 @@ -14,14 +14,14 @@ /* These are being used in ZwMapViewOfSection as well */ const char TestString[] = "TheLongBrownFoxJumpedTheWhiteRabbitTheLongBrownFoxJumpedTheWhiteRabbitTheLongBrownFoxJumpedTheWhiteRabbitTheLongBrownFoxJumpedTheWhiteRabbitTheLongBrownFoxJumpedTheWhiteRabbitTheLongBrownFoxJumpedThe"; -const SIZE_T TestStringSize = sizeof(TestString); +const ULONG TestStringSize = sizeof(TestString); VOID Test_ZwAllocateVirtualMemory(VOID); typedef struct _TEST_CONTEXT { HANDLE ProcessHandle; - ULONG RegionSize; + SIZE_T RegionSize; ULONG AllocationType; ULONG Protect; PVOID Bases[1024]; Modified: trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwCreateS…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c [iso-8859-1] Sun May 5 12:18:49 2013 @@ -11,7 +11,7 @@ #define NO_HANDLE_CLOSE -998 #define _4mb 4194304 extern const char TestString[]; -extern const SIZE_T TestStringSize; +extern const ULONG TestStringSize; static UNICODE_STRING FileReadOnlyPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll"); static UNICODE_STRING WritableFilePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\kmtest-MmSection.txt"); static UNICODE_STRING CalcImgPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\calc.exe"); Modified: trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwMapView…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c [iso-8859-1] Sun May 5 12:18:49 2013 @@ -16,7 +16,7 @@ static UNICODE_STRING WritableFilePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\kmtest-MmSection.txt"); static UNICODE_STRING SharedSectionName = RTL_CONSTANT_STRING(L"\\BaseNamedObjects\\kmtest-SharedSection"); extern const char TestString[]; -extern const SIZE_T TestStringSize; +extern const ULONG TestStringSize; static OBJECT_ATTRIBUTES NtdllObject; static OBJECT_ATTRIBUTES KmtestFileObject; static OBJECT_ATTRIBUTES NtoskrnlFileObject; @@ -266,7 +266,7 @@ static SIZE_T -CompareFileContents(HANDLE FileHandle, SIZE_T BufferLength, PVOID Buffer) +CompareFileContents(HANDLE FileHandle, ULONG BufferLength, PVOID Buffer) { NTSTATUS Status; LARGE_INTEGER ByteOffset;
11 years, 7 months
1
0
0
0
[hbelusca] 58939: [CDMAKE] Reset the "volume expiration date" and the "volume effective date". They are not used. See http://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor for more information.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun May 5 10:18:52 2013 New Revision: 58939 URL:
http://svn.reactos.org/svn/reactos?rev=58939&view=rev
Log: [CDMAKE] Reset the "volume expiration date" and the "volume effective date". They are not used. See
http://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor
for more information. Modified: trunk/reactos/tools/cdmake/cdmake.c Modified: trunk/reactos/tools/cdmake/cdmake.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sun May 5 10:18:52 2013 @@ -1165,9 +1165,9 @@ write_byte(0); write_string(timestring); // most recent modification write_byte(0); - write_string(timestring); // volume expires + write_string("0000000000000000"); // volume expires write_byte(0); - write_string(timestring); // volume is effective + write_string("0000000000000000"); // volume is effective write_byte(0); write_byte(1); write_byte(0); @@ -1221,13 +1221,13 @@ write_block(37, ' '); // abstract file identifier write_block(37, ' '); // bibliographic file identifier write_string(timestring); // volume creation - write_byte(48); + write_byte(0); write_string(timestring); // most recent modification - write_byte(48); - write_string(timestring); // volume expires - write_byte(48); - write_string(timestring); // volume is effective - write_byte(48); + write_byte(0); + write_string("0000000000000000"); // volume expires + write_byte(0); + write_string("0000000000000000"); // volume is effective + write_byte(0); write_byte(1); write_byte(0); fill_sector();
11 years, 7 months
1
0
0
0
[pschweitzer] 58938: [RTL] Comment out RtlAcquirePrivilege & RtlReleasePrivilege for the moment. It appears we are overflowing memory and thus corrupting registry, that breaks ReactOS install. To b...
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun May 5 09:55:32 2013 New Revision: 58938 URL:
http://svn.reactos.org/svn/reactos?rev=58938&view=rev
Log: [RTL] Comment out RtlAcquirePrivilege & RtlReleasePrivilege for the moment. It appears we are overflowing memory and thus corrupting registry, that breaks ReactOS install. To be investigated... Modified: trunk/reactos/lib/rtl/priv.c Modified: trunk/reactos/lib/rtl/priv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/priv.c?rev=58938&r…
============================================================================== --- trunk/reactos/lib/rtl/priv.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/priv.c [iso-8859-1] Sun May 5 09:55:32 2013 @@ -112,6 +112,7 @@ IN ULONG Flags, OUT PVOID *ReturnedState) { +#if 0 NTSTATUS Status; PRTL_ACQUIRE_STATE State; ULONG ReturnLength, i, OldSize; @@ -344,6 +345,10 @@ RtlFreeHeap(RtlGetProcessHeap(), 0, State); return Status; +#else + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +#endif } /* @@ -353,6 +358,7 @@ NTAPI RtlReleasePrivilege(IN PVOID ReturnedState) { +#if 0 NTSTATUS Status; PRTL_ACQUIRE_STATE State = (PRTL_ACQUIRE_STATE)ReturnedState; @@ -388,6 +394,9 @@ /* Release token and free state */ ZwClose(State->Token); RtlFreeHeap(RtlGetProcessHeap(), 0, State); +#else + UNIMPLEMENTED; +#endif } /*
11 years, 7 months
1
0
0
0
[pschweitzer] 58937: [RTL] Implement RtlAcquirePrivilege and RtlReleasePrivilege. Reviewed by Aleksey
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun May 5 09:30:12 2013 New Revision: 58937 URL:
http://svn.reactos.org/svn/reactos?rev=58937&view=rev
Log: [RTL] Implement RtlAcquirePrivilege and RtlReleasePrivilege. Reviewed by Aleksey Modified: trunk/reactos/lib/rtl/priv.c Modified: trunk/reactos/lib/rtl/priv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/priv.c?rev=58937&r…
============================================================================== --- trunk/reactos/lib/rtl/priv.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/priv.c [iso-8859-1] Sun May 5 09:30:12 2013 @@ -4,6 +4,7 @@ * FILE: lib/rtl/priv.c * PURPOSE: Security related functions and Security Objects * PROGRAMMER: Eric Kohl + * Pierre Schweitzer (pierre(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -14,6 +15,27 @@ #include <debug.h> /* FUNCTIONS ***************************************************************/ + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlpOpenThreadToken(IN ACCESS_MASK DesiredAccess, + OUT PHANDLE TokenHandle) +{ + NTSTATUS Status; + + Status = ZwOpenThreadToken(NtCurrentThread(), DesiredAccess, + TRUE, TokenHandle); + if (!NT_SUCCESS(Status)) + { + Status = ZwOpenThreadToken(NtCurrentThread(), DesiredAccess, + FALSE, TokenHandle); + } + + return Status; +} /* * @implemented @@ -81,7 +103,7 @@ } /* - * @unimplemented + * @implemented */ NTSTATUS NTAPI @@ -90,18 +112,282 @@ IN ULONG Flags, OUT PVOID *ReturnedState) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + PRTL_ACQUIRE_STATE State; + ULONG ReturnLength, i, OldSize; + SECURITY_QUALITY_OF_SERVICE Sqos; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE ImpersonationToken = 0, ProcessToken; + + /* Validate flags */ + if (Flags & ~(RTL_ACQUIRE_PRIVILEGE_PROCESS | RTL_ACQUIRE_PRIVILEGE_IMPERSONATE)) + { + return STATUS_INVALID_PARAMETER; + } + + /* If user wants to acquire privileges for the process, we have to impersonate him */ + if (Flags & RTL_ACQUIRE_PRIVILEGE_PROCESS) + { + Flags |= RTL_ACQUIRE_PRIVILEGE_IMPERSONATE; + } + + /* Allocate enough memory to hold: old privileges (fixed buffer size, might not be enough) + * new privileges (big enough, after old privileges memory area) + */ + State = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(RTL_ACQUIRE_STATE) + sizeof(TOKEN_PRIVILEGES) + + NumPriv * sizeof(LUID_AND_ATTRIBUTES)); + if (!State) + { + return STATUS_NO_MEMORY; + } + + /* Only zero a bit of the memory (will be faster that way) */ + State->Token = 0; + State->OldImpersonationToken = 0; + State->Flags = 0; + State->OldPrivileges = NULL; + + /* Check whether we have already an active impersonation */ + if (NtCurrentTeb()->IsImpersonating) + { + /* Check whether we want to impersonate */ + if (Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE) + { + /* That's all fine, just get the token. + * We need access for: adjust (obvious...) but also + * query, to be able to query old privileges + */ + Status = RtlpOpenThreadToken(TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &State->Token); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, State); + return Status; + } + } + else + { + /* Otherwise, we have to temporary disable active impersonation. + * Get previous impersonation token to save it + */ + Status = RtlpOpenThreadToken(TOKEN_IMPERSONATE, &State->OldImpersonationToken); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, State); + return Status; + } + + /* Remember the fact we had an active impersonation */ + State->Flags |= RTL_ACQUIRE_PRIVILEGE_IMPERSONATE; + + /* Revert impersonation (ie, give 0 as handle) */ + Status = ZwSetInformationThread(NtCurrentThread(), + ThreadImpersonationToken, + &ImpersonationToken, + sizeof(HANDLE)); + } + } + + /* If we have no token yet (which is likely) */ + if (!State->Token) + { + /* If we are asked to use process, then do */ + if (Flags & RTL_ACQUIRE_PRIVILEGE_PROCESS) + { + Status = ZwOpenProcessToken(NtCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + &State->Token); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + } + else + { + /* Otherwise, we have to impersonate. + * Open token for duplication + */ + Status = ZwOpenProcessToken(NtCurrentProcess(), TOKEN_DUPLICATE, &ProcessToken); + + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + + ObjectAttributes.SecurityQualityOfService = &Sqos; + Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE); + Sqos.ImpersonationLevel = SecurityDelegation; + Sqos.ContextTrackingMode = 1; + Sqos.EffectiveOnly = FALSE; + + /* Duplicate */ + Status = ZwDuplicateToken(ProcessToken, + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY | TOKEN_IMPERSONATE, + &ObjectAttributes, + FALSE, + TokenImpersonation, + &ImpersonationToken); + if (!NT_SUCCESS(Status)) + { + ZwClose(ProcessToken); + goto Cleanup; + } + + /* Assign our duplicated token to current thread */ + Status = ZwSetInformationThread(NtCurrentThread(), + ThreadImpersonationToken, + &ImpersonationToken, + sizeof(HANDLE)); + if (!NT_SUCCESS(Status)) + { + ZwClose(ImpersonationToken); + ZwClose(ProcessToken); + goto Cleanup; + } + + /* Save said token */ + State->Token = ImpersonationToken; + + ZwClose(ProcessToken); + } + } + + /* Properly set the privileges pointers: + * OldPrivileges points to the static memory in struct (= OldPrivBuffer) + * NewPrivileges points to the dynamic memory after OldPrivBuffer + * There's NO overflow risks (OldPrivileges is always used with its size) + */ + State->OldPrivileges = (PTOKEN_PRIVILEGES)State->OldPrivBuffer; + State->NewPrivileges = (PTOKEN_PRIVILEGES)(State->OldPrivBuffer + 1024); + + /* Assign all the privileges to be acquired */ + State->NewPrivileges->PrivilegeCount = NumPriv; + for (i = 0; i < NumPriv; ++i) + { + State->NewPrivileges->Privileges[i].Luid.LowPart = Privilege[i]; + State->NewPrivileges->Privileges[i].Luid.HighPart = 0; + State->NewPrivileges->Privileges[i].Attributes = SE_PRIVILEGE_ENABLED; + } + + /* Start privileges adjustements */ + OldSize = sizeof(State->OldPrivBuffer); + do + { + ReturnLength = sizeof(State->OldPrivBuffer); + Status = ZwAdjustPrivilegesToken(State->Token, FALSE, State->NewPrivileges, + OldSize, State->OldPrivileges, &ReturnLength); + /* This is returned when OldPrivileges buffer is too small */ + if (Status == STATUS_BUFFER_TOO_SMALL) + { + /* Try to allocate a new one, big enough to hold data */ + State->OldPrivileges = RtlAllocateHeap(RtlGetProcessHeap(), 0, ReturnLength); + if (State->OldPrivileges) + { + OldSize = ReturnLength; + continue; + } + else + { + /* If we failed, properly set status: we failed because of the lack of memory */ + Status = STATUS_NO_MEMORY; + } + } + + /* If we failed to assign at least one privilege */ + if (Status == STATUS_NOT_ALL_ASSIGNED) + { + /* If there was actually only one privilege to acquire, use more accurate status */ + if (NumPriv == 1) + { + Status = STATUS_PRIVILEGE_NOT_HELD; + } + } + + /* Fail if needed, otherwise return our state to caller */ + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + else + { + *ReturnedState = State; + } + } while (FALSE); + + return Status; + +Cleanup: + /* If we allocated our own buffer for old privileges, release it */ + if (State->OldPrivileges && (PVOID)State->OldPrivBuffer != (PVOID)State->OldPrivileges) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, State->OldPrivileges); + } + + /* Do we have to restore previously active impersonation? */ + if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE) + { + Status = ZwSetInformationThread(NtCurrentThread(), ThreadImpersonationToken, + &State->OldImpersonationToken, sizeof(HANDLE)); + /* If this ever happens, we're in a really bad situation... */ + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + } + + /* Release token */ + if (State->Token) + { + ZwClose(State->Token); + } + + /* And free our state buffer */ + RtlFreeHeap(RtlGetProcessHeap(), 0, State); + + return Status; } /* - * @unimplemented + * @implemented */ VOID NTAPI RtlReleasePrivilege(IN PVOID ReturnedState) { - UNIMPLEMENTED; + NTSTATUS Status; + PRTL_ACQUIRE_STATE State = (PRTL_ACQUIRE_STATE)ReturnedState; + + /* If we had an active impersonation before we acquired privileges */ + if (State->Flags & RTL_ACQUIRE_PRIVILEGE_IMPERSONATE) + { + /* Restore it for the current thread */ + Status = ZwSetInformationThread(NtCurrentThread(), ThreadImpersonationToken, + &State->OldImpersonationToken, sizeof(HANDLE)); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + + /* And close the token if needed */ + if (State->OldImpersonationToken) + ZwClose(State->OldImpersonationToken); + } + else + { + /* Otherwise, restore old state */ + ZwAdjustPrivilegesToken(State->Token, FALSE, + State->OldPrivileges, 0, NULL, NULL); + + } + + /* If we used a different buffer for old privileges, just free it */ + if ((PVOID)State->OldPrivBuffer != (PVOID)State->OldPrivileges) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, State->OldPrivileges); + } + + /* Release token and free state */ + ZwClose(State->Token); + RtlFreeHeap(RtlGetProcessHeap(), 0, State); } /*
11 years, 7 months
1
0
0
0
[tkreuzer] 58936: {RTL] - Implement RtlFillMemoryUlonglong - Add missing bitmap64.c - Fix 64bit bitmap code
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun May 5 09:02:36 2013 New Revision: 58936 URL:
http://svn.reactos.org/svn/reactos?rev=58936&view=rev
Log: {RTL] - Implement RtlFillMemoryUlonglong - Add missing bitmap64.c - Fix 64bit bitmap code Added: trunk/reactos/lib/rtl/bitmap64.c (with props) Modified: trunk/reactos/lib/rtl/bitmap.c trunk/reactos/lib/rtl/mem.c Modified: trunk/reactos/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=58936…
============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -20,6 +20,7 @@ #ifdef USE_RTL_BITMAP64 #define _BITCOUNT 64 +#define MAXINDEX 0xFFFFFFFFFFFFFFFF typedef ULONG64 BITMAP_INDEX, *PBITMAP_INDEX; typedef ULONG64 BITMAP_BUFFER, *PBITMAP_BUFFER; #define RTL_BITMAP RTL_BITMAP64 @@ -55,6 +56,7 @@ #define RtlFindLongestRunSet RtlFindLongestRunSet64 #else #define _BITCOUNT 32 +#define MAXINDEX 0xFFFFFFFF typedef ULONG BITMAP_INDEX, *PBITMAP_INDEX; typedef ULONG BITMAP_BUFFER, *PBITMAP_BUFFER; #endif @@ -312,8 +314,8 @@ /* Are we unaligned? */ if (Bits) { - /* Create an inverse mask by shifting MAXULONG */ - Mask = MAXULONG << Bits; + /* Create an inverse mask by shifting MAXINDEX */ + Mask = MAXINDEX << Bits; /* This is what's left in the first ULONG */ Bits = _BITCOUNT - Bits; @@ -346,7 +348,7 @@ /* Clear what's left */ NumberToClear &= (_BITCOUNT - 1); - Mask = MAXULONG << NumberToClear; + Mask = MAXINDEX << NumberToClear; *Buffer &= Mask; } @@ -369,8 +371,8 @@ /* Are we unaligned? */ if (Bits) { - /* Create a mask by shifting MAXULONG */ - Mask = MAXULONG << Bits; + /* Create a mask by shifting MAXINDEX */ + Mask = MAXINDEX << Bits; /* This is what's left in the first ULONG */ Bits = _BITCOUNT - Bits; @@ -398,12 +400,12 @@ } /* Set all full ULONGs */ - RtlFillMemoryUlong(Buffer, NumberToSet >> 3, MAXULONG); + RtlFillMemoryUlong(Buffer, NumberToSet >> 3, MAXINDEX); Buffer += NumberToSet / _BITCOUNT; /* Set what's left */ NumberToSet &= (_BITCOUNT - 1); - Mask = MAXULONG << NumberToSet; + Mask = MAXINDEX << NumberToSet; *Buffer |= ~Mask; } @@ -491,7 +493,7 @@ /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) { - return MAXULONG; + return MAXINDEX; } /* Check if the hint is outside the bitmap */ @@ -517,7 +519,7 @@ /* Search for the next clear run, by skipping a set run */ CurrentBit += RtlpGetLengthOfRunSet(BitMapHeader, CurrentBit, - MAXULONG); + MAXINDEX); /* Get length of the clear bit run */ CurrentLength = RtlpGetLengthOfRunClear(BitMapHeader, @@ -544,7 +546,7 @@ } /* Nothing found */ - return MAXULONG; + return MAXINDEX; } BITMAP_INDEX @@ -559,7 +561,7 @@ /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) { - return MAXULONG; + return MAXINDEX; } /* Check if the hint is outside the bitmap */ @@ -585,7 +587,7 @@ /* Search for the next set run, by skipping a clear run */ CurrentBit += RtlpGetLengthOfRunClear(BitMapHeader, CurrentBit, - MAXULONG); + MAXINDEX); /* Get length of the set bit run */ CurrentLength = RtlpGetLengthOfRunSet(BitMapHeader, @@ -612,7 +614,7 @@ } /* Nothing found */ - return MAXULONG; + return MAXINDEX; } BITMAP_INDEX @@ -628,7 +630,7 @@ Position = RtlFindClearBits(BitMapHeader, NumberToFind, HintIndex); /* Did we get something? */ - if (Position != MAXULONG) + if (Position != MAXINDEX) { /* Yes, set the bits */ RtlSetBits(BitMapHeader, Position, NumberToFind); @@ -651,7 +653,7 @@ Position = RtlFindSetBits(BitMapHeader, NumberToFind, HintIndex); /* Did we get something? */ - if (Position != MAXULONG) + if (Position != MAXINDEX) { /* Yes, clear the bits */ RtlClearBits(BitMapHeader, Position, NumberToFind); @@ -678,11 +680,11 @@ } /* Assume a set run first, count it's length */ - Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG); + Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXINDEX); *StartingRunIndex = FromIndex + Length; /* Now return the length of the run */ - return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex + Length, MAXULONG); + return RtlpGetLengthOfRunClear(BitMapHeader, FromIndex + Length, MAXINDEX); } BITMAP_INDEX @@ -702,11 +704,11 @@ } /* Assume a clear run first, count it's length */ - Length = RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXULONG); + Length = RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXINDEX); *StartingRunIndex = FromIndex + Length; /* Now return the length of the run */ - return RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG); + return RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXINDEX); } BITMAP_INDEX Added: trunk/reactos/lib/rtl/bitmap64.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap64.c?rev=589…
============================================================================== --- trunk/reactos/lib/rtl/bitmap64.c (added) +++ trunk/reactos/lib/rtl/bitmap64.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -0,0 +1,4 @@ + +#define USE_RTL_BITMAP64 + +#include "bitmap.c" Propchange: trunk/reactos/lib/rtl/bitmap64.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/lib/rtl/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=58936&r1…
============================================================================== --- trunk/reactos/lib/rtl/mem.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/mem.c [iso-8859-1] Sun May 5 09:02:36 2013 @@ -112,6 +112,25 @@ } } +#ifdef _WIN64 +VOID +NTAPI +RtlFillMemoryUlonglong( + PVOID Destination, + SIZE_T Length, + ULONGLONG Fill) +{ + PULONGLONG Dest = Destination; + SIZE_T Count = Length / sizeof(ULONGLONG); + + while (Count > 0) + { + *Dest = Fill; + Dest++; + Count--; + } +} +#endif #undef RtlMoveMemory /*
11 years, 7 months
1
0
0
0
[zguo] 58935: Forgot this, add RosApps shortcut to desktop. Packaged versions already have this fix, this is just to preserve the change in SVN.
by zguo@svn.reactos.org
Author: zguo Date: Sun May 5 02:16:11 2013 New Revision: 58935 URL:
http://svn.reactos.org/svn/reactos?rev=58935&view=rev
Log: Forgot this, add RosApps shortcut to desktop. Packaged versions already have this fix, this is just to preserve the change in SVN. Modified: branches/ReactOS-0.3.15/dll/win32/syssetup/install.c Modified: branches/ReactOS-0.3.15/dll/win32/syssetup/install.c URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.15/dll/win32/sysset…
============================================================================== --- branches/ReactOS-0.3.15/dll/win32/syssetup/install.c [iso-8859-1] (original) +++ branches/ReactOS-0.3.15/dll/win32/syssetup/install.c [iso-8859-1] Sun May 5 02:16:11 2013 @@ -718,6 +718,7 @@ /* Create desktop shortcuts */ CreateShortcut(CSIDL_DESKTOP, NULL, IDS_SHORT_CMD, _T("%SystemRoot%\\system32\\cmd.exe"), IDS_CMT_CMD, TRUE, 0); + CreateShortcut(CSIDL_DESKTOP, NULL, IDS_SHORT_DOWNLOADER, _T("%SystemRoot%\\system32\\rapps.exe"), IDS_CMT_DOWNLOADER, TRUE, 0); /* Create program startmenu shortcuts */ CreateShortcut(CSIDL_PROGRAMS, NULL, IDS_SHORT_EXPLORER, _T("%SystemRoot%\\explorer.exe"), IDS_CMT_EXPLORER, TRUE, 1);
11 years, 7 months
1
0
0
0
[ekohl] 58934: [MSV1_0] Add token data from the old logon code.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun May 5 00:53:25 2013 New Revision: 58934 URL:
http://svn.reactos.org/svn/reactos?rev=58934&view=rev
Log: [MSV1_0] Add token data from the old logon code. Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c trunk/reactos/dll/win32/msv1_0/msv1_0.h Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.c?…
============================================================================== --- trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] Sun May 5 00:53:25 2013 @@ -81,7 +81,7 @@ PVOID ClientBaseAddress = NULL; LPWSTR Ptr; ULONG BufferLength; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; *ProfileBuffer = NULL; *ProfileBufferLength = 0; @@ -118,12 +118,24 @@ LocalBuffer->MessageType = MsV1_0InteractiveProfile; LocalBuffer->LogonCount = UserInfo->All.LogonCount; LocalBuffer->BadPasswordCount = UserInfo->All.BadPasswordCount; -// LARGE_INTEGER LogonTime; -// LARGE_INTEGER LogoffTime; -// LARGE_INTEGER KickOffTime; -// LARGE_INTEGER PasswordLastSet; -// LARGE_INTEGER PasswordCanChange; -// LARGE_INTEGER PasswordMustChange; + + LocalBuffer->LogonTime.LowPart = UserInfo->All.LastLogon.LowPart; + LocalBuffer->LogonTime.HighPart = UserInfo->All.LastLogon.HighPart; + +// LocalBuffer->LogoffTime.LowPart = +// LocalBuffer->LogoffTime.HighPart = + +// LocalBuffer->KickOffTime.LowPart = +// LocalBuffer->KickOffTime.HighPart = + + LocalBuffer->PasswordLastSet.LowPart = UserInfo->All.PasswordLastSet.LowPart; + LocalBuffer->PasswordLastSet.HighPart = UserInfo->All.PasswordLastSet.HighPart; + + LocalBuffer->PasswordCanChange.LowPart = UserInfo->All.PasswordCanChange.LowPart; + LocalBuffer->PasswordCanChange.HighPart = UserInfo->All.PasswordCanChange.HighPart; + + LocalBuffer->PasswordMustChange.LowPart = UserInfo->All.PasswordMustChange.LowPart; + LocalBuffer->PasswordMustChange.HighPart = UserInfo->All.PasswordMustChange.HighPart; LocalBuffer->LogonScript.Length = UserInfo->All.ScriptPath.Length; LocalBuffer->LogonScript.MaximumLength = UserInfo->All.ScriptPath.Length + sizeof(WCHAR); @@ -202,6 +214,511 @@ if (ClientBaseAddress != NULL) DispatchTable.FreeClientBuffer(ClientRequest, ClientBaseAddress); + } + + return Status; +} + + +static +PSID +AppendRidToSid(PSID SrcSid, + ULONG Rid) +{ + PSID DstSid = NULL; + UCHAR RidCount; + ULONG Size; + ULONG i; + + RidCount = *RtlSubAuthorityCountSid(SrcSid); + if (RidCount >= 8) + return NULL; + + Size = RtlLengthRequiredSid(RidCount + 1); + + DstSid = DispatchTable.AllocateLsaHeap(Size); + if (DstSid == NULL) + return NULL; + + for (i = 0; i < RidCount; i++) + *RtlSubAuthoritySid(DstSid, i) = *RtlSubAuthoritySid(SrcSid, i); + + *RtlSubAuthoritySid(DstSid, RidCount) = Rid; + + return DstSid; +} + +static +NTSTATUS +BuildTokenUser(OUT PTOKEN_USER User, + IN PSID AccountDomainSid, + IN ULONG RelativeId) +{ + User->User.Sid = AppendRidToSid(AccountDomainSid, + RelativeId); + User->User.Attributes = 0; + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +BuildTokenGroups(IN PSID AccountDomainSid, + IN PLUID LogonId, + OUT PTOKEN_GROUPS *Groups, + OUT PSID *PrimaryGroupSid, + OUT PSID *OwnerSid) +{ + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY LocalAuthority = {SECURITY_LOCAL_SID_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY}; + PTOKEN_GROUPS TokenGroups; +#define MAX_GROUPS 8 + DWORD GroupCount = 0; + PSID Sid; + NTSTATUS Status = STATUS_SUCCESS; + + TokenGroups = DispatchTable.AllocateLsaHeap(sizeof(TOKEN_GROUPS) + + MAX_GROUPS * sizeof(SID_AND_ATTRIBUTES)); + if (TokenGroups == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + Sid = AppendRidToSid(AccountDomainSid, DOMAIN_GROUP_RID_USERS); + if (Sid == NULL) + { + + } + + /* Member of the domain */ + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + *PrimaryGroupSid = Sid; + GroupCount++; + + /* Member of 'Everyone' */ + RtlAllocateAndInitializeSid(&WorldAuthority, + 1, + SECURITY_WORLD_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; + +#if 1 + /* Member of 'Administrators' */ + RtlAllocateAndInitializeSid(&SystemAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; +#else + TRACE("Not adding user to Administrators group\n"); +#endif + + /* Member of 'Users' */ + RtlAllocateAndInitializeSid(&SystemAuthority, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_USERS, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; + + /* Logon SID */ + RtlAllocateAndInitializeSid(&SystemAuthority, + SECURITY_LOGON_IDS_RID_COUNT, + SECURITY_LOGON_IDS_RID, + LogonId->HighPart, + LogonId->LowPart, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY | SE_GROUP_LOGON_ID; + GroupCount++; + *OwnerSid = Sid; + + /* Member of 'Local users */ + RtlAllocateAndInitializeSid(&LocalAuthority, + 1, + SECURITY_LOCAL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; + + /* Member of 'Interactive users' */ + RtlAllocateAndInitializeSid(&SystemAuthority, + 1, + SECURITY_INTERACTIVE_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; + + /* Member of 'Authenticated users' */ + RtlAllocateAndInitializeSid(&SystemAuthority, + 1, + SECURITY_AUTHENTICATED_USER_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &Sid); + TokenGroups->Groups[GroupCount].Sid = Sid; + TokenGroups->Groups[GroupCount].Attributes = + SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY; + GroupCount++; + + TokenGroups->GroupCount = GroupCount; + ASSERT(TokenGroups->GroupCount <= MAX_GROUPS); + + *Groups = TokenGroups; + + return Status; +} + + +static +NTSTATUS +BuildTokenPrimaryGroup(PTOKEN_PRIMARY_GROUP PrimaryGroup, + PSID PrimaryGroupSid) +{ + ULONG RidCount; + ULONG Size; + + RidCount = *RtlSubAuthorityCountSid(PrimaryGroupSid); + Size = RtlLengthRequiredSid(RidCount); + + PrimaryGroup->PrimaryGroup = DispatchTable.AllocateLsaHeap(Size); + if (PrimaryGroup->PrimaryGroup == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlCopyMemory(PrimaryGroup->PrimaryGroup, + PrimaryGroupSid, + Size); + + return STATUS_SUCCESS; +} + +static +NTSTATUS +BuildTokenPrivileges(PTOKEN_PRIVILEGES *TokenPrivileges) +{ + /* FIXME shouldn't use hard-coded list of privileges */ + static struct + { + LPCWSTR PrivName; + DWORD Attributes; + } + DefaultPrivs[] = + { + { L"SeMachineAccountPrivilege", 0 }, + { L"SeSecurityPrivilege", 0 }, + { L"SeTakeOwnershipPrivilege", 0 }, + { L"SeLoadDriverPrivilege", 0 }, + { L"SeSystemProfilePrivilege", 0 }, + { L"SeSystemtimePrivilege", 0 }, + { L"SeProfileSingleProcessPrivilege", 0 }, + { L"SeIncreaseBasePriorityPrivilege", 0 }, + { L"SeCreatePagefilePrivilege", 0 }, + { L"SeBackupPrivilege", 0 }, + { L"SeRestorePrivilege", 0 }, + { L"SeShutdownPrivilege", 0 }, + { L"SeDebugPrivilege", 0 }, + { L"SeSystemEnvironmentPrivilege", 0 }, + { L"SeChangeNotifyPrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT }, + { L"SeRemoteShutdownPrivilege", 0 }, + { L"SeUndockPrivilege", 0 }, + { L"SeEnableDelegationPrivilege", 0 }, + { L"SeImpersonatePrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT }, + { L"SeCreateGlobalPrivilege", SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT } + }; + PTOKEN_PRIVILEGES Privileges = NULL; + ULONG i; + RPC_UNICODE_STRING PrivilegeName; + LSAPR_HANDLE PolicyHandle = NULL; + NTSTATUS Status = STATUS_SUCCESS; + + Status = LsaIOpenPolicyTrusted(&PolicyHandle); + if (!NT_SUCCESS(Status)) + { + goto done; + } + + /* Allocate and initialize token privileges */ + Privileges = DispatchTable.AllocateLsaHeap(sizeof(TOKEN_PRIVILEGES) + + sizeof(DefaultPrivs) / sizeof(DefaultPrivs[0]) * + sizeof(LUID_AND_ATTRIBUTES)); + if (Privileges == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Privileges->PrivilegeCount = 0; + for (i = 0; i < sizeof(DefaultPrivs) / sizeof(DefaultPrivs[0]); i++) + { + PrivilegeName.Length = wcslen(DefaultPrivs[i].PrivName) * sizeof(WCHAR); + PrivilegeName.MaximumLength = PrivilegeName.Length + sizeof(WCHAR); + PrivilegeName.Buffer = (LPWSTR)DefaultPrivs[i].PrivName; + + Status = LsarLookupPrivilegeValue(PolicyHandle, + &PrivilegeName, + &Privileges->Privileges[Privileges->PrivilegeCount].Luid); + if (!NT_SUCCESS(Status)) + { + WARN("Can't set privilege %S\n", DefaultPrivs[i].PrivName); + } + else + { + Privileges->Privileges[Privileges->PrivilegeCount].Attributes = DefaultPrivs[i].Attributes; + Privileges->PrivilegeCount++; + } + } + + *TokenPrivileges = Privileges; + +done: + if (PolicyHandle != NULL) + LsarClose(PolicyHandle); + + return Status; +} + + +static +NTSTATUS +BuildTokenOwner(PTOKEN_OWNER Owner, + PSID OwnerSid) +{ + ULONG RidCount; + ULONG Size; + + RidCount = *RtlSubAuthorityCountSid(OwnerSid); + Size = RtlLengthRequiredSid(RidCount); + + Owner->Owner = DispatchTable.AllocateLsaHeap(Size); + if (Owner->Owner == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlCopyMemory(Owner->Owner, + OwnerSid, + Size); + + return STATUS_SUCCESS; +} + + +static +NTSTATUS +BuildTokenDefaultDacl(PTOKEN_DEFAULT_DACL DefaultDacl, + PSID OwnerSid) +{ + SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY}; + PSID LocalSystemSid = NULL; + PACL Dacl = NULL; + NTSTATUS Status = STATUS_SUCCESS; + + RtlAllocateAndInitializeSid(&SystemAuthority, + 1, + SECURITY_LOCAL_SYSTEM_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &LocalSystemSid); + + Dacl = DispatchTable.AllocateLsaHeap(1024); + if (Dacl == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = RtlCreateAcl(Dacl, 1024, ACL_REVISION); + if (!NT_SUCCESS(Status)) + goto done; + + RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + GENERIC_ALL, + OwnerSid); + + /* SID: S-1-5-18 */ + RtlAddAccessAllowedAce(Dacl, + ACL_REVISION, + GENERIC_ALL, + LocalSystemSid); + + DefaultDacl->DefaultDacl = Dacl; + +done: + if (!NT_SUCCESS(Status)) + { + if (Dacl != NULL) + DispatchTable.FreeLsaHeap(Dacl); + } + + if (LocalSystemSid != NULL) + RtlFreeSid(LocalSystemSid); + + return Status; +} + + +static +NTSTATUS +BuildTokenInformationBuffer(PLSA_TOKEN_INFORMATION_V1 *TokenInformation, + PRPC_SID AccountDomainSid, + ULONG RelativeId, + PLUID LogonId) +{ + PLSA_TOKEN_INFORMATION_V1 Buffer = NULL; + PSID OwnerSid = NULL; + PSID PrimaryGroupSid = NULL; + ULONG i; + NTSTATUS Status = STATUS_SUCCESS; + + Buffer = DispatchTable.AllocateLsaHeap(sizeof(LSA_TOKEN_INFORMATION_V1)); + if (Buffer == NULL) + { + TRACE("Failed to allocate the local buffer!\n"); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + /* FIXME: */ + Buffer->ExpirationTime.QuadPart = -1; + + Status = BuildTokenUser(&Buffer->User, + (PSID)AccountDomainSid, + RelativeId); + if (!NT_SUCCESS(Status)) + goto done; + + Status = BuildTokenGroups((PSID)AccountDomainSid, + LogonId, + &Buffer->Groups, + &PrimaryGroupSid, + &OwnerSid); + if (!NT_SUCCESS(Status)) + goto done; + + Status = BuildTokenPrimaryGroup(&Buffer->PrimaryGroup, + PrimaryGroupSid); + if (!NT_SUCCESS(Status)) + goto done; + + Status = BuildTokenPrivileges(&Buffer->Privileges); + if (!NT_SUCCESS(Status)) + goto done; + + Status = BuildTokenOwner(&Buffer->Owner, + OwnerSid); + if (!NT_SUCCESS(Status)) + goto done; + + Status = BuildTokenDefaultDacl(&Buffer->DefaultDacl, + OwnerSid); + if (!NT_SUCCESS(Status)) + goto done; + + *TokenInformation = Buffer; + +done: + if (!NT_SUCCESS(Status)) + { + if (Buffer != NULL) + { + if (Buffer->User.User.Sid != NULL) + DispatchTable.FreeLsaHeap(Buffer->User.User.Sid); + + if (Buffer->Groups != NULL) + { + for (i = 0; i < Buffer->Groups->GroupCount; i++) + { + if (Buffer->Groups->Groups[i].Sid != NULL) + DispatchTable.FreeLsaHeap(Buffer->Groups->Groups[i].Sid); + } + + DispatchTable.FreeLsaHeap(Buffer->Groups); + } + + if (Buffer->PrimaryGroup.PrimaryGroup != NULL) + DispatchTable.FreeLsaHeap(Buffer->PrimaryGroup.PrimaryGroup); + + if (Buffer->Privileges != NULL) + DispatchTable.FreeLsaHeap(Buffer->Privileges); + + if (Buffer->Owner.Owner != NULL) + DispatchTable.FreeLsaHeap(Buffer->Owner.Owner); + + if (Buffer->DefaultDacl.DefaultDacl != NULL) + DispatchTable.FreeLsaHeap(Buffer->DefaultDacl.DefaultDacl); + + DispatchTable.FreeLsaHeap(Buffer); + } } return Status; @@ -504,7 +1021,34 @@ /* Return the token information type */ *TokenInformationType = LsaTokenInformationV1; + /* Build and fill the token information buffer */ + Status = BuildTokenInformationBuffer((PLSA_TOKEN_INFORMATION_V1*)TokenInformation, + AccountDomainSid, + RelativeIds.Element[0], + LogonId); + if (!NT_SUCCESS(Status)) + { + TRACE("BuildTokenInformationBuffer failed (Status %08lx)\n", Status); + goto done; + } + + *SubStatus = STATUS_SUCCESS; + done: + /* Return the account name */ + *AccountName = DispatchTable.AllocateLsaHeap(sizeof(UNICODE_STRING)); + if (*AccountName != NULL) + { + (*AccountName)->Buffer = DispatchTable.AllocateLsaHeap(LogonInfo->UserName.Length + + sizeof(UNICODE_NULL)); + if ((*AccountName)->Buffer != NULL) + { + (*AccountName)->MaximumLength = LogonInfo->UserName.Length + + sizeof(UNICODE_NULL); + RtlCopyUnicodeString(*AccountName, &LogonInfo->UserName); + } + } + if (!NT_SUCCESS(Status)) { if (*ProfileBuffer != NULL) Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.h?…
============================================================================== --- trunk/reactos/dll/win32/msv1_0/msv1_0.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msv1_0/msv1_0.h [iso-8859-1] Sun May 5 00:53:25 2013 @@ -283,9 +283,14 @@ NTSTATUS WINAPI +LsarLookupPrivilegeValue(IN LSAPR_HANDLE PolicyHandle, + IN PRPC_UNICODE_STRING Name, + OUT PLUID Value); + +NTSTATUS +WINAPI LsarQueryInformationPolicy(IN LSAPR_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PLSAPR_POLICY_INFORMATION *PolicyInformation); - /* EOF */
11 years, 7 months
1
0
0
0
[ekohl] 58933: [LSASRV] Free additional data returned by calls to LsaApLogonUser/Ex/2.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun May 5 00:39:58 2013 New Revision: 58933 URL:
http://svn.reactos.org/svn/reactos?rev=58933&view=rev
Log: [LSASRV] Free additional data returned by calls to LsaApLogonUser/Ex/2. Modified: trunk/reactos/dll/win32/lsasrv/authpackage.c Modified: trunk/reactos/dll/win32/lsasrv/authpackage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authpacka…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] Sun May 5 00:39:58 2013 @@ -743,6 +743,7 @@ if (LocalAuthInfo != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, LocalAuthInfo); + /* Free the token information */ if (TokenInformation != NULL) { if (TokenInformationType == LsaTokenInformationV1) @@ -786,19 +787,31 @@ } } + /* Free the account name */ if (AccountName != NULL) { - - } - + if (AccountName->Buffer != NULL) + LsapFreeHeap(AccountName->Buffer); + + LsapFreeHeap(AccountName); + } + + /* Free the authentication authority */ if (AuthenticatingAuthority != NULL) { - - } - + if (AuthenticatingAuthority != NULL) + LsapFreeHeap(AuthenticatingAuthority->Buffer); + + LsapFreeHeap(AuthenticatingAuthority); + } + + /* Free the machine name */ if (MachineName != NULL) { - + if (MachineName->Buffer != NULL) + LsapFreeHeap(MachineName->Buffer); + + LsapFreeHeap(MachineName); } return Status;
11 years, 7 months
1
0
0
0
[hbelusca] 58932: [CDMAKE] ISO images generated by cdmake have invalid time and date. Patch by Aleksandar Andrejevic, aka. [TheFlash] CORE-7163 #resolve #comment Committed in revision r58932, thank...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat May 4 22:15:26 2013 New Revision: 58932 URL:
http://svn.reactos.org/svn/reactos?rev=58932&view=rev
Log: [CDMAKE] ISO images generated by cdmake have invalid time and date. Patch by Aleksandar Andrejevic, aka. [TheFlash] CORE-7163 #resolve #comment Committed in revision r58932, thanks for the patch ;) Modified: trunk/reactos/tools/cdmake/cdmake.c Modified: trunk/reactos/tools/cdmake/cdmake.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sat May 4 22:15:26 2013 @@ -1097,6 +1097,20 @@ } } +static void get_time_string(char *str) +{ + struct tm *current; + time_t timestamp = time(NULL); + current = gmtime(×tamp); + sprintf(str, "%04d%02d%02d%02d%02d%02d00", + current->tm_year + 1900, + current->tm_mon, + current->tm_mday, + current->tm_hour, + current->tm_min, + current->tm_sec); +} + static void pass(void) { PDIR_RECORD d; @@ -1110,6 +1124,9 @@ char *old_end_source; int n; FILE *file; + char timestring[17]; + + get_time_string(timestring); // first 16 sectors are zeros @@ -1144,13 +1161,13 @@ write_block(37, ' '); // copyright file identifier write_block(37, ' '); // abstract file identifier write_block(37, ' '); // bibliographic file identifier - write_string("0000000000000000"); // volume creation + write_string(timestring); // volume creation write_byte(0); - write_string("0000000000000000"); // most recent modification + write_string(timestring); // most recent modification write_byte(0); - write_string("0000000000000000"); // volume expires + write_string(timestring); // volume expires write_byte(0); - write_string("0000000000000000"); // volume is effective + write_string(timestring); // volume is effective write_byte(0); write_byte(1); write_byte(0); @@ -1203,14 +1220,14 @@ write_block(37, ' '); // copyright file identifier write_block(37, ' '); // abstract file identifier write_block(37, ' '); // bibliographic file identifier - write_string("0000000000000000"); // volume creation - write_byte(0); - write_string("0000000000000000"); // most recent modification - write_byte(0); - write_string("0000000000000000"); // volume expires - write_byte(0); - write_string("0000000000000000"); // volume is effective - write_byte(0); + write_string(timestring); // volume creation + write_byte(48); + write_string(timestring); // most recent modification + write_byte(48); + write_string(timestring); // volume expires + write_byte(48); + write_string(timestring); // volume is effective + write_byte(48); write_byte(1); write_byte(0); fill_sector(); @@ -1499,6 +1516,8 @@ int main(int argc, char **argv) { + struct tm *current_time; + time_t timestamp = time(NULL); BOOL q_option = FALSE; BOOL v_option = FALSE; int i; @@ -1520,8 +1539,15 @@ error_exit("Insufficient memory"); memset(&root, 0, sizeof(root)); + current_time = gmtime(×tamp); root.level = 1; root.flags = DIRECTORY_FLAG; + root.date_and_time.year = current_time->tm_year + 1900; + root.date_and_time.month = current_time->tm_mon; + root.date_and_time.day = current_time->tm_mday; + root.date_and_time.hour = current_time->tm_hour; + root.date_and_time.minute = current_time->tm_min; + root.date_and_time.second = current_time->tm_sec; // initialize CD-ROM write buffer
11 years, 7 months
1
0
0
0
[hbelusca] 58931: [CONSRV] Add heap diagnostic flags for the ConSrvHeap.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat May 4 21:03:27 2013 New Revision: 58931 URL:
http://svn.reactos.org/svn/reactos?rev=58931&view=rev
Log: [CONSRV] Add heap diagnostic flags for the ConSrvHeap. Modified: trunk/reactos/win32ss/user/consrv/init.c Modified: trunk/reactos/win32ss/user/consrv/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/init.c…
============================================================================== --- trunk/reactos/win32ss/user/consrv/init.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/consrv/init.c [iso-8859-1] Sat May 4 21:03:27 2013 @@ -484,7 +484,12 @@ // HACK: To try to uncover a heap corruption in CONSRV, use our own heap // instead of the CSR heap, so that we won't corrupt it. // ConSrvHeap = RtlGetProcessHeap(); - ConSrvHeap = RtlCreateHeap(HEAP_GROWABLE, NULL, 0, 0, NULL, NULL); + ConSrvHeap = RtlCreateHeap(HEAP_GROWABLE | + HEAP_PROTECTION_ENABLED | + HEAP_FREE_CHECKING_ENABLED | + HEAP_TAIL_CHECKING_ENABLED | + HEAP_VALIDATE_ALL_ENABLED, + NULL, 0, 0, NULL, NULL); if (!ConSrvHeap) return STATUS_NO_MEMORY; ConSrvInitConsoleSupport();
11 years, 7 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
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