From 77520445a88e91fd93a528d6a5c21721b49d9187 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 22 Oct 2012 20:43:04 +0000 Subject: [PATCH] [SAMLIB] Implement SamRemoveMemberFromAlias, SamRemoveMemberFromForeignDomain, SamRemoveMemberFromGroup and SamRemoveMultipleMembersFromAlias. svn path=/trunk/; revision=57594 --- reactos/dll/win32/samlib/samlib.c | 110 ++++++++++++++++++++++++++- reactos/dll/win32/samlib/samlib.spec | 8 +- reactos/include/ddk/ntsam.h | 16 ++++ 3 files changed, 129 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/samlib/samlib.c b/reactos/dll/win32/samlib/samlib.c index 27f9bed73cc..56071964299 100644 --- a/reactos/dll/win32/samlib/samlib.c +++ b/reactos/dll/win32/samlib/samlib.c @@ -171,7 +171,7 @@ SamAddMultipleMembersToAlias(IN SAM_HANDLE AliasHandle, return STATUS_INVALID_PARAMETER_2; Buffer.Count = MemberCount; - Buffer.Sids = (PSAMPR_SID_INFORMATION)MemberIds; + Buffer.Sids = (PSAMPR_SID_INFORMATION)MemberIds; RpcTryExcept { @@ -1330,6 +1330,114 @@ SamQuerySecurityObject(IN SAM_HANDLE ObjectHandle, } +NTSTATUS +NTAPI +SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, + IN PSID MemberId) +{ + NTSTATUS Status; + + TRACE("SamRemoveMemberFromAlias(%p %ul)\n", + AliasHandle, MemberId); + + RpcTryExcept + { + Status = SamrRemoveMemberFromAlias((SAMPR_HANDLE)AliasHandle, + MemberId); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamRemoveMemberFromForeignDomain(IN SAM_HANDLE DomainHandle, + IN PSID MemberId) +{ + NTSTATUS Status; + + TRACE("SamRemoveMemberFromForeignDomain(%p %ul)\n", + DomainHandle, MemberId); + + RpcTryExcept + { + Status = SamrRemoveMemberFromForeignDomain((SAMPR_HANDLE)DomainHandle, + MemberId); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamRemoveMemberFromGroup(IN SAM_HANDLE GroupHandle, + IN ULONG MemberId) +{ + NTSTATUS Status; + + TRACE("SamRemoveMemberFromGroup(%p %ul)\n", + GroupHandle, MemberId); + + RpcTryExcept + { + Status = SamrRemoveMemberFromGroup((SAMPR_HANDLE)GroupHandle, + MemberId); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI +SamRemoveMultipleMembersFromAlias(IN SAM_HANDLE AliasHandle, + IN PSID *MemberIds, + IN ULONG MemberCount) +{ + SAMPR_PSID_ARRAY Buffer; + NTSTATUS Status; + + TRACE("SamRemoveMultipleMembersFromAlias(%p %p %lu)\n", + AliasHandle, MemberIds, MemberCount); + + if (MemberIds == NULL) + return STATUS_INVALID_PARAMETER_2; + + Buffer.Count = MemberCount; + Buffer.Sids = (PSAMPR_SID_INFORMATION)MemberIds; + + RpcTryExcept + { + Status = SamrRemoveMultipleMembersFromAlias((SAMPR_HANDLE)AliasHandle, + &Buffer); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + NTSTATUS NTAPI SamRidToSid(IN SAM_HANDLE ObjectHandle, diff --git a/reactos/dll/win32/samlib/samlib.spec b/reactos/dll/win32/samlib/samlib.spec index e63ae9265e4..0176a0c0a68 100644 --- a/reactos/dll/win32/samlib/samlib.spec +++ b/reactos/dll/win32/samlib/samlib.spec @@ -38,10 +38,10 @@ @ stdcall SamQueryInformationGroup(ptr long ptr) @ stdcall SamQueryInformationUser(ptr long ptr) @ stdcall SamQuerySecurityObject(ptr long ptr) -@ stub SamRemoveMemberFromAlias -@ stub SamRemoveMemberFromForeignDomain -@ stub SamRemoveMemberFromGroup -@ stub SamRemoveMultipleMembersFromAlias +@ stdcall SamRemoveMemberFromAlias(ptr long) +@ stdcall SamRemoveMemberFromForeignDomain(ptr long) +@ stdcall SamRemoveMemberFromGroup(ptr long) +@ stdcall SamRemoveMultipleMembersFromAlias(ptr ptr long) @ stdcall SamRidToSid(ptr long ptr) @ stdcall SamSetInformationAlias(ptr long ptr) @ stdcall SamSetInformationDomain(ptr long ptr) diff --git a/reactos/include/ddk/ntsam.h b/reactos/include/ddk/ntsam.h index 00412624e8f..cb0af846bf3 100644 --- a/reactos/include/ddk/ntsam.h +++ b/reactos/include/ddk/ntsam.h @@ -540,6 +540,22 @@ NTAPI SamRemoveMemberFromAlias(IN SAM_HANDLE AliasHandle, IN PSID MemberId); +NTSTATUS +NTAPI +SamRemoveMemberFromForeignDomain(IN SAM_HANDLE DomainHandle, + IN PSID MemberId); + +NTSTATUS +NTAPI +SamRemoveMemberFromGroup(IN SAM_HANDLE GroupHandle, + IN ULONG MemberId); + +NTSTATUS +NTAPI +SamRemoveMultipleMembersFromAlias(IN SAM_HANDLE AliasHandle, + IN PSID *MemberIds, + IN ULONG MemberCount); + NTSTATUS NTAPI SamRidToSid(IN SAM_HANDLE ObjectHandle,