Implement SamIFree_SAMPR_DISPLAY_INFO_BUFFER.

svn path=/trunk/; revision=75925
This commit is contained in:
Eric Kohl 2017-09-22 12:29:53 +00:00
parent 70d4f2c68f
commit 451d484fcd
2 changed files with 153 additions and 56 deletions

View file

@ -187,6 +187,103 @@ SamIFree_SAMPR_ALIAS_INFO_BUFFER(
} }
VOID
NTAPI
SamIFree_SAMPR_DISPLAY_INFO_BUFFER(
PSAMPR_DISPLAY_INFO_BUFFER Ptr,
DOMAIN_DISPLAY_INFORMATION InformationClass)
{
ULONG i;
if (Ptr == NULL)
return;
switch (InformationClass)
{
case DomainDisplayUser:
if (Ptr->UserInformation.Buffer != NULL)
{
for (i = 0; i < Ptr->UserInformation.EntriesRead; i++)
{
if (Ptr->UserInformation.Buffer[i].AccountName.Buffer != NULL)
MIDL_user_free(Ptr->UserInformation.Buffer[i].AccountName.Buffer);
if (Ptr->UserInformation.Buffer[i].AdminComment.Buffer != NULL)
MIDL_user_free(Ptr->UserInformation.Buffer[i].AdminComment.Buffer);
if (Ptr->UserInformation.Buffer[i].FullName.Buffer != NULL)
MIDL_user_free(Ptr->UserInformation.Buffer[i].FullName.Buffer);
}
MIDL_user_free(Ptr->UserInformation.Buffer);
}
break;
case DomainDisplayMachine:
if (Ptr->MachineInformation.Buffer != NULL)
{
for (i = 0; i < Ptr->MachineInformation.EntriesRead; i++)
{
if (Ptr->MachineInformation.Buffer[i].AccountName.Buffer != NULL)
MIDL_user_free(Ptr->MachineInformation.Buffer[i].AccountName.Buffer);
if (Ptr->MachineInformation.Buffer[i].AdminComment.Buffer != NULL)
MIDL_user_free(Ptr->MachineInformation.Buffer[i].AdminComment.Buffer);
}
MIDL_user_free(Ptr->MachineInformation.Buffer);
}
break;
case DomainDisplayGroup:
if (Ptr->GroupInformation.Buffer != NULL)
{
for (i = 0; i < Ptr->GroupInformation.EntriesRead; i++)
{
if (Ptr->GroupInformation.Buffer[i].AccountName.Buffer != NULL)
MIDL_user_free(Ptr->GroupInformation.Buffer[i].AccountName.Buffer);
if (Ptr->GroupInformation.Buffer[i].AdminComment.Buffer != NULL)
MIDL_user_free(Ptr->GroupInformation.Buffer[i].AdminComment.Buffer);
}
MIDL_user_free(Ptr->GroupInformation.Buffer);
}
break;
case DomainDisplayOemUser:
if (Ptr->OemUserInformation.Buffer != NULL)
{
for (i = 0; i < Ptr->OemUserInformation.EntriesRead; i++)
{
if (Ptr->OemUserInformation.Buffer[i].OemAccountName.Buffer != NULL)
MIDL_user_free(Ptr->OemUserInformation.Buffer[i].OemAccountName.Buffer);
}
MIDL_user_free(Ptr->OemUserInformation.Buffer);
}
break;
case DomainDisplayOemGroup:
if (Ptr->OemGroupInformation.Buffer != NULL)
{
for (i = 0; i < Ptr->OemGroupInformation.EntriesRead; i++)
{
if (Ptr->OemGroupInformation.Buffer[i].OemAccountName.Buffer != NULL)
MIDL_user_free(Ptr->OemGroupInformation.Buffer[i].OemAccountName.Buffer);
}
MIDL_user_free(Ptr->OemGroupInformation.Buffer);
}
break;
default:
FIXME("Unsupported information class: %lu\n", InformationClass);
break;
}
}
VOID VOID
NTAPI NTAPI
SamIFree_SAMPR_DOMAIN_INFO_BUFFER( SamIFree_SAMPR_DOMAIN_INFO_BUFFER(
@ -271,21 +368,21 @@ SamIFree_SAMPR_ENUMERATION_BUFFER(PSAMPR_ENUMERATION_BUFFER Ptr)
{ {
ULONG i; ULONG i;
if (Ptr != NULL) if (Ptr == NULL)
{ return;
if (Ptr->Buffer != NULL)
{
for (i = 0; i < Ptr->EntriesRead; i++)
{
if (Ptr->Buffer[i].Name.Buffer != NULL)
MIDL_user_free(Ptr->Buffer[i].Name.Buffer);
}
MIDL_user_free(Ptr->Buffer); if (Ptr->Buffer != NULL)
{
for (i = 0; i < Ptr->EntriesRead; i++)
{
if (Ptr->Buffer[i].Name.Buffer != NULL)
MIDL_user_free(Ptr->Buffer[i].Name.Buffer);
} }
MIDL_user_free(Ptr); MIDL_user_free(Ptr->Buffer);
} }
MIDL_user_free(Ptr);
} }
@ -293,13 +390,13 @@ VOID
NTAPI NTAPI
SamIFree_SAMPR_GET_GROUPS_BUFFER(PSAMPR_GET_GROUPS_BUFFER Ptr) SamIFree_SAMPR_GET_GROUPS_BUFFER(PSAMPR_GET_GROUPS_BUFFER Ptr)
{ {
if (Ptr != NULL) if (Ptr == NULL)
{ return;
if (Ptr->Groups != NULL)
MIDL_user_free(Ptr->Groups);
MIDL_user_free(Ptr); if (Ptr->Groups != NULL)
} MIDL_user_free(Ptr->Groups);
MIDL_user_free(Ptr);
} }
@ -307,16 +404,16 @@ VOID
NTAPI NTAPI
SamIFree_SAMPR_GET_MEMBERS_BUFFER(PSAMPR_GET_MEMBERS_BUFFER Ptr) SamIFree_SAMPR_GET_MEMBERS_BUFFER(PSAMPR_GET_MEMBERS_BUFFER Ptr)
{ {
if (Ptr != NULL) if (Ptr == NULL)
{ return;
if (Ptr->Members != NULL)
MIDL_user_free(Ptr->Members);
if (Ptr->Attributes != NULL) if (Ptr->Members != NULL)
MIDL_user_free(Ptr->Attributes); MIDL_user_free(Ptr->Members);
MIDL_user_free(Ptr); if (Ptr->Attributes != NULL)
} MIDL_user_free(Ptr->Attributes);
MIDL_user_free(Ptr);
} }
@ -365,12 +462,12 @@ VOID
NTAPI NTAPI
SamIFree_SAMPR_PSID_ARRAY(PSAMPR_PSID_ARRAY Ptr) SamIFree_SAMPR_PSID_ARRAY(PSAMPR_PSID_ARRAY Ptr)
{ {
if (Ptr != NULL) if (Ptr == NULL)
return;
if (Ptr->Sids != NULL)
{ {
if (Ptr->Sids != NULL) MIDL_user_free(Ptr->Sids);
{
MIDL_user_free(Ptr->Sids);
}
} }
} }
@ -381,20 +478,20 @@ SamIFree_SAMPR_RETURNED_USTRING_ARRAY(PSAMPR_RETURNED_USTRING_ARRAY Ptr)
{ {
ULONG i; ULONG i;
if (Ptr != NULL) if (Ptr == NULL)
{ return;
if (Ptr->Element != NULL)
{
for (i = 0; i < Ptr->Count; i++)
{
if (Ptr->Element[i].Buffer != NULL)
MIDL_user_free(Ptr->Element[i].Buffer);
}
MIDL_user_free(Ptr->Element); if (Ptr->Element != NULL)
Ptr->Element = NULL; {
Ptr->Count = 0; for (i = 0; i < Ptr->Count; i++)
{
if (Ptr->Element[i].Buffer != NULL)
MIDL_user_free(Ptr->Element[i].Buffer);
} }
MIDL_user_free(Ptr->Element);
Ptr->Element = NULL;
Ptr->Count = 0;
} }
} }
@ -403,13 +500,13 @@ VOID
NTAPI NTAPI
SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR(PSAMPR_SR_SECURITY_DESCRIPTOR Ptr) SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR(PSAMPR_SR_SECURITY_DESCRIPTOR Ptr)
{ {
if (Ptr != NULL) if (Ptr == NULL)
{ return;
if (Ptr->SecurityDescriptor != NULL)
MIDL_user_free(Ptr->SecurityDescriptor);
MIDL_user_free(Ptr); if (Ptr->SecurityDescriptor != NULL)
} MIDL_user_free(Ptr->SecurityDescriptor);
MIDL_user_free(Ptr);
} }
@ -417,14 +514,14 @@ VOID
NTAPI NTAPI
SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr) SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr)
{ {
if (Ptr != NULL) if (Ptr == NULL)
return;
if (Ptr->Element != NULL)
{ {
if (Ptr->Element != NULL) MIDL_user_free(Ptr->Element);
{ Ptr->Element = NULL;
MIDL_user_free(Ptr->Element); Ptr->Count = 0;
Ptr->Element = NULL;
Ptr->Count = 0;
}
} }
} }

View file

@ -18,7 +18,7 @@
@ stub SamIFreeSidArray @ stub SamIFreeSidArray
@ stdcall SamIFreeVoid(ptr) @ stdcall SamIFreeVoid(ptr)
@ stdcall SamIFree_SAMPR_ALIAS_INFO_BUFFER(ptr long) @ stdcall SamIFree_SAMPR_ALIAS_INFO_BUFFER(ptr long)
@ stub SamIFree_SAMPR_DISPLAY_INFO_BUFFER @ stdcall SamIFree_SAMPR_DISPLAY_INFO_BUFFER(ptr long)
@ stdcall SamIFree_SAMPR_DOMAIN_INFO_BUFFER(ptr long) @ stdcall SamIFree_SAMPR_DOMAIN_INFO_BUFFER(ptr long)
@ stdcall SamIFree_SAMPR_ENUMERATION_BUFFER(ptr) @ stdcall SamIFree_SAMPR_ENUMERATION_BUFFER(ptr)
@ stdcall SamIFree_SAMPR_GET_GROUPS_BUFFER(ptr) @ stdcall SamIFree_SAMPR_GET_GROUPS_BUFFER(ptr)