mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
[NETAPI32]
Implement NetLocalGroupDel. svn path=/trunk/; revision=59136
This commit is contained in:
parent
1e2b31b8bc
commit
9eddf468b6
1 changed files with 114 additions and 4 deletions
|
@ -385,17 +385,122 @@ NET_API_STATUS WINAPI NetLocalGroupAddMembers(
|
||||||
return NERR_Success;
|
return NERR_Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* NetLocalGroupDel (NETAPI32.@)
|
* NetLocalGroupDel (NETAPI32.@)
|
||||||
*/
|
*/
|
||||||
NET_API_STATUS WINAPI NetLocalGroupDel(
|
NET_API_STATUS
|
||||||
|
WINAPI
|
||||||
|
NetLocalGroupDel(
|
||||||
LPCWSTR servername,
|
LPCWSTR servername,
|
||||||
LPCWSTR groupname)
|
LPCWSTR groupname)
|
||||||
{
|
{
|
||||||
FIXME("(%s %s) stub!\n", debugstr_w(servername), debugstr_w(groupname));
|
UNICODE_STRING ServerName;
|
||||||
return NERR_Success;
|
UNICODE_STRING GroupName;
|
||||||
|
SAM_HANDLE ServerHandle = NULL;
|
||||||
|
SAM_HANDLE DomainHandle = NULL;
|
||||||
|
SAM_HANDLE AliasHandle = NULL;
|
||||||
|
NET_API_STATUS ApiStatus = NERR_Success;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
TRACE("(%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 Builtin Domain */
|
||||||
|
Status = OpenBuiltinDomain(ServerHandle,
|
||||||
|
DOMAIN_LOOKUP,
|
||||||
|
&DomainHandle);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the alias account in the builtin domain */
|
||||||
|
ApiStatus = OpenAliasByName(DomainHandle,
|
||||||
|
&GroupName,
|
||||||
|
DELETE,
|
||||||
|
&AliasHandle);
|
||||||
|
if (ApiStatus != NERR_Success && ApiStatus != ERROR_NONE_MAPPED)
|
||||||
|
{
|
||||||
|
TRACE("OpenAliasByName failed (ApiStatus %lu)\n", ApiStatus);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AliasHandle == NULL)
|
||||||
|
{
|
||||||
|
if (DomainHandle != NULL)
|
||||||
|
{
|
||||||
|
SamCloseHandle(DomainHandle);
|
||||||
|
DomainHandle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 alias account in the account domain */
|
||||||
|
ApiStatus = OpenAliasByName(DomainHandle,
|
||||||
|
&GroupName,
|
||||||
|
DELETE,
|
||||||
|
&AliasHandle);
|
||||||
|
if (ApiStatus != NERR_Success)
|
||||||
|
{
|
||||||
|
ERR("OpenAliasByName failed (ApiStatus %lu)\n", ApiStatus);
|
||||||
|
if (ApiStatus == ERROR_NONE_MAPPED)
|
||||||
|
ApiStatus = NERR_GroupNotFound;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete the alias */
|
||||||
|
Status = SamDeleteAlias(AliasHandle);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR("SamDeleteAlias failed (Status %08lx)\n", Status);
|
||||||
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (AliasHandle != NULL)
|
||||||
|
SamCloseHandle(AliasHandle);
|
||||||
|
|
||||||
|
if (DomainHandle != NULL)
|
||||||
|
SamCloseHandle(DomainHandle);
|
||||||
|
|
||||||
|
if (ServerHandle != NULL)
|
||||||
|
SamCloseHandle(ServerHandle);
|
||||||
|
|
||||||
|
return ApiStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* NetLocalGroupDelMember (NETAPI32.@)
|
* NetLocalGroupDelMember (NETAPI32.@)
|
||||||
*/
|
*/
|
||||||
|
@ -424,10 +529,13 @@ NET_API_STATUS WINAPI NetLocalGroupDelMembers(
|
||||||
return NERR_Success;
|
return NERR_Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* NetLocalGroupEnum (NETAPI32.@)
|
* NetLocalGroupEnum (NETAPI32.@)
|
||||||
*/
|
*/
|
||||||
NET_API_STATUS WINAPI NetLocalGroupEnum(
|
NET_API_STATUS
|
||||||
|
WINAPI
|
||||||
|
NetLocalGroupEnum(
|
||||||
LPCWSTR servername,
|
LPCWSTR servername,
|
||||||
DWORD level,
|
DWORD level,
|
||||||
LPBYTE* bufptr,
|
LPBYTE* bufptr,
|
||||||
|
@ -881,3 +989,5 @@ NET_API_STATUS WINAPI NetLocalGroupSetMembers(
|
||||||
debugstr_w(groupname), level, buf, totalentries);
|
debugstr_w(groupname), level, buf, totalentries);
|
||||||
return NERR_Success;
|
return NERR_Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue