Author: ekohl
Date: Wed Dec 26 21:07:13 2012
New Revision: 58017
URL:
http://svn.reactos.org/svn/reactos?rev=58017&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/netapi32/access.c
trunk/reactos/dll/win32/netapi32/apibuf.c
trunk/reactos/dll/win32/netapi32/browsr.c
trunk/reactos/dll/win32/netapi32/ds.c
trunk/reactos/dll/win32/netapi32/group.c
trunk/reactos/dll/win32/netapi32/local_group.c
trunk/reactos/dll/win32/netapi32/misc.c
trunk/reactos/dll/win32/netapi32/netapi32.h
trunk/reactos/dll/win32/netapi32/user.c
Modified: trunk/reactos/dll/win32/netapi32/access.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/access.…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/access.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/access.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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);
Modified: trunk/reactos/dll/win32/netapi32/apibuf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/apibuf.…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/apibuf.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/apibuf.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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);
Modified: trunk/reactos/dll/win32/netapi32/browsr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/browsr.…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/browsr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/browsr.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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.@)
Modified: trunk/reactos/dll/win32/netapi32/ds.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/ds.c?re…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/ds.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/ds.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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);
Modified: trunk/reactos/dll/win32/netapi32/group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/group.c…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/group.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/group.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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);
Modified: trunk/reactos/dll/win32/netapi32/local_group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/local_g…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/local_group.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/local_group.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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 @@
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 @@
goto done;
}
- /* Get the Builtin Domain SID */
- Status = GetBuiltinDomainSid(&DomainSid);
+ /* Open the Builtin Domain */
+ Status = OpenBuiltinDomain(ServerHandle,
+ DOMAIN_LOOKUP,
+ &DomainHandle);
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);
- 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 @@
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 @@
if (AliasHandle != NULL)
SamCloseHandle(AliasHandle);
- if (DomainSid != NULL)
- RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
-
if (DomainHandle != NULL)
SamCloseHandle(DomainHandle);
@@ -478,7 +431,6 @@
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 @@
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 @@
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 @@
goto done;
}
- /* Get the Builtin Domain SID */
- Status = GetBuiltinDomainSid(&DomainSid);
+ /* Open the Builtin Domain */
+ Status = OpenBuiltinDomain(ServerHandle,
+ DOMAIN_LOOKUP,
+ &DomainHandle);
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);
- 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 @@
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);
+ /* Open the Acount Domain */
+ Status = OpenAccountDomain(ServerHandle,
+ (servername != NULL) ? &ServerName : NULL,
+ DOMAIN_LOOKUP,
+ &DomainHandle);
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);
- if (!NT_SUCCESS(Status))
- {
- ERR("SamOpenDomain failed (Status %08lx)\n", Status);
+ ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
ApiStatus = NetpNtStatusToApiStatus(Status);
goto done;
}
@@ -854,9 +758,6 @@
if (AliasHandle != NULL)
SamCloseHandle(AliasHandle);
-
- if (DomainSid != NULL)
- RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
if (DomainHandle != NULL)
SamCloseHandle(DomainHandle);
Modified: trunk/reactos/dll/win32/netapi32/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/misc.c?…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/misc.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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 @@
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 */
Modified: trunk/reactos/dll/win32/netapi32/netapi32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.h [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -1,6 +1,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
@@ -15,4 +41,15 @@
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
Modified: trunk/reactos/dll/win32/netapi32/user.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/user.c?…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/user.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/user.c [iso-8859-1] Wed Dec 26 21:07:13 2012
@@ -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 @@
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 @@
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 @@
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)
{
@@ -322,7 +301,6 @@
UserInfo10->usri10_full_name[UserInfo->FullName.Length /
sizeof(WCHAR)] = UNICODE_NULL;
}
break;
-
// case 11:
@@ -592,10 +570,7 @@
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 @@
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 @@
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 @@
goto done;
}
- /* Get the Account Domain SID */
- Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
- &DomainSid);
+ /* Open the Account Domain */
+ Status = OpenAccountDomain(ServerHandle,
+ (servername != NULL) ? &ServerName : NULL,
+ DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
+ &AccountDomainHandle);
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);
- if (!NT_SUCCESS(Status))
- {
- ERR("SamOpenDomain failed (Status %08lx)\n", Status);
+ ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
ApiStatus = NetpNtStatusToApiStatus(Status);
goto done;
}
@@ -988,9 +928,6 @@
if (Use != NULL)
SamFreeMemory(Use);
-
- if (DomainSid != NULL)
- RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
if (AccountDomainHandle != NULL)
SamCloseHandle(AccountDomainHandle);