mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
[NETAPI32]
- Include a netapi32.h in most files and move the other includes into netapi32.h. - Add functions to open account and builtin domains directly and use these functions. svn path=/trunk/; revision=58017
This commit is contained in:
parent
ed10069057
commit
b2b4d4f502
9 changed files with 150 additions and 280 deletions
|
@ -18,22 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmaccess.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmerr.h"
|
||||
#include "lmuse.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||
|
||||
|
|
|
@ -18,15 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmerr.h"
|
||||
#include "winerror.h"
|
||||
#include "wine/debug.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||
|
||||
|
|
|
@ -18,14 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmbrowsr.h"
|
||||
#include "lmshare.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
/************************************************************
|
||||
* I_BrowserSetNetlogonState (NETAPI32.@)
|
||||
|
|
|
@ -18,17 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "dsrole.h"
|
||||
#include "dsgetdc.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ds);
|
||||
|
||||
|
|
|
@ -18,22 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmaccess.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmerr.h"
|
||||
#include "lmuse.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||
|
||||
|
|
|
@ -18,25 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmaccess.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmerr.h"
|
||||
#include "winreg.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "ntsam.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||
|
@ -232,7 +213,6 @@ NetLocalGroupAdd(
|
|||
SAM_HANDLE ServerHandle = NULL;
|
||||
SAM_HANDLE DomainHandle = NULL;
|
||||
SAM_HANDLE AliasHandle = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
LPWSTR aliasname = NULL;
|
||||
LPWSTR aliascomment = NULL;
|
||||
ULONG RelativeId;
|
||||
|
@ -277,23 +257,13 @@ NetLocalGroupAdd(
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Get the Builtin Domain SID */
|
||||
Status = GetBuiltinDomainSid(&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open the Builtin Domain */
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&DomainHandle);
|
||||
Status = OpenBuiltinDomain(ServerHandle,
|
||||
DOMAIN_LOOKUP,
|
||||
&DomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -314,29 +284,15 @@ NetLocalGroupAdd(
|
|||
|
||||
ApiStatus = NERR_Success;
|
||||
|
||||
/* Free the Builtin Domain SID */
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
DomainSid = NULL;
|
||||
|
||||
/* Close the Builtin Domain */
|
||||
SamCloseHandle(DomainHandle);
|
||||
DomainHandle = NULL;
|
||||
|
||||
/* Get the account domain SID */
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open the account domain */
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DOMAIN_CREATE_ALIAS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&DomainHandle);
|
||||
Status = OpenAccountDomain(ServerHandle,
|
||||
(servername != NULL) ? &ServerName : NULL,
|
||||
DOMAIN_CREATE_ALIAS | DOMAIN_LOOKUP,
|
||||
&DomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
|
@ -383,9 +339,6 @@ done:
|
|||
if (AliasHandle != NULL)
|
||||
SamCloseHandle(AliasHandle);
|
||||
|
||||
if (DomainSid != NULL)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (DomainHandle != NULL)
|
||||
SamCloseHandle(DomainHandle);
|
||||
|
||||
|
@ -478,7 +431,6 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
UNICODE_STRING ServerName;
|
||||
PSAM_RID_ENUMERATION CurrentAlias;
|
||||
PENUM_CONTEXT EnumContext = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
ULONG i;
|
||||
SAM_HANDLE AliasHandle = NULL;
|
||||
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
||||
|
@ -523,47 +475,23 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
|||
goto done;
|
||||
}
|
||||
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
Status = OpenAccountDomain(EnumContext->ServerHandle,
|
||||
(servername != NULL) ? &ServerName : NULL,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
&EnumContext->AccountDomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&EnumContext->AccountDomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
Status = OpenBuiltinDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
&EnumContext->BuiltinDomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = GetBuiltinDomainSid(&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&EnumContext->BuiltinDomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -732,7 +660,6 @@ NetLocalGroupGetInfo(
|
|||
SAM_HANDLE ServerHandle = NULL;
|
||||
SAM_HANDLE DomainHandle = NULL;
|
||||
SAM_HANDLE AliasHandle = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
||||
LPVOID Buffer = NULL;
|
||||
NET_API_STATUS ApiStatus = NERR_Success;
|
||||
|
@ -758,23 +685,13 @@ NetLocalGroupGetInfo(
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Get the Builtin Domain SID */
|
||||
Status = GetBuiltinDomainSid(&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open the Builtin Domain */
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&DomainHandle);
|
||||
Status = OpenBuiltinDomain(ServerHandle,
|
||||
DOMAIN_LOOKUP,
|
||||
&DomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -792,30 +709,17 @@ NetLocalGroupGetInfo(
|
|||
|
||||
if (AliasHandle == NULL)
|
||||
{
|
||||
if (DomainSid != NULL)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (DomainHandle != NULL)
|
||||
SamCloseHandle(DomainHandle);
|
||||
|
||||
/* Get the Account Domain SID */
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open the Acount Domain */
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&DomainHandle);
|
||||
Status = OpenAccountDomain(ServerHandle,
|
||||
(servername != NULL) ? &ServerName : NULL,
|
||||
DOMAIN_LOOKUP,
|
||||
&DomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -855,9 +759,6 @@ done:
|
|||
if (AliasHandle != NULL)
|
||||
SamCloseHandle(AliasHandle);
|
||||
|
||||
if (DomainSid != NULL)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (DomainHandle != NULL)
|
||||
SamCloseHandle(DomainHandle);
|
||||
|
||||
|
|
|
@ -9,20 +9,6 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "ntsam.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
|
||||
|
@ -125,4 +111,68 @@ done:
|
|||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
OpenAccountDomain(IN SAM_HANDLE ServerHandle,
|
||||
IN PUNICODE_STRING ServerName,
|
||||
IN ULONG DesiredAccess,
|
||||
OUT PSAM_HANDLE DomainHandle)
|
||||
{
|
||||
PSID DomainSid = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = GetAccountDomainSid(ServerName,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DesiredAccess,
|
||||
DomainSid,
|
||||
DomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
OpenBuiltinDomain(IN SAM_HANDLE ServerHandle,
|
||||
IN ULONG DesiredAccess,
|
||||
OUT PSAM_HANDLE DomainHandle)
|
||||
{
|
||||
PSID DomainSid = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = GetBuiltinDomainSid(&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetBuiltinDomainSid failed (Status %08lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DesiredAccess,
|
||||
DomainSid,
|
||||
DomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -2,6 +2,32 @@
|
|||
#ifndef __WINE_NETAPI32_H__
|
||||
#define __WINE_NETAPI32_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmaccess.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmbrowsr.h"
|
||||
#include "lmerr.h"
|
||||
#include "lmshare.h"
|
||||
#include "lmuse.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "dsrole.h"
|
||||
#include "dsgetdc.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "ntsam.h"
|
||||
|
||||
|
||||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetpNtStatusToApiStatus(NTSTATUS Status);
|
||||
|
@ -15,4 +41,15 @@ GetAccountDomainSid(IN PUNICODE_STRING ServerName,
|
|||
NTSTATUS
|
||||
GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid);
|
||||
|
||||
NTSTATUS
|
||||
OpenAccountDomain(IN SAM_HANDLE ServerHandle,
|
||||
IN PUNICODE_STRING ServerName,
|
||||
IN ULONG DesiredAccess,
|
||||
OUT PSAM_HANDLE DomainHandle);
|
||||
|
||||
NTSTATUS
|
||||
OpenBuiltinDomain(IN SAM_HANDLE ServerHandle,
|
||||
IN ULONG DesiredAccess,
|
||||
OUT SAM_HANDLE *DomainHandle);
|
||||
|
||||
#endif
|
|
@ -18,26 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "lmcons.h"
|
||||
#include "lmaccess.h"
|
||||
#include "lmapibuf.h"
|
||||
#include "lmerr.h"
|
||||
#include "lmuse.h"
|
||||
#include "ntsecapi.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include "ntsam.h"
|
||||
#include "netapi32.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||
|
@ -177,7 +157,7 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
if (UserInfo->AdminComment.Length > 0)
|
||||
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
||||
|
||||
/* FIXME: Add user comment here */
|
||||
/* FIXME: usri10_usr_comment */
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
Size += UserInfo->FullName.Length + sizeof(WCHAR);
|
||||
|
@ -239,9 +219,8 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
|
||||
UserInfo1->usri1_password = NULL;
|
||||
|
||||
UserInfo1->usri1_password_age = 0; /* FIXME */
|
||||
|
||||
UserInfo1->usri1_priv = 0; /* FIXME */
|
||||
/* FIXME: UserInfo1->usri1_password_age */
|
||||
/* FIXME: UserInfo1->usri1_priv */
|
||||
|
||||
if (UserInfo->HomeDirectory.Length > 0)
|
||||
{
|
||||
|
@ -310,7 +289,7 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->AdminComment.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: Add user comment here */
|
||||
/* FIXME: UserInfo10->usri10_usr_comment */
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
{
|
||||
|
@ -323,7 +302,6 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
// case 11:
|
||||
|
||||
case 20:
|
||||
|
@ -592,10 +570,7 @@ NetUserEnum(LPCWSTR servername,
|
|||
PSAM_RID_ENUMERATION CurrentUser;
|
||||
PENUM_CONTEXT EnumContext = NULL;
|
||||
LPVOID Buffer = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
|
||||
ULONG i;
|
||||
|
||||
SAM_HANDLE UserHandle = NULL;
|
||||
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
||||
|
||||
|
@ -639,47 +614,23 @@ NetUserEnum(LPCWSTR servername,
|
|||
goto done;
|
||||
}
|
||||
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
Status = OpenAccountDomain(EnumContext->ServerHandle,
|
||||
(servername != NULL) ? &ServerName : NULL,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
&EnumContext->AccountDomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&EnumContext->AccountDomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
Status = OpenBuiltinDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
&EnumContext->BuiltinDomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = GetBuiltinDomainSid(&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&EnumContext->BuiltinDomainHandle);
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -871,7 +822,6 @@ NetUserGetInfo(LPCWSTR servername,
|
|||
SAM_HANDLE ServerHandle = NULL;
|
||||
SAM_HANDLE AccountDomainHandle = NULL;
|
||||
SAM_HANDLE UserHandle = NULL;
|
||||
PSID DomainSid = NULL;
|
||||
PULONG RelativeIds = NULL;
|
||||
PSID_NAME_USE Use = NULL;
|
||||
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
||||
|
@ -899,24 +849,14 @@ NetUserGetInfo(LPCWSTR servername,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Get the Account Domain SID */
|
||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
||||
&DomainSid);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Open the Account Domain */
|
||||
Status = SamOpenDomain(ServerHandle,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
DomainSid,
|
||||
&AccountDomainHandle);
|
||||
Status = OpenAccountDomain(ServerHandle,
|
||||
(servername != NULL) ? &ServerName : NULL,
|
||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||
&AccountDomainHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||
goto done;
|
||||
}
|
||||
|
@ -989,9 +929,6 @@ done:
|
|||
if (Use != NULL)
|
||||
SamFreeMemory(Use);
|
||||
|
||||
if (DomainSid != NULL)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
||||
|
||||
if (AccountDomainHandle != NULL)
|
||||
SamCloseHandle(AccountDomainHandle);
|
||||
|
||||
|
|
Loading…
Reference in a new issue