From fda13e9c4c170edaff56434839db78395330487e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 13 Apr 2013 21:04:54 +0000 Subject: [PATCH] [SAMSRV] Implement SamIFree_SAMPR_USER_INFO_BUFFER. svn path=/trunk/; revision=58742 --- reactos/dll/win32/samsrv/samsrv.c | 217 ++++++++++++++++++++++++++- reactos/dll/win32/samsrv/samsrv.spec | 2 +- 2 files changed, 217 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/samsrv/samsrv.c b/reactos/dll/win32/samsrv/samsrv.c index 23049e00249..490f6167607 100644 --- a/reactos/dll/win32/samsrv/samsrv.c +++ b/reactos/dll/win32/samsrv/samsrv.c @@ -131,7 +131,7 @@ SamIFree_SAMPR_PSID_ARRAY(PSAMPR_PSID_ARRAY Ptr) { if (Ptr != NULL) { - if (Ptr->Sids !=0) + if (Ptr->Sids != NULL) { MIDL_user_free(Ptr->Sids); } @@ -176,7 +176,222 @@ SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr) Ptr->Count = 0; } } +} + +VOID +NTAPI +SamIFree_SAMPR_USER_INFO_BUFFER(PSAMPR_USER_INFO_BUFFER Ptr, + USER_INFORMATION_CLASS InformationClass) +{ + if (Ptr == NULL) + return; + + switch (InformationClass) + { + case UserGeneralInformation: + if (Ptr->General.UserName.Buffer != NULL) + MIDL_user_free(Ptr->General.UserName.Buffer); + + if (Ptr->General.FullName.Buffer != NULL) + MIDL_user_free(Ptr->General.FullName.Buffer); + + if (Ptr->General.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->General.AdminComment.Buffer); + + if (Ptr->General.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->General.UserComment.Buffer); + break; + + case UserPreferencesInformation: + if (Ptr->Preferences.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->Preferences.UserComment.Buffer); + + if (Ptr->Preferences.Reserved1.Buffer != NULL) + MIDL_user_free(Ptr->Preferences.Reserved1.Buffer); + break; + + case UserLogonInformation: + if (Ptr->Logon.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Logon.UserName.Buffer); + + if (Ptr->Logon.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Logon.FullName.Buffer); + + if (Ptr->Logon.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Logon.HomeDirectory.Buffer); + + if (Ptr->Logon.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Logon.HomeDirectoryDrive.Buffer); + + if (Ptr->Logon.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Logon.ScriptPath.Buffer); + + if (Ptr->Logon.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Logon.ProfilePath.Buffer); + + if (Ptr->Logon.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->Logon.WorkStations.Buffer); + + if (Ptr->Logon.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->Logon.LogonHours.LogonHours); + break; + + case UserLogonHoursInformation: + if (Ptr->LogonHours.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->LogonHours.LogonHours.LogonHours); + break; + + case UserAccountInformation: + if (Ptr->Account.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Account.UserName.Buffer); + + if (Ptr->Account.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Account.FullName.Buffer); + + if (Ptr->Account.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Account.HomeDirectory.Buffer); + + if (Ptr->Account.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Account.HomeDirectoryDrive.Buffer); + + if (Ptr->Account.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Account.ScriptPath.Buffer); + + if (Ptr->Account.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Account.ProfilePath.Buffer); + + if (Ptr->Account.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->Account.AdminComment.Buffer); + + if (Ptr->Account.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->Account.WorkStations.Buffer); + + if (Ptr->Account.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->Account.LogonHours.LogonHours); + break; + + case UserNameInformation: + if (Ptr->Name.UserName.Buffer != NULL) + MIDL_user_free(Ptr->Name.UserName.Buffer); + + if (Ptr->Name.FullName.Buffer != NULL) + MIDL_user_free(Ptr->Name.FullName.Buffer); + break; + + case UserAccountNameInformation: + if (Ptr->AccountName.UserName.Buffer != NULL) + MIDL_user_free(Ptr->AccountName.UserName.Buffer); + break; + + case UserFullNameInformation: + if (Ptr->FullName.FullName.Buffer != NULL) + MIDL_user_free(Ptr->FullName.FullName.Buffer); + break; + + case UserPrimaryGroupInformation: + break; + + case UserHomeInformation: + if (Ptr->Home.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->Home.HomeDirectory.Buffer); + + if (Ptr->Home.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->Home.HomeDirectoryDrive.Buffer); + break; + + case UserScriptInformation: + if (Ptr->Script.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->Script.ScriptPath.Buffer); + + case UserProfileInformation: + if (Ptr->Profile.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->Profile.ProfilePath.Buffer); + + case UserAdminCommentInformation: + if (Ptr->AdminComment.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->AdminComment.AdminComment.Buffer); + break; + + case UserWorkStationsInformation: + if (Ptr->WorkStations.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->WorkStations.WorkStations.Buffer); + break; + + case UserSetPasswordInformation: + ERR("Information class UserSetPasswordInformation cannot be queried!\n"); + break; + + case UserControlInformation: + break; + + case UserExpiresInformation: + break; + + case UserInternal1Information: + break; + + case UserInternal2Information: + break; + + case UserParametersInformation: + if (Ptr->Parameters.Parameters.Buffer != NULL) + MIDL_user_free(Ptr->Parameters.Parameters.Buffer); + break; + + case UserAllInformation: + if (Ptr->All.UserName.Buffer != NULL) + MIDL_user_free(Ptr->All.UserName.Buffer); + + if (Ptr->All.FullName.Buffer != NULL) + MIDL_user_free(Ptr->All.FullName.Buffer); + + if (Ptr->All.HomeDirectory.Buffer != NULL) + MIDL_user_free(Ptr->All.HomeDirectory.Buffer); + + if (Ptr->All.HomeDirectoryDrive.Buffer != NULL) + MIDL_user_free(Ptr->All.HomeDirectoryDrive.Buffer); + + if (Ptr->All.ScriptPath.Buffer != NULL) + MIDL_user_free(Ptr->All.ScriptPath.Buffer); + + if (Ptr->All.ProfilePath.Buffer != NULL) + MIDL_user_free(Ptr->All.ProfilePath.Buffer); + + if (Ptr->All.AdminComment.Buffer != NULL) + MIDL_user_free(Ptr->All.AdminComment.Buffer); + + if (Ptr->All.WorkStations.Buffer != NULL) + MIDL_user_free(Ptr->All.WorkStations.Buffer); + + if (Ptr->All.UserComment.Buffer != NULL) + MIDL_user_free(Ptr->All.UserComment.Buffer); + + if (Ptr->All.Parameters.Buffer != NULL) + MIDL_user_free(Ptr->All.Parameters.Buffer); + + if (Ptr->All.LmOwfPassword.Buffer != NULL) + MIDL_user_free(Ptr->All.LmOwfPassword.Buffer); + + if (Ptr->All.NtOwfPassword.Buffer != NULL) + MIDL_user_free(Ptr->All.NtOwfPassword.Buffer); + + if (Ptr->All.PrivateData.Buffer != NULL) + MIDL_user_free(Ptr->All.PrivateData.Buffer); + + if (Ptr->All.SecurityDescriptor.SecurityDescriptor != NULL) + MIDL_user_free(Ptr->All.SecurityDescriptor.SecurityDescriptor); + + if (Ptr->All.LogonHours.LogonHours != NULL) + MIDL_user_free(Ptr->All.LogonHours.LogonHours); + break; + + default: + FIXME("Unsupported information class: %lu\n", InformationClass); + break; + } + + MIDL_user_free(Ptr); } /* EOF */ diff --git a/reactos/dll/win32/samsrv/samsrv.spec b/reactos/dll/win32/samsrv/samsrv.spec index 4d5e97d05ad..f7129cfd7fd 100644 --- a/reactos/dll/win32/samsrv/samsrv.spec +++ b/reactos/dll/win32/samsrv/samsrv.spec @@ -28,7 +28,7 @@ @ stdcall SamIFree_SAMPR_RETURNED_USTRING_ARRAY(ptr) @ stub SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR @ stdcall SamIFree_SAMPR_ULONG_ARRAY(ptr) -@ stub SamIFree_SAMPR_USER_INFO_BUFFER +@ stdcall SamIFree_SAMPR_USER_INFO_BUFFER(ptr long) @ stub SamIFree_UserInternal6Information @ stub SamIGCLookupNames @ stub SamIGCLookupSids