[NETAPI32]

NetLocalGroupGetMembers: Implement levels 2 and 3. Fixes netapi32:access winetest failures.

svn path=/trunk/; revision=59190
This commit is contained in:
Eric Kohl 2013-06-08 11:04:18 +00:00
parent 015d9d3a12
commit f0c9ed8f21

View file

@ -946,6 +946,8 @@ NetLocalGroupGetMembers(
LPVOID Buffer = NULL;
PLOCALGROUP_MEMBERS_INFO_0 MembersInfo0;
PLOCALGROUP_MEMBERS_INFO_1 MembersInfo1;
PLOCALGROUP_MEMBERS_INFO_2 MembersInfo2;
PLOCALGROUP_MEMBERS_INFO_3 MembersInfo3;
LPWSTR Ptr;
ULONG Size = 0;
ULONG SidLength;
@ -1060,7 +1062,7 @@ NetLocalGroupGetMembers(
goto done;
}
/* Get name and domain information for all members */
if (level != 0)
{
InitializeObjectAttributes(&ObjectAttributes,
@ -1108,6 +1110,19 @@ NetLocalGroupGetMembers(
EnumContext->Names[i].Name.Length + sizeof(WCHAR);
break;
case 2:
Size = sizeof(LOCALGROUP_MEMBERS_INFO_2) +
RtlLengthSid(EnumContext->Sids[i]) +
EnumContext->Names[i].Name.Length + sizeof(WCHAR) +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length + sizeof(WCHAR);
break;
case 3:
Size = sizeof(LOCALGROUP_MEMBERS_INFO_3) +
EnumContext->Names[i].Name.Length + sizeof(WCHAR) +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length + sizeof(WCHAR);
break;
default:
ApiStatus = ERROR_INVALID_LEVEL;
goto done;
@ -1133,6 +1148,16 @@ NetLocalGroupGetMembers(
MembersInfo1 = (PLOCALGROUP_MEMBERS_INFO_1)Buffer;
Ptr = (PVOID)((ULONG_PTR)Buffer + sizeof(LOCALGROUP_MEMBERS_INFO_1) * EnumContext->Count);
break;
case 2:
MembersInfo2 = (PLOCALGROUP_MEMBERS_INFO_2)Buffer;
Ptr = (PVOID)((ULONG_PTR)Buffer + sizeof(LOCALGROUP_MEMBERS_INFO_2) * EnumContext->Count);
break;
case 3:
MembersInfo3 = (PLOCALGROUP_MEMBERS_INFO_3)Buffer;
Ptr = (PVOID)((ULONG_PTR)Buffer + sizeof(LOCALGROUP_MEMBERS_INFO_3) * EnumContext->Count);
break;
}
for (i = 0; i < EnumContext->Count; i++)
@ -1169,6 +1194,51 @@ NetLocalGroupGetMembers(
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
break;
case 2:
MembersInfo2->lgrmi2_sid = (PSID)Ptr;
SidLength = RtlLengthSid(EnumContext->Sids[i]);
memcpy(MembersInfo2->lgrmi2_sid,
EnumContext->Sids[i],
SidLength);
Ptr = (PVOID)((ULONG_PTR)Ptr + SidLength);
MembersInfo2->lgrmi2_sidusage = EnumContext->Names[i].Use;
MembersInfo2->lgrmi2_domainandname = (LPWSTR)Ptr;
memcpy(MembersInfo2->lgrmi2_domainandname,
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
Ptr = (PVOID)((ULONG_PTR)Ptr + EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
*((LPWSTR)Ptr) = L'\\';
Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
memcpy(Ptr,
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
break;
case 3:
MembersInfo3->lgrmi3_domainandname = (PSID)Ptr;
memcpy(MembersInfo2->lgrmi2_domainandname,
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
Ptr = (PVOID)((ULONG_PTR)Ptr + EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
*((LPWSTR)Ptr) = L'\\';
Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
memcpy(Ptr,
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
break;
}
}