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
October 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
14 participants
211 discussions
Start a n
N
ew thread
[hbelusca] 57591: [NTDLL] - Fix a variable and a header names. [CSR] - Move all the interesting code from the "old" csrsrv (see r57579) to the new one. TODO: finish to reorganize the code. - Rename...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Mon Oct 22 00:09:51 2012 New Revision: 57591 URL:
http://svn.reactos.org/svn/reactos?rev=57591&view=rev
Log: [NTDLL] - Fix a variable and a header names. [CSR] - Move all the interesting code from the "old" csrsrv (see r57579) to the new one. TODO: finish to reorganize the code. - Rename the headers to a standard naming I will use for the other server dlls. - Remove now unneeded files. (one can sometimes find commented names next to declaration of variables: it is when a variable name doesn't satisfy me because it isn't enough self-explaining for my taste). [CONSOLE] - Add a new header for console working (win32csr --> consrv.dll == the console part of winsrv.dll I separate from it, because I plan a profound reworking on the console after all that). Added: branches/ros-csrss/include/reactos/subsys/csr/ - copied from r57588, branches/ros-csrss/include/reactos/subsys/csrss/ branches/ros-csrss/include/reactos/subsys/csr/csrcl.h - copied, changed from r57588, branches/ros-csrss/include/reactos/subsys/csrss/client.h branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h - copied, changed from r57570, branches/ros-csrss/include/reactos/subsys/csrss/msg.h branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h - copied, changed from r57588, branches/ros-csrss/include/reactos/subsys/csrss/server.h branches/ros-csrss/include/reactos/subsys/win/conmsg.h - copied, changed from r57588, branches/ros-csrss/include/reactos/subsys/win/console.h branches/ros-csrss/include/reactos/subsys/win/winmsg.h - copied, changed from r57588, branches/ros-csrss/include/reactos/subsys/win/windows.h branches/ros-csrss/subsystems/win32/csrsrv/api.c - copied, changed from r57588, branches/ros-csrss/subsystems/win32/csrsrv/api/wapi.c branches/ros-csrss/subsystems/win32/csrsrv/user.c - copied, changed from r57588, branches/ros-csrss/subsystems/win32/csrsrv/api/user.c Removed: branches/ros-csrss/include/reactos/subsys/csr/client.h branches/ros-csrss/include/reactos/subsys/csr/msg.h branches/ros-csrss/include/reactos/subsys/csr/server.h branches/ros-csrss/include/reactos/subsys/csrss/ branches/ros-csrss/include/reactos/subsys/win/console.h branches/ros-csrss/include/reactos/subsys/win/windows.h branches/ros-csrss/subsystems/win32/csrsrv/api/ Modified: branches/ros-csrss/dll/ntdll/csr/connect.c branches/ros-csrss/dll/ntdll/include/ntdll.h branches/ros-csrss/include/reactos/subsys/csr/csrss.h branches/ros-csrss/subsystems/win32/csrsrv/CMakeLists.txt branches/ros-csrss/subsystems/win32/csrsrv/csrsrv.spec branches/ros-csrss/subsystems/win32/csrsrv/include/api.h branches/ros-csrss/subsystems/win32/csrsrv/include/csrplugin.h branches/ros-csrss/subsystems/win32/csrsrv/init.c branches/ros-csrss/subsystems/win32/csrsrv/procsup.c branches/ros-csrss/subsystems/win32/csrsrv/server.c branches/ros-csrss/subsystems/win32/csrsrv/session.c branches/ros-csrss/subsystems/win32/csrsrv/srv.h branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt branches/ros-csrss/subsystems/win32/csrss/csrss.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/ros-csrss/dll/ntdll/csr/connect.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/ntdll/csr/connect…
Modified: branches/ros-csrss/dll/ntdll/include/ntdll.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/ntdll/include/ntd…
Removed: branches/ros-csrss/include/reactos/subsys/csr/client.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Copied: branches/ros-csrss/include/reactos/subsys/csr/csrcl.h (from r57588, branches/ros-csrss/include/reactos/subsys/csrss/client.h) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Copied: branches/ros-csrss/include/reactos/subsys/csr/csrmsg.h (from r57570, branches/ros-csrss/include/reactos/subsys/csrss/msg.h) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Copied: branches/ros-csrss/include/reactos/subsys/csr/csrsrv.h (from r57588, branches/ros-csrss/include/reactos/subsys/csrss/server.h) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Modified: branches/ros-csrss/include/reactos/subsys/csr/csrss.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Removed: branches/ros-csrss/include/reactos/subsys/csr/msg.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Removed: branches/ros-csrss/include/reactos/subsys/csr/server.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Copied: branches/ros-csrss/include/reactos/subsys/win/conmsg.h (from r57588, branches/ros-csrss/include/reactos/subsys/win/console.h) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Removed: branches/ros-csrss/include/reactos/subsys/win/console.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Removed: branches/ros-csrss/include/reactos/subsys/win/windows.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Copied: branches/ros-csrss/include/reactos/subsys/win/winmsg.h (from r57588, branches/ros-csrss/include/reactos/subsys/win/windows.h) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Copied: branches/ros-csrss/subsystems/win32/csrsrv/api.c (from r57588, branches/ros-csrss/subsystems/win32/csrsrv/api/wapi.c) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/csrsrv.spec URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/include/api.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/include/csrplugin.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/server.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/session.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/srv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/thredsup.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Copied: branches/ros-csrss/subsystems/win32/csrsrv/user.c (from r57588, branches/ros-csrss/subsystems/win32/csrsrv/api/user.c) URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrss/csrss.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
12 years, 2 months
1
0
0
0
[ekohl] 57590: [SAMLIB] - Implement SamDeleteAlias, SamDeleteGroup, SamGetGroupsForUser, SamGetMembersInGroup, SamQuerySecurityObject, SamSetMemberAttributesOfGroup and SamSetSecurityObject. - Add ...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Oct 21 17:51:36 2012 New Revision: 57590 URL:
http://svn.reactos.org/svn/reactos?rev=57590&view=rev
Log: [SAMLIB] - Implement SamDeleteAlias, SamDeleteGroup, SamGetGroupsForUser, SamGetMembersInGroup, SamQuerySecurityObject, SamSetMemberAttributesOfGroup and SamSetSecurityObject. - Add stub for SamRidToSid. Modified: trunk/reactos/dll/win32/samlib/samlib.c trunk/reactos/dll/win32/samlib/samlib.spec trunk/reactos/include/ddk/ntsam.h trunk/reactos/include/reactos/idl/sam.idl Modified: trunk/reactos/dll/win32/samlib/samlib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.c?…
============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] Sun Oct 21 17:51:36 2012 @@ -382,6 +382,62 @@ NTSTATUS NTAPI +SamDeleteAlias(IN SAM_HANDLE AliasHandle) +{ + SAMPR_HANDLE LocalAliasHandle; + NTSTATUS Status; + + TRACE("SamDeleteAlias(%p)\n", AliasHandle); + + LocalAliasHandle = (SAMPR_HANDLE)AliasHandle; + + if (LocalAliasHandle == NULL) + return STATUS_INVALID_HANDLE; + + RpcTryExcept + { + Status = SamrDeleteAlias(&LocalAliasHandle); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamDeleteGroup(IN SAM_HANDLE GroupHandle) +{ + SAMPR_HANDLE LocalGroupHandle; + NTSTATUS Status; + + TRACE("SamDeleteGroup(%p)\n", GroupHandle); + + LocalGroupHandle = (SAMPR_HANDLE)GroupHandle; + + if (LocalGroupHandle == NULL) + return STATUS_INVALID_HANDLE; + + RpcTryExcept + { + Status = SamrDeleteGroup(&LocalGroupHandle); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI SamDeleteUser(IN SAM_HANDLE UserHandle) { SAMPR_HANDLE LocalUserHandle; @@ -667,6 +723,50 @@ NTSTATUS NTAPI +SamGetGroupsForUser(IN SAM_HANDLE UserHandle, + OUT PGROUP_MEMBERSHIP *Groups, + OUT PULONG MembershipCount) +{ + PSAMPR_GET_GROUPS_BUFFER GroupsBuffer = NULL; + NTSTATUS Status; + + TRACE("SamGetGroupsForUser(%p %p %p)\n", + UserHandle, Groups, MembershipCount); + + RpcTryExcept + { + Status = SamrGetGroupsForUser((SAMPR_HANDLE)UserHandle, + &GroupsBuffer); + if (NT_SUCCESS(Status)) + { + *Groups = GroupsBuffer->Groups; + *MembershipCount = GroupsBuffer->MembershipCount; + + MIDL_user_free(GroupsBuffer); + } + else + { + if (GroupsBuffer != NULL) + { + if (GroupsBuffer->Groups != NULL) + MIDL_user_free(GroupsBuffer->Groups); + + MIDL_user_free(GroupsBuffer); + } + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, OUT PSID **MemberIds, OUT PULONG MemberCount) @@ -696,6 +796,55 @@ *MemberIds = (PSID *)SidArray.Sids; } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamGetMembersInGroup(IN SAM_HANDLE GroupHandle, + OUT PULONG *MemberIds, + OUT PULONG *Attributes, + OUT PULONG MemberCount) +{ + PSAMPR_GET_MEMBERS_BUFFER MembersBuffer = NULL; + NTSTATUS Status; + + TRACE("SamGetMembersInGroup(%p %p %p %p)\n", + GroupHandle, MemberIds, Attributes, MemberCount); + + RpcTryExcept + { + Status = SamrGetMembersInGroup((SAMPR_HANDLE)GroupHandle, + &MembersBuffer); + if (NT_SUCCESS(Status)) + { + *MemberIds = MembersBuffer->Members; + *Attributes = MembersBuffer->Attributes; + *MemberCount = MembersBuffer->MemberCount; + + MIDL_user_free(MembersBuffer); + } + else + { + if (MembersBuffer != NULL) + { + if (MembersBuffer->Members != NULL) + MIDL_user_free(MembersBuffer->Members); + + if (MembersBuffer->Attributes != NULL) + MIDL_user_free(MembersBuffer->Attributes); + + MIDL_user_free(MembersBuffer); + } + } } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { @@ -1147,6 +1296,53 @@ NTSTATUS NTAPI +SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle, + IN SECURITY_INFORMATION SecurityInformation, + OUT PSECURITY_DESCRIPTOR *SecurityDescriptor) +{ + SAMPR_SR_SECURITY_DESCRIPTOR LocalSecurityDescriptor; + PSAMPR_SR_SECURITY_DESCRIPTOR pLocalSecurityDescriptor; + NTSTATUS Status; + + TRACE("SamQuerySecurityObject(%p %lu %p)\n", + ObjectHandle, SecurityInformation, SecurityDescriptor); + + LocalSecurityDescriptor.Length = 0; + LocalSecurityDescriptor.SecurityDescriptor = NULL; + + RpcTryExcept + { + pLocalSecurityDescriptor = &LocalSecurityDescriptor; + + Status = SamrQuerySecurityObject((SAMPR_HANDLE)ObjectHandle, + SecurityInformation, + &pLocalSecurityDescriptor); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + *SecurityDescriptor = LocalSecurityDescriptor.SecurityDescriptor; + + return Status; +} + + +NTSTATUS +NTAPI +SamRidToSid(IN SAM_HANDLE ObjectHandle, + IN ULONG Rid, + OUT PSID *Sid) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + + +NTSTATUS +NTAPI SamSetInformationAlias(IN SAM_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PVOID Buffer) @@ -1255,6 +1451,88 @@ NTSTATUS NTAPI +SamSetMemberAttributesOfGroup(IN SAM_HANDLE GroupHandle, + IN ULONG MemberId, + IN ULONG Attributes) +{ + NTSTATUS Status; + + TRACE("SamSetMemberAttributesOfGroup(%p %lu 0x%lx)\n", + GroupHandle, MemberId, Attributes); + + RpcTryExcept + { + Status = SamrSetMemberAttributesOfGroup((SAMPR_HANDLE)GroupHandle, + MemberId, + Attributes); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamSetSecurityObject(IN SAM_HANDLE ObjectHandle, + IN SECURITY_INFORMATION SecurityInformation, + IN PSECURITY_DESCRIPTOR SecurityDescriptor) +{ + SAMPR_SR_SECURITY_DESCRIPTOR DescriptorToPass; + ULONG Length; + NTSTATUS Status; + + TRACE("SamSetSecurityObject(%p %lu %p)\n", + ObjectHandle, SecurityInformation, SecurityDescriptor); + + /* Retrieve the length of the relative security descriptor */ + Length = 0; + Status = RtlMakeSelfRelativeSD(SecurityDescriptor, + NULL, + &Length); + if (Status != STATUS_BUFFER_TOO_SMALL) + return STATUS_INVALID_PARAMETER; + + + /* Allocate a buffer for the security descriptor */ + DescriptorToPass.Length = Length; + DescriptorToPass.SecurityDescriptor = MIDL_user_allocate(Length); + if (DescriptorToPass.SecurityDescriptor == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Convert the given security descriptor to a relative security descriptor */ + Status = RtlMakeSelfRelativeSD(SecurityDescriptor, + (PSECURITY_DESCRIPTOR)DescriptorToPass.SecurityDescriptor, + &Length); + if (!NT_SUCCESS(Status)) + goto done; + + RpcTryExcept + { + Status = SamrSetSecurityObject((SAMPR_HANDLE)ObjectHandle, + SecurityInformation, + &DescriptorToPass); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + +done: + if (DescriptorToPass.SecurityDescriptor != NULL) + MIDL_user_free(DescriptorToPass.SecurityDescriptor); + + return Status; +} + + +NTSTATUS +NTAPI SamShutdownSamServer(IN SAM_HANDLE ServerHandle) { UNIMPLEMENTED; Modified: trunk/reactos/dll/win32/samlib/samlib.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.sp…
============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] Sun Oct 21 17:51:36 2012 @@ -11,8 +11,8 @@ @ stdcall SamCreateGroupInDomain(ptr ptr long ptr ptr) @ stdcall SamCreateUser2InDomain(ptr ptr long long ptr ptr ptr) @ stdcall SamCreateUserInDomain(ptr ptr long ptr ptr) -@ stub SamDeleteAlias -@ stub SamDeleteGroup +@ stdcall SamDeleteAlias(ptr) +@ stdcall SamDeleteGroup(ptr) @ stdcall SamDeleteUser(ptr) @ stdcall SamEnumerateAliasesInDomain(ptr ptr ptr long ptr) @ stdcall SamEnumerateDomainsInSamServer(ptr ptr ptr long ptr) @@ -22,9 +22,9 @@ @ stdcall SamGetAliasMembership(ptr long ptr ptr ptr) @ stub SamGetCompatibilityMode @ stub SamGetDisplayEnumerationIndex -@ stub SamGetGroupsForUser +@ stdcall SamGetGroupsForUser(ptr ptr ptr) @ stdcall SamGetMembersInAlias(ptr ptr ptr) -@ stub SamGetMembersInGroup +@ stdcall SamGetMembersInGroup(ptr ptr ptr ptr) @ stdcall SamLookupDomainInSamServer(ptr ptr ptr) @ stdcall SamLookupIdsInDomain(ptr long ptr ptr ptr) @ stdcall SamLookupNamesInDomain(ptr long ptr ptr ptr) @@ -37,18 +37,18 @@ @ stdcall SamQueryInformationDomain(ptr long ptr) @ stdcall SamQueryInformationGroup(ptr long ptr) @ stdcall SamQueryInformationUser(ptr long ptr) -@ stub SamQuerySecurityObject +@ stdcall SamQuerySecurityObject(ptr long ptr) @ stub SamRemoveMemberFromAlias @ stub SamRemoveMemberFromForeignDomain @ stub SamRemoveMemberFromGroup @ stub SamRemoveMultipleMembersFromAlias -@ stub SamRidToSid +@ stdcall SamRidToSid(ptr long ptr) @ stdcall SamSetInformationAlias(ptr long ptr) @ stdcall SamSetInformationDomain(ptr long ptr) @ stdcall SamSetInformationGroup(ptr long ptr) @ stdcall SamSetInformationUser(ptr long ptr) -@ stub SamSetMemberAttributesOfGroup -@ stub SamSetSecurityObject +@ stdcall SamSetMemberAttributesOfGroup(ptr long long) +@ stdcall SamSetSecurityObject(ptr long ptr) @ stdcall SamShutdownSamServer(ptr) @ stub SamTestPrivateFunctionsDomain @ stub SamTestPrivateFunctionsUser Modified: trunk/reactos/include/ddk/ntsam.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntsam.h?rev=57…
============================================================================== --- trunk/reactos/include/ddk/ntsam.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntsam.h [iso-8859-1] Sun Oct 21 17:51:36 2012 @@ -270,6 +270,12 @@ GroupAdminCommentInformation, GroupReplicationInformation } GROUP_INFORMATION_CLASS; + +typedef struct _GROUP_MEMBERSHIP +{ + ULONG RelativeId; + ULONG Attributes; +} GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP; typedef enum _USER_INFORMATION_CLASS { @@ -375,6 +381,14 @@ NTSTATUS NTAPI +SamDeleteAlias(IN SAM_HANDLE AliasHandle); + +NTSTATUS +NTAPI +SamDeleteGroup(IN SAM_HANDLE GroupHandle); + +NTSTATUS +NTAPI SamDeleteUser(IN SAM_HANDLE UserHandle); NTSTATUS @@ -424,8 +438,21 @@ NTSTATUS NTAPI +SamGetGroupsForUser(IN SAM_HANDLE UserHandle, + OUT PGROUP_MEMBERSHIP *Groups, + OUT PULONG MembershipCount); + +NTSTATUS +NTAPI SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, OUT PSID **MemberIds, + OUT PULONG MemberCount); + +NTSTATUS +NTAPI +SamGetMembersInGroup(IN SAM_HANDLE GroupHandle, + OUT PULONG *MemberIds, + OUT PULONG *Attributes, OUT PULONG MemberCount); NTSTATUS @@ -504,8 +531,20 @@ NTSTATUS NTAPI +SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle, + IN SECURITY_INFORMATION SecurityInformation, + OUT PSECURITY_DESCRIPTOR *SecurityDescriptor); + +NTSTATUS +NTAPI SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, IN PSID MemberId); + +NTSTATUS +NTAPI +SamRidToSid(IN SAM_HANDLE ObjectHandle, + IN ULONG Rid, + OUT PSID *Sid); NTSTATUS NTAPI @@ -533,6 +572,18 @@ NTSTATUS NTAPI +SamSetMemberAttributesOfGroup(IN SAM_HANDLE GroupHandle, + IN ULONG MemberId, + IN ULONG Attributes); + +NTSTATUS +NTAPI +SamSetSecurityObject(IN SAM_HANDLE ObjectHandle, + IN SECURITY_INFORMATION SecurityInformation, + IN PSECURITY_DESCRIPTOR SecurityDescriptor); + +NTSTATUS +NTAPI SamShutdownSamServer(IN SAM_HANDLE ServerHandle); #ifdef __cplusplus Modified: trunk/reactos/include/reactos/idl/sam.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/idl/sam.id…
============================================================================== --- trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] (original) +++ trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] Sun Oct 21 17:51:36 2012 @@ -99,11 +99,13 @@ [size_is(Length)] unsigned char* SecurityDescriptor; } SAMPR_SR_SECURITY_DESCRIPTOR, *PSAMPR_SR_SECURITY_DESCRIPTOR; +cpp_quote("#ifndef _NTSAM_") typedef struct _GROUP_MEMBERSHIP { unsigned long RelativeId; unsigned long Attributes; } GROUP_MEMBERSHIP, *PGROUP_MEMBERSHIP; +cpp_quote("#endif") typedef struct _SAMPR_GET_GROUPS_BUFFER {
12 years, 2 months
1
0
0
0
[hbelusca] 57589: [BASESRV] - Compile basesrv and add headers. Some other things are missing yet.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun Oct 21 17:18:33 2012 New Revision: 57589 URL:
http://svn.reactos.org/svn/reactos?rev=57589&view=rev
Log: [BASESRV] - Compile basesrv and add headers. Some other things are missing yet. Added: branches/ros-csrss/include/reactos/subsys/win/basemsg.h (with props) Modified: branches/ros-csrss/include/reactos/subsys/win/base.h branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt branches/ros-csrss/subsystems/win/basesrv/basesrv.h branches/ros-csrss/subsystems/win/basesrv/init.c branches/ros-csrss/subsystems/win/basesrv/server.c Modified: branches/ros-csrss/include/reactos/subsys/win/base.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
============================================================================== --- branches/ros-csrss/include/reactos/subsys/win/base.h [iso-8859-1] (original) +++ branches/ros-csrss/include/reactos/subsys/win/base.h [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -1,17 +1,84 @@ -/*** Public header for BASESRV and the rest ***/ -#ifndef __INCLUDE_WIN_BASE_H -#define __INCLUDE_WIN_BASE_H +#ifndef __BASE_H__ +#define __BASE_H__ -//#include <csr/protocol.h> - -/* Base Server */ +#pragma once typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID); NTSTATUS WINAPI BaseSetProcessCreateNotify (BASE_PROCESS_CREATE_NOTIFY_ROUTINE); CSR_SERVER_DLL_INIT(ServerDllInitialization); -#endif // __INCLUDE_WIN_BASE_H + + +typedef struct _NLS_USER_INFO +{ + WCHAR iCountry[80]; + WCHAR sCountry[80]; + WCHAR sList[80]; + WCHAR iMeasure[80]; + WCHAR iPaperSize[80]; + WCHAR sDecimal[80]; + WCHAR sThousand[80]; + WCHAR sGrouping[80]; + WCHAR iDigits[80]; + WCHAR iLZero[80]; + WCHAR iNegNumber[80]; + WCHAR sNativeDigits[80]; + WCHAR iDigitSubstitution[80]; + WCHAR sCurrency[80]; + WCHAR sMonDecSep[80]; + WCHAR sMonThouSep[80]; + WCHAR sMonGrouping[80]; + WCHAR iCurrDigits[80]; + WCHAR iCurrency[80]; + WCHAR iNegCurr[80]; + WCHAR sPosSign[80]; + WCHAR sNegSign[80]; + WCHAR sTimeFormat[80]; + WCHAR s1159[80]; + WCHAR s2359[80]; + WCHAR sShortDate[80]; + WCHAR sYearMonth[80]; + WCHAR sLongDate[80]; + WCHAR iCalType[80]; + WCHAR iFirstDay[80]; + WCHAR iFirstWeek[80]; + WCHAR sLocale[80]; + WCHAR sLocaleName[85]; + LCID UserLocaleId; + LUID InteractiveUserLuid; + CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy + ULONG ulCacheUpdateCount; +} NLS_USER_INFO, *PNLS_USER_INFO; + + +typedef struct _BASE_STATIC_SERVER_DATA +{ + UNICODE_STRING WindowsDirectory; + UNICODE_STRING WindowsSystemDirectory; + UNICODE_STRING NamedObjectDirectory; + USHORT WindowsMajorVersion; + USHORT WindowsMinorVersion; + USHORT BuildNumber; + USHORT CSDNumber; + USHORT RCNumber; + WCHAR CSDVersion[128]; + SYSTEM_BASIC_INFORMATION SysInfo; + SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay; + PVOID IniFileMapping; + NLS_USER_INFO NlsUserInfo; + BOOLEAN DefaultSeparateVDM; + BOOLEAN IsWowTaskReady; + UNICODE_STRING WindowsSys32x86Directory; + BOOLEAN fTermsrvAppInstallMode; + TIME_ZONE_INFORMATION tziTermsrvClientTimeZone; + KSYSTEM_TIME ktTermsrvClientBias; + ULONG TermsrvClientTimeZoneId; + BOOLEAN LUIDDeviceMapsEnabled; + ULONG TermsrvClientTimeZoneChangeNum; +} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA; + +#endif // __BASE_H__ /* EOF */ Added: branches/ros-csrss/include/reactos/subsys/win/basemsg.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
============================================================================== --- branches/ros-csrss/include/reactos/subsys/win/basemsg.h (added) +++ branches/ros-csrss/include/reactos/subsys/win/basemsg.h [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -1,0 +1,200 @@ + +#ifndef __BASEMSG_H__ +#define __BASEMSG_H__ + +#pragma once + +#define BASESRV_SERVERDLL_INDEX 1 +#define BASESRV_FIRST_API_NUMBER 0 + +// Windows NT 4 table, adapted from
http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_NT
+// It is for testing purposes. After that I will update it to 2k3 version and add stubs. +typedef enum _BASESRV_API_NUMBER +{ + BasepCreateProcess = BASESRV_FIRST_API_NUMBER, + BasepCreateThread, + BasepGetTempFile, + BasepExitProcess, + // BasepDebugProcess, + // BasepCheckVDM, + // BasepUpdateVDMEntry, + // BasepGetNextVDMCommand, + // BasepExitVDM, + // BasepIsFirstVDM, + // BasepGetVDMExitCode, + // BasepSetReenterCount, + BasepSetProcessShutdownParam, + BasepGetProcessShutdownParam, + // BasepNlsSetUserInfo, + // BasepNlsSetMultipleUserInfo, + // BasepNlsCreateSortSection, + // BasepNlsPreserveSection, + // BasepSetVDMCurDirs, + // BasepGetVDMCurDirs, + // BasepBatNotification, + // BasepRegisterWowExec, + BasepSoundSentryNotification, + // BasepRefreshIniFileMapping, + BasepDefineDosDevice, + + BasepMaxApiNumber +} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER; + +typedef struct _BASE_SXS_CREATEPROCESS_MSG +{ + ULONG Flags; + ULONG ProcessParameterFlags; + HANDLE FileHandle; + UNICODE_STRING SxsWin32ExePath; + UNICODE_STRING SxsNtExePath; + SIZE_T OverrideManifestOffset; + ULONG OverrideManifestSize; + SIZE_T OverridePolicyOffset; + ULONG OverridePolicySize; + PVOID PEManifestAddress; + ULONG PEManifestSize; + UNICODE_STRING CultureFallbacks; + ULONG Unknown[7]; + UNICODE_STRING AssemblyName; +} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG; + +typedef struct +{ + // + // NT-type structure (BASE_CREATEPROCESS_MSG) + // + HANDLE ProcessHandle; + HANDLE ThreadHandle; + CLIENT_ID ClientId; + ULONG CreationFlags; + ULONG VdmBinaryType; + ULONG VdmTask; + HANDLE hVDM; + BASE_SXS_CREATEPROCESS_MSG Sxs; + PVOID PebAddressNative; + ULONG PebAddressWow64; + USHORT ProcessorArchitecture; + + // + // ReactOS Data + // + BOOL bInheritHandles; +} BASE_CREATE_PROCESS, *PBASE_CREATE_PROCESS; + +typedef struct +{ + CLIENT_ID ClientId; + HANDLE ThreadHandle; +} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD; + +typedef struct +{ + UINT uExitCode; +} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS; + +typedef struct +{ + UINT UniqueID; +} BASE_GET_TEMP_FILE, *PBASE_GET_TEMP_FILE; + +typedef struct +{ + ULONG iTask; + HANDLE ConsoleHandle; + ULONG BinaryType; + HANDLE WaitObjectForParent; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; + ULONG CodePage; + ULONG dwCreationFlags; + PCHAR CmdLine; + PCHAR appName; + PCHAR PifFile; + PCHAR CurDirectory; + PCHAR Env; + ULONG EnvLen; + PVOID StartupInfo; + PCHAR Desktop; + ULONG DesktopLen; + PCHAR Title; + ULONG TitleLen; + PCHAR Reserved; + ULONG ReservedLen; + USHORT CmdLen; + USHORT AppLen; + USHORT PifLen; + USHORT CurDirectoryLen; + USHORT CurDrive; + USHORT VDMState; +} BASE_CHECK_VDM, *PBASE_CHECK_VDM; + +typedef struct +{ + ULONG iTask; + ULONG BinaryType; + HANDLE ConsoleHandle; + HANDLE VDMProcessHandle; + HANDLE WaitObjectForParent; + USHORT EntryIndex; + USHORT VDMCreationState; +} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY; + +typedef struct +{ + HANDLE ConsoleHandle; + HANDLE hParent; + ULONG ExitCode; +} BASE_GET_VDM_EXIT_CODE, *PBASE_GET_VDM_EXIT_CODE; + +typedef struct +{ + DWORD Level; + DWORD Flags; +} BASE_SET_PROCESS_SHUTDOWN_PARAMS, *PBASE_SET_PROCESS_SHUTDOWN_PARAMS; + +typedef struct +{ + DWORD Level; + DWORD Flags; +} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS; + +typedef struct +{ + ULONG VideoMode; +} BASE_SOUND_SENTRY, *PBASE_SOUND_SENTRY; + +typedef struct +{ + UNICODE_STRING DeviceName; + UNICODE_STRING TargetName; + DWORD dwFlags; +} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE; + +typedef struct _BASE_API_MESSAGE +{ + PORT_MESSAGE Header; + + PCSR_CAPTURE_BUFFER CsrCaptureData; + CSR_API_NUMBER ApiNumber; + ULONG Status; + ULONG Reserved; + union + { + BASE_CREATE_PROCESS CreateProcessRequest; + BASE_CREATE_THREAD CreateThreadRequest; + BASE_EXIT_PROCESS ExitProcessRequest; // CSRSS_TERMINATE_PROCESS TerminateProcessRequest; + BASE_GET_TEMP_FILE GetTempFile; + BASE_CHECK_VDM CheckVdm; + BASE_UPDATE_VDM_ENTRY UpdateVdmEntry; + BASE_GET_VDM_EXIT_CODE GetVdmExitCode; + BASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest; // CSRSS_SET_SHUTDOWN_PARAMETERS + BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest; // CSRSS_GET_SHUTDOWN_PARAMETERS + BASE_SOUND_SENTRY SoundSentryRequest; + BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest; + } Data; +} BASE_API_MESSAGE, *PBASE_API_MESSAGE; + +#endif // __BASEMSG_H__ + +/* EOF */ Propchange: branches/ros-csrss/include/reactos/subsys/win/basemsg.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -1,6 +1,5 @@ -include_directories(${REACTOS_SOURCE_DIR}/subsystems/win32/csrss/include - ${REACTOS_SOURCE_DIR}/include/reactos/subsys) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) spec2def(basesrv.dll basesrv.spec) @@ -14,7 +13,7 @@ target_link_libraries(basesrv ${PSEH_LIB}) -set_module_type(basesrv win32dll) +set_module_type(basesrv nativedll) # win32dll add_importlibs(basesrv ntdll csrsrv) Modified: branches/ros-csrss/subsystems/win/basesrv/basesrv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/basesrv.h [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/basesrv.h [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -1,289 +1,38 @@ -/*** Private header for BASESRV ***/ + +#ifndef __BASESRV_H__ +#define __BASESRV_H__ #pragma once /* PSDK/NDK Headers */ -#include <stdio.h> +#define WIN32_NO_STATUS #include <windows.h> - #define NTOS_MODE_USER #include <ndk/ntndk.h> /* CSRSS Header */ -#include <csrss/server.h> +#include <csr/csrsrv.h> - +/* BASE Headers */ +#include <win/basemsg.h> #include <win/base.h> +extern HANDLE BaseSrvHeap; +extern HANDLE BaseSrvSharedHeap; +extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; -#define BASESRV_SERVERDLL_INDEX 1 -#define BASESRV_FIRST_API_NUMBER 0 +VOID BaseCleanupDefineDosDevice(VOID); +CSR_API(BaseSrvCreateProcess); +CSR_API(BaseSrvCreateThread); +CSR_API(BaseSrvGetTempFile); +CSR_API(BaseSrvExitProcess); +CSR_API(BaseSrvGetProcessShutdownParam); +CSR_API(BaseSrvSetProcessShutdownParam); +CSR_API(BaseSrvSoundSentryNotification); +CSR_API(BaseSrvDefineDosDevice); -// Windows NT 4 table, adapted from
http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_NT
-// It is for testing purposes. After that I will update it to 2k3 version and add stubs. -typedef enum _BASESRV_API_NUMBER -{ - BasepCreateProcess = BASESRV_FIRST_API_NUMBER, - BasepCreateThread, - BasepGetTempFile, - BasepExitProcess, - // BasepDebugProcess, - BasepCheckVDM, - BasepUpdateVDMEntry, - // BasepGetNextVDMCommand, - // BasepExitVDM, - // BasepIsFirstVDM, - BasepGetVDMExitCode, - // BasepSetReenterCount, - BasepSetProcessShutdownParam, - BasepGetProcessShutdownParam, - // BasepNlsSetUserInfo, - // BasepNlsSetMultipleUserInfo, - // BasepNlsCreateSortSection, - // BasepNlsPreserveSection, - // BasepSetVDMCurDirs, - // BasepGetVDMCurDirs, - // BasepBatNotification, - // BasepRegisterWowExec, - BasepSoundSentryNotification, - // BasepRefreshIniFileMapping, - BasepDefineDosDevice, +#endif // __BASESRV_H__ - BasepMaxApiNumber -} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER; - - -typedef struct _BASE_SXS_CREATEPROCESS_MSG -{ - ULONG Flags; - ULONG ProcessParameterFlags; - HANDLE FileHandle; - UNICODE_STRING SxsWin32ExePath; - UNICODE_STRING SxsNtExePath; - SIZE_T OverrideManifestOffset; - ULONG OverrideManifestSize; - SIZE_T OverridePolicyOffset; - ULONG OverridePolicySize; - PVOID PEManifestAddress; - ULONG PEManifestSize; - UNICODE_STRING CultureFallbacks; - ULONG Unknown[7]; - UNICODE_STRING AssemblyName; -} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG; - -typedef struct -{ - // - // NT-type structure (BASE_CREATEPROCESS_MSG) - // - HANDLE ProcessHandle; - HANDLE ThreadHandle; - CLIENT_ID ClientId; - ULONG CreationFlags; - ULONG VdmBinaryType; - ULONG VdmTask; - HANDLE hVDM; - BASE_SXS_CREATEPROCESS_MSG Sxs; - PVOID PebAddressNative; - ULONG PebAddressWow64; - USHORT ProcessorArchitecture; - - // - // ReactOS Data - // - BOOL bInheritHandles; -} BASE_CREATE_PROCESS, *PBASE_CREATE_PROCESS; - -typedef struct -{ - CLIENT_ID ClientId; - HANDLE ThreadHandle; -} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD; - -typedef struct -{ - UINT uExitCode; -} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS; - -typedef struct -{ - UINT UniqueID; -} BASE_GET_TEMP_FILE, *PBASE_GET_TEMP_FILE; - -typedef struct -{ - ULONG iTask; - HANDLE ConsoleHandle; - ULONG BinaryType; - HANDLE WaitObjectForParent; - HANDLE StdIn; - HANDLE StdOut; - HANDLE StdErr; - ULONG CodePage; - ULONG dwCreationFlags; - PCHAR CmdLine; - PCHAR appName; - PCHAR PifFile; - PCHAR CurDirectory; - PCHAR Env; - ULONG EnvLen; - PVOID StartupInfo; - PCHAR Desktop; - ULONG DesktopLen; - PCHAR Title; - ULONG TitleLen; - PCHAR Reserved; - ULONG ReservedLen; - USHORT CmdLen; - USHORT AppLen; - USHORT PifLen; - USHORT CurDirectoryLen; - USHORT CurDrive; - USHORT VDMState; -} BASE_CHECK_VDM, *PBASE_CHECK_VDM; - -typedef struct -{ - ULONG iTask; - ULONG BinaryType; - HANDLE ConsoleHandle; - HANDLE VDMProcessHandle; - HANDLE WaitObjectForParent; - USHORT EntryIndex; - USHORT VDMCreationState; -} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY; - -typedef struct -{ - HANDLE ConsoleHandle; - HANDLE hParent; - ULONG ExitCode; -} BASE_GET_VDM_EXIT_CODE, *PBASE_GET_VDM_EXIT_CODE; - -typedef struct -{ - DWORD Level; - DWORD Flags; -} BASE_SET_PROCESS_SHUTDOWN_PARAMS, *PBASE_SET_PROCESS_SHUTDOWN_PARAMS; - -typedef struct -{ - DWORD Level; - DWORD Flags; -} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS; - -typedef struct -{ - ULONG VideoMode; -} BASE_SOUND_SENTRY, *PBASE_SOUND_SENTRY; - -typedef struct -{ - UNICODE_STRING DeviceName; - UNICODE_STRING TargetName; - DWORD dwFlags; -} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE; - - -typedef struct _BASE_API_MESSAGE -{ - PORT_MESSAGE Header; - - PCSR_CAPTURE_BUFFER CsrCaptureData; - CSR_API_NUMBER ApiNumber; - ULONG Status; - ULONG Reserved; - union - { - BASE_CREATE_PROCESS CreateProcessRequest; - BASE_CREATE_THREAD CreateThreadRequest; - BASE_EXIT_PROCESS ExitProcessRequest; // CSRSS_TERMINATE_PROCESS TerminateProcessRequest; - BASE_GET_TEMP_FILE GetTempFile; - BASE_CHECK_VDM CheckVdm; - BASE_UPDATE_VDM_ENTRY UpdateVdmEntry; - BASE_GET_VDM_EXIT_CODE GetVdmExitCode; - BASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest; // CSRSS_SET_SHUTDOWN_PARAMETERS - BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest; // CSRSS_GET_SHUTDOWN_PARAMETERS - BASE_SOUND_SENTRY SoundSentryRequest; - BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest; - } Data; -} BASE_API_MESSAGE, *PBASE_API_MESSAGE; - - - - - - - - -typedef struct _NLS_USER_INFO -{ - WCHAR iCountry[80]; - WCHAR sCountry[80]; - WCHAR sList[80]; - WCHAR iMeasure[80]; - WCHAR iPaperSize[80]; - WCHAR sDecimal[80]; - WCHAR sThousand[80]; - WCHAR sGrouping[80]; - WCHAR iDigits[80]; - WCHAR iLZero[80]; - WCHAR iNegNumber[80]; - WCHAR sNativeDigits[80]; - WCHAR iDigitSubstitution[80]; - WCHAR sCurrency[80]; - WCHAR sMonDecSep[80]; - WCHAR sMonThouSep[80]; - WCHAR sMonGrouping[80]; - WCHAR iCurrDigits[80]; - WCHAR iCurrency[80]; - WCHAR iNegCurr[80]; - WCHAR sPosSign[80]; - WCHAR sNegSign[80]; - WCHAR sTimeFormat[80]; - WCHAR s1159[80]; - WCHAR s2359[80]; - WCHAR sShortDate[80]; - WCHAR sYearMonth[80]; - WCHAR sLongDate[80]; - WCHAR iCalType[80]; - WCHAR iFirstDay[80]; - WCHAR iFirstWeek[80]; - WCHAR sLocale[80]; - WCHAR sLocaleName[85]; - LCID UserLocaleId; - LUID InteractiveUserLuid; - CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy - ULONG ulCacheUpdateCount; -} NLS_USER_INFO, *PNLS_USER_INFO; - - -typedef struct _BASE_STATIC_SERVER_DATA -{ - UNICODE_STRING WindowsDirectory; - UNICODE_STRING WindowsSystemDirectory; - UNICODE_STRING NamedObjectDirectory; - USHORT WindowsMajorVersion; - USHORT WindowsMinorVersion; - USHORT BuildNumber; - USHORT CSDNumber; - USHORT RCNumber; - WCHAR CSDVersion[128]; - SYSTEM_BASIC_INFORMATION SysInfo; - SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay; - PVOID IniFileMapping; - NLS_USER_INFO NlsUserInfo; - BOOLEAN DefaultSeparateVDM; - BOOLEAN IsWowTaskReady; - UNICODE_STRING WindowsSys32x86Directory; - BOOLEAN fTermsrvAppInstallMode; - TIME_ZONE_INFORMATION tziTermsrvClientTimeZone; - KSYSTEM_TIME ktTermsrvClientBias; - ULONG TermsrvClientTimeZoneId; - BOOLEAN LUIDDeviceMapsEnabled; - ULONG TermsrvClientTimeZoneChangeNum; -} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA; - - +/* EOF */ Modified: branches/ros-csrss/subsystems/win/basesrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/init.c [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -14,6 +14,11 @@ HANDLE DllHandle = NULL; HANDLE BaseApiPort = NULL; +/* Memory */ +HANDLE BaseSrvHeap = NULL; // Our own heap. +HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap) +PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap. + extern LIST_ENTRY DosDeviceHistory; extern RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec; @@ -27,12 +32,12 @@ BaseSrvGetTempFile, BaseSrvExitProcess, // BaseSrvDebugProcess, - BaseSrvCheckVDM, - BaseSrvUpdateVDMEntry, + // BaseSrvCheckVDM, + // BaseSrvUpdateVDMEntry, // BaseSrvGetNextVDMCommand, // BaseSrvExitVDM, // BaseSrvIsFirstVDM, - BaseSrvGetVDMExitCode, + // BaseSrvGetVDMExitCode, // BaseSrvSetReenterCount, BaseSrvSetProcessShutdownParam, BaseSrvGetProcessShutdownParam, @@ -56,12 +61,12 @@ TRUE, // SrvGetTempFile, FALSE, // SrvExitProcess, // FALSE, // SrvDebugProcess, - TRUE, // SrvCheckVDM, - TRUE, // SrvUpdateVDMEntry + // TRUE, // SrvCheckVDM, + // TRUE, // SrvUpdateVDMEntry // TRUE, // SrvGetNextVDMCommand // TRUE, // SrvExitVDM // TRUE, // SrvIsFirstVDM - TRUE, // SrvGetVDMExitCode + // TRUE, // SrvGetVDMExitCode // TRUE, // SrvSetReenterCount TRUE, // SrvSetProcessShutdownParam TRUE, // SrvGetProcessShutdownParam @@ -86,12 +91,12 @@ "BaseGetTempFile", "BaseExitProcess", // "BaseDebugProcess", - "BaseCheckVDM", - "BaseUpdateVDMEntry", + // "BaseCheckVDM", + // "BaseUpdateVDMEntry", // "BaseGetNextVDMCommand", // "BaseExitVDM", // "BaseIsFirstVDM", - "BaseGetVDMExitCode", + // "BaseGetVDMExitCode", // "BaseSetReenterCount", "BaseSetProcessShutdownParam", "BaseGetProcessShutdownParam", @@ -112,9 +117,126 @@ /* FUNCTIONS ******************************************************************/ +NTSTATUS +NTAPI +CreateBaseAcls(OUT PACL* Dacl, + OUT PACL* RestrictedDacl) +{ + PSID SystemSid, WorldSid, RestrictedSid; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + NTSTATUS Status; + // UCHAR KeyValueBuffer[0x40]; + // PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; + // UNICODE_STRING KeyName; + // ULONG ProtectionMode = 0; + ULONG AclLength; // , ResultLength; + // HANDLE hKey; + // OBJECT_ATTRIBUTES ObjectAttributes; + + /* Open the Session Manager Key */ + /* + RtlInitUnicodeString(&KeyName, SM_REG_KEY); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /\* Read the key value *\/ + RtlInitUnicodeString(&KeyName, L"ProtectionMode"); + Status = NtQueryValueKey(hKey, + &KeyName, + KeyValuePartialInformation, + KeyValueBuffer, + sizeof(KeyValueBuffer), + &ResultLength); + + /\* Make sure it's what we expect it to be *\/ + KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer; + if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) && + (*(PULONG)KeyValuePartialInfo->Data)) + { + /\* Save the Protection Mode *\/ + // ProtectionMode = *(PULONG)KeyValuePartialInfo->Data; + } + + /\* Close the handle *\/ + NtClose(hKey); + } + */ + + /* Allocate the System SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_LOCAL_SYSTEM_RID, + 0, 0, 0, 0, 0, 0, 0, + &SystemSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the World SID */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate the restricted SID */ + Status = RtlAllocateAndInitializeSid(&NtAuthority, + 1, SECURITY_RESTRICTED_CODE_RID, + 0, 0, 0, 0, 0, 0, 0, + &RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Allocate one ACL with 3 ACEs each for one SID */ + AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) + + RtlLengthSid(SystemSid) + + RtlLengthSid(RestrictedSid) + + RtlLengthSid(WorldSid); + *Dacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength); + ASSERT(*Dacl != NULL); + + /* Set the correct header fields */ + Status = RtlCreateAcl(*Dacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* Give the appropriate rights to each SID */ + /* FIXME: Should check SessionId/ProtectionMode */ + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* Now allocate the restricted DACL */ + *RestrictedDacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength); + ASSERT(*RestrictedDacl != NULL); + + /* Initialize it */ + Status = RtlCreateAcl(*RestrictedDacl, AclLength, ACL_REVISION2); + ASSERT(NT_SUCCESS(Status)); + + /* And add the same ACEs as before */ + /* FIXME: Not really fully correct */ + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid); + ASSERT(NT_SUCCESS(Status)); + Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid); + ASSERT(NT_SUCCESS(Status)); + + /* The SIDs are captured, can free them now */ + RtlFreeHeap(BaseSrvHeap, 0, SystemSid); + RtlFreeHeap(BaseSrvHeap, 0, WorldSid); + RtlFreeHeap(BaseSrvHeap, 0, RestrictedSid); + return Status; +} + VOID NTAPI -BasepFakeStaticServerData(VOID) +BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) { NTSTATUS Status; WCHAR Buffer[MAX_PATH]; @@ -147,6 +269,10 @@ {0} }; + /* Initialize memory */ + BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap. + BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap. + /* Get the session ID */ SessionId = NtCurrentPeb()->SessionId; @@ -175,7 +301,7 @@ RtlInitUnicodeString(&BnoString, Buffer); /* Allocate the server data */ - BaseStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, + BaseStaticServerData = RtlAllocateHeap(BaseSrvSharedHeap, HEAP_ZERO_MEMORY, sizeof(BASE_STATIC_SERVER_DATA)); ASSERT(BaseStaticServerData != NULL); @@ -191,7 +317,7 @@ /* Make a shared heap copy of the Windows directory */ BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory; - HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, 0, BaseSrvWindowsDirectory.MaximumLength); ASSERT(HeapBuffer); @@ -202,7 +328,7 @@ /* Make a shared heap copy of the System directory */ BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory; - HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, 0, BaseSrvWindowsSystemDirectory.MaximumLength); ASSERT(HeapBuffer); @@ -220,7 +346,7 @@ BaseStaticServerData->NamedObjectDirectory = BnoString; BaseStaticServerData->NamedObjectDirectory.MaximumLength = BnoString.Length + sizeof(UNICODE_NULL); - HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap, 0, BaseStaticServerData->NamedObjectDirectory.MaximumLength); ASSERT(HeapBuffer); @@ -272,7 +398,7 @@ BaseStaticServerData->IsWowTaskReady = FALSE; /* Allocate a security descriptor and create it */ - BnoSd = RtlAllocateHeap(CsrHeap, 0, 1024); + BnoSd = RtlAllocateHeap(BaseSrvHeap, 0, 1024); ASSERT(BnoSd); Status = RtlCreateSecurityDescriptor(BnoSd, SECURITY_DESCRIPTOR_REVISION); ASSERT(NT_SUCCESS(Status)); @@ -376,13 +502,14 @@ } /* Finally, set the pointer */ - CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData; + // CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData; + LoadedServerDll->SharedSection = BaseStaticServerData; } VOID WINAPI BaseStaticServerThread(PVOID x) { - NTSTATUS Status = STATUS_SUCCESS; + // NTSTATUS Status = STATUS_SUCCESS; PPORT_MESSAGE Request = (PPORT_MESSAGE)x; PPORT_MESSAGE Reply = NULL; ULONG MessageType = 0; @@ -396,7 +523,7 @@ { default: Reply = Request; - Status = NtReplyPort(BaseApiPort, Reply); + /* Status =*/ NtReplyPort(BaseApiPort, Reply); break; } } @@ -427,8 +554,7 @@ LoadedServerDll->SizeOfProcessData = 0; LoadedServerDll->ConnectCallback = NULL; LoadedServerDll->DisconnectCallback = NULL; - - BasepFakeStaticServerData(); + BaseInitializeStaticServerData(LoadedServerDll); RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec); InitializeListHead(&DosDeviceHistory); Modified: branches/ros-csrss/subsystems/win/basesrv/server.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
============================================================================== --- branches/ros-csrss/subsystems/win/basesrv/server.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win/basesrv/server.c [iso-8859-1] Sun Oct 21 17:18:33 2012 @@ -12,15 +12,44 @@ #include <debug.h> -extern NTSTATUS CallProcessCreated(PCSR_PROCESS, PCSR_PROCESS); // TODO: Import it from csrsrv/init.c +// extern NTSTATUS CallProcessCreated(PCSR_PROCESS, PCSR_PROCESS); // TODO: Import it from csrsrv/init.c +// Remove it and correct csrsrv instead... +#if 0 +NTSTATUS +CallProcessCreated(IN PCSR_PROCESS SourceProcessData, + IN PCSR_PROCESS TargetProcessData) +{ + NTSTATUS Status = STATUS_SUCCESS; + ULONG i; + PCSR_SERVER_DLL ServerDll; + + DPRINT("CSR: %s called\n", __FUNCTION__); + + /* Notify the Server DLLs */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Get the current Server DLL */ + ServerDll = CsrLoadedServerDll[i]; + + /* Make sure it's valid and that it has callback */ + if ((ServerDll) && (ServerDll->NewProcessCallback)) + { + Status = ServerDll->NewProcessCallback(SourceProcessData, TargetProcessData); + } + } + + return Status; +} +#endif CSR_API(BaseSrvCreateProcess) { NTSTATUS Status; + PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest; HANDLE ProcessHandle, ThreadHandle; PCSR_THREAD CsrThread; - PCSR_PROCESS Process, NewProcess; - ULONG Flags, VdmPower = 0, DebugFlags = 0; + PCSR_PROCESS Process; // , NewProcess; + ULONG /* Flags, */ VdmPower = 0, DebugFlags = 0; /* Get the current client thread */ CsrThread = CsrGetClientThread(); @@ -29,12 +58,12 @@ Process = CsrThread->Process; /* Extract the flags out of the process handle */ - Flags = (ULONG_PTR)ApiMessage->Data.CreateProcessRequest.ProcessHandle & 3; - ApiMessage->Data.CreateProcessRequest.ProcessHandle = (HANDLE)((ULONG_PTR)ApiMessage->Data.CreateProcessRequest.ProcessHandle & ~3); + // Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3; + CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3); /* Duplicate the process handle */ Status = NtDuplicateObject(Process->ProcessHandle, - ApiMessage->Data.CreateProcessRequest.ProcessHandle, + CreateProcessRequest->ProcessHandle, NtCurrentProcess(), &ProcessHandle, 0, @@ -48,7 +77,7 @@ /* Duplicate the thread handle */ Status = NtDuplicateObject(Process->ProcessHandle, - ApiMessage->Data.CreateProcessRequest.ThreadHandle, + CreateProcessRequest->ThreadHandle, NtCurrentProcess(), &ThreadHandle, 0, @@ -79,7 +108,7 @@ } /* Convert some flags. FIXME: More need conversion */ - if (ApiMessage->Data.CreateProcessRequest.CreationFlags & CREATE_NEW_PROCESS_GROUP) + if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP) { DebugFlags |= CsrProcessCreateNewGroup; } @@ -89,7 +118,7 @@ /* Call CSRSRV to create the CSR_PROCESS structure and the first CSR_THREAD */ Status = CsrCreateProcess(ProcessHandle, ThreadHandle, - &ApiMessage->Data.CreateProcessRequest.ClientId, + &CreateProcessRequest->ClientId, Process->NtSession, DebugFlags, NULL); @@ -111,16 +140,18 @@ /* FIXME: VDM vodoo */ /* ReactOS Compatibility */ - Status = CsrLockProcessByClientId(ApiMessage->Data.CreateProcessRequest.ClientId.UniqueProcess, &NewProcess); +#if 0 + Status = CsrLockProcessByClientId(CreateProcessRequest->ClientId.UniqueProcess, &NewProcess); ASSERT(Status == STATUS_SUCCESS); - if (!(ApiMessage->Data.CreateProcessRequest.CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS))) + if (!(CreateProcessRequest->CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS))) { NewProcess->ParentConsole = Process->Console; - NewProcess->bInheritHandles = ApiMessage->Data.CreateProcessRequest.bInheritHandles; + NewProcess->bInheritHandles = CreateProcessRequest->bInheritHandles; } RtlInitializeCriticalSection(&NewProcess->HandleTableLock); CallProcessCreated(Process, NewProcess); CsrUnlockProcess(NewProcess); +#endif /* Return the result of this operation */ return Status; @@ -128,9 +159,10 @@ CSR_API(BaseSrvCreateThread) { + NTSTATUS Status; + PBASE_CREATE_THREAD CreateThreadRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateThreadRequest; PCSR_THREAD CurrentThread; HANDLE ThreadHandle; - NTSTATUS Status; PCSR_PROCESS CsrProcess; /* Get the current CSR thread */ @@ -138,32 +170,32 @@ if (!CurrentThread) { DPRINT1("Server Thread TID: [%lx.%lx]\n", - ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess, - ApiMessage->Data.CreateThreadRequest.ClientId.UniqueThread); + CreateThreadRequest->ClientId.UniqueProcess, + CreateThreadRequest->ClientId.UniqueThread); return STATUS_SUCCESS; // server-to-server } /* Get the CSR Process for this request */ CsrProcess = CurrentThread->Process; if (CsrProcess->ClientId.UniqueProcess != - ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess) + CreateThreadRequest->ClientId.UniqueProcess) { /* This is a remote thread request -- is it within the server itself? */ - if (ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) + if (CreateThreadRequest->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess) { /* Accept this without any further work */ return STATUS_SUCCESS; } /* Get the real CSR Process for the remote thread's process */ - Status = CsrLockProcessByClientId(ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess, + Status = CsrLockProcessByClientId(CreateThreadRequest->ClientId.UniqueProcess, &CsrProcess); if (!NT_SUCCESS(Status)) return Status; } /* Duplicate the thread handle so we can own it */ Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle, - ApiMessage->Data.CreateThreadRequest.ThreadHandle, + CreateThreadRequest->ThreadHandle, NtCurrentProcess(), &ThreadHandle, 0, @@ -174,7 +206,7 @@ /* Call CSRSRV to tell it about the new thread */ Status = CsrCreateThread(CsrProcess, ThreadHandle, - &ApiMessage->Data.CreateThreadRequest.ClientId); + &CreateThreadRequest->ClientId); } /* Unlock the process and return */ @@ -185,11 +217,12 @@ CSR_API(BaseSrvGetTempFile) { static UINT CsrGetTempFileUnique = 0; + PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile; /* Return 16-bits ID */ - ApiMessage->Data.GetTempFile.UniqueID = (++CsrGetTempFileUnique & 0xFFFF); - - DPRINT("Returning: %u\n", ApiMessage->Data.GetTempFile.UniqueID); + GetTempFile->UniqueID = (++CsrGetTempFileUnique & 0xFFFF); + + DPRINT("Returning: %u\n", GetTempFile->UniqueID); return STATUS_SUCCESS; } @@ -204,27 +237,29 @@ /* Remove the CSR_THREADs and CSR_PROCESS */ return CsrDestroyProcess(&CsrThread->ClientId, - (NTSTATUS)ApiMessage->Data.TerminateProcessRequest.uExitCode); + (NTSTATUS)((PBASE_API_MESSAGE)ApiMessage)->Data.ExitProcessRequest.uExitCode); } CSR_API(BaseSrvGetProcessShutdownParam) { + PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetShutdownParametersRequest; PCSR_THREAD CsrThread = CsrGetClientThread(); ASSERT(CsrThread); - ApiMessage->Data.GetShutdownParametersRequest.Level = CsrThread->Process->ShutdownLevel; - ApiMessage->Data.GetShutdownParametersRequest.Flags = CsrThread->Process->ShutdownFlags; + GetShutdownParametersRequest->Level = CsrThread->Process->ShutdownLevel; + GetShutdownParametersRequest->Flags = CsrThread->Process->ShutdownFlags; return STATUS_SUCCESS; } CSR_API(BaseSrvSetProcessShutdownParam) { + PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetShutdownParametersRequest; PCSR_THREAD CsrThread = CsrGetClientThread(); ASSERT(CsrThread); - CsrThread->Process->ShutdownLevel = ApiMessage->Data.SetShutdownParametersRequest.Level; - CsrThread->Process->ShutdownFlags = ApiMessage->Data.SetShutdownParametersRequest.Flags; + CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level; + CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags; return STATUS_SUCCESS; } @@ -284,21 +319,56 @@ *** Dos Devices (C) Pierre Schweitzer (pierre.schweitzer(a)reactos.org) ***/ -typedef struct tagCSRSS_DOS_DEVICE_HISTORY_ENTRY +typedef struct tagBASE_DOS_DEVICE_HISTORY_ENTRY { UNICODE_STRING Device; UNICODE_STRING Target; LIST_ENTRY Entry; -} CSRSS_DOS_DEVICE_HISTORY_ENTRY, *PCSRSS_DOS_DEVICE_HISTORY_ENTRY; +} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY; LIST_ENTRY DosDeviceHistory; RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec; +VOID BaseCleanupDefineDosDevice(VOID) +{ + PLIST_ENTRY Entry, ListHead; + PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; + + (void) RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec); + + ListHead = &DosDeviceHistory; + Entry = ListHead->Flink; + while (Entry != ListHead) + { + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + CONTAINING_RECORD(Entry, + BASE_DOS_DEVICE_HISTORY_ENTRY, + Entry); + Entry = Entry->Flink; + + if (HistoryEntry) + { + if (HistoryEntry->Target.Buffer) + (void) RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Target.Buffer); + if (HistoryEntry->Device.Buffer) + (void) RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry->Device.Buffer); + (void) RtlFreeHeap(BaseSrvHeap, + 0, + HistoryEntry); + } + } +} + CSR_API(BaseSrvDefineDosDevice) { + NTSTATUS Status; + PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.DefineDosDeviceRequest; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE LinkHandle = NULL; - NTSTATUS Status; UNICODE_STRING DeviceName = {0}; UNICODE_STRING RequestDeviceName = {0}; UNICODE_STRING LinkTarget = {0}; @@ -312,7 +382,7 @@ PSID SystemSid; PSID WorldSid; ULONG SidLength; - PCSRSS_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; + PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; PLIST_ENTRY Entry; PLIST_ENTRY ListHead; BOOLEAN Matched, AddHistory; @@ -320,16 +390,16 @@ PWSTR lpBuffer; DPRINT("CsrDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetName:%wZ\n", - ApiMessage->Data.DefineDosDeviceRequest.dwFlags, - &ApiMessage->Data.DefineDosDeviceRequest.DeviceName, - &ApiMessage->Data.DefineDosDeviceRequest.TargetName); + DefineDosDeviceRequest->dwFlags, + &DefineDosDeviceRequest->DeviceName, + &DefineDosDeviceRequest->TargetName); Matched = AddHistory = FALSE; HistoryEntry = NULL; AdminSid = SystemSid = WorldSid = NULL; SecurityDescriptor = NULL; ListHead = &DosDeviceHistory; - dwFlags = ApiMessage->Data.DefineDosDeviceRequest.dwFlags; + dwFlags = DefineDosDeviceRequest->dwFlags; /* Validate the flags */ if ( (dwFlags & 0xFFFFFFF0) || @@ -351,14 +421,13 @@ { Status = RtlUpcaseUnicodeString(&RequestDeviceName, - &ApiMessage->Data.DefineDosDeviceRequest.DeviceName, + &DefineDosDeviceRequest->DeviceName, TRUE); if (! NT_SUCCESS(Status)) _SEH2_LEAVE; - RequestLinkTarget = - &ApiMessage->Data.DefineDosDeviceRequest.TargetName; - lpBuffer = (PWSTR) RtlAllocateHeap(Win32CsrApiHeap, + RequestLinkTarget = &DefineDosDeviceRequest->TargetName; + lpBuffer = (PWSTR) RtlAllocateHeap(BaseSrvHeap, HEAP_ZERO_MEMORY, RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR)); if (! lpBuffer) @@ -392,7 +461,7 @@ LinkTarget.Length = 0; LinkTarget.MaximumLength = Length; LinkTarget.Buffer = (PWSTR) - RtlAllocateHeap(Win32CsrApiHeap, + RtlAllocateHeap(BaseSrvHeap, HEAP_ZERO_MEMORY, Length); if (! LinkTarget.Buffer) @@ -444,9 +513,9 @@ Entry = ListHead->Flink; while (Entry != ListHead) { - HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY) + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) CONTAINING_RECORD(Entry, - CSRSS_DOS_DEVICE_HISTORY_ENTRY, + BASE_DOS_DEVICE_HISTORY_ENTRY, Entry); Matched = ! RtlCompareUnicodeString(&RequestDeviceName, @@ -473,9 +542,9 @@ Entry = ListHead->Flink; while (Entry != ListHead) { - HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY) + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) CONTAINING_RECORD(Entry, - CSRSS_DOS_DEVICE_HISTORY_ENTRY, + BASE_DOS_DEVICE_HISTORY_ENTRY, Entry); Matched = ! RtlCompareUnicodeString(&RequestDeviceName, @@ -551,10 +620,10 @@ if (AddHistory) { - HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY) - RtlAllocateHeap(Win32CsrApiHeap, + HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) + RtlAllocateHeap(BaseSrvHeap, HEAP_ZERO_MEMORY, - sizeof(CSRSS_DOS_DEVICE_HISTORY_ENTRY)); + sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY)); if (! HistoryEntry) { DPRINT1("Failed to allocate memory\n"); @@ -563,7 +632,7 @@ } HistoryEntry->Target.Buffer = - RtlAllocateHeap(Win32CsrApiHeap, + RtlAllocateHeap(BaseSrvHeap, HEAP_ZERO_MEMORY, LinkTarget.Length); if (! HistoryEntry->Target.Buffer) @@ -579,7 +648,7 @@ &LinkTarget); HistoryEntry->Device.Buffer = - RtlAllocateHeap(Win32CsrApiHeap, + RtlAllocateHeap(BaseSrvHeap, HEAP_ZERO_MEMORY, RequestDeviceName.Length); if (! HistoryEntry->Device.Buffer) @@ -641,7 +710,7 @@ RtlLengthSid(WorldSid); Length = sizeof(ACL) + SidLength + 3 * sizeof(ACCESS_ALLOWED_ACE); - SecurityDescriptor = RtlAllocateHeap(Win32CsrApiHeap, + SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap, 0, SECURITY_DESCRIPTOR_MIN_LENGTH + Length); if (! SecurityDescriptor) @@ -723,15 +792,15 @@ { (void) RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec); if (DeviceName.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, DeviceName.Buffer); if (LinkTarget.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, LinkTarget.Buffer); if (SecurityDescriptor) - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, SecurityDescriptor); if (LinkHandle) @@ -746,14 +815,14 @@ if (HistoryEntry) { if (HistoryEntry->Target.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, HistoryEntry->Target.Buffer); if (HistoryEntry->Device.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, HistoryEntry->Device.Buffer); - (void) RtlFreeHeap(Win32CsrApiHeap, + (void) RtlFreeHeap(BaseSrvHeap, 0, HistoryEntry); } @@ -764,40 +833,6 @@ return Status; } -VOID BaseCleanupDefineDosDevice(VOID) -{ - PLIST_ENTRY Entry, ListHead; - PCSRSS_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; - - (void) RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec); - - ListHead = &DosDeviceHistory; - Entry = ListHead->Flink; - while (Entry != ListHead) - { - HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY) - CONTAINING_RECORD(Entry, - CSRSS_DOS_DEVICE_HISTORY_ENTRY, - Entry); - Entry = Entry->Flink; - - if (HistoryEntry) - { - if (HistoryEntry->Target.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, - 0, - HistoryEntry->Target.Buffer); - if (HistoryEntry->Device.Buffer) - (void) RtlFreeHeap(Win32CsrApiHeap, - 0, - HistoryEntry->Device.Buffer); - (void) RtlFreeHeap(Win32CsrApiHeap, - 0, - HistoryEntry); - } - } -} -
12 years, 2 months
1
0
0
0
[hbelusca] 57588: [BASESRV] Forget two files.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 20 21:04:51 2012 New Revision: 57588 URL:
http://svn.reactos.org/svn/reactos?rev=57588&view=rev
Log: [BASESRV] Forget two files. Added: branches/ros-csrss/subsystems/win/CMakeLists.txt (with props) Modified: branches/ros-csrss/subsystems/CMakeLists.txt Modified: branches/ros-csrss/subsystems/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/CMakeLists…
============================================================================== --- branches/ros-csrss/subsystems/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/CMakeLists.txt [iso-8859-1] Sat Oct 20 21:04:51 2012 @@ -1,4 +1,6 @@ + if(ARCH STREQUAL "i386") add_subdirectory(ntvdm) endif() +add_subdirectory(win) add_subdirectory(win32) Added: branches/ros-csrss/subsystems/win/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/CMakeL…
============================================================================== --- branches/ros-csrss/subsystems/win/CMakeLists.txt (added) +++ branches/ros-csrss/subsystems/win/CMakeLists.txt [iso-8859-1] Sat Oct 20 21:04:51 2012 @@ -1,0 +1,2 @@ + +add_subdirectory(basesrv) Propchange: branches/ros-csrss/subsystems/win/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
12 years, 2 months
1
0
0
0
[hbelusca] 57587: [NTDLL/KERNEL32] - Use new naming scheme. [CSRSRV] - Continuing headers reorganization. - Activate new code. [CSRSRV/WIN32CSR] - Move some code into basesrv. [BASESRV] - Add bases...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 20 21:03:32 2012 New Revision: 57587 URL:
http://svn.reactos.org/svn/reactos?rev=57587&view=rev
Log: [NTDLL/KERNEL32] - Use new naming scheme. [CSRSRV] - Continuing headers reorganization. - Activate new code. [CSRSRV/WIN32CSR] - Move some code into basesrv. [BASESRV] - Add basesrv.dll The names of the APIs tables come from
http://j00ru.vexillium.org/csrss_list/api_list.html
as usual, however I used the NT 4 ones for testing purposes only. After that I will update them to 2k3 version and add function stubs. Also some variable names are deduced from the subsystems/win32/csrss/csrsrv/server.c ones. Added: branches/ros-csrss/include/reactos/subsys/win/console.h (with props) branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt (with props) branches/ros-csrss/subsystems/win/basesrv/basesrv.spec (with props) Removed: branches/ros-csrss/include/reactos/subsys/csrss/csrcons.h branches/ros-csrss/subsystems/win/basesrv/basesrv.def branches/ros-csrss/subsystems/win/basesrv/main.c branches/ros-csrss/win32ss/user/win32csr/file.c branches/ros-csrss/win32ss/user/win32csr/file.h Modified: branches/ros-csrss/dll/ntdll/csr/api.c branches/ros-csrss/dll/win32/kernel32/client/dosdev.c branches/ros-csrss/dll/win32/kernel32/client/file/deviceio.c branches/ros-csrss/dll/win32/kernel32/client/file/filename.c branches/ros-csrss/dll/win32/kernel32/client/proc.c branches/ros-csrss/dll/win32/kernel32/client/vdm.c branches/ros-csrss/include/reactos/subsys/csrss/csrss.h branches/ros-csrss/include/reactos/subsys/win/base.h (contents, props changed) branches/ros-csrss/include/reactos/subsys/win/windows.h (contents, props changed) branches/ros-csrss/subsystems/win/basesrv/basesrv.h (contents, props changed) branches/ros-csrss/subsystems/win/basesrv/basesrv.rc (contents, props changed) branches/ros-csrss/subsystems/win/basesrv/init.c (contents, props changed) branches/ros-csrss/subsystems/win/basesrv/server.c (contents, props changed) branches/ros-csrss/subsystems/win32/csrsrv/api/process.c branches/ros-csrss/subsystems/win32/csrsrv/api/wapi.c branches/ros-csrss/subsystems/win32/csrsrv/init.c branches/ros-csrss/subsystems/win32/csrsrv/procsup.c branches/ros-csrss/subsystems/win32/csrsrv/server.c branches/ros-csrss/win32ss/user/win32csr/CMakeLists.txt branches/ros-csrss/win32ss/user/win32csr/dllmain.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/ros-csrss/dll/ntdll/csr/api.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/ntdll/csr/api.c?r…
Modified: branches/ros-csrss/dll/win32/kernel32/client/dosdev.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
Modified: branches/ros-csrss/dll/win32/kernel32/client/file/deviceio.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
Modified: branches/ros-csrss/dll/win32/kernel32/client/file/filename.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
Modified: branches/ros-csrss/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
Modified: branches/ros-csrss/dll/win32/kernel32/client/vdm.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
Removed: branches/ros-csrss/include/reactos/subsys/csrss/csrcons.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Modified: branches/ros-csrss/include/reactos/subsys/csrss/csrss.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Modified: branches/ros-csrss/include/reactos/subsys/win/base.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Added: branches/ros-csrss/include/reactos/subsys/win/console.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Modified: branches/ros-csrss/include/reactos/subsys/win/windows.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
Added: branches/ros-csrss/subsystems/win/basesrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Removed: branches/ros-csrss/subsystems/win/basesrv/basesrv.def URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Modified: branches/ros-csrss/subsystems/win/basesrv/basesrv.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Modified: branches/ros-csrss/subsystems/win/basesrv/basesrv.rc URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Added: branches/ros-csrss/subsystems/win/basesrv/basesrv.spec URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Modified: branches/ros-csrss/subsystems/win/basesrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Removed: branches/ros-csrss/subsystems/win/basesrv/main.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Modified: branches/ros-csrss/subsystems/win/basesrv/server.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win/basesr…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api/process.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/subsystems/win32/csrsrv/server.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
Modified: branches/ros-csrss/win32ss/user/win32csr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/win32csr…
Modified: branches/ros-csrss/win32ss/user/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/win32csr…
Removed: branches/ros-csrss/win32ss/user/win32csr/file.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/win32csr…
Removed: branches/ros-csrss/win32ss/user/win32csr/file.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/win32csr…
12 years, 2 months
1
0
0
0
[ekohl] 57585: [LSASRV] Rename sids.c to lookup.c because the new name fits much better.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Oct 20 14:21:32 2012 New Revision: 57585 URL:
http://svn.reactos.org/svn/reactos?rev=57585&view=rev
Log: [LSASRV] Rename sids.c to lookup.c because the new name fits much better. Added: trunk/reactos/dll/win32/lsasrv/lookup.c - copied, changed from r57581, trunk/reactos/dll/win32/lsasrv/sids.c Removed: trunk/reactos/dll/win32/lsasrv/sids.c Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt trunk/reactos/dll/win32/lsasrv/lsasrv.h Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/CMakeList…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] Sat Oct 20 14:21:32 2012 @@ -13,11 +13,11 @@ list(APPEND SOURCE authport.c database.c + lookup.c lsarpc.c lsasrv.c policy.c privileges.c - sids.c lsasrv.rc ${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/lsasrv.def Copied: trunk/reactos/dll/win32/lsasrv/lookup.c (from r57581, trunk/reactos/dll/win32/lsasrv/sids.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lookup.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lookup.c [iso-8859-1] Sat Oct 20 14:21:32 2012 @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: Local Security Authority (LSA) Server - * FILE: reactos/dll/win32/lsasrv/sids.c + * FILE: reactos/dll/win32/lsasrv/lookup.c * PURPOSE: Sid / Name lookup functions * * PROGRAMMERS: Eric Kohl Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sat Oct 20 14:21:32 2012 @@ -118,90 +118,7 @@ LPVOID AttributeData, ULONG AttributeSize); -/* lsarpc.c */ -VOID -LsarStartRpcServer(VOID); - -/* policy.c */ -NTSTATUS -LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryModification(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_INFORMATION *PolicyInformation); - -NTSTATUS -LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_PRIMARY_DOM_INFO Info); - -NTSTATUS -LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_ACCOUNT_DOM_INFO Info); - -NTSTATUS -LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject, - PLSAPR_POLICY_DNS_DOMAIN_INFO Info); - -/* privileges.c */ -NTSTATUS -LsarpLookupPrivilegeName(PLUID Value, - PUNICODE_STRING *Name); - -NTSTATUS -LsarpLookupPrivilegeValue(PUNICODE_STRING Name, - PLUID Value); - -NTSTATUS -LsarpEnumeratePrivileges(DWORD *EnumerationContext, - PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer, - DWORD PreferedMaximumLength); - -/* sids.h */ +/* lookup.c */ NTSTATUS LsapInitSids(VOID); @@ -227,4 +144,87 @@ DWORD LookupOptions, DWORD ClientRevision); +/* lsarpc.c */ +VOID +LsarStartRpcServer(VOID); + +/* policy.c */ +NTSTATUS +LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryModification(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_INFORMATION *PolicyInformation); + +NTSTATUS +LsarSetPrimaryDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_PRIMARY_DOM_INFO Info); + +NTSTATUS +LsarSetAccountDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_ACCOUNT_DOM_INFO Info); + +NTSTATUS +LsarSetDnsDomain(PLSA_DB_OBJECT PolicyObject, + PLSAPR_POLICY_DNS_DOMAIN_INFO Info); + +/* privileges.c */ +NTSTATUS +LsarpLookupPrivilegeName(PLUID Value, + PUNICODE_STRING *Name); + +NTSTATUS +LsarpLookupPrivilegeValue(PUNICODE_STRING Name, + PLUID Value); + +NTSTATUS +LsarpEnumeratePrivileges(DWORD *EnumerationContext, + PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer, + DWORD PreferedMaximumLength); + /* EOF */ Removed: trunk/reactos/dll/win32/lsasrv/sids.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/sids.c?re…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/sids.c (removed) @@ -1,2418 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: Local Security Authority (LSA) Server - * FILE: reactos/dll/win32/lsasrv/sids.c - * PURPOSE: Sid / Name lookup functions - * - * PROGRAMMERS: Eric Kohl - */ -#include "lsasrv.h" - -WINE_DEFAULT_DEBUG_CHANNEL(lsasrv); - -typedef wchar_t *PSAMPR_SERVER_NAME; -typedef void *SAMPR_HANDLE; - -typedef struct _SAMPR_RETURNED_USTRING_ARRAY -{ - unsigned long Count; - PRPC_UNICODE_STRING Element; -} SAMPR_RETURNED_USTRING_ARRAY, *PSAMPR_RETURNED_USTRING_ARRAY; - -typedef struct _SAMPR_ULONG_ARRAY -{ - unsigned long Count; - unsigned long *Element; -} SAMPR_ULONG_ARRAY, *PSAMPR_ULONG_ARRAY; - - -VOID -NTAPI -SamIFree_SAMPR_RETURNED_USTRING_ARRAY(PSAMPR_RETURNED_USTRING_ARRAY Ptr); - -VOID -NTAPI -SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr); - -NTSTATUS -NTAPI -SamrConnect(IN PSAMPR_SERVER_NAME ServerName, - OUT SAMPR_HANDLE *ServerHandle, - IN ACCESS_MASK DesiredAccess); - -NTSTATUS -NTAPI -SamrCloseHandle(IN OUT SAMPR_HANDLE *SamHandle); - -NTSTATUS -NTAPI -SamrOpenDomain(IN SAMPR_HANDLE ServerHandle, - IN ACCESS_MASK DesiredAccess, - IN PRPC_SID DomainId, - OUT SAMPR_HANDLE *DomainHandle); - -NTSTATUS -NTAPI -SamrLookupIdsInDomain(IN SAMPR_HANDLE DomainHandle, - IN ULONG Count, - IN ULONG *RelativeIds, - OUT PSAMPR_RETURNED_USTRING_ARRAY Names, - OUT PSAMPR_ULONG_ARRAY Use); - -NTSTATUS -NTAPI -SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle, - IN ULONG Count, - IN RPC_UNICODE_STRING Names[], - OUT PSAMPR_ULONG_ARRAY RelativeIds, - OUT PSAMPR_ULONG_ARRAY Use); - - -typedef struct _WELL_KNOWN_SID -{ - LIST_ENTRY ListEntry; - PSID Sid; - UNICODE_STRING AccountName; - UNICODE_STRING DomainName; - SID_NAME_USE Use; -} WELL_KNOWN_SID, *PWELL_KNOWN_SID; - - -LIST_ENTRY WellKnownSidListHead; - -#if 0 -typedef struct _AccountSid -{ - WELL_KNOWN_SID_TYPE type; - LPCWSTR account; - LPCWSTR domain; - SID_NAME_USE name_use; -} AccountSid; - -static const WCHAR Account_Operators[] = { 'A','c','c','o','u','n','t',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR Administrator[] = {'A','d','m','i','n','i','s','t','r','a','t','o','r',0 }; -static const WCHAR Administrators[] = { 'A','d','m','i','n','i','s','t','r','a','t','o','r','s',0 }; -static const WCHAR ANONYMOUS_LOGON[] = { 'A','N','O','N','Y','M','O','U','S',' ','L','O','G','O','N',0 }; -static const WCHAR Authenticated_Users[] = { 'A','u','t','h','e','n','t','i','c','a','t','e','d',' ','U','s','e','r','s',0 }; -static const WCHAR Backup_Operators[] = { 'B','a','c','k','u','p',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR BATCH[] = { 'B','A','T','C','H',0 }; -static const WCHAR Blank[] = { 0 }; -static const WCHAR BUILTIN[] = { 'B','U','I','L','T','I','N',0 }; -static const WCHAR Cert_Publishers[] = { 'C','e','r','t',' ','P','u','b','l','i','s','h','e','r','s',0 }; -static const WCHAR CREATOR_GROUP[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',0 }; -static const WCHAR CREATOR_GROUP_SERVER[] = { 'C','R','E','A','T','O','R',' ','G','R','O','U','P',' ','S','E','R','V','E','R',0 }; -static const WCHAR CREATOR_OWNER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',0 }; -static const WCHAR CREATOR_OWNER_SERVER[] = { 'C','R','E','A','T','O','R',' ','O','W','N','E','R',' ','S','E','R','V','E','R',0 }; -static const WCHAR DIALUP[] = { 'D','I','A','L','U','P',0 }; -static const WCHAR Digest_Authentication[] = { 'D','i','g','e','s','t',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR DOMAIN[] = {'D','O','M','A','I','N',0}; -static const WCHAR Domain_Admins[] = { 'D','o','m','a','i','n',' ','A','d','m','i','n','s',0 }; -static const WCHAR Domain_Computers[] = { 'D','o','m','a','i','n',' ','C','o','m','p','u','t','e','r','s',0 }; -static const WCHAR Domain_Controllers[] = { 'D','o','m','a','i','n',' ','C','o','n','t','r','o','l','l','e','r','s',0 }; -static const WCHAR Domain_Guests[] = { 'D','o','m','a','i','n',' ','G','u','e','s','t','s',0 }; -static const WCHAR Domain_Users[] = { 'D','o','m','a','i','n',' ','U','s','e','r','s',0 }; -static const WCHAR Enterprise_Admins[] = { 'E','n','t','e','r','p','r','i','s','e',' ','A','d','m','i','n','s',0 }; -static const WCHAR ENTERPRISE_DOMAIN_CONTROLLERS[] = { 'E','N','T','E','R','P','R','I','S','E',' ','D','O','M','A','I','N',' ','C','O','N','T','R','O','L','L','E','R','S',0 }; -static const WCHAR Everyone[] = { 'E','v','e','r','y','o','n','e',0 }; -static const WCHAR Group_Policy_Creator_Owners[] = { 'G','r','o','u','p',' ','P','o','l','i','c','y',' ','C','r','e','a','t','o','r',' ','O','w','n','e','r','s',0 }; -static const WCHAR Guest[] = { 'G','u','e','s','t',0 }; -static const WCHAR Guests[] = { 'G','u','e','s','t','s',0 }; -static const WCHAR INTERACTIVE[] = { 'I','N','T','E','R','A','C','T','I','V','E',0 }; -static const WCHAR LOCAL[] = { 'L','O','C','A','L',0 }; -static const WCHAR LOCAL_SERVICE[] = { 'L','O','C','A','L',' ','S','E','R','V','I','C','E',0 }; -static const WCHAR NETWORK[] = { 'N','E','T','W','O','R','K',0 }; -static const WCHAR Network_Configuration_Operators[] = { 'N','e','t','w','o','r','k',' ','C','o','n','f','i','g','u','r','a','t','i','o','n',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR NETWORK_SERVICE[] = { 'N','E','T','W','O','R','K',' ','S','E','R','V','I','C','E',0 }; -static const WCHAR NT_AUTHORITY[] = { 'N','T',' ','A','U','T','H','O','R','I','T','Y',0 }; -static const WCHAR NT_Pseudo_Domain[] = { 'N','T',' ','P','s','e','u','d','o',' ','D','o','m','a','i','n',0 }; -static const WCHAR NTML_Authentication[] = { 'N','T','M','L',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR NULL_SID[] = { 'N','U','L','L',' ','S','I','D',0 }; -static const WCHAR Other_Organization[] = { 'O','t','h','e','r',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 }; -static const WCHAR Performance_Log_Users[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','L','o','g',' ','U','s','e','r','s',0 }; -static const WCHAR Performance_Monitor_Users[] = { 'P','e','r','f','o','r','m','a','n','c','e',' ','M','o','n','i','t','o','r',' ','U','s','e','r','s',0 }; -static const WCHAR Power_Users[] = { 'P','o','w','e','r',' ','U','s','e','r','s',0 }; -static const WCHAR Pre_Windows_2000_Compatible_Access[] = { 'P','r','e','-','W','i','n','d','o','w','s',' ','2','0','0','0',' ','C','o','m','p','a','t','i','b','l','e',' ','A','c','c','e','s','s',0 }; -static const WCHAR Print_Operators[] = { 'P','r','i','n','t',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR PROXY[] = { 'P','R','O','X','Y',0 }; -static const WCHAR RAS_and_IAS_Servers[] = { 'R','A','S',' ','a','n','d',' ','I','A','S',' ','S','e','r','v','e','r','s',0 }; -static const WCHAR Remote_Desktop_Users[] = { 'R','e','m','o','t','e',' ','D','e','s','k','t','o','p',' ','U','s','e','r','s',0 }; -static const WCHAR REMOTE_INTERACTIVE_LOGON[] = { 'R','E','M','O','T','E',' ','I','N','T','E','R','A','C','T','I','V','E',' ','L','O','G','O','N',0 }; -static const WCHAR Replicators[] = { 'R','e','p','l','i','c','a','t','o','r','s',0 }; -static const WCHAR RESTRICTED[] = { 'R','E','S','T','R','I','C','T','E','D',0 }; -static const WCHAR SChannel_Authentication[] = { 'S','C','h','a','n','n','e','l',' ','A','u','t','h','e','n','t','i','c','a','t','i','o','n',0 }; -static const WCHAR Schema_Admins[] = { 'S','c','h','e','m','a',' ','A','d','m','i','n','s',0 }; -static const WCHAR SELF[] = { 'S','E','L','F',0 }; -static const WCHAR Server_Operators[] = { 'S','e','r','v','e','r',' ','O','p','e','r','a','t','o','r','s',0 }; -static const WCHAR SERVICE[] = { 'S','E','R','V','I','C','E',0 }; -static const WCHAR SYSTEM[] = { 'S','Y','S','T','E','M',0 }; -static const WCHAR TERMINAL_SERVER_USER[] = { 'T','E','R','M','I','N','A','L',' ','S','E','R','V','E','R',' ','U','S','E','R',0 }; -static const WCHAR This_Organization[] = { 'T','h','i','s',' ','O','r','g','a','n','i','z','a','t','i','o','n',0 }; -static const WCHAR Users[] = { 'U','s','e','r','s',0 }; - -static const AccountSid ACCOUNT_SIDS[] = { -// { WinNullSid, NULL_SID, Blank, SidTypeWellKnownGroup }, -// { WinWorldSid, Everyone, Blank, SidTypeWellKnownGroup }, -// { WinLocalSid, LOCAL, Blank, SidTypeWellKnownGroup }, -// { WinCreatorOwnerSid, CREATOR_OWNER, Blank, SidTypeWellKnownGroup }, -// { WinCreatorGroupSid, CREATOR_GROUP, Blank, SidTypeWellKnownGroup }, -// { WinCreatorOwnerServerSid, CREATOR_OWNER_SERVER, Blank, SidTypeWellKnownGroup }, -// { WinCreatorGroupServerSid, CREATOR_GROUP_SERVER, Blank, SidTypeWellKnownGroup }, -// { WinNtAuthoritySid, NT_Pseudo_Domain, NT_Pseudo_Domain, SidTypeDomain }, -// { WinDialupSid, DIALUP, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinNetworkSid, NETWORK, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinBatchSid, BATCH, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinInteractiveSid, INTERACTIVE, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinServiceSid, SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinAnonymousSid, ANONYMOUS_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinProxySid, PROXY, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinEnterpriseControllersSid, ENTERPRISE_DOMAIN_CONTROLLERS, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinSelfSid, SELF, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinAuthenticatedUserSid, Authenticated_Users, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinRestrictedCodeSid, RESTRICTED, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinTerminalServerSid, TERMINAL_SERVER_USER, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinRemoteLogonIdSid, REMOTE_INTERACTIVE_LOGON, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinLocalSystemSid, SYSTEM, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinLocalServiceSid, LOCAL_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinNetworkServiceSid, NETWORK_SERVICE, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinBuiltinDomainSid, BUILTIN, BUILTIN, SidTypeDomain }, -// { WinBuiltinAdministratorsSid, Administrators, BUILTIN, SidTypeAlias }, -// { WinBuiltinUsersSid, Users, BUILTIN, SidTypeAlias }, -// { WinBuiltinGuestsSid, Guests, BUILTIN, SidTypeAlias }, -// { WinBuiltinPowerUsersSid, Power_Users, BUILTIN, SidTypeAlias }, -// { WinBuiltinAccountOperatorsSid, Account_Operators, BUILTIN, SidTypeAlias }, -// { WinBuiltinSystemOperatorsSid, Server_Operators, BUILTIN, SidTypeAlias }, -// { WinBuiltinPrintOperatorsSid, Print_Operators, BUILTIN, SidTypeAlias }, -// { WinBuiltinBackupOperatorsSid, Backup_Operators, BUILTIN, SidTypeAlias }, -// { WinBuiltinReplicatorSid, Replicators, BUILTIN, SidTypeAlias }, -// { WinBuiltinPreWindows2000CompatibleAccessSid, Pre_Windows_2000_Compatible_Access, BUILTIN, SidTypeAlias }, -// { WinBuiltinRemoteDesktopUsersSid, Remote_Desktop_Users, BUILTIN, SidTypeAlias }, -// { WinBuiltinNetworkConfigurationOperatorsSid, Network_Configuration_Operators, BUILTIN, SidTypeAlias }, - { WinNTLMAuthenticationSid, NTML_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinDigestAuthenticationSid, Digest_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinSChannelAuthenticationSid, SChannel_Authentication, NT_AUTHORITY, SidTypeWellKnownGroup }, -// { WinThisOrganizationSid, This_Organization, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinOtherOrganizationSid, Other_Organization, NT_AUTHORITY, SidTypeWellKnownGroup }, - { WinBuiltinPerfMonitoringUsersSid, Performance_Monitor_Users, BUILTIN, SidTypeAlias }, - { WinBuiltinPerfLoggingUsersSid, Performance_Log_Users, BUILTIN, SidTypeAlias }, -}; -#endif - - -BOOLEAN -LsapCreateSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, - UCHAR SubAuthorityCount, - PULONG SubAuthorities, - PWSTR AccountName, - PWSTR DomainName, - SID_NAME_USE Use) -{ - PWELL_KNOWN_SID SidEntry; - PULONG p; - ULONG i; - - SidEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WELL_KNOWN_SID)); - if (SidEntry == NULL) - return FALSE; - - InitializeListHead(&SidEntry->ListEntry); - - SidEntry->Sid = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - RtlLengthRequiredSid(SubAuthorityCount)); - if (SidEntry->Sid == NULL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry); - return FALSE; - } - - RtlInitializeSid(SidEntry->Sid, - IdentifierAuthority, - SubAuthorityCount); - - for (i = 0; i < (ULONG)SubAuthorityCount; i++) - { - p = RtlSubAuthoritySid(SidEntry->Sid, i); - *p = SubAuthorities[i]; - } - - RtlInitUnicodeString(&SidEntry->AccountName, - AccountName); - - RtlInitUnicodeString(&SidEntry->DomainName, - DomainName); - - SidEntry->Use = Use; - - InsertTailList(&WellKnownSidListHead, - &SidEntry->ListEntry); - - return TRUE; -} - - -NTSTATUS -LsapInitSids(VOID) -{ - ULONG SubAuthorities[8]; - - InitializeListHead(&WellKnownSidListHead); - - /* NT Authority */ - LsapCreateSid(&NtAuthority, - 0, - NULL, - L"NT AUTHORITY", - L"NT AUTHORITY", - SidTypeDomain); - - /* Null Sid */ - SubAuthorities[0] = SECURITY_NULL_RID; - LsapCreateSid(&NullSidAuthority, - 1, - SubAuthorities, - L"NULL SID", - L"", - SidTypeWellKnownGroup); - - /* World Sid */ - SubAuthorities[0] = SECURITY_WORLD_RID; - LsapCreateSid(&WorldSidAuthority, - 1, - SubAuthorities, - L"Everyone", - L"", - SidTypeWellKnownGroup); - - /* Local Sid */ - SubAuthorities[0] = SECURITY_LOCAL_RID; - LsapCreateSid(&LocalSidAuthority, - 1, - SubAuthorities, - L"LOCAL", - L"", - SidTypeWellKnownGroup); - - /* Creator Owner Sid */ - SubAuthorities[0] = SECURITY_CREATOR_OWNER_RID; - LsapCreateSid(&CreatorSidAuthority, - 1, - SubAuthorities, - L"CREATOR OWNER", - L"", - SidTypeWellKnownGroup); - - /* Creator Group Sid */ - SubAuthorities[0] = SECURITY_CREATOR_GROUP_RID; - LsapCreateSid(&CreatorSidAuthority, - 1, - SubAuthorities, - L"CREATOR GROUP", - L"", - SidTypeWellKnownGroup); - - /* Creator Owner Server Sid */ - SubAuthorities[0] = SECURITY_CREATOR_OWNER_SERVER_RID; - LsapCreateSid(&CreatorSidAuthority, - 1, - SubAuthorities, - L"CREATOR OWNER SERVER", - L"", - SidTypeWellKnownGroup); - - /* Creator Group Server Sid */ - SubAuthorities[0] = SECURITY_CREATOR_GROUP_SERVER_RID; - LsapCreateSid(&CreatorSidAuthority, - 1, - SubAuthorities, - L"CREATOR GROUP SERVER", - L"", - SidTypeWellKnownGroup); - - /* Dialup Sid */ - SubAuthorities[0] = SECURITY_DIALUP_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"DIALUP", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Network Sid */ - SubAuthorities[0] = SECURITY_NETWORK_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"NETWORK", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Batch Sid*/ - SubAuthorities[0] = SECURITY_BATCH_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"BATCH", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Interactive Sid */ - SubAuthorities[0] = SECURITY_INTERACTIVE_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"INTERACTIVE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Service Sid */ - SubAuthorities[0] = SECURITY_SERVICE_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"SERVICE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Anonymous Logon Sid */ - SubAuthorities[0] = SECURITY_ANONYMOUS_LOGON_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"ANONYMOUS LOGON", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Proxy Sid */ - SubAuthorities[0] = SECURITY_PROXY_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"PROXY", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Enterprise Controllers Sid */ - SubAuthorities[0] = SECURITY_ENTERPRISE_CONTROLLERS_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"ENTERPRISE DOMAIN CONTROLLERS", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Principal Self Sid */ - SubAuthorities[0] = SECURITY_PRINCIPAL_SELF_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"SELF", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Authenticated Users Sid */ - SubAuthorities[0] = SECURITY_AUTHENTICATED_USER_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"Authenticated Users", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Restricted Code Sid */ - SubAuthorities[0] = SECURITY_RESTRICTED_CODE_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"RESTRICTED", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Terminal Server Sid */ - SubAuthorities[0] = SECURITY_TERMINAL_SERVER_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"TERMINAL SERVER USER", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Remote Logon Sid */ - SubAuthorities[0] = SECURITY_REMOTE_LOGON_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"REMOTE INTERACTIVE LOGON", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* This Organization Sid */ - SubAuthorities[0] = SECURITY_THIS_ORGANIZATION_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"This Organization", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Local System Sid */ - SubAuthorities[0] = SECURITY_LOCAL_SYSTEM_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"SYSTEM", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Local Service Sid */ - SubAuthorities[0] = SECURITY_LOCAL_SERVICE_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"LOCAL SERVICE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"LOCALSERVICE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Network Service Sid */ - SubAuthorities[0] = SECURITY_NETWORK_SERVICE_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"NETWORK SERVICE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"NETWORKSERVICE", - L"NT AUTHORITY", - SidTypeWellKnownGroup); - - /* Builtin Domain Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - LsapCreateSid(&NtAuthority, - 1, - SubAuthorities, - L"BUILTIN", - L"BUILTIN", - SidTypeDomain); - - /* Administrators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_ADMINS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Administrators", - L"BUILTIN", - SidTypeAlias); - - /* Users Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_USERS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Users", - L"BUILTIN", - SidTypeAlias); - - /* Guests Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_GUESTS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Guests", - L"BUILTIN", - SidTypeAlias); - - /* Power User Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_POWER_USERS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Power User", - L"BUILTIN", - SidTypeAlias); - - /* Account Operators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_ACCOUNT_OPS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Account Operators", - L"BUILTIN", - SidTypeAlias); - - /* System Operators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_SYSTEM_OPS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Server Operators", - L"BUILTIN", - SidTypeAlias); - - /* Print Operators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_PRINT_OPS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Print Operators", - L"BUILTIN", - SidTypeAlias); - - /* Backup Operators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_BACKUP_OPS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Backup Operators", - L"BUILTIN", - SidTypeAlias); - - /* Replicators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_REPLICATOR; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Replicators", - L"BUILTIN", - SidTypeAlias); - -#if 0 - /* RAS Servers Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_RAS_SERVERS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Backup Operators", - L"BUILTIN", - SidTypeAlias); -#endif - - /* Pre-Windows 2000 Compatible Access Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_PREW2KCOMPACCESS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Pre-Windows 2000 Compatible Access", - L"BUILTIN", - SidTypeAlias); - - /* Remote Desktop Users Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Remote Desktop Users", - L"BUILTIN", - SidTypeAlias); - - /* Network Configuration Operators Alias Sid */ - SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; - SubAuthorities[1] = DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS; - LsapCreateSid(&NtAuthority, - 2, - SubAuthorities, - L"Network Configuration Operators", - L"BUILTIN", - SidTypeAlias); - - /* FIXME: Add more well known sids */ - - return STATUS_SUCCESS; -} - - -PWELL_KNOWN_SID -LsapLookupWellKnownSid(PSID Sid) -{ - PLIST_ENTRY ListEntry; - PWELL_KNOWN_SID Ptr; - - ListEntry = WellKnownSidListHead.Flink; - while (ListEntry != &WellKnownSidListHead) - { - Ptr = CONTAINING_RECORD(ListEntry, - WELL_KNOWN_SID, - ListEntry); - if (RtlEqualSid(Sid, Ptr->Sid)) - { - return Ptr; - } - - ListEntry = ListEntry->Flink; - } - - return NULL; -} - - -PWELL_KNOWN_SID -LsapLookupIsolatedWellKnownName(PUNICODE_STRING AccountName) -{ - PLIST_ENTRY ListEntry; - PWELL_KNOWN_SID Ptr; - - ListEntry = WellKnownSidListHead.Flink; - while (ListEntry != &WellKnownSidListHead) - { - Ptr = CONTAINING_RECORD(ListEntry, - WELL_KNOWN_SID, - ListEntry); - if (RtlEqualUnicodeString(AccountName, &Ptr->AccountName, TRUE)) - { - return Ptr; - } - - ListEntry = ListEntry->Flink; - } - - return NULL; -} - - -PWELL_KNOWN_SID -LsapLookupFullyQualifiedWellKnownName(PUNICODE_STRING AccountName, - PUNICODE_STRING DomainName) -{ - PLIST_ENTRY ListEntry; - PWELL_KNOWN_SID Ptr; - - ListEntry = WellKnownSidListHead.Flink; - while (ListEntry != &WellKnownSidListHead) - { - Ptr = CONTAINING_RECORD(ListEntry, - WELL_KNOWN_SID, - ListEntry); - if (RtlEqualUnicodeString(AccountName, &Ptr->AccountName, TRUE) && - RtlEqualUnicodeString(DomainName, &Ptr->DomainName, TRUE)) - { - return Ptr; - } - - ListEntry = ListEntry->Flink; - } - - return NULL; -} - - -static -NTSTATUS -LsapSplitNames(DWORD Count, - PRPC_UNICODE_STRING Names, - PRPC_UNICODE_STRING *DomainNames, - PRPC_UNICODE_STRING *AccountNames) -{ - PRPC_UNICODE_STRING DomainsBuffer = NULL; - PRPC_UNICODE_STRING AccountsBuffer = NULL; - ULONG DomainLength; - ULONG AccountLength; - ULONG i; - LPWSTR Ptr; - NTSTATUS Status = STATUS_SUCCESS; - - DomainsBuffer = MIDL_user_allocate(Count * sizeof(RPC_UNICODE_STRING)); - if (DomainsBuffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - AccountsBuffer = MIDL_user_allocate(Count * sizeof(RPC_UNICODE_STRING)); - if (AccountsBuffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - for (i = 0; i < Count; i++) - { -//TRACE("Name: %wZ\n", &Names[i]); - - Ptr = wcschr(Names[i].Buffer, L'\\'); - if (Ptr == NULL) - { - AccountLength = Names[i].Length / sizeof(WCHAR); - - AccountsBuffer[i].Length = Names[i].Length; - AccountsBuffer[i].MaximumLength = AccountsBuffer[i].Length + sizeof(WCHAR); - AccountsBuffer[i].Buffer = MIDL_user_allocate(AccountsBuffer[i].MaximumLength); - if (AccountsBuffer[i].Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - CopyMemory(AccountsBuffer[i].Buffer, - Names[i].Buffer, - AccountsBuffer[i].Length); - AccountsBuffer[i].Buffer[AccountLength] = UNICODE_NULL; - -//TRACE("Account name: %wZ\n", &AccountsBuffer[i]); - } - else - { - DomainLength = (ULONG)(ULONG_PTR)(Ptr - Names[i].Buffer); - AccountLength = (Names[i].Length / sizeof(WCHAR)) - DomainLength - 1; -//TRACE("DomainLength: %u\n", DomainLength); -//TRACE("AccountLength: %u\n", AccountLength); - - if (DomainLength > 0) - { - DomainsBuffer[i].Length = (USHORT)DomainLength * sizeof(WCHAR); - DomainsBuffer[i].MaximumLength = DomainsBuffer[i].Length + sizeof(WCHAR); - DomainsBuffer[i].Buffer = MIDL_user_allocate(DomainsBuffer[i].MaximumLength); - if (DomainsBuffer[i].Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - CopyMemory(DomainsBuffer[i].Buffer, - Names[i].Buffer, - DomainsBuffer[i].Length); - DomainsBuffer[i].Buffer[DomainLength] = UNICODE_NULL; - -//TRACE("Domain name: %wZ\n", &DomainsBuffer[i]); - } - - AccountsBuffer[i].Length = (USHORT)AccountLength * sizeof(WCHAR); - AccountsBuffer[i].MaximumLength = AccountsBuffer[i].Length + sizeof(WCHAR); - AccountsBuffer[i].Buffer = MIDL_user_allocate(AccountsBuffer[i].MaximumLength); - if (AccountsBuffer[i].Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - CopyMemory(AccountsBuffer[i].Buffer, - &(Names[i].Buffer[DomainLength + 1]), - AccountsBuffer[i].Length); - AccountsBuffer[i].Buffer[AccountLength] = UNICODE_NULL; - -//TRACE("Account name: %wZ\n", &AccountsBuffer[i]); - } - } - -done: - if (!NT_SUCCESS(Status)) - { - if (AccountsBuffer != NULL) - { - for (i = 0; i < Count; i++) - { - if (AccountsBuffer[i].Buffer != NULL) - MIDL_user_free(AccountsBuffer[i].Buffer); - } - - MIDL_user_free(AccountsBuffer); - } - - if (DomainsBuffer != NULL) - { - for (i = 0; i < Count; i++) - { - if (DomainsBuffer[i].Buffer != NULL) - MIDL_user_free(DomainsBuffer[i].Buffer); - } - - MIDL_user_free(DomainsBuffer); - } - } - else - { - *DomainNames = DomainsBuffer; - *AccountNames = AccountsBuffer; - } - - return Status; -} - - -static NTSTATUS -LsapAddDomainToDomainsList(PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains, - PUNICODE_STRING Name, - PSID Sid, - PULONG Index) -{ - ULONG i; - - i = 0; - while (i < ReferencedDomains->Entries && - ReferencedDomains->Domains[i].Sid != NULL) - { - if (RtlEqualSid(Sid, ReferencedDomains->Domains[i].Sid)) - { - *Index = i; - return STATUS_SUCCESS; - } - - i++; - } - - ReferencedDomains->Domains[i].Sid = MIDL_user_allocate(RtlLengthSid(Sid)); - if (ReferencedDomains->Domains[i].Sid == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - - RtlCopySid(RtlLengthSid(Sid), ReferencedDomains->Domains[i].Sid, Sid); - - ReferencedDomains->Domains[i].Name.Length = Name->Length; - ReferencedDomains->Domains[i].Name.MaximumLength = Name->MaximumLength; - ReferencedDomains->Domains[i].Name.Buffer = MIDL_user_allocate(Name->MaximumLength); - if (ReferencedDomains->Domains[i].Sid == NULL) - { - MIDL_user_free(ReferencedDomains->Domains[i].Sid); - ReferencedDomains->Domains[i].Sid = NULL; - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlCopyMemory(ReferencedDomains->Domains[i].Name.Buffer, - Name->Buffer, - Name->MaximumLength); - - ReferencedDomains->Entries++; - *Index = i; - - return STATUS_SUCCESS; -} - - -static BOOLEAN -LsapIsPrefixSid(IN PSID PrefixSid, - IN PSID Sid) -{ - PISID Sid1 = PrefixSid, Sid2 = Sid; - ULONG i; - - if (Sid1->Revision != Sid2->Revision) - return FALSE; - - if ((Sid1->IdentifierAuthority.Value[0] != Sid2->IdentifierAuthority.Value[0]) || - (Sid1->IdentifierAuthority.Value[1] != Sid2->IdentifierAuthority.Value[1]) || - (Sid1->IdentifierAuthority.Value[2] != Sid2->IdentifierAuthority.Value[2]) || - (Sid1->IdentifierAuthority.Value[3] != Sid2->IdentifierAuthority.Value[3]) || - (Sid1->IdentifierAuthority.Value[4] != Sid2->IdentifierAuthority.Value[4]) || - (Sid1->IdentifierAuthority.Value[5] != Sid2->IdentifierAuthority.Value[5])) - return FALSE; - - if (Sid1->SubAuthorityCount >= Sid2->SubAuthorityCount) - return FALSE; - - if (Sid1->SubAuthorityCount == 0) - return TRUE; - - for (i = 0; i < Sid1->SubAuthorityCount; i++) - { - if (Sid1->SubAuthority[i] != Sid2->SubAuthority[i]) - return FALSE; - } - - return TRUE; -} - - -ULONG -LsapGetRelativeIdFromSid(PSID Sid_) -{ - PISID Sid = Sid_; - - if (Sid->SubAuthorityCount != 0) - return Sid->SubAuthority[Sid->SubAuthorityCount - 1]; - - return 0; -} - - -static PSID -CreateSidFromSidAndRid(PSID SrcSid, - ULONG RelativeId) -{ - UCHAR RidCount; - PSID DstSid; - ULONG i; - ULONG DstSidSize; - PULONG p, q; - - RidCount = *RtlSubAuthorityCountSid(SrcSid); - if (RidCount >= 8) - return NULL; - - DstSidSize = RtlLengthRequiredSid(RidCount + 1); - - DstSid = MIDL_user_allocate(DstSidSize); - if (DstSid == NULL) - return NULL; - - RtlInitializeSid(DstSid, - RtlIdentifierAuthoritySid(SrcSid), - RidCount + 1); - - for (i = 0; i < (ULONG)RidCount; i++) - { - p = RtlSubAuthoritySid(SrcSid, i); - q = RtlSubAuthoritySid(DstSid, i); - *q = *p; - } - - q = RtlSubAuthoritySid(DstSid, (ULONG)RidCount); - *q = RelativeId; - - return DstSid; -} - - -static PSID -CreateDomainSidFromAccountSid(PSID AccountSid) -{ - UCHAR RidCount; - PSID DomainSid; - ULONG i; - ULONG DstSidSize; - PULONG p, q; - - RidCount = *RtlSubAuthorityCountSid(AccountSid); - if (RidCount > 0) - RidCount--; - - DstSidSize = RtlLengthRequiredSid(RidCount); - - DomainSid = MIDL_user_allocate(DstSidSize); - if (DomainSid == NULL) - return NULL; - - RtlInitializeSid(DomainSid, - RtlIdentifierAuthoritySid(AccountSid), - RidCount); - - for (i = 0; i < (ULONG)RidCount; i++) - { - p = RtlSubAuthoritySid(AccountSid, i); - q = RtlSubAuthoritySid(DomainSid, i); - *q = *p; - } - - return DomainSid; -} - - -static PSID -LsapCopySid(PSID SrcSid) -{ - UCHAR RidCount; - PSID DstSid; - ULONG i; - ULONG DstSidSize; - PULONG p, q; - - RidCount = *RtlSubAuthorityCountSid(SrcSid); - DstSidSize = RtlLengthRequiredSid(RidCount); - - DstSid = MIDL_user_allocate(DstSidSize); - if (DstSid == NULL) - return NULL; - - RtlInitializeSid(DstSid, - RtlIdentifierAuthoritySid(SrcSid), - RidCount); - - for (i = 0; i < (ULONG)RidCount; i++) - { - p = RtlSubAuthoritySid(SrcSid, i); - q = RtlSubAuthoritySid(DstSid, i); - *q = *p; - } - - return DstSid; -} - - -static -NTSTATUS -LsapLookupIsolatedNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - UNICODE_STRING EmptyDomainName = RTL_CONSTANT_STRING(L""); - PWELL_KNOWN_SID ptr, ptr2; - PSID DomainSid; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore fully qualified account names */ - if (DomainNames[i].Length != 0) - continue; - - TRACE("Mapping name: %wZ\n", &AccountNames[i]); - - /* Look-up all well-known names */ - ptr = LsapLookupIsolatedWellKnownName((PUNICODE_STRING)&AccountNames[i]); - if (ptr != NULL) - { - SidsBuffer[i].Use = ptr->Use; - SidsBuffer[i].Sid = LsapCopySid(ptr->Sid); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - if (ptr->Use == SidTypeDomain) - { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr->AccountName, - ptr->Sid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - else - { - ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); - if (ptr2 != NULL) - { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->AccountName, - ptr2->Sid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - else - { - DomainSid = CreateDomainSidFromAccountSid(ptr->Sid); - if (DomainSid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &EmptyDomainName, - DomainSid, - &DomainIndex); - - if (DomainSid != NULL) - { - MIDL_user_free(DomainSid); - DomainSid = NULL; - } - - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - } - - (*Mapped)++; - continue; - } - - /* Look-up the built-in domain */ - if (RtlEqualUnicodeString((PUNICODE_STRING)&AccountNames[i], &BuiltinDomainName, TRUE)) - { - SidsBuffer[i].Use = SidTypeDomain; - SidsBuffer[i].Sid = LsapCopySid(BuiltinDomainSid); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &BuiltinDomainName, - BuiltinDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - continue; - } - - /* Look-up the account domain */ - if (RtlEqualUnicodeString((PUNICODE_STRING)&AccountNames[i], &AccountDomainName, TRUE)) - { - SidsBuffer[i].Use = SidTypeDomain; - SidsBuffer[i].Sid = LsapCopySid(AccountDomainSid); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &AccountDomainName, - AccountDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - continue; - } - - /* FIXME: Look-up the primary domain */ - - /* FIXME: Look-up the trusted domains */ - - } - -done: - - return Status; -} - - -static -NTSTATUS -LsapLookupIsolatedBuiltinNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_ULONG_ARRAY RelativeIds = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - BuiltinDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore fully qualified account names */ - if (DomainNames[i].Length != 0) - continue; - - TRACE("Mapping name: %wZ\n", &AccountNames[i]); - - Status = SamrLookupNamesInDomain(DomainHandle, - 1, - &AccountNames[i], - &RelativeIds, - &Use); - if (NT_SUCCESS(Status)) - { - TRACE("Found relative ID: %lu\n", RelativeIds.Element[0]); - - SidsBuffer[i].Use = Use.Element[0]; - SidsBuffer[i].Sid = CreateSidFromSidAndRid(BuiltinDomainSid, - RelativeIds.Element[0]); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &BuiltinDomainName, - BuiltinDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - } - - SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -static -NTSTATUS -LsapLookupIsolatedAccountNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_ULONG_ARRAY RelativeIds = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - TRACE("()\n"); - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - AccountDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore fully qualified account names */ - if (DomainNames[i].Length != 0) - continue; - - TRACE("Mapping name: %wZ\n", &AccountNames[i]); - - Status = SamrLookupNamesInDomain(DomainHandle, - 1, - &AccountNames[i], - &RelativeIds, - &Use); - if (NT_SUCCESS(Status)) - { - TRACE("Found relative ID: %lu\n", RelativeIds.Element[0]); - - SidsBuffer[i].Use = Use.Element[0]; - SidsBuffer[i].Sid = CreateSidFromSidAndRid(AccountDomainSid, - RelativeIds.Element[0]); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &AccountDomainName, - AccountDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - } - - SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -static -NTSTATUS -LsapLookupFullyQualifiedWellKnownNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - UNICODE_STRING EmptyDomainName = RTL_CONSTANT_STRING(L""); - PWELL_KNOWN_SID ptr, ptr2; - PSID DomainSid; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore isolated account names */ - if (DomainNames[i].Length == 0) - continue; - - TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); - - /* Look-up all well-known names */ - ptr = LsapLookupFullyQualifiedWellKnownName((PUNICODE_STRING)&AccountNames[i], - (PUNICODE_STRING)&DomainNames[i]); - if (ptr != NULL) - { - TRACE("Found it! (%wZ\\%wZ)\n", &ptr->DomainName, &ptr->AccountName); - - SidsBuffer[i].Use = ptr->Use; - SidsBuffer[i].Sid = LsapCopySid(ptr->Sid); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - if (ptr->Use == SidTypeDomain) - { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr->AccountName, - ptr->Sid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - else - { - ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); - if (ptr2 != NULL) - { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->AccountName, - ptr2->Sid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - else - { - DomainSid = CreateDomainSidFromAccountSid(ptr->Sid); - if (DomainSid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &EmptyDomainName, - DomainSid, - &DomainIndex); - - if (DomainSid != NULL) - { - MIDL_user_free(DomainSid); - DomainSid = NULL; - } - - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - } - } - - (*Mapped)++; - continue; - } - } - -done: - return Status; -} - - -static -NTSTATUS -LsapLookupBuiltinNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_ULONG_ARRAY RelativeIds = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - BuiltinDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore isolated account names */ - if (DomainNames[i].Length == 0) - continue; - - if (!RtlEqualUnicodeString((PUNICODE_STRING)&DomainNames[i], &BuiltinDomainName, TRUE)) - continue; - - TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); - - Status = SamrLookupNamesInDomain(DomainHandle, - 1, - &AccountNames[i], - &RelativeIds, - &Use); - if (NT_SUCCESS(Status)) - { - SidsBuffer[i].Use = Use.Element[0]; - SidsBuffer[i].Sid = CreateSidFromSidAndRid(BuiltinDomainSid, - RelativeIds.Element[0]); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &BuiltinDomainName, - BuiltinDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - } - - SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -static -NTSTATUS -LsapLookupAccountNames(DWORD Count, - PRPC_UNICODE_STRING DomainNames, - PRPC_UNICODE_STRING AccountNames, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_ULONG_ARRAY RelativeIds = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - AccountDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < Count; i++) - { - /* Ignore names which were already mapped */ - if (SidsBuffer[i].Use != SidTypeUnknown) - continue; - - /* Ignore isolated account names */ - if (DomainNames[i].Length == 0) - continue; - - if (!RtlEqualUnicodeString((PUNICODE_STRING)&DomainNames[i], &AccountDomainName, TRUE)) - continue; - - TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); - - Status = SamrLookupNamesInDomain(DomainHandle, - 1, - &AccountNames[i], - &RelativeIds, - &Use); - if (NT_SUCCESS(Status)) - { - SidsBuffer[i].Use = Use.Element[0]; - SidsBuffer[i].Sid = CreateSidFromSidAndRid(AccountDomainSid, - RelativeIds.Element[0]); - if (SidsBuffer[i].Sid == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &AccountDomainName, - AccountDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - SidsBuffer[i].DomainIndex = DomainIndex; - - (*Mapped)++; - } - - SamIFree_SAMPR_ULONG_ARRAY(&RelativeIds); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -NTSTATUS -LsapLookupNames(DWORD Count, - PRPC_UNICODE_STRING Names, - PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, - PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, - LSAP_LOOKUP_LEVEL LookupLevel, - DWORD *MappedCount, - DWORD LookupOptions, - DWORD ClientRevision) -{ - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL; - PLSAPR_TRANSLATED_SID_EX2 SidsBuffer = NULL; - PRPC_UNICODE_STRING DomainNames = NULL; - PRPC_UNICODE_STRING AccountNames = NULL; - ULONG SidsBufferLength; - ULONG i; - ULONG Mapped = 0; - NTSTATUS Status = STATUS_SUCCESS; - -//TRACE("()\n"); - - TranslatedSids->Entries = 0; - TranslatedSids->Sids = NULL; - *ReferencedDomains = NULL; - - SidsBufferLength = Count * sizeof(LSAPR_TRANSLATED_SID_EX2); - SidsBuffer = MIDL_user_allocate(SidsBufferLength); - if (SidsBuffer == NULL) - { -//TRACE("\n"); - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - DomainsBuffer = MIDL_user_allocate(sizeof(LSAPR_REFERENCED_DOMAIN_LIST)); - if (DomainsBuffer == NULL) - { -//TRACE("\n"); - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - DomainsBuffer->Domains = MIDL_user_allocate(Count * sizeof(LSA_TRUST_INFORMATION)); - if (DomainsBuffer->Domains == NULL) - { -//TRACE("\n"); - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - DomainsBuffer->Entries = 0; - DomainsBuffer->MaxEntries = Count; - - for (i = 0; i < Count; i++) - { - SidsBuffer[i].Use = SidTypeUnknown; - SidsBuffer[i].Sid = NULL; - SidsBuffer[i].DomainIndex = -1; - SidsBuffer[i].Flags = 0; - } - - Status = LsapSplitNames(Count, - Names, - &DomainNames, - &AccountNames); - if (!NT_SUCCESS(Status)) - { - TRACE("LsapSplitNames failed! (Status %lx)\n", Status); - goto done; - } - - - Status = LsapLookupIsolatedNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupIsolatedNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - - - Status = LsapLookupIsolatedBuiltinNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupIsolatedBuiltinNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - - - Status = LsapLookupIsolatedAccountNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupIsolatedAccountNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - - Status = LsapLookupFullyQualifiedWellKnownNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupFullyQualifiedWellKnownNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - - Status = LsapLookupBuiltinNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupBuiltinNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - - - Status = LsapLookupAccountNames(Count, - DomainNames, - AccountNames, - DomainsBuffer, - SidsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - { - TRACE("LsapLookupAccountNames failed! (Status %lx)\n", Status); - goto done; - } - - if (Mapped == Count) - goto done; - -done: -// TRACE("done: Status %lx\n", Status); - - if (DomainNames != NULL) - { -//TRACE("Free DomainNames\n"); - for (i = 0; i < Count; i++) - { - if (DomainNames[i].Buffer != NULL) - MIDL_user_free(DomainNames[i].Buffer); - } - - MIDL_user_free(DomainNames); - } - - if (AccountNames != NULL) - { -//TRACE("Free AccountNames\n"); - for (i = 0; i < Count; i++) - { -//TRACE("i: %lu\n", i); - if (AccountNames[i].Buffer != NULL) - { - MIDL_user_free(AccountNames[i].Buffer); - } - } - - MIDL_user_free(AccountNames); - } - - if (!NT_SUCCESS(Status)) - { -//TRACE("Failure!\n"); - -//TRACE("Free DomainsBuffer\n"); - if (DomainsBuffer != NULL) - { - if (DomainsBuffer->Domains != NULL) - MIDL_user_free(DomainsBuffer->Domains); - - MIDL_user_free(DomainsBuffer); - } - -//TRACE("Free SidsBuffer\n"); - if (SidsBuffer != NULL) - MIDL_user_free(SidsBuffer); - } - else - { -//TRACE("Success!\n"); - - *ReferencedDomains = DomainsBuffer; - TranslatedSids->Entries = Count; - TranslatedSids->Sids = SidsBuffer; - *MappedCount = Mapped; - - if (Mapped == 0) - Status = STATUS_NONE_MAPPED; - else if (Mapped < Count) - Status = STATUS_SOME_NOT_MAPPED; - } - -// TRACE("done: Status %lx\n", Status); - - return Status; -} - - -static NTSTATUS -LsapLookupWellKnownSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, - PLSAPR_TRANSLATED_NAME_EX NamesBuffer, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PULONG Mapped) -{ - PWELL_KNOWN_SID ptr, ptr2; - LPWSTR SidString = NULL; - ULONG DomainIndex; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - for (i = 0; i < SidEnumBuffer->Entries; i++) - { - /* Ignore SIDs which are already mapped */ - if (NamesBuffer[i].Use != SidTypeUnknown) - continue; - - ConvertSidToStringSidW(SidEnumBuffer->SidInfo[i].Sid, &SidString); - TRACE("Mapping SID: %S\n", SidString); - LocalFree(SidString); - SidString = NULL; - - ptr = LsapLookupWellKnownSid(SidEnumBuffer->SidInfo[i].Sid); - if (ptr != NULL) - { - NamesBuffer[i].Use = ptr->Use; - NamesBuffer[i].Flags = 0; - - NamesBuffer[i].Name.Length = ptr->AccountName.Length; - NamesBuffer[i].Name.MaximumLength = ptr->AccountName.MaximumLength; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->AccountName.MaximumLength); - if (NamesBuffer[i].Name.Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength); - - ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); - if (ptr2 != NULL) - { - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->AccountName, - ptr2->Sid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - NamesBuffer[i].DomainIndex = DomainIndex; - } - - TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name); - - (*Mapped)++; - } - } - -done: - return Status; -} - - -static NTSTATUS -LsapLookupBuiltinDomainSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, - PLSAPR_TRANSLATED_NAME_EX NamesBuffer, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_RETURNED_USTRING_ARRAY Names = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - LPWSTR SidString = NULL; - ULONG DomainIndex; - ULONG RelativeIds[1]; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - BuiltinDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < SidEnumBuffer->Entries; i++) - { - /* Ignore SIDs which are already mapped */ - if (NamesBuffer[i].Use != SidTypeUnknown) - continue; - - ConvertSidToStringSidW(SidEnumBuffer->SidInfo[i].Sid, &SidString); - TRACE("Mapping SID: %S\n", SidString); - LocalFree(SidString); - SidString = NULL; - - if (RtlEqualSid(BuiltinDomainSid, SidEnumBuffer->SidInfo[i].Sid)) - { - TRACE("Found builtin domain!\n"); - - NamesBuffer[i].Use = SidTypeDomain; - NamesBuffer[i].Flags = 0; - - NamesBuffer[i].Name.Length = BuiltinDomainName.Length; - NamesBuffer[i].Name.MaximumLength = BuiltinDomainName.MaximumLength; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(BuiltinDomainName.MaximumLength); - if (NamesBuffer[i].Name.Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - RtlCopyMemory(NamesBuffer[i].Name.Buffer, BuiltinDomainName.Buffer, BuiltinDomainName.MaximumLength); - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &BuiltinDomainName, - BuiltinDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - NamesBuffer[i].DomainIndex = DomainIndex; - - TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name); - - (*Mapped)++; - } - else if (LsapIsPrefixSid(BuiltinDomainSid, SidEnumBuffer->SidInfo[i].Sid)) - { - TRACE("Found builtin domain account!\n"); - - RelativeIds[0] = LsapGetRelativeIdFromSid(SidEnumBuffer->SidInfo[i].Sid); - - Status = SamrLookupIdsInDomain(DomainHandle, - 1, - RelativeIds, - &Names, - &Use); - if (NT_SUCCESS(Status)) - { - NamesBuffer[i].Use = Use.Element[0]; - NamesBuffer[i].Flags = 0; - - NamesBuffer[i].Name.Length = Names.Element[0].Length; - NamesBuffer[i].Name.MaximumLength = Names.Element[0].MaximumLength; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(Names.Element[0].MaximumLength); - if (NamesBuffer[i].Name.Buffer == NULL) - { - SamIFree_SAMPR_RETURNED_USTRING_ARRAY(&Names); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - RtlCopyMemory(NamesBuffer[i].Name.Buffer, - Names.Element[0].Buffer, - Names.Element[0].MaximumLength); - - SamIFree_SAMPR_RETURNED_USTRING_ARRAY(&Names); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &BuiltinDomainName, - BuiltinDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - NamesBuffer[i].DomainIndex = DomainIndex; - - TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name); - - (*Mapped)++; - } - } - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -static NTSTATUS -LsapLookupAccountDomainSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, - PLSAPR_TRANSLATED_NAME_EX NamesBuffer, - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, - PULONG Mapped) -{ - SAMPR_HANDLE ServerHandle = NULL; - SAMPR_HANDLE DomainHandle = NULL; - SAMPR_RETURNED_USTRING_ARRAY Names = {0, NULL}; - SAMPR_ULONG_ARRAY Use = {0, NULL}; - LPWSTR SidString = NULL; - ULONG DomainIndex; - ULONG RelativeIds[1]; - ULONG i; - NTSTATUS Status = STATUS_SUCCESS; - - Status = SamrConnect(NULL, - &ServerHandle, - SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN); - if (!NT_SUCCESS(Status)) - { - TRACE("SamrConnect failed (Status %08lx)\n", Status); - goto done; - } - - Status = SamrOpenDomain(ServerHandle, - DOMAIN_LOOKUP, - AccountDomainSid, - &DomainHandle); - if (!NT_SUCCESS(Status)) - { - TRACE("SamOpenDomain failed (Status %08lx)\n", Status); - goto done; - } - - for (i = 0; i < SidEnumBuffer->Entries; i++) - { - /* Ignore SIDs which are already mapped */ - if (NamesBuffer[i].Use != SidTypeUnknown) - continue; - - ConvertSidToStringSidW(SidEnumBuffer->SidInfo[i].Sid, &SidString); - TRACE("Mapping SID: %S\n", SidString); - LocalFree(SidString); - SidString = NULL; - - if (RtlEqualSid(AccountDomainSid, SidEnumBuffer->SidInfo[i].Sid)) - { - TRACE("Found account domain!\n"); - - NamesBuffer[i].Use = SidTypeDomain; - NamesBuffer[i].Flags = 0; - - NamesBuffer[i].Name.Length = AccountDomainName.Length; - NamesBuffer[i].Name.MaximumLength = AccountDomainName.MaximumLength; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(AccountDomainName.MaximumLength); - if (NamesBuffer[i].Name.Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - RtlCopyMemory(NamesBuffer[i].Name.Buffer, AccountDomainName.Buffer, AccountDomainName.MaximumLength); - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &AccountDomainName, - AccountDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - NamesBuffer[i].DomainIndex = DomainIndex; - - TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name); - - (*Mapped)++; - } - else if (LsapIsPrefixSid(AccountDomainSid, SidEnumBuffer->SidInfo[i].Sid)) - { - TRACE("Found account domain account!\n"); - - RelativeIds[0] = LsapGetRelativeIdFromSid(SidEnumBuffer->SidInfo[i].Sid); - - Status = SamrLookupIdsInDomain(DomainHandle, - 1, - RelativeIds, - &Names, - &Use); - if (NT_SUCCESS(Status)) - { - NamesBuffer[i].Use = Use.Element[0]; - NamesBuffer[i].Flags = 0; - - NamesBuffer[i].Name.Length = Names.Element[0].Length; - NamesBuffer[i].Name.MaximumLength = Names.Element[0].MaximumLength; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(Names.Element[0].MaximumLength); - if (NamesBuffer[i].Name.Buffer == NULL) - { - SamIFree_SAMPR_RETURNED_USTRING_ARRAY(&Names); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - RtlCopyMemory(NamesBuffer[i].Name.Buffer, - Names.Element[0].Buffer, - Names.Element[0].MaximumLength); - - SamIFree_SAMPR_RETURNED_USTRING_ARRAY(&Names); - SamIFree_SAMPR_ULONG_ARRAY(&Use); - - Status = LsapAddDomainToDomainsList(DomainsBuffer, - &AccountDomainName, - AccountDomainSid, - &DomainIndex); - if (!NT_SUCCESS(Status)) - goto done; - - NamesBuffer[i].DomainIndex = DomainIndex; - - TRACE("Mapped to: %wZ\n", &NamesBuffer[i].Name); - - (*Mapped)++; - } - } - } - -done: - if (DomainHandle != NULL) - SamrCloseHandle(&DomainHandle); - - if (ServerHandle != NULL) - SamrCloseHandle(&ServerHandle); - - return Status; -} - - -NTSTATUS -LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, - PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, - PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, - LSAP_LOOKUP_LEVEL LookupLevel, - DWORD *MappedCount, - DWORD LookupOptions, - DWORD ClientRevision) -{ - PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer = NULL; - PLSAPR_TRANSLATED_NAME_EX NamesBuffer = NULL; - ULONG NamesBufferLength; - ULONG i; - ULONG Mapped = 0; - NTSTATUS Status = STATUS_SUCCESS; - - NamesBufferLength = SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME_EX); - NamesBuffer = MIDL_user_allocate(NamesBufferLength); - if (NamesBuffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - DomainsBuffer = MIDL_user_allocate(sizeof(LSAPR_REFERENCED_DOMAIN_LIST)); - if (DomainsBuffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - DomainsBuffer->Domains = MIDL_user_allocate(SidEnumBuffer->Entries * sizeof(LSA_TRUST_INFORMATION)); - if (DomainsBuffer->Domains == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - DomainsBuffer->Entries = 0; - DomainsBuffer->MaxEntries = SidEnumBuffer->Entries; - - /* Initialize all name entries */ - for (i = 0; i < SidEnumBuffer->Entries; i++) - { - NamesBuffer[i].Use = SidTypeUnknown; - NamesBuffer[i].Name.Length = 0; - NamesBuffer[i].Name.MaximumLength = 0; - NamesBuffer[i].Name.Buffer = NULL; - NamesBuffer[i].DomainIndex = -1; - NamesBuffer[i].Flags = 0; - } - - /* Look-up well-known SIDs */ - Status = LsapLookupWellKnownSids(SidEnumBuffer, - NamesBuffer, - DomainsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - goto done; - - if (Mapped == SidEnumBuffer->Entries) - goto done; - - /* Look-up builtin domain SIDs */ - Status = LsapLookupBuiltinDomainSids(SidEnumBuffer, - NamesBuffer, - DomainsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - goto done; - - if (Mapped == SidEnumBuffer->Entries) - goto done; - - /* Look-up account domain SIDs */ - Status = LsapLookupAccountDomainSids(SidEnumBuffer, - NamesBuffer, - DomainsBuffer, - &Mapped); - if (!NT_SUCCESS(Status) && - Status != STATUS_NONE_MAPPED && - Status != STATUS_SOME_NOT_MAPPED) - goto done; - - if (Mapped == SidEnumBuffer->Entries) - goto done; - -done: - TRACE("done Status: %lx Mapped: %lu\n", Status, Mapped); - - if (!NT_SUCCESS(Status)) - { - if (DomainsBuffer != NULL) - { - if (DomainsBuffer->Domains != NULL) - MIDL_user_free(DomainsBuffer->Domains); - - MIDL_user_free(DomainsBuffer); - } - - if (NamesBuffer != NULL) - MIDL_user_free(NamesBuffer); - } - else - { - *ReferencedDomains = DomainsBuffer; - TranslatedNames->Entries = SidEnumBuffer->Entries; - TranslatedNames->Names = NamesBuffer; - *MappedCount = Mapped; - - if (Mapped == 0) - Status = STATUS_NONE_MAPPED; - else if (Mapped < SidEnumBuffer->Entries) - Status = STATUS_SOME_NOT_MAPPED; - } - - return Status; -} - -/* EOF */
12 years, 2 months
1
0
0
0
[hbelusca] 57584: [NTDLL] - Activate new code (but keep the old one for the moment).
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 20 14:10:50 2012 New Revision: 57584 URL:
http://svn.reactos.org/svn/reactos?rev=57584&view=rev
Log: [NTDLL] - Activate new code (but keep the old one for the moment). Modified: branches/ros-csrss/dll/ntdll/csr/connect.c Modified: branches/ros-csrss/dll/ntdll/csr/connect.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/ntdll/csr/connect…
============================================================================== --- branches/ros-csrss/dll/ntdll/csr/connect.c [iso-8859-1] (original) +++ branches/ros-csrss/dll/ntdll/csr/connect.c [iso-8859-1] Sat Oct 20 14:10:50 2012 @@ -431,17 +431,16 @@ *ConnectionInfoSize = ClientConnect->ConnectionInfoSize; /* Call CSR */ -#if 0 Status = CsrClientCallServer(&ApiMessage, CaptureBuffer, CSR_CREATE_API_NUMBER(CSR_SRV_DLL, CsrpClientConnect), sizeof(CSR_CLIENT_CONNECT)); -#else +/* Status = CsrClientCallServer(&ApiMessage, CaptureBuffer, CSR_CREATE_API_NUMBER(CSR_NATIVE, CONNECT_PROCESS), sizeof(CSR_API_MESSAGE)); -#endif +*/ } else {
12 years, 2 months
1
0
0
0
[hbelusca] 57583: [CSRSRV] - Start renaming some APIs which should not be present there, but in basesrv instead. Names come from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 20 14:07:04 2012 New Revision: 57583 URL:
http://svn.reactos.org/svn/reactos?rev=57583&view=rev
Log: [CSRSRV] - Start renaming some APIs which should not be present there, but in basesrv instead. Names come from
http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
Modified: branches/ros-csrss/subsystems/win32/csrsrv/api/process.c branches/ros-csrss/subsystems/win32/csrsrv/api/user.c branches/ros-csrss/subsystems/win32/csrsrv/include/api.h branches/ros-csrss/subsystems/win32/csrsrv/init.c Modified: branches/ros-csrss/subsystems/win32/csrsrv/api/process.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/api/process.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/api/process.c [iso-8859-1] Sat Oct 20 14:07:04 2012 @@ -23,7 +23,14 @@ * CSRSS API *********************************************************************/ -CSR_API(CsrSrvCreateProcess) +/*** + *** Some APIs from here will go to basesrv.dll, some others to winsrv.dll. + *** Furthermore, this structure uses the old definition of APIs list. + *** The new one is in fact three arrays, one of APIs pointers, one other of + *** corresponding indexes, and the third one of names (not very efficient...). + ***/ + +CSR_API(BaseSrvCreateProcess) { NTSTATUS Status; HANDLE ProcessHandle, ThreadHandle; @@ -135,7 +142,7 @@ return Status; } -CSR_API(CsrSrvCreateThread) +CSR_API(BaseSrvCreateThread) { PCSR_THREAD CurrentThread; HANDLE ThreadHandle; @@ -191,7 +198,7 @@ return Status; } -CSR_API(CsrTerminateProcess) +CSR_API(BaseSrvExitProcess) { PCSR_THREAD CsrThread = CsrGetClientThread(); ASSERT(CsrThread != NULL); @@ -204,12 +211,7 @@ (NTSTATUS)ApiMessage->Data.TerminateProcessRequest.uExitCode); } -CSR_API(CsrConnectProcess) -{ - return STATUS_SUCCESS; -} - -CSR_API(CsrGetShutdownParameters) +CSR_API(BaseSrvGetProcessShutdownParam) { PCSR_THREAD CsrThread = CsrGetClientThread(); ASSERT(CsrThread); @@ -220,7 +222,7 @@ return STATUS_SUCCESS; } -CSR_API(CsrSetShutdownParameters) +CSR_API(BaseSrvSetProcessShutdownParam) { PCSR_THREAD CsrThread = CsrGetClientThread(); ASSERT(CsrThread); Modified: branches/ros-csrss/subsystems/win32/csrsrv/api/user.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/api/user.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/api/user.c [iso-8859-1] Sat Oct 20 14:07:04 2012 @@ -23,7 +23,7 @@ /* FUNCTIONS *****************************************************************/ -CSR_API(CsrRegisterServicesProcess) +CSR_API(SrvRegisterServicesProcess) { if (ServicesProcessIdValid == TRUE) { Modified: branches/ros-csrss/subsystems/win32/csrsrv/include/api.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/include/api.h [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/include/api.h [iso-8859-1] Sat Oct 20 14:07:04 2012 @@ -71,11 +71,11 @@ /* api/process.c */ CSR_API(CsrConnectProcess); -CSR_API(CsrSrvCreateProcess); -CSR_API(CsrTerminateProcess); -CSR_API(CsrSrvCreateThread); -CSR_API(CsrGetShutdownParameters); -CSR_API(CsrSetShutdownParameters); +CSR_API(BaseSrvCreateProcess); +CSR_API(BaseSrvExitProcess); +CSR_API(BaseSrvCreateThread); +CSR_API(BaseSrvGetProcessShutdownParam); +CSR_API(BaseSrvSetProcessShutdownParam); VOID NTAPI @@ -263,6 +263,6 @@ IN ULONG ServerId); /* api/user.c */ -CSR_API(CsrRegisterServicesProcess); +CSR_API(SrvRegisterServicesProcess); /* EOF */ Modified: branches/ros-csrss/subsystems/win32/csrsrv/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrsrv/init.c [iso-8859-1] Sat Oct 20 14:07:04 2012 @@ -94,13 +94,12 @@ ***/ CSRSS_API_DEFINITION NativeDefinitions[] = { - CSRSS_DEFINE_API(CREATE_PROCESS, CsrSrvCreateProcess), - CSRSS_DEFINE_API(CREATE_THREAD, CsrSrvCreateThread), - CSRSS_DEFINE_API(TERMINATE_PROCESS, CsrTerminateProcess), - CSRSS_DEFINE_API(CONNECT_PROCESS, CsrConnectProcess), - CSRSS_DEFINE_API(REGISTER_SERVICES_PROCESS, CsrRegisterServicesProcess), - CSRSS_DEFINE_API(GET_SHUTDOWN_PARAMETERS, CsrGetShutdownParameters), - CSRSS_DEFINE_API(SET_SHUTDOWN_PARAMETERS, CsrSetShutdownParameters), + CSRSS_DEFINE_API(CREATE_PROCESS, BaseSrvCreateProcess), + CSRSS_DEFINE_API(CREATE_THREAD, BaseSrvCreateThread), + CSRSS_DEFINE_API(TERMINATE_PROCESS, BaseSrvExitProcess), + CSRSS_DEFINE_API(REGISTER_SERVICES_PROCESS, SrvRegisterServicesProcess), + CSRSS_DEFINE_API(GET_SHUTDOWN_PARAMETERS, BaseSrvGetProcessShutdownParam), + CSRSS_DEFINE_API(SET_SHUTDOWN_PARAMETERS, BaseSrvSetProcessShutdownParam), { 0, 0, NULL } };
12 years, 2 months
1
0
0
0
[hbelusca] 57582: [CSRSS/CSRSRV] - Reorganize the source code tree. (Branch build still broken)
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 20 13:28:09 2012 New Revision: 57582 URL:
http://svn.reactos.org/svn/reactos?rev=57582&view=rev
Log: [CSRSS/CSRSRV] - Reorganize the source code tree. (Branch build still broken) Added: branches/ros-csrss/subsystems/win32/csrsrv/ - copied from r57580, branches/ros-csrss/subsystems/win32/csrss/csrsrv/ branches/ros-csrss/subsystems/win32/csrsrv/include/ - copied from r57580, branches/ros-csrss/subsystems/win32/csrss/include/ Removed: branches/ros-csrss/subsystems/win32/csrss/csrsrv/ branches/ros-csrss/subsystems/win32/csrss/include/ Modified: branches/ros-csrss/subsystems/win32/CMakeLists.txt branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt Modified: branches/ros-csrss/subsystems/win32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/CMak…
============================================================================== --- branches/ros-csrss/subsystems/win32/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/CMakeLists.txt [iso-8859-1] Sat Oct 20 13:28:09 2012 @@ -1,2 +1,3 @@ +add_subdirectory(csrsrv) add_subdirectory(csrss) Modified: branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
============================================================================== --- branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-csrss/subsystems/win32/csrss/CMakeLists.txt [iso-8859-1] Sat Oct 20 13:28:09 2012 @@ -10,5 +10,3 @@ add_importlibs(csrss ntdll csrsrv) add_dependencies(csrss psdk bugcodes) add_cd_file(TARGET csrss DESTINATION reactos/system32 FOR all) - -add_subdirectory(csrsrv)
12 years, 2 months
1
0
0
0
[ekohl] 57581: [LSASRV] - Change the account and domain names in the WELL_KNOWN_SID type to AccountName and DomainName. - Implement a function to look-up fully qualified well-known names (for examp...
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Oct 20 13:21:48 2012 New Revision: 57581 URL:
http://svn.reactos.org/svn/reactos?rev=57581&view=rev
Log: [LSASRV] - Change the account and domain names in the WELL_KNOWN_SID type to AccountName and DomainName. - Implement a function to look-up fully qualified well-known names (for example "NT AUTHORITY\LOCAL SERVICE"). This kind of look-up was still missing from LsapLookupNames. - Ensure that all well-known SIDs returned by look-up functions are copied from the list of well-known SIDs, because RPCRT4.DLL frees the SID buffers after copying the SIDs to the caller. This will corrupt the well-known SID list if pointers to the original SIDs are passed. - Check all memory allocations. Modified: trunk/reactos/dll/win32/lsasrv/sids.c Modified: trunk/reactos/dll/win32/lsasrv/sids.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/sids.c?re…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/sids.c [iso-8859-1] Sat Oct 20 13:21:48 2012 @@ -72,8 +72,8 @@ { LIST_ENTRY ListEntry; PSID Sid; - UNICODE_STRING Name; - UNICODE_STRING Domain; + UNICODE_STRING AccountName; + UNICODE_STRING DomainName; SID_NAME_USE Use; } WELL_KNOWN_SID, *PWELL_KNOWN_SID; @@ -202,8 +202,8 @@ LsapCreateSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, UCHAR SubAuthorityCount, PULONG SubAuthorities, - PWSTR Name, - PWSTR Domain, + PWSTR AccountName, + PWSTR DomainName, SID_NAME_USE Use) { PWELL_KNOWN_SID SidEntry; @@ -235,11 +235,11 @@ *p = SubAuthorities[i]; } - RtlInitUnicodeString(&SidEntry->Name, - Name); - - RtlInitUnicodeString(&SidEntry->Domain, - Domain); + RtlInitUnicodeString(&SidEntry->AccountName, + AccountName); + + RtlInitUnicodeString(&SidEntry->DomainName, + DomainName); SidEntry->Use = Use; @@ -667,7 +667,7 @@ PWELL_KNOWN_SID -LsapLookupWellKnownName(PUNICODE_STRING Name) +LsapLookupIsolatedWellKnownName(PUNICODE_STRING AccountName) { PLIST_ENTRY ListEntry; PWELL_KNOWN_SID Ptr; @@ -678,7 +678,33 @@ Ptr = CONTAINING_RECORD(ListEntry, WELL_KNOWN_SID, ListEntry); - if (RtlEqualUnicodeString(Name, &Ptr->Name, TRUE)) + if (RtlEqualUnicodeString(AccountName, &Ptr->AccountName, TRUE)) + { + return Ptr; + } + + ListEntry = ListEntry->Flink; + } + + return NULL; +} + + +PWELL_KNOWN_SID +LsapLookupFullyQualifiedWellKnownName(PUNICODE_STRING AccountName, + PUNICODE_STRING DomainName) +{ + PLIST_ENTRY ListEntry; + PWELL_KNOWN_SID Ptr; + + ListEntry = WellKnownSidListHead.Flink; + while (ListEntry != &WellKnownSidListHead) + { + Ptr = CONTAINING_RECORD(ListEntry, + WELL_KNOWN_SID, + ListEntry); + if (RtlEqualUnicodeString(AccountName, &Ptr->AccountName, TRUE) && + RtlEqualUnicodeString(DomainName, &Ptr->DomainName, TRUE)) { return Ptr; } @@ -989,6 +1015,37 @@ } +static PSID +LsapCopySid(PSID SrcSid) +{ + UCHAR RidCount; + PSID DstSid; + ULONG i; + ULONG DstSidSize; + PULONG p, q; + + RidCount = *RtlSubAuthorityCountSid(SrcSid); + DstSidSize = RtlLengthRequiredSid(RidCount); + + DstSid = MIDL_user_allocate(DstSidSize); + if (DstSid == NULL) + return NULL; + + RtlInitializeSid(DstSid, + RtlIdentifierAuthoritySid(SrcSid), + RidCount); + + for (i = 0; i < (ULONG)RidCount; i++) + { + p = RtlSubAuthoritySid(SrcSid, i); + q = RtlSubAuthoritySid(DstSid, i); + *q = *p; + } + + return DstSid; +} + + static NTSTATUS LsapLookupIsolatedNames(DWORD Count, @@ -1018,18 +1075,24 @@ TRACE("Mapping name: %wZ\n", &AccountNames[i]); /* Look-up all well-known names */ - ptr = LsapLookupWellKnownName((PUNICODE_STRING)&AccountNames[i]); + ptr = LsapLookupIsolatedWellKnownName((PUNICODE_STRING)&AccountNames[i]); if (ptr != NULL) { SidsBuffer[i].Use = ptr->Use; - SidsBuffer[i].Sid = ptr->Sid; + SidsBuffer[i].Sid = LsapCopySid(ptr->Sid); + if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; if (ptr->Use == SidTypeDomain) { Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr->Name, + &ptr->AccountName, ptr->Sid, &DomainIndex); if (!NT_SUCCESS(Status)) @@ -1039,11 +1102,11 @@ } else { - ptr2= LsapLookupWellKnownName(&ptr->Domain); + ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); if (ptr2 != NULL) { Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->Name, + &ptr2->AccountName, ptr2->Sid, &DomainIndex); if (!NT_SUCCESS(Status)) @@ -1086,7 +1149,13 @@ if (RtlEqualUnicodeString((PUNICODE_STRING)&AccountNames[i], &BuiltinDomainName, TRUE)) { SidsBuffer[i].Use = SidTypeDomain; - SidsBuffer[i].Sid = BuiltinDomainSid; + SidsBuffer[i].Sid = LsapCopySid(BuiltinDomainSid); + if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1107,7 +1176,12 @@ if (RtlEqualUnicodeString((PUNICODE_STRING)&AccountNames[i], &AccountDomainName, TRUE)) { SidsBuffer[i].Use = SidTypeDomain; - SidsBuffer[i].Sid = AccountDomainSid; + SidsBuffer[i].Sid = LsapCopySid(AccountDomainSid); + if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1197,7 +1271,10 @@ SidsBuffer[i].Sid = CreateSidFromSidAndRid(BuiltinDomainSid, RelativeIds.Element[0]); if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; goto done; + } SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1292,7 +1369,10 @@ SidsBuffer[i].Sid = CreateSidFromSidAndRid(AccountDomainSid, RelativeIds.Element[0]); if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; goto done; + } SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1320,6 +1400,114 @@ if (ServerHandle != NULL) SamrCloseHandle(&ServerHandle); + return Status; +} + + +static +NTSTATUS +LsapLookupFullyQualifiedWellKnownNames(DWORD Count, + PRPC_UNICODE_STRING DomainNames, + PRPC_UNICODE_STRING AccountNames, + PLSAPR_REFERENCED_DOMAIN_LIST DomainsBuffer, + PLSAPR_TRANSLATED_SID_EX2 SidsBuffer, + PULONG Mapped) +{ + UNICODE_STRING EmptyDomainName = RTL_CONSTANT_STRING(L""); + PWELL_KNOWN_SID ptr, ptr2; + PSID DomainSid; + ULONG DomainIndex; + ULONG i; + NTSTATUS Status = STATUS_SUCCESS; + + for (i = 0; i < Count; i++) + { + /* Ignore names which were already mapped */ + if (SidsBuffer[i].Use != SidTypeUnknown) + continue; + + /* Ignore isolated account names */ + if (DomainNames[i].Length == 0) + continue; + + TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); + + /* Look-up all well-known names */ + ptr = LsapLookupFullyQualifiedWellKnownName((PUNICODE_STRING)&AccountNames[i], + (PUNICODE_STRING)&DomainNames[i]); + if (ptr != NULL) + { + TRACE("Found it! (%wZ\\%wZ)\n", &ptr->DomainName, &ptr->AccountName); + + SidsBuffer[i].Use = ptr->Use; + SidsBuffer[i].Sid = LsapCopySid(ptr->Sid); + if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + SidsBuffer[i].DomainIndex = -1; + SidsBuffer[i].Flags = 0; + + if (ptr->Use == SidTypeDomain) + { + Status = LsapAddDomainToDomainsList(DomainsBuffer, + &ptr->AccountName, + ptr->Sid, + &DomainIndex); + if (!NT_SUCCESS(Status)) + goto done; + + SidsBuffer[i].DomainIndex = DomainIndex; + } + else + { + ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); + if (ptr2 != NULL) + { + Status = LsapAddDomainToDomainsList(DomainsBuffer, + &ptr2->AccountName, + ptr2->Sid, + &DomainIndex); + if (!NT_SUCCESS(Status)) + goto done; + + SidsBuffer[i].DomainIndex = DomainIndex; + } + else + { + DomainSid = CreateDomainSidFromAccountSid(ptr->Sid); + if (DomainSid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + Status = LsapAddDomainToDomainsList(DomainsBuffer, + &EmptyDomainName, + DomainSid, + &DomainIndex); + + if (DomainSid != NULL) + { + MIDL_user_free(DomainSid); + DomainSid = NULL; + } + + if (!NT_SUCCESS(Status)) + goto done; + + SidsBuffer[i].DomainIndex = DomainIndex; + } + } + + (*Mapped)++; + continue; + } + } + +done: return Status; } @@ -1372,6 +1560,8 @@ if (!RtlEqualUnicodeString((PUNICODE_STRING)&DomainNames[i], &BuiltinDomainName, TRUE)) continue; + + TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); Status = SamrLookupNamesInDomain(DomainHandle, 1, @@ -1384,7 +1574,10 @@ SidsBuffer[i].Sid = CreateSidFromSidAndRid(BuiltinDomainSid, RelativeIds.Element[0]); if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; goto done; + } SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1464,6 +1657,8 @@ if (!RtlEqualUnicodeString((PUNICODE_STRING)&DomainNames[i], &AccountDomainName, TRUE)) continue; + + TRACE("Mapping name: %wZ\\%wZ\n", &DomainNames[i], &AccountNames[i]); Status = SamrLookupNamesInDomain(DomainHandle, 1, @@ -1476,7 +1671,10 @@ SidsBuffer[i].Sid = CreateSidFromSidAndRid(AccountDomainSid, RelativeIds.Element[0]); if (SidsBuffer[i].Sid == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; goto done; + } SidsBuffer[i].DomainIndex = -1; SidsBuffer[i].Flags = 0; @@ -1523,12 +1721,9 @@ PRPC_UNICODE_STRING DomainNames = NULL; PRPC_UNICODE_STRING AccountNames = NULL; ULONG SidsBufferLength; -// ULONG DomainIndex; ULONG i; ULONG Mapped = 0; NTSTATUS Status = STATUS_SUCCESS; - -// PWELL_KNOWN_SID ptr, ptr2; //TRACE("()\n"); @@ -1635,7 +1830,22 @@ if (Mapped == Count) goto done; - + Status = LsapLookupFullyQualifiedWellKnownNames(Count, + DomainNames, + AccountNames, + DomainsBuffer, + SidsBuffer, + &Mapped); + if (!NT_SUCCESS(Status) && + Status != STATUS_NONE_MAPPED && + Status != STATUS_SOME_NOT_MAPPED) + { + TRACE("LsapLookupFullyQualifiedWellKnownNames failed! (Status %lx)\n", Status); + goto done; + } + + if (Mapped == Count) + goto done; Status = LsapLookupBuiltinNames(Count, DomainNames, @@ -1769,16 +1979,22 @@ NamesBuffer[i].Use = ptr->Use; NamesBuffer[i].Flags = 0; - NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->Name.MaximumLength); - NamesBuffer[i].Name.Length = ptr->Name.Length; - NamesBuffer[i].Name.MaximumLength = ptr->Name.MaximumLength; - RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->Name.Buffer, ptr->Name.MaximumLength); - - ptr2= LsapLookupWellKnownName(&ptr->Domain); + NamesBuffer[i].Name.Length = ptr->AccountName.Length; + NamesBuffer[i].Name.MaximumLength = ptr->AccountName.MaximumLength; + NamesBuffer[i].Name.Buffer = MIDL_user_allocate(ptr->AccountName.MaximumLength); + if (NamesBuffer[i].Name.Buffer == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + RtlCopyMemory(NamesBuffer[i].Name.Buffer, ptr->AccountName.Buffer, ptr->AccountName.MaximumLength); + + ptr2= LsapLookupIsolatedWellKnownName(&ptr->DomainName); if (ptr2 != NULL) { Status = LsapAddDomainToDomainsList(DomainsBuffer, - &ptr2->Name, + &ptr2->AccountName, ptr2->Sid, &DomainIndex); if (!NT_SUCCESS(Status))
12 years, 2 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
22
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Results per page:
10
25
50
100
200