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
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2018
----- 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
24 participants
223 discussions
Start a n
N
ew thread
01/01: [NTOSKRNL] Move data mapping implementation to an internel helper
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=02da7b452c413c05d6863…
commit 02da7b452c413c05d6863b03eb2d2479d25060d4 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Sep 9 11:14:42 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Sep 9 14:02:13 2018 +0200 [NTOSKRNL] Move data mapping implementation to an internel helper --- ntoskrnl/cc/pin.c | 58 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c index d96c64bc2f..3c8747e76b 100644 --- a/ntoskrnl/cc/pin.c +++ b/ntoskrnl/cc/pin.c @@ -31,12 +31,10 @@ ULONG CcPinReadNoWait = 0; /* FUNCTIONS *****************************************************************/ -/* - * @implemented - */ +static BOOLEAN NTAPI -CcMapData ( +CcpMapData( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, @@ -53,19 +51,6 @@ CcMapData ( LONGLONG ROffset; KIRQL OldIrql; - DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lu, Flags 0x%lx," - " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart, - Length, Flags, pBcb, pBuffer); - - if (Flags & MAP_WAIT) - { - ++CcMapDataWait; - } - else - { - ++CcMapDataNoWait; - } - ReadOffset = FileOffset->QuadPart; ASSERT(FileObject); @@ -160,11 +145,44 @@ CcMapData ( InsertTailList(&SharedCacheMap->BcbList, &iBcb->BcbEntry); KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); - CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> TRUE Bcb=%p\n", - FileObject, FileOffset, Length, Flags, iBcb); return TRUE; } +/* + * @implemented + */ +BOOLEAN +NTAPI +CcMapData ( + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN ULONG Length, + IN ULONG Flags, + OUT PVOID *pBcb, + OUT PVOID *pBuffer) +{ + BOOLEAN Ret; + + DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lu, Flags 0x%lx," + " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart, + Length, Flags, pBcb, pBuffer); + + if (Flags & MAP_WAIT) + { + ++CcMapDataWait; + } + else + { + ++CcMapDataNoWait; + } + + Ret = CcpMapData(FileObject, FileOffset, Length, Flags, pBcb, pBuffer); + + CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> %d Bcb=%p\n", + FileObject, FileOffset, Length, Flags, Ret, *pBcb); + return Ret; +} + /* * @unimplemented */ @@ -246,7 +264,7 @@ CcPinRead ( } /* Map first */ - if (!CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer)) + if (!CcpMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer)) { return FALSE; }
6 years, 2 months
1
0
0
0
01/01: [NETAPI32] Implement NetGroupSetInfo
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=df0137a1694a24291594c…
commit df0137a1694a24291594cf3b9aa58168bcd45c9f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Sep 9 13:39:01 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Sep 9 13:39:01 2018 +0200 [NETAPI32] Implement NetGroupSetInfo --- dll/win32/netapi32/group.c | 18 --- dll/win32/netapi32/group_new.c | 255 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 254 insertions(+), 19 deletions(-) diff --git a/dll/win32/netapi32/group.c b/dll/win32/netapi32/group.c index 75c03697bc..b87ab9b83c 100644 --- a/dll/win32/netapi32/group.c +++ b/dll/win32/netapi32/group.c @@ -76,24 +76,6 @@ NetGroupGetUsers(IN LPCWSTR servername, } -/************************************************************ - * NetGroupSetInfo (NETAPI32.@) - * - */ -NET_API_STATUS -WINAPI -NetGroupSetInfo(IN LPCWSTR servername, - IN LPCWSTR groupname, - IN DWORD level, - IN LPBYTE buf, - OUT LPDWORD parm_err) -{ - FIXME("(%s, %s, %d, %p, %p) stub!\n", debugstr_w(servername), - debugstr_w(groupname), level, buf, parm_err); - return ERROR_ACCESS_DENIED; -} - - /************************************************************ * NetGroupSetUsers (NETAPI32.@) * diff --git a/dll/win32/netapi32/group_new.c b/dll/win32/netapi32/group_new.c index 7adb98b01c..7a9d27185b 100644 --- a/dll/win32/netapi32/group_new.c +++ b/dll/win32/netapi32/group_new.c @@ -272,7 +272,7 @@ NetGroupAdd( _In_opt_ LPCWSTR servername, _In_ DWORD level, _In_ LPBYTE buf, - _Out_ LPDWORD parm_err) + _Out_opt_ LPDWORD parm_err) { GROUP_ADM_COMMENT_INFORMATION AdminComment; GROUP_ATTRIBUTE_INFORMATION AttributeInfo; @@ -875,4 +875,257 @@ done: return ApiStatus; } + +NET_API_STATUS +WINAPI +NetGroupSetInfo( + _In_opt_ LPCWSTR servername, + _In_ LPCWSTR groupname, + _In_ DWORD level, + _In_ LPBYTE buf, + _Out_opt_ LPDWORD parm_err) +{ + UNICODE_STRING ServerName; + UNICODE_STRING GroupName; + SAM_HANDLE ServerHandle = NULL; + SAM_HANDLE DomainHandle = NULL; + SAM_HANDLE GroupHandle = NULL; + GROUP_NAME_INFORMATION GroupNameInfo; + GROUP_ADM_COMMENT_INFORMATION AdminCommentInfo; + GROUP_ATTRIBUTE_INFORMATION AttributeInfo; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("NetGroupSetInfo(%s, %s, %d, %p, %p)\n", + debugstr_w(servername), debugstr_w(groupname), level, buf, parm_err); + + if (parm_err != NULL) + *parm_err = PARM_ERROR_NONE; + + if (servername != NULL) + RtlInitUnicodeString(&ServerName, servername); + + RtlInitUnicodeString(&GroupName, groupname); + + /* Connect to the SAM Server */ + Status = SamConnect((servername != NULL) ? &ServerName : NULL, + &ServerHandle, + SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("SamConnect failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the Acount Domain */ + Status = OpenAccountDomain(ServerHandle, + (servername != NULL) ? &ServerName : NULL, + DOMAIN_LOOKUP, + &DomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("OpenAccountDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the group */ + ApiStatus = OpenGroupByName(DomainHandle, + &GroupName, + GROUP_WRITE_ACCOUNT, + &GroupHandle, + NULL); + if (ApiStatus != NERR_Success) + { + WARN("OpenGroupByName failed (ApiStatus %lu)\n", ApiStatus); + if (ApiStatus == ERROR_NONE_MAPPED) + ApiStatus = NERR_GroupNotFound; + goto done; + } + + switch (level) + { + case 0: + /* Set the group name */ + RtlInitUnicodeString(&GroupNameInfo.Name, + ((PGROUP_INFO_0)buf)->grpi0_name); + + Status = SamSetInformationGroup(GroupHandle, + GroupNameInformation, + &GroupNameInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + case 1: + /* Set the group name */ + RtlInitUnicodeString(&GroupNameInfo.Name, + ((PGROUP_INFO_1)buf)->grpi1_name); + + Status = SamSetInformationGroup(GroupHandle, + GroupNameInformation, + &GroupNameInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Set the admin comment */ + RtlInitUnicodeString(&AdminCommentInfo.AdminComment, + ((PGROUP_INFO_1)buf)->grpi1_comment); + + Status = SamSetInformationGroup(GroupHandle, + GroupAdminCommentInformation, + &AdminCommentInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + case 2: + /* Set the group name */ + RtlInitUnicodeString(&GroupNameInfo.Name, + ((PGROUP_INFO_2)buf)->grpi2_name); + + Status = SamSetInformationGroup(GroupHandle, + GroupNameInformation, + &GroupNameInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Set the admin comment */ + RtlInitUnicodeString(&AdminCommentInfo.AdminComment, + ((PGROUP_INFO_2)buf)->grpi2_comment); + + Status = SamSetInformationGroup(GroupHandle, + GroupAdminCommentInformation, + &AdminCommentInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Set the attributes */ + AttributeInfo.Attributes = ((PGROUP_INFO_2)buf)->grpi2_attributes; + + Status = SamSetInformationGroup(GroupHandle, + GroupAttributeInformation, + &AttributeInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + case 3: + /* Set the group name */ + RtlInitUnicodeString(&GroupNameInfo.Name, + ((PGROUP_INFO_3)buf)->grpi3_name); + + Status = SamSetInformationGroup(GroupHandle, + GroupNameInformation, + &GroupNameInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Set the admin comment */ + RtlInitUnicodeString(&AdminCommentInfo.AdminComment, + ((PGROUP_INFO_3)buf)->grpi3_comment); + + Status = SamSetInformationGroup(GroupHandle, + GroupAdminCommentInformation, + &AdminCommentInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Set the attributes */ + AttributeInfo.Attributes = ((PGROUP_INFO_3)buf)->grpi3_attributes; + + Status = SamSetInformationGroup(GroupHandle, + GroupAttributeInformation, + &AttributeInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + case 1002: + /* Set the admin comment */ + RtlInitUnicodeString(&AdminCommentInfo.AdminComment, + ((PGROUP_INFO_1002)buf)->grpi1002_comment); + + Status = SamSetInformationGroup(GroupHandle, + GroupAdminCommentInformation, + &AdminCommentInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + case 1005: + /* Set the attributes */ + AttributeInfo.Attributes = ((PGROUP_INFO_1005)buf)->grpi1005_attributes; + + Status = SamSetInformationGroup(GroupHandle, + GroupAttributeInformation, + &AttributeInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationGroup failed (ApiStatus %lu)\n", ApiStatus); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + break; + + default: + ApiStatus = ERROR_INVALID_LEVEL; + goto done; + } + +done: + if (GroupHandle != NULL) + SamCloseHandle(GroupHandle); + + if (DomainHandle != NULL) + SamCloseHandle(DomainHandle); + + if (ServerHandle != NULL) + SamCloseHandle(ServerHandle); + + return ApiStatus; +} + /* EOF */
6 years, 2 months
1
0
0
0
01/01: [NETAPI32] Implement NetGroupAdd and NetGroupDel
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c48d09d19a683576c21d4…
commit c48d09d19a683576c21d4e1f45ea53f7d0d8c68f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Sep 9 11:52:08 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Sep 9 11:52:44 2018 +0200 [NETAPI32] Implement NetGroupAdd and NetGroupDel --- dll/win32/netapi32/group.c | 32 ----- dll/win32/netapi32/group_new.c | 262 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 261 insertions(+), 33 deletions(-) diff --git a/dll/win32/netapi32/group.c b/dll/win32/netapi32/group.c index 7139f1b3b6..75c03697bc 100644 --- a/dll/win32/netapi32/group.c +++ b/dll/win32/netapi32/group.c @@ -22,23 +22,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(netapi32); -/************************************************************ - * NetGroupAdd (NETAPI32.@) - * - */ -NET_API_STATUS -WINAPI -NetGroupAdd(IN LPCWSTR servername, - IN DWORD level, - IN LPBYTE buf, - OUT LPDWORD parm_err) -{ - FIXME("(%s, %d, %p, %p) stub!\n", debugstr_w(servername), - level, buf, parm_err); - return ERROR_ACCESS_DENIED; -} - - /************************************************************ * NetGroupAddUser (NETAPI32.@) * @@ -55,21 +38,6 @@ NetGroupAddUser(IN LPCWSTR servername, } -/************************************************************ - * NetGroupDel (NETAPI32.@) - * - */ -NET_API_STATUS -WINAPI -NetGroupDel(IN LPCWSTR servername, - IN LPCWSTR groupname) -{ - FIXME("(%s, %s) stub!\n", debugstr_w(servername), - debugstr_w(groupname)); - return ERROR_ACCESS_DENIED; -} - - /************************************************************ * NetGroupDelUser (NETAPI32.@) * diff --git a/dll/win32/netapi32/group_new.c b/dll/win32/netapi32/group_new.c index 7e4f9ef0a1..7adb98b01c 100644 --- a/dll/win32/netapi32/group_new.c +++ b/dll/win32/netapi32/group_new.c @@ -226,7 +226,7 @@ OpenGroupByName( &Use); if (!NT_SUCCESS(Status)) { - ERR("SamLookupNamesInDomain failed (Status %08lx)\n", Status); + WARN("SamLookupNamesInDomain failed (Status %08lx)\n", Status); return NetpNtStatusToApiStatus(Status); } @@ -266,6 +266,266 @@ done: /* PUBLIC FUNCTIONS **********************************************************/ +NET_API_STATUS +WINAPI +NetGroupAdd( + _In_opt_ LPCWSTR servername, + _In_ DWORD level, + _In_ LPBYTE buf, + _Out_ LPDWORD parm_err) +{ + GROUP_ADM_COMMENT_INFORMATION AdminComment; + GROUP_ATTRIBUTE_INFORMATION AttributeInfo; + UNICODE_STRING ServerName; + UNICODE_STRING GroupName; + SAM_HANDLE ServerHandle = NULL; + SAM_HANDLE DomainHandle = NULL; + SAM_HANDLE GroupHandle = NULL; + PWSTR Name = NULL; + PWSTR Comment = NULL; + ULONG Attributes = 0; + ULONG RelativeId; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("NetGroupAdd(%s, %d, %p, %p)\n", + debugstr_w(servername), level, buf, parm_err); + + /* Initialize the Server name*/ + if (servername != NULL) + RtlInitUnicodeString(&ServerName, servername); + + /* Initialize the Alias name*/ + switch (level) + { + case 0: + Name = ((PGROUP_INFO_0)buf)->grpi0_name; + Comment = NULL; + Attributes = 0; + break; + + case 1: + Name = ((PGROUP_INFO_1)buf)->grpi1_name; + Comment = ((PGROUP_INFO_1)buf)->grpi1_comment; + Attributes = 0; + break; + + case 2: + Name = ((PGROUP_INFO_2)buf)->grpi2_name; + Comment = ((PGROUP_INFO_2)buf)->grpi2_comment; + Attributes = ((PGROUP_INFO_2)buf)->grpi2_attributes; + break; + + case 3: + Name = ((PGROUP_INFO_3)buf)->grpi3_name; + Comment = ((PGROUP_INFO_3)buf)->grpi3_comment; + Attributes = ((PGROUP_INFO_3)buf)->grpi3_attributes; + break; + + default: + return ERROR_INVALID_LEVEL; + } + + RtlInitUnicodeString(&GroupName, Name); + + /* Connect to the SAM Server */ + Status = SamConnect((servername != NULL) ? &ServerName : NULL, + &ServerHandle, + SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("SamConnect failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the account domain */ + Status = OpenAccountDomain(ServerHandle, + (servername != NULL) ? &ServerName : NULL, + DOMAIN_CREATE_GROUP | DOMAIN_LOOKUP, + &DomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("SamOpenDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Try to open the group account */ + ApiStatus = OpenGroupByName(DomainHandle, + &GroupName, + GROUP_READ_INFORMATION, + &GroupHandle, + NULL); + if (ApiStatus == NERR_Success) + { + ERR("OpenGroupByName: Group %wZ already exists!\n", &GroupName); + + SamCloseHandle(GroupHandle); + ApiStatus = ERROR_GROUP_EXISTS; + goto done; + } + + ApiStatus = NERR_Success; + + /* Create the group */ + Status = SamCreateGroupInDomain(DomainHandle, + &GroupName, + DELETE | GROUP_WRITE_ACCOUNT, + &GroupHandle, + &RelativeId); + if (!NT_SUCCESS(Status)) + { + ERR("SamCreateGroupInDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + TRACE("Created group \"%wZ\" (RID: %lu)\n", &GroupName, RelativeId); + + /* Set the admin comment */ + if (level == 1 || level == 2 || level == 3) + { + RtlInitUnicodeString(&AdminComment.AdminComment, Comment); + + Status = SamSetInformationGroup(GroupHandle, + GroupAdminCommentInformation, + &AdminComment); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationAlias failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + + /* Delete the Alias if the Comment could not be set */ + SamDeleteGroup(GroupHandle); + + goto done; + } + } + + /* Set the attributes */ + if (level == 2 || level == 3) + { + AttributeInfo.Attributes = Attributes; + + Status = SamSetInformationGroup(GroupHandle, + GroupAttributeInformation, + &AttributeInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamSetInformationAlias failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + + /* Delete the Alias if the Attributes could not be set */ + SamDeleteGroup(GroupHandle); + + goto done; + } + } + +done: + if (GroupHandle != NULL) + { + if (ApiStatus != NERR_Success) + SamDeleteGroup(GroupHandle); + else + SamCloseHandle(GroupHandle); + } + + if (DomainHandle != NULL) + SamCloseHandle(DomainHandle); + + if (ServerHandle != NULL) + SamCloseHandle(ServerHandle); + + return ApiStatus; +} + + +NET_API_STATUS +WINAPI +NetGroupDel( + _In_opt_ LPCWSTR servername, + _In_ IN LPCWSTR groupname) +{ + UNICODE_STRING ServerName; + UNICODE_STRING GroupName; + SAM_HANDLE ServerHandle = NULL; + SAM_HANDLE DomainHandle = NULL; + SAM_HANDLE GroupHandle = NULL; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("NetGroupDel(%s, %s)\n", + debugstr_w(servername), debugstr_w(groupname)); + + if (servername != NULL) + RtlInitUnicodeString(&ServerName, servername); + + RtlInitUnicodeString(&GroupName, groupname); + + /* Connect to the SAM Server */ + Status = SamConnect((servername != NULL) ? &ServerName : NULL, + &ServerHandle, + SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("SamConnect failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the Acount Domain */ + Status = OpenAccountDomain(ServerHandle, + (servername != NULL) ? &ServerName : NULL, + DOMAIN_LOOKUP, + &DomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("OpenAccountDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the group */ + ApiStatus = OpenGroupByName(DomainHandle, + &GroupName, + DELETE, + &GroupHandle, + NULL); + if (ApiStatus != NERR_Success) + { + ERR("OpenGroupByName failed (ApiStatus %lu)\n", ApiStatus); + if (ApiStatus == ERROR_NONE_MAPPED) + ApiStatus = NERR_GroupNotFound; + goto done; + } + + /* Delete the group */ + Status = SamDeleteGroup(GroupHandle); + if (!NT_SUCCESS(Status)) + { + ERR("SamDeleteGroup failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + +done: + if (GroupHandle != NULL) + SamCloseHandle(GroupHandle); + + if (DomainHandle != NULL) + SamCloseHandle(DomainHandle); + + if (ServerHandle != NULL) + SamCloseHandle(ServerHandle); + + return ApiStatus; +} + + NET_API_STATUS WINAPI NetGroupEnum(
6 years, 2 months
1
0
0
0
01/01: [USBHUB_NEW][USBPORT] Fix buffer size calculation for multi-sz values in IRP_MN_QUERY_ID.
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3baf43c5def76d2b30bc3…
commit 3baf43c5def76d2b30bc32f5792c110c3e90e686 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sat Sep 8 20:52:06 2018 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Sun Sep 9 11:24:48 2018 +0200 [USBHUB_NEW][USBPORT] Fix buffer size calculation for multi-sz values in IRP_MN_QUERY_ID. Also fix some copypasta'd DPRINTs. --- drivers/usb/usbhub_new/pnp.c | 8 ++++---- drivers/usb/usbport/pnp.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/usbhub_new/pnp.c b/drivers/usb/usbhub_new/pnp.c index 16cd2b17b9..c1862574b0 100644 --- a/drivers/usb/usbhub_new/pnp.c +++ b/drivers/usb/usbhub_new/pnp.c @@ -1649,7 +1649,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, DeviceDescriptor->idProduct); } - Length = sizeof(Buffer) - (Remaining - sizeof(UNICODE_NULL)); + Length = sizeof(Buffer) - (Remaining - 2 * sizeof(UNICODE_NULL)); Id = ExAllocatePoolWithTag(PagedPool, Length, USB_HUB_TAG); @@ -1662,7 +1662,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, if (PortExtension->PortPdoFlags & USBHUB_PDO_FLAG_INIT_PORT_FAILED) { - DPRINT("USBH_PdoQueryId: BusQueryInstanceID - %S\n", Id); + DPRINT("USBH_PdoQueryId: BusQueryHardwareID - %S\n", Id); } else { @@ -1766,7 +1766,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, InterfaceDescriptor->bInterfaceClass); } - Length = sizeof(Buffer) - (Remaining - sizeof(UNICODE_NULL)); + Length = sizeof(Buffer) - (Remaining - 2 * sizeof(UNICODE_NULL)); Id = ExAllocatePoolWithTag(PagedPool, Length, USB_HUB_TAG); @@ -1779,7 +1779,7 @@ USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, if (PortExtension->PortPdoFlags & USBHUB_PDO_FLAG_INIT_PORT_FAILED) { - DPRINT("USBH_PdoQueryId: BusQueryInstanceID - %S\n", Id); + DPRINT("USBH_PdoQueryId: BusQueryCompatibleID - %S\n", Id); } else { diff --git a/drivers/usb/usbport/pnp.c b/drivers/usb/usbport/pnp.c index 4e7a545b27..545b75e820 100644 --- a/drivers/usb/usbport/pnp.c +++ b/drivers/usb/usbport/pnp.c @@ -1493,7 +1493,7 @@ USBPORT_GetDeviceHwIds(IN PDEVICE_OBJECT FdoDevice, L"USB\\ROOT_HUB"); } - Length = (sizeof(Buffer) - Remaining + sizeof(UNICODE_NULL)); + Length = (sizeof(Buffer) - Remaining + 2 * sizeof(UNICODE_NULL)); /* for debug only */ if (FALSE)
6 years, 2 months
1
0
0
0
01/01: [NETAPI] Implement NetGroupGetInfo
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a9da3c50bea58d0c1bf0d…
commit a9da3c50bea58d0c1bf0d2925a90cb449cd2a38c Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Sep 9 09:40:11 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Sep 9 09:40:11 2018 +0200 [NETAPI] Implement NetGroupGetInfo --- dll/win32/netapi32/group.c | 17 ----- dll/win32/netapi32/group_new.c | 163 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 162 insertions(+), 18 deletions(-) diff --git a/dll/win32/netapi32/group.c b/dll/win32/netapi32/group.c index cac6be73b0..7139f1b3b6 100644 --- a/dll/win32/netapi32/group.c +++ b/dll/win32/netapi32/group.c @@ -86,23 +86,6 @@ NetGroupDelUser(IN LPCWSTR servername, } -/************************************************************ - * NetGroupGetInfo (NETAPI32.@) - * - */ -NET_API_STATUS -WINAPI -NetGroupGetInfo(IN LPCWSTR servername, - IN LPCWSTR groupname, - IN DWORD level, - OUT LPBYTE *bufptr) -{ - FIXME("(%s, %s, %d, %p) stub!\n", debugstr_w(servername), - debugstr_w(groupname), level, bufptr); - return ERROR_ACCESS_DENIED; -} - - /************************************************************ * NetGroupGetUsers (NETAPI32.@) * diff --git a/dll/win32/netapi32/group_new.c b/dll/win32/netapi32/group_new.c index 5fa38313cf..7e4f9ef0a1 100644 --- a/dll/win32/netapi32/group_new.c +++ b/dll/win32/netapi32/group_new.c @@ -192,7 +192,7 @@ done: static VOID FreeGroupInfo( - PGROUP_GENERAL_INFORMATION GroupInfo) + _In_ PGROUP_GENERAL_INFORMATION GroupInfo) { if (GroupInfo->Name.Buffer != NULL) SamFreeMemory(GroupInfo->Name.Buffer); @@ -204,6 +204,66 @@ FreeGroupInfo( } +static +NET_API_STATUS +OpenGroupByName( + _In_ SAM_HANDLE DomainHandle, + _In_ PUNICODE_STRING GroupName, + _In_ ULONG DesiredAccess, + _Out_ PSAM_HANDLE GroupHandle, + _Out_ PULONG RelativeId) +{ + PULONG RelativeIds = NULL; + PSID_NAME_USE Use = NULL; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + /* Get the RID for the given user name */ + Status = SamLookupNamesInDomain(DomainHandle, + 1, + GroupName, + &RelativeIds, + &Use); + if (!NT_SUCCESS(Status)) + { + ERR("SamLookupNamesInDomain failed (Status %08lx)\n", Status); + return NetpNtStatusToApiStatus(Status); + } + + /* Fail, if it is not an alias account */ + if (Use[0] != SidTypeGroup) + { + ERR("Object is not a group!\n"); + ApiStatus = NERR_GroupNotFound; + goto done; + } + + /* Open the alias account */ + Status = SamOpenGroup(DomainHandle, + DesiredAccess, + RelativeIds[0], + GroupHandle); + if (!NT_SUCCESS(Status)) + { + ERR("SamOpenGroup failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + if (RelativeId != NULL) + *RelativeId = RelativeIds[0]; + +done: + if (RelativeIds != NULL) + SamFreeMemory(RelativeIds); + + if (Use != NULL) + SamFreeMemory(Use); + + return ApiStatus; +} + + /* PUBLIC FUNCTIONS **********************************************************/ NET_API_STATUS @@ -454,4 +514,105 @@ done: return ApiStatus; } + +NET_API_STATUS +WINAPI +NetGroupGetInfo( + _In_opt_ LPCWSTR servername, + _In_ LPCWSTR groupname, + _In_ DWORD level, + _Out_ LPBYTE *bufptr) +{ + UNICODE_STRING ServerName; + UNICODE_STRING GroupName; + SAM_HANDLE ServerHandle = NULL; + SAM_HANDLE DomainHandle = NULL; + SAM_HANDLE GroupHandle = NULL; + PGROUP_GENERAL_INFORMATION GroupInfo = NULL; + PVOID Buffer = NULL; + ULONG RelativeId; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("NetGroupGetInfo(%s, %s, %d, %p)\n", + debugstr_w(servername), debugstr_w(groupname), level, bufptr); + + if (servername != NULL) + RtlInitUnicodeString(&ServerName, servername); + + RtlInitUnicodeString(&GroupName, groupname); + + /* Connect to the SAM Server */ + Status = SamConnect((servername != NULL) ? &ServerName : NULL, + &ServerHandle, + SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("SamConnect failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the Acount Domain */ + Status = OpenAccountDomain(ServerHandle, + (servername != NULL) ? &ServerName : NULL, + DOMAIN_LOOKUP, + &DomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("OpenAccountDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + /* Open the group account in the account domain */ + ApiStatus = OpenGroupByName(DomainHandle, + &GroupName, + GROUP_READ_INFORMATION, + &GroupHandle, + &RelativeId); + if (ApiStatus != NERR_Success) + { + ERR("OpenGroupByName failed (ApiStatus %lu)\n", ApiStatus); + if (ApiStatus == ERROR_NONE_MAPPED) + ApiStatus = NERR_GroupNotFound; + goto done; + } + + Status = SamQueryInformationGroup(GroupHandle, + GroupGeneralInformation, + (PVOID *)&GroupInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamQueryInformationGroup failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + ApiStatus = BuildGroupInfoBuffer(GroupInfo, + level, + RelativeId, + &Buffer); + if (ApiStatus != NERR_Success) + goto done; + +done: + if (GroupInfo != NULL) + FreeGroupInfo(GroupInfo); + + if (GroupHandle != NULL) + SamCloseHandle(GroupHandle); + + if (DomainHandle != NULL) + SamCloseHandle(DomainHandle); + + if (ServerHandle != NULL) + SamCloseHandle(ServerHandle); + + *bufptr = (LPBYTE)Buffer; + + return ApiStatus; +} + /* EOF */
6 years, 2 months
1
0
0
0
01/01: [PSDK] Add missing struct _GROUP_INFO_3 to lmaccess.h
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45beb1a523985444f77de…
commit 45beb1a523985444f77de8f1f93916af514cf7d9 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Sep 8 22:21:15 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Sep 8 22:21:15 2018 +0200 [PSDK] Add missing struct _GROUP_INFO_3 to lmaccess.h --- sdk/include/psdk/lmaccess.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/include/psdk/lmaccess.h b/sdk/include/psdk/lmaccess.h index 7b97812839..6e67e28974 100644 --- a/sdk/include/psdk/lmaccess.h +++ b/sdk/include/psdk/lmaccess.h @@ -482,7 +482,13 @@ typedef struct _GROUP_INFO_2 { LPWSTR grpi2_comment; DWORD grpi2_group_id; DWORD grpi2_attributes; -}GROUP_INFO_2,*PGROUP_INFO_2; +}GROUP_INFO_2,*PGROUP_INFO_2,*LPGROUP_INFO_2; +typedef struct _GROUP_INFO_3 { + LPWSTR grpi3_name; + LPWSTR grpi3_comment; + PSID grpi3_group_sid; + DWORD grpi3_attributes; +}GROUP_INFO_3,*PGROUP_INFO_3,*LPGROUP_INFO_3; typedef struct _GROUP_INFO_1002 { LPWSTR grpi1002_comment; } GROUP_INFO_1002,*PGROUP_INFO_1002,*LPGROUP_INFO_1002;
6 years, 2 months
1
0
0
0
01/01: [NETAPI] Implement NetGroupEnum
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=033146ca23bc3122e9ffe…
commit 033146ca23bc3122e9ffe96257e178ff0c618aff Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Sep 8 20:55:13 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Sep 8 20:55:13 2018 +0200 [NETAPI] Implement NetGroupEnum --- dll/win32/netapi32/CMakeLists.txt | 1 + dll/win32/netapi32/group.c | 20 -- dll/win32/netapi32/group_new.c | 457 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 458 insertions(+), 20 deletions(-) diff --git a/dll/win32/netapi32/CMakeLists.txt b/dll/win32/netapi32/CMakeLists.txt index c5066c09e4..d714bb24b8 100644 --- a/dll/win32/netapi32/CMakeLists.txt +++ b/dll/win32/netapi32/CMakeLists.txt @@ -21,6 +21,7 @@ list(APPEND SOURCE display.c dssetup.c group.c + group_new.c local_group.c misc.c nbcmdqueue.c diff --git a/dll/win32/netapi32/group.c b/dll/win32/netapi32/group.c index 92627ece51..cac6be73b0 100644 --- a/dll/win32/netapi32/group.c +++ b/dll/win32/netapi32/group.c @@ -86,26 +86,6 @@ NetGroupDelUser(IN LPCWSTR servername, } -/************************************************************ - * NetGroupEnum (NETAPI32.@) - * - */ -NET_API_STATUS -WINAPI -NetGroupEnum(IN LPCWSTR servername, - IN DWORD level, - OUT LPBYTE *bufptr, - IN DWORD prefmaxlen, - OUT LPDWORD entriesread, - OUT LPDWORD totalentries, - IN OUT PDWORD_PTR resume_handle) -{ - FIXME("(%s, %d, %p, %d, %p, %p, %p) stub!\n", debugstr_w(servername), - level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); - return ERROR_ACCESS_DENIED; -} - - /************************************************************ * NetGroupGetInfo (NETAPI32.@) * diff --git a/dll/win32/netapi32/group_new.c b/dll/win32/netapi32/group_new.c new file mode 100644 index 0000000000..5fa38313cf --- /dev/null +++ b/dll/win32/netapi32/group_new.c @@ -0,0 +1,457 @@ +/* + * PROJECT: ReactOS NetAPI DLL + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: SAM service group interface code + * COPYRIGHT: Copyright 2018 Eric Kohl (eric.kohl(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "netapi32.h" + +WINE_DEFAULT_DEBUG_CHANNEL(netapi32); + +typedef enum _ENUM_PHASE +{ + BuiltinPhase, + AccountPhase, + DonePhase +} ENUM_PHASE; + +typedef struct _ENUM_CONTEXT +{ + SAM_HANDLE ServerHandle; + SAM_HANDLE DomainHandle; + SAM_HANDLE BuiltinDomainHandle; + SAM_HANDLE AccountDomainHandle; + + SAM_ENUMERATE_HANDLE EnumerationContext; + PSAM_RID_ENUMERATION Buffer; + ULONG Returned; + ULONG Index; + ENUM_PHASE Phase; +} ENUM_CONTEXT, *PENUM_CONTEXT; + + +/* FUNCTIONS *****************************************************************/ + +static +NET_API_STATUS +BuildGroupInfoBuffer( + _In_ PGROUP_GENERAL_INFORMATION GroupInfo, + _In_ DWORD Level, + _In_ DWORD GroupId, + _Out_ LPVOID *Buffer) +{ + PVOID GroupBuffer = NULL; + PGROUP_INFO_0 GroupInfo0; + PGROUP_INFO_1 GroupInfo1; + PGROUP_INFO_2 GroupInfo2; + PGROUP_INFO_3 GroupInfo3; + PWSTR Ptr; + ULONG Size = 0; + NET_API_STATUS ApiStatus = NERR_Success; + + *Buffer = NULL; + + switch (Level) + { + case 0: + Size = sizeof(GROUP_INFO_0) + + GroupInfo->Name.Length + sizeof(WCHAR); + break; + + case 1: + Size = sizeof(GROUP_INFO_1) + + GroupInfo->Name.Length + sizeof(WCHAR) + + GroupInfo->AdminComment.Length + sizeof(WCHAR); + break; + + case 2: + Size = sizeof(GROUP_INFO_2) + + GroupInfo->Name.Length + sizeof(WCHAR) + + GroupInfo->AdminComment.Length + sizeof(WCHAR); + break; + + case 3: + Size = sizeof(GROUP_INFO_3) + + GroupInfo->Name.Length + sizeof(WCHAR) + + GroupInfo->AdminComment.Length + sizeof(WCHAR); + /* FIXME: Sid size */ + break; + + default: + ApiStatus = ERROR_INVALID_LEVEL; + goto done; + } + + ApiStatus = NetApiBufferAllocate(Size, &GroupBuffer); + if (ApiStatus != NERR_Success) + goto done; + + ZeroMemory(GroupBuffer, Size); + + switch (Level) + { + case 0: + GroupInfo0 = (PGROUP_INFO_0)GroupBuffer; + + Ptr = (PWSTR)((ULONG_PTR)GroupInfo0 + sizeof(LOCALGROUP_INFO_0)); + GroupInfo0->grpi0_name = Ptr; + + memcpy(GroupInfo0->grpi0_name, + GroupInfo->Name.Buffer, + GroupInfo->Name.Length); + GroupInfo0->grpi0_name[GroupInfo->Name.Length / sizeof(WCHAR)] = UNICODE_NULL; + break; + + case 1: + GroupInfo1 = (PGROUP_INFO_1)GroupBuffer; + + Ptr = (PWSTR)((ULONG_PTR)GroupInfo1 + sizeof(GROUP_INFO_1)); + GroupInfo1->grpi1_name = Ptr; + + memcpy(GroupInfo1->grpi1_name, + GroupInfo->Name.Buffer, + GroupInfo->Name.Length); + GroupInfo1->grpi1_name[GroupInfo->Name.Length / sizeof(WCHAR)] = UNICODE_NULL; + + Ptr = (PWSTR)((ULONG_PTR)Ptr + GroupInfo->Name.Length + sizeof(WCHAR)); + GroupInfo1->grpi1_comment = Ptr; + + memcpy(GroupInfo1->grpi1_comment, + GroupInfo->AdminComment.Buffer, + GroupInfo->AdminComment.Length); + GroupInfo1->grpi1_comment[GroupInfo->AdminComment.Length / sizeof(WCHAR)] = UNICODE_NULL; + break; + + case 2: + GroupInfo2 = (PGROUP_INFO_2)GroupBuffer; + + Ptr = (PWSTR)((ULONG_PTR)GroupInfo2 + sizeof(GROUP_INFO_2)); + GroupInfo2->grpi2_name = Ptr; + + memcpy(GroupInfo2->grpi2_name, + GroupInfo->Name.Buffer, + GroupInfo->Name.Length); + GroupInfo2->grpi2_name[GroupInfo->Name.Length / sizeof(WCHAR)] = UNICODE_NULL; + + Ptr = (PWSTR)((ULONG_PTR)Ptr + GroupInfo->Name.Length + sizeof(WCHAR)); + GroupInfo2->grpi2_comment = Ptr; + + memcpy(GroupInfo2->grpi2_comment, + GroupInfo->AdminComment.Buffer, + GroupInfo->AdminComment.Length); + GroupInfo2->grpi2_comment[GroupInfo->AdminComment.Length / sizeof(WCHAR)] = UNICODE_NULL; + + GroupInfo2->grpi2_group_id = GroupId; + + GroupInfo2->grpi2_attributes= GroupInfo->Attributes; + break; + + case 3: + GroupInfo3 = (PGROUP_INFO_3)GroupBuffer; + + Ptr = (PWSTR)((ULONG_PTR)GroupInfo3 + sizeof(GROUP_INFO_3)); + GroupInfo3->grpi3_name = Ptr; + + memcpy(GroupInfo3->grpi3_name, + GroupInfo->Name.Buffer, + GroupInfo->Name.Length); + GroupInfo3->grpi3_name[GroupInfo->Name.Length / sizeof(WCHAR)] = UNICODE_NULL; + + Ptr = (PWSTR)((ULONG_PTR)Ptr + GroupInfo->Name.Length + sizeof(WCHAR)); + GroupInfo3->grpi3_comment = Ptr; + + memcpy(GroupInfo3->grpi3_comment, + GroupInfo->AdminComment.Buffer, + GroupInfo->AdminComment.Length); + GroupInfo3->grpi3_comment[GroupInfo->AdminComment.Length / sizeof(WCHAR)] = UNICODE_NULL; + + GroupInfo3->grpi3_group_sid = NULL; /* FIXME */ + + GroupInfo3->grpi3_attributes= GroupInfo->Attributes; + break; + } + +done: + if (ApiStatus == NERR_Success) + { + *Buffer = GroupBuffer; + } + else + { + if (GroupBuffer != NULL) + NetApiBufferFree(GroupBuffer); + } + + return ApiStatus; +} + + +static +VOID +FreeGroupInfo( + PGROUP_GENERAL_INFORMATION GroupInfo) +{ + if (GroupInfo->Name.Buffer != NULL) + SamFreeMemory(GroupInfo->Name.Buffer); + + if (GroupInfo->AdminComment.Buffer != NULL) + SamFreeMemory(GroupInfo->AdminComment.Buffer); + + SamFreeMemory(GroupInfo); +} + + +/* PUBLIC FUNCTIONS **********************************************************/ + +NET_API_STATUS +WINAPI +NetGroupEnum( + _In_opt_ LPCWSTR servername, + _In_ DWORD level, + _Out_ LPBYTE *bufptr, + _In_ DWORD prefmaxlen, + _Out_ LPDWORD entriesread, + _Out_ LPDWORD totalentries, + _Inout_opt_ PDWORD_PTR resume_handle) +{ + UNICODE_STRING ServerName; + PSAM_RID_ENUMERATION CurrentGroup; + PENUM_CONTEXT EnumContext = NULL; + ULONG i; + SAM_HANDLE GroupHandle = NULL; + PGROUP_GENERAL_INFORMATION GroupInfo = NULL; + PVOID Buffer = NULL; + NET_API_STATUS ApiStatus = NERR_Success; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("NetGroupEnum(%s, %d, %p, %d, %p, %p, %p)\n", debugstr_w(servername), + level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); + + *entriesread = 0; + *totalentries = 0; + *bufptr = NULL; + + if (servername != NULL) + RtlInitUnicodeString(&ServerName, servername); + + if (resume_handle != NULL && *resume_handle != 0) + { + EnumContext = (PENUM_CONTEXT)*resume_handle; + } + else + { + ApiStatus = NetApiBufferAllocate(sizeof(ENUM_CONTEXT), (PVOID*)&EnumContext); + if (ApiStatus != NERR_Success) + goto done; + + EnumContext->EnumerationContext = 0; + EnumContext->Buffer = NULL; + EnumContext->Returned = 0; + EnumContext->Index = 0; + + Status = SamConnect((servername != NULL) ? &ServerName : NULL, + &EnumContext->ServerHandle, + SAM_SERVER_CONNECT | SAM_SERVER_LOOKUP_DOMAIN, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("SamConnect failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + Status = OpenAccountDomain(EnumContext->ServerHandle, + (servername != NULL) ? &ServerName : NULL, + DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP, + &EnumContext->AccountDomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("OpenAccountDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + Status = OpenBuiltinDomain(EnumContext->ServerHandle, + DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP, + &EnumContext->BuiltinDomainHandle); + if (!NT_SUCCESS(Status)) + { + ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + EnumContext->Phase = AccountPhase; //BuiltinPhase; + EnumContext->DomainHandle = EnumContext->AccountDomainHandle; //BuiltinDomainHandle; + } + + +// while (TRUE) +// { + TRACE("EnumContext->Index: %lu\n", EnumContext->Index); + TRACE("EnumContext->Returned: %lu\n", EnumContext->Returned); + + if (EnumContext->Index >= EnumContext->Returned) + { + TRACE("Calling SamEnumerateGroupsInDomain\n"); + + Status = SamEnumerateGroupsInDomain(EnumContext->DomainHandle, + &EnumContext->EnumerationContext, + (PVOID *)&EnumContext->Buffer, + prefmaxlen, + &EnumContext->Returned); + + TRACE("SamEnumerateGroupsInDomain returned (Status %08lx)\n", Status); + if (!NT_SUCCESS(Status)) + { + ERR("SamEnumerateAliasesInDomain failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + if (Status == STATUS_MORE_ENTRIES) + { + ApiStatus = NERR_BufTooSmall; + goto done; + } + } + + TRACE("EnumContext: %lu\n", EnumContext); + TRACE("EnumContext->Returned: %lu\n", EnumContext->Returned); + TRACE("EnumContext->Buffer: %p\n", EnumContext->Buffer); + + /* Get a pointer to the current group */ + CurrentGroup = &EnumContext->Buffer[EnumContext->Index]; + + TRACE("RID: %lu\n", CurrentGroup->RelativeId); + + Status = SamOpenGroup(EnumContext->DomainHandle, + GROUP_READ_INFORMATION, + CurrentGroup->RelativeId, + &GroupHandle); + if (!NT_SUCCESS(Status)) + { + ERR("SamOpenGroup failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + Status = SamQueryInformationGroup(GroupHandle, + GroupGeneralInformation, + (PVOID *)&GroupInfo); + if (!NT_SUCCESS(Status)) + { + ERR("SamQueryInformationGroup failed (Status %08lx)\n", Status); + ApiStatus = NetpNtStatusToApiStatus(Status); + goto done; + } + + SamCloseHandle(GroupHandle); + GroupHandle = NULL; + + TRACE("Name: %S\n", GroupInfo->Name.Buffer); + TRACE("Comment: %S\n", GroupInfo->AdminComment.Buffer); + + ApiStatus = BuildGroupInfoBuffer(GroupInfo, + level, + CurrentGroup->RelativeId, + &Buffer); + if (ApiStatus != NERR_Success) + goto done; + + if (GroupInfo != NULL) + { + FreeGroupInfo(GroupInfo); + GroupInfo = NULL; + } + + EnumContext->Index++; + + (*entriesread)++; + + if (EnumContext->Index == EnumContext->Returned) + { + switch (EnumContext->Phase) + { + case BuiltinPhase: + EnumContext->Phase = AccountPhase; + EnumContext->DomainHandle = EnumContext->AccountDomainHandle; + EnumContext->EnumerationContext = 0; + EnumContext->Index = 0; + EnumContext->Returned = 0; + + if (EnumContext->Buffer != NULL) + { + for (i = 0; i < EnumContext->Returned; i++) + { + SamFreeMemory(EnumContext->Buffer[i].Name.Buffer); + } + + SamFreeMemory(EnumContext->Buffer); + EnumContext->Buffer = NULL; + } + break; + + case AccountPhase: + case DonePhase: + EnumContext->Phase = DonePhase; + break; + } + } +// } + +done: + if (ApiStatus == NERR_Success && EnumContext != NULL && EnumContext->Phase != DonePhase) + ApiStatus = ERROR_MORE_DATA; + + if (EnumContext != NULL) + *totalentries = EnumContext->Returned; + + if (resume_handle == NULL || ApiStatus != ERROR_MORE_DATA) + { + if (EnumContext != NULL) + { + if (EnumContext->BuiltinDomainHandle != NULL) + SamCloseHandle(EnumContext->BuiltinDomainHandle); + + if (EnumContext->AccountDomainHandle != NULL) + SamCloseHandle(EnumContext->AccountDomainHandle); + + if (EnumContext->ServerHandle != NULL) + SamCloseHandle(EnumContext->ServerHandle); + + if (EnumContext->Buffer != NULL) + { + for (i = 0; i < EnumContext->Returned; i++) + { + SamFreeMemory(EnumContext->Buffer[i].Name.Buffer); + } + + SamFreeMemory(EnumContext->Buffer); + } + + NetApiBufferFree(EnumContext); + EnumContext = NULL; + } + } + + if (GroupHandle != NULL) + SamCloseHandle(GroupHandle); + + if (GroupInfo != NULL) + FreeGroupInfo(GroupInfo); + + if (resume_handle != NULL) + *resume_handle = (DWORD_PTR)EnumContext; + + *bufptr = (LPBYTE)Buffer; + + TRACE("return %lu\n", ApiStatus); + + return ApiStatus; +} + +/* EOF */
6 years, 2 months
1
0
0
0
01/01: [SAMSRV] Fix SamrQueryInformationGroup
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0e69bc3bce2c311ebde80…
commit 0e69bc3bce2c311ebde8039016a381afeb90a45f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Sep 8 19:23:00 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Sep 8 19:24:13 2018 +0200 [SAMSRV] Fix SamrQueryInformationGroup - Use the registry value AdminComment for admin comments instead of Description. Fix SamrSetInformationGroup as well. - Add some TRACEs. - Do not fail if the Members value does not exist. --- dll/win32/samsrv/samrpc.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/dll/win32/samsrv/samrpc.c b/dll/win32/samsrv/samrpc.c index 45c550c499..5d3595c14a 100644 --- a/dll/win32/samsrv/samrpc.c +++ b/dll/win32/samsrv/samrpc.c @@ -4164,7 +4164,7 @@ SampQueryGroupGeneral(PSAM_DB_OBJECT GroupObject, } Status = SampGetObjectAttributeString(GroupObject, - L"Description", + L"AdminComment", &InfoBuffer->General.AdminComment); if (!NT_SUCCESS(Status)) { @@ -4179,7 +4179,10 @@ SampQueryGroupGeneral(PSAM_DB_OBJECT GroupObject, (PVOID)&FixedData, &Length); if (!NT_SUCCESS(Status)) + { + TRACE("Status 0x%08lx\n", Status); goto done; + } InfoBuffer->General.Attributes = FixedData.Attributes; @@ -4189,12 +4192,20 @@ SampQueryGroupGeneral(PSAM_DB_OBJECT GroupObject, NULL, &MembersLength); if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_NOT_FOUND) + { + TRACE("Status 0x%08lx\n", Status); goto done; + } if (Status == STATUS_OBJECT_NAME_NOT_FOUND) + { InfoBuffer->General.MemberCount = 0; + Status = STATUS_SUCCESS; + } else + { InfoBuffer->General.MemberCount = MembersLength / sizeof(ULONG); + } *Buffer = InfoBuffer; @@ -4279,7 +4290,10 @@ SampQueryGroupAttribute(PSAM_DB_OBJECT GroupObject, (PVOID)&FixedData, &Length); if (!NT_SUCCESS(Status)) + { + TRACE("Status 0x%08lx\n", Status); goto done; + } InfoBuffer->Attribute.Attributes = FixedData.Attributes; @@ -4312,7 +4326,7 @@ SampQueryGroupAdminComment(PSAM_DB_OBJECT GroupObject, return STATUS_INSUFFICIENT_RESOURCES; Status = SampGetObjectAttributeString(GroupObject, - L"Description", + L"AdminComment", &InfoBuffer->AdminComment.AdminComment); if (!NT_SUCCESS(Status)) { @@ -4540,7 +4554,7 @@ SamrSetInformationGroup(IN SAMPR_HANDLE GroupHandle, case GroupAdminCommentInformation: Status = SampSetObjectAttributeString(GroupObject, - L"Description", + L"AdminComment", &Buffer->AdminComment.AdminComment); break;
6 years, 2 months
1
0
0
0
01/01: [KMTESTS:CC] Fix two failing tests on WHS bot
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c287bbe586376bc02f58c…
commit c287bbe586376bc02f58c775666c6aa1853eafe8 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Sep 8 15:19:45 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Sep 8 15:21:01 2018 +0200 [KMTESTS:CC] Fix two failing tests on WHS bot --- modules/rostests/kmtests/ntos_cc/CcMapData_drv.c | 3 ++- modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c index 3e86a3a55c..16de38cfbf 100644 --- a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c @@ -335,8 +335,9 @@ PerformTest( KmtStartSeh(); Ret = CcMapData(TestFileObject, &Offset, 0x1000, 0, &Bcb, (PVOID *)&Buffer); KmtEndSeh(STATUS_SUCCESS); + ok(Ret == FALSE, "CcMapData succeed\n"); - if (!skip(Ret == TRUE, "CcMapData failed\n")) + if (Ret) { CcUnpinData(Bcb); } diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c index 9c338fe785..d827766fc5 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c @@ -486,8 +486,9 @@ PerformTest( KmtStartSeh(); Ret = CcPinRead(TestFileObject, &Offset, 0x1000, 0, &Bcb, (PVOID *)&Buffer); KmtEndSeh(STATUS_SUCCESS); + ok(Ret == FALSE, "CcMapData succeed\n"); - if (!skip(Ret == TRUE, "CcPinRead failed\n")) + if (Ret) { CcUnpinData(Bcb); }
6 years, 2 months
1
0
0
0
01/01: [NET] Implement the group command
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=23a90aab5a5b4eb323a9c…
commit 23a90aab5a5b4eb323a9ca0b0a267dc156528422 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Sep 8 14:14:13 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Sep 8 14:18:36 2018 +0200 [NET] Implement the group command --- base/applications/network/net/CMakeLists.txt | 1 + base/applications/network/net/cmdGroup.c | 366 +++++++++++++++++++++++++++ base/applications/network/net/lang/en-US.rc | 5 + base/applications/network/net/lang/es-ES.rc | 5 + base/applications/network/net/lang/ro-RO.rc | 5 + base/applications/network/net/lang/ru-RU.rc | 5 + base/applications/network/net/lang/tr-TR.rc | 5 + base/applications/network/net/lang/zh-CN.rc | 5 + base/applications/network/net/lang/zh-TW.rc | 5 + base/applications/network/net/main.c | 2 +- base/applications/network/net/net.h | 1 + base/applications/network/net/resource.h | 4 + 12 files changed, 408 insertions(+), 1 deletion(-) diff --git a/base/applications/network/net/CMakeLists.txt b/base/applications/network/net/CMakeLists.txt index 3555509fa9..03f772bc09 100644 --- a/base/applications/network/net/CMakeLists.txt +++ b/base/applications/network/net/CMakeLists.txt @@ -8,6 +8,7 @@ list(APPEND SOURCE cmdAccounts.c cmdConfig.c cmdContinue.c + cmdGroup.c cmdHelpMsg.c cmdLocalGroup.c cmdPause.c diff --git a/base/applications/network/net/cmdGroup.c b/base/applications/network/net/cmdGroup.c new file mode 100644 index 0000000000..ccb5c6cb04 --- /dev/null +++ b/base/applications/network/net/cmdGroup.c @@ -0,0 +1,366 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS net command + * FILE: base/applications/network/net/cmdGroup.c + * PROGRAMMERS: Eric Kohl <eric.kohl(a)reactos.org> + */ + +#include "net.h" + + +static +int +CompareInfo(const void *a, + const void *b) +{ + return _wcsicmp(((PGROUP_INFO_0)a)->grpi0_name, + ((PGROUP_INFO_0)b)->grpi0_name); +} + + +static +NET_API_STATUS +EnumerateGroups(VOID) +{ + PGROUP_INFO_0 pBuffer = NULL; + PSERVER_INFO_100 pServer = NULL; + DWORD dwRead = 0, dwTotal = 0; + DWORD i; + DWORD_PTR ResumeHandle = 0; + NET_API_STATUS Status; + + Status = NetServerGetInfo(NULL, + 100, + (LPBYTE*)&pServer); + if (Status != NERR_Success) + return Status; + + ConPuts(StdOut, L"\n"); + ConResPrintf(StdOut, IDS_GROUP_GROUPS, pServer->sv100_name); + ConPuts(StdOut, L"\n\n"); + PrintPadding(L'-', 79); + ConPuts(StdOut, L"\n"); + + NetApiBufferFree(pServer); + + Status = NetGroupEnum(NULL, + 0, + (LPBYTE*)&pBuffer, + MAX_PREFERRED_LENGTH, + &dwRead, + &dwTotal, + &ResumeHandle); + if (Status != NERR_Success) + return Status; + + qsort(pBuffer, + dwRead, + sizeof(PGROUP_INFO_0), + CompareInfo); + + for (i = 0; i < dwRead; i++) + { + if (pBuffer[i].grpi0_name) + ConPrintf(StdOut, L"*%s\n", pBuffer[i].grpi0_name); + } + + NetApiBufferFree(pBuffer); + + return NERR_Success; +} + + +static +NET_API_STATUS +DisplayGroup(LPWSTR lpGroupName) +{ + PGROUP_INFO_1 pGroupInfo = NULL; + PGROUP_USERS_INFO_0 pUsers = NULL; + LPWSTR *pNames = NULL; + DWORD dwRead = 0; + DWORD dwTotal = 0; + DWORD_PTR ResumeHandle = 0; + DWORD i; + INT nPaddedLength = 15; + NET_API_STATUS Status; + + Status = NetGroupGetInfo(NULL, + lpGroupName, + 1, + (LPBYTE*)&pGroupInfo); + if (Status != NERR_Success) + return Status; + + Status = NetGroupGetUsers(NULL, + lpGroupName, + 0, + (LPBYTE*)&pUsers, + MAX_PREFERRED_LENGTH, + &dwRead, + &dwTotal, + &ResumeHandle); + if (Status != NERR_Success) + goto done; + + pNames = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + dwRead * sizeof(LPWSTR)); + if (pNames == NULL) + { + Status = ERROR_OUTOFMEMORY; + goto done; + } + + for (i = 0; i < dwRead; i++) + { + pNames[i] = pUsers[i].grui0_name; + } + + PrintPaddedResourceString(IDS_GROUP_NAME, nPaddedLength); + ConPrintf(StdOut, L"%s\n", pGroupInfo->grpi1_name); + + PrintPaddedResourceString(IDS_GROUP_COMMENT, nPaddedLength); + ConPrintf(StdOut, L"%s\n", pGroupInfo->grpi1_comment); + + ConPuts(StdOut, L"\n"); + + ConResPuts(StdOut, IDS_GROUP_MEMBERS); + ConPuts(StdOut, L"\n\n"); + + PrintPadding(L'-', 79); + ConPuts(StdOut, L"\n"); + + for (i = 0; i < dwRead; i++) + { + if (pNames[i]) + ConPrintf(StdOut, L"%s\n", pNames[i]); + } + +done: + if (pNames != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, pNames); + + if (pUsers != NULL) + NetApiBufferFree(pUsers); + + if (pGroupInfo != NULL) + NetApiBufferFree(pGroupInfo); + + return Status; +} + + +INT +cmdGroup( + INT argc, + WCHAR **argv) +{ + INT i, j; + INT result = 0; + ULONG dwUserCount = 0; + BOOL bAdd = FALSE; + BOOL bDelete = FALSE; +#if 0 + BOOL bDomain = FALSE; +#endif + PWSTR pGroupName = NULL; + PWSTR pComment = NULL; + PWSTR *pUsers = NULL; + GROUP_INFO_0 Info0; + GROUP_INFO_1 Info1; + GROUP_INFO_1002 Info1002; + NET_API_STATUS Status; + + if (argc == 2) + { + Status = EnumerateGroups(); + ConPrintf(StdOut, L"Status: %lu\n", Status); + return 0; + } + else if (argc == 3) + { + Status = DisplayGroup(argv[2]); + ConPrintf(StdOut, L"Status: %lu\n", Status); + return 0; + } + + i = 2; + if (argv[i][0] != L'/') + { + pGroupName = argv[i]; + i++; + } + + for (j = i; j < argc; j++) + { + if (argv[j][0] == L'/') + break; + + dwUserCount++; + } + + if (dwUserCount > 0) + { + pUsers = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + dwUserCount * sizeof(PGROUP_USERS_INFO_0)); + if (pUsers == NULL) + return 0; + } + + j = 0; + for (; i < argc; i++) + { + if (argv[i][0] == L'/') + break; + + pUsers[j] = argv[i]; + j++; + } + + for (; i < argc; i++) + { + if (_wcsicmp(argv[i], L"/help") == 0) + { + ConResPuts(StdOut, IDS_GENERIC_SYNTAX); + ConResPuts(StdOut, IDS_GROUP_SYNTAX); + ConResPuts(StdOut, IDS_GROUP_HELP_1); + ConResPuts(StdOut, IDS_GROUP_HELP_2); + ConResPuts(StdOut, IDS_GROUP_HELP_3); + ConResPuts(StdOut, IDS_GROUP_HELP_4); + ConResPuts(StdOut, IDS_GROUP_HELP_5); + ConResPuts(StdOut, IDS_GROUP_HELP_6); + ConResPuts(StdOut, IDS_GROUP_HELP_7); + ConResPuts(StdOut, IDS_GENERIC_PAGE); + return 0; + } + else if (_wcsicmp(argv[i], L"/add") == 0) + { + bAdd = TRUE; + } + else if (_wcsicmp(argv[i], L"/delete") == 0) + { + bDelete = TRUE; + } + else if (_wcsnicmp(argv[i], L"/comment:", 9) == 0) + { + pComment = &argv[i][9]; + } + else if (_wcsicmp(argv[i], L"/domain") == 0) + { + ConResPrintf(StdErr, IDS_ERROR_OPTION_NOT_SUPPORTED, L"/DOMAIN"); +#if 0 + bDomain = TRUE; +#endif + } + else + { + result = 1; + goto done; + } + } + + if (pGroupName == NULL) + { + result = 1; + goto done; + } + + if (bAdd && bDelete) + { + result = 1; + goto done; + } + + if (pUsers == NULL) + { + if (!bAdd && !bDelete && pComment != NULL) + { + /* Set group comment */ + Info1002.grpi1002_comment = pComment; + Status = NetGroupSetInfo(NULL, + pGroupName, + 1002, + (LPBYTE)&Info1002, + NULL); + ConPrintf(StdOut, L"Status: %lu\n", Status); + } + else if (bAdd && !bDelete) + { + /* Add the group */ + if (pComment == NULL) + { + Info0.grpi0_name = pGroupName; + } + else + { + Info1.grpi1_name = pGroupName; + Info1.grpi1_comment = pComment; + } + + Status = NetGroupAdd(NULL, + (pComment == NULL) ? 0 : 1, + (pComment == NULL) ? (LPBYTE)&Info0 : (LPBYTE)&Info1, + NULL); + ConPrintf(StdOut, L"Status: %lu\n", Status); + } + else if (!bAdd && bDelete && pComment == NULL) + { + /* Delete the group */ + Status = NetGroupDel(NULL, + pGroupName); + ConPrintf(StdOut, L"Status: %lu\n", Status); + } + else + { + result = 1; + } + } + else + { + if (bAdd && !bDelete && pComment == NULL) + { + /* Add group user */ + for (i = 0; i < dwUserCount; i++) + { + Status = NetGroupAddUser(NULL, + pGroupName, + pUsers[i]); + if (Status != NERR_Success) + break; + } + ConPrintf(StdOut, L"Status: %lu\n", Status); + } + else if (!bAdd && bDelete && pComment == NULL) + { + /* Delete group members */ + for (i = 0; i < dwUserCount; i++) + { + Status = NetGroupDelUser(NULL, + pGroupName, + pUsers[i]); + if (Status != NERR_Success) + break; + } + ConPrintf(StdOut, L"Status: %lu\n", Status); + } + else + { + result = 1; + } + } + +done: + if (pUsers != NULL) + RtlFreeHeap(RtlGetProcessHeap(), 0, pUsers); + + if (result != 0) + { + ConResPuts(StdOut, IDS_GENERIC_SYNTAX); + ConResPuts(StdOut, IDS_GROUP_SYNTAX); + } + + return result; +} + +/* EOF */ diff --git a/base/applications/network/net/lang/en-US.rc b/base/applications/network/net/lang/en-US.rc index 793344d10f..c8c3b6e4b2 100644 --- a/base/applications/network/net/lang/en-US.rc +++ b/base/applications/network/net/lang/en-US.rc @@ -221,6 +221,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "Aliases for \\\\%s" IDS_LOCALGROUP_ALIAS_NAME "Alias name" IDS_LOCALGROUP_COMMENT "Comment" diff --git a/base/applications/network/net/lang/es-ES.rc b/base/applications/network/net/lang/es-ES.rc index b86e48a05a..45619ea332 100644 --- a/base/applications/network/net/lang/es-ES.rc +++ b/base/applications/network/net/lang/es-ES.rc @@ -221,6 +221,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "Alias de \\\\%s" IDS_LOCALGROUP_ALIAS_NAME "Nombre del alias" IDS_LOCALGROUP_COMMENT "Comentario" diff --git a/base/applications/network/net/lang/ro-RO.rc b/base/applications/network/net/lang/ro-RO.rc index a2c9963a2e..647e51d53c 100644 --- a/base/applications/network/net/lang/ro-RO.rc +++ b/base/applications/network/net/lang/ro-RO.rc @@ -224,6 +224,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "Alias pentru \\\\%s" IDS_LOCALGROUP_ALIAS_NAME "Nume alias" IDS_LOCALGROUP_COMMENT "Comentariu" diff --git a/base/applications/network/net/lang/ru-RU.rc b/base/applications/network/net/lang/ru-RU.rc index 7d91bd56b1..69b275a275 100644 --- a/base/applications/network/net/lang/ru-RU.rc +++ b/base/applications/network/net/lang/ru-RU.rc @@ -220,6 +220,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "Псевдонимы для \\\\%s" IDS_LOCALGROUP_ALIAS_NAME "Имя псевдонима" IDS_LOCALGROUP_COMMENT "Комментарий" diff --git a/base/applications/network/net/lang/tr-TR.rc b/base/applications/network/net/lang/tr-TR.rc index 203f82be88..3fb24e39c2 100644 --- a/base/applications/network/net/lang/tr-TR.rc +++ b/base/applications/network/net/lang/tr-TR.rc @@ -220,6 +220,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "\\\\%s için başka adlar" IDS_LOCALGROUP_ALIAS_NAME "Başka ad" IDS_LOCALGROUP_COMMENT "Açıklama" diff --git a/base/applications/network/net/lang/zh-CN.rc b/base/applications/network/net/lang/zh-CN.rc index 14de45cdfb..b643c14d1a 100644 --- a/base/applications/network/net/lang/zh-CN.rc +++ b/base/applications/network/net/lang/zh-CN.rc @@ -220,6 +220,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "\\\\%s 的别名" IDS_LOCALGROUP_ALIAS_NAME "别名名称" IDS_LOCALGROUP_COMMENT "注释" diff --git a/base/applications/network/net/lang/zh-TW.rc b/base/applications/network/net/lang/zh-TW.rc index 08a0f88380..1673f953ae 100644 --- a/base/applications/network/net/lang/zh-TW.rc +++ b/base/applications/network/net/lang/zh-TW.rc @@ -220,6 +220,11 @@ service can stop others. Some services cannot be stopped.\n\n" IDS_CONFIG_WORKSTATION_DOMAIN "Workstation domain" IDS_CONFIG_WORKSTATION_LOGON "Logon domain" + IDS_GROUP_GROUPS "Group Accounts for \\\\%s" + IDS_GROUP_NAME "Group name" + IDS_GROUP_COMMENT "Comment" + IDS_GROUP_MEMBERS "Members" + IDS_LOCALGROUP_ALIASES "別名 \\\\%s" IDS_LOCALGROUP_ALIAS_NAME "別名名稱" IDS_LOCALGROUP_COMMENT "評論" diff --git a/base/applications/network/net/main.c b/base/applications/network/net/main.c index 5b2ad60b78..298b875caf 100644 --- a/base/applications/network/net/main.c +++ b/base/applications/network/net/main.c @@ -25,7 +25,7 @@ COMMAND cmds[] = {L"config", cmdConfig}, {L"continue", cmdContinue}, {L"file", unimplemented}, - {L"group", unimplemented}, + {L"group", cmdGroup}, {L"help", cmdHelp}, {L"helpmsg", cmdHelpMsg}, {L"localgroup", cmdLocalGroup}, diff --git a/base/applications/network/net/net.h b/base/applications/network/net/net.h index a595166af5..3f04b18502 100644 --- a/base/applications/network/net/net.h +++ b/base/applications/network/net/net.h @@ -48,6 +48,7 @@ INT unimplemented(INT argc, WCHAR **argv); INT cmdAccounts(INT argc, WCHAR **argv); INT cmdConfig(INT argc, WCHAR **argv); INT cmdContinue(INT argc, WCHAR **argv); +INT cmdGroup(INT argc, WCHAR **argv); INT cmdHelp(INT argc, WCHAR **argv); INT cmdHelpMsg(INT argc, WCHAR **argv); INT cmdLocalGroup(INT argc, WCHAR **argv); diff --git a/base/applications/network/net/resource.h b/base/applications/network/net/resource.h index beff7b0f3c..84d5f878a7 100644 --- a/base/applications/network/net/resource.h +++ b/base/applications/network/net/resource.h @@ -116,6 +116,10 @@ #define IDS_CONFIG_WORKSTATION_DOMAIN 244 #define IDS_CONFIG_WORKSTATION_LOGON 245 +#define IDS_GROUP_GROUPS 260 +#define IDS_GROUP_NAME 261 +#define IDS_GROUP_COMMENT 262 +#define IDS_GROUP_MEMBERS 263 #define IDS_LOCALGROUP_ALIASES 300 #define IDS_LOCALGROUP_ALIAS_NAME 301
6 years, 2 months
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
22
23
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Results per page:
10
25
50
100
200