mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +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
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "netapi32.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"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "netapi32.h"
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "lmcons.h"
|
|
||||||
#include "lmapibuf.h"
|
|
||||||
#include "lmerr.h"
|
|
||||||
#include "winerror.h"
|
|
||||||
#include "wine/debug.h"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "netapi32.h"
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winerror.h"
|
|
||||||
#include "lmcons.h"
|
|
||||||
#include "lmbrowsr.h"
|
|
||||||
#include "lmshare.h"
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* I_BrowserSetNetlogonState (NETAPI32.@)
|
* I_BrowserSetNetlogonState (NETAPI32.@)
|
||||||
|
|
|
@ -18,17 +18,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "netapi32.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"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ds);
|
WINE_DEFAULT_DEBUG_CHANNEL(ds);
|
||||||
|
|
||||||
|
|
|
@ -18,22 +18,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include "netapi32.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"
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||||
|
|
||||||
|
|
|
@ -18,25 +18,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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"
|
#include "netapi32.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||||
|
@ -232,7 +213,6 @@ NetLocalGroupAdd(
|
||||||
SAM_HANDLE ServerHandle = NULL;
|
SAM_HANDLE ServerHandle = NULL;
|
||||||
SAM_HANDLE DomainHandle = NULL;
|
SAM_HANDLE DomainHandle = NULL;
|
||||||
SAM_HANDLE AliasHandle = NULL;
|
SAM_HANDLE AliasHandle = NULL;
|
||||||
PSID DomainSid = NULL;
|
|
||||||
LPWSTR aliasname = NULL;
|
LPWSTR aliasname = NULL;
|
||||||
LPWSTR aliascomment = NULL;
|
LPWSTR aliascomment = NULL;
|
||||||
ULONG RelativeId;
|
ULONG RelativeId;
|
||||||
|
@ -277,23 +257,13 @@ NetLocalGroupAdd(
|
||||||
goto done;
|
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 */
|
/* Open the Builtin Domain */
|
||||||
Status = SamOpenDomain(ServerHandle,
|
Status = OpenBuiltinDomain(ServerHandle,
|
||||||
DOMAIN_LOOKUP,
|
DOMAIN_LOOKUP,
|
||||||
DomainSid,
|
&DomainHandle);
|
||||||
&DomainHandle);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -314,29 +284,15 @@ NetLocalGroupAdd(
|
||||||
|
|
||||||
ApiStatus = NERR_Success;
|
ApiStatus = NERR_Success;
|
||||||
|
|
||||||
/* Free the Builtin Domain SID */
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
DomainSid = NULL;
|
|
||||||
|
|
||||||
/* Close the Builtin Domain */
|
/* Close the Builtin Domain */
|
||||||
SamCloseHandle(DomainHandle);
|
SamCloseHandle(DomainHandle);
|
||||||
DomainHandle = NULL;
|
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 */
|
/* Open the account domain */
|
||||||
Status = SamOpenDomain(ServerHandle,
|
Status = OpenAccountDomain(ServerHandle,
|
||||||
DOMAIN_CREATE_ALIAS | DOMAIN_LOOKUP,
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
DomainSid,
|
DOMAIN_CREATE_ALIAS | DOMAIN_LOOKUP,
|
||||||
&DomainHandle);
|
&DomainHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
||||||
|
@ -383,9 +339,6 @@ done:
|
||||||
if (AliasHandle != NULL)
|
if (AliasHandle != NULL)
|
||||||
SamCloseHandle(AliasHandle);
|
SamCloseHandle(AliasHandle);
|
||||||
|
|
||||||
if (DomainSid != NULL)
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (DomainHandle != NULL)
|
if (DomainHandle != NULL)
|
||||||
SamCloseHandle(DomainHandle);
|
SamCloseHandle(DomainHandle);
|
||||||
|
|
||||||
|
@ -478,7 +431,6 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
||||||
UNICODE_STRING ServerName;
|
UNICODE_STRING ServerName;
|
||||||
PSAM_RID_ENUMERATION CurrentAlias;
|
PSAM_RID_ENUMERATION CurrentAlias;
|
||||||
PENUM_CONTEXT EnumContext = NULL;
|
PENUM_CONTEXT EnumContext = NULL;
|
||||||
PSID DomainSid = NULL;
|
|
||||||
ULONG i;
|
ULONG i;
|
||||||
SAM_HANDLE AliasHandle = NULL;
|
SAM_HANDLE AliasHandle = NULL;
|
||||||
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
||||||
|
@ -523,47 +475,23 @@ NET_API_STATUS WINAPI NetLocalGroupEnum(
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
Status = OpenAccountDomain(EnumContext->ServerHandle,
|
||||||
&DomainSid);
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
|
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||||
|
&EnumContext->AccountDomainHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
Status = OpenBuiltinDomain(EnumContext->ServerHandle,
|
||||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||||
DomainSid,
|
&EnumContext->BuiltinDomainHandle);
|
||||||
&EnumContext->AccountDomainHandle);
|
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenBuiltinDomain 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);
|
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +660,6 @@ NetLocalGroupGetInfo(
|
||||||
SAM_HANDLE ServerHandle = NULL;
|
SAM_HANDLE ServerHandle = NULL;
|
||||||
SAM_HANDLE DomainHandle = NULL;
|
SAM_HANDLE DomainHandle = NULL;
|
||||||
SAM_HANDLE AliasHandle = NULL;
|
SAM_HANDLE AliasHandle = NULL;
|
||||||
PSID DomainSid = NULL;
|
|
||||||
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
PALIAS_GENERAL_INFORMATION AliasInfo = NULL;
|
||||||
LPVOID Buffer = NULL;
|
LPVOID Buffer = NULL;
|
||||||
NET_API_STATUS ApiStatus = NERR_Success;
|
NET_API_STATUS ApiStatus = NERR_Success;
|
||||||
|
@ -758,23 +685,13 @@ NetLocalGroupGetInfo(
|
||||||
goto done;
|
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 */
|
/* Open the Builtin Domain */
|
||||||
Status = SamOpenDomain(ServerHandle,
|
Status = OpenBuiltinDomain(ServerHandle,
|
||||||
DOMAIN_LOOKUP,
|
DOMAIN_LOOKUP,
|
||||||
DomainSid,
|
&DomainHandle);
|
||||||
&DomainHandle);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenBuiltinDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -792,30 +709,17 @@ NetLocalGroupGetInfo(
|
||||||
|
|
||||||
if (AliasHandle == NULL)
|
if (AliasHandle == NULL)
|
||||||
{
|
{
|
||||||
if (DomainSid != NULL)
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (DomainHandle != NULL)
|
if (DomainHandle != NULL)
|
||||||
SamCloseHandle(DomainHandle);
|
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 */
|
/* Open the Acount Domain */
|
||||||
Status = SamOpenDomain(ServerHandle,
|
Status = OpenAccountDomain(ServerHandle,
|
||||||
DOMAIN_LOOKUP,
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
DomainSid,
|
DOMAIN_LOOKUP,
|
||||||
&DomainHandle);
|
&DomainHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -855,9 +759,6 @@ done:
|
||||||
if (AliasHandle != NULL)
|
if (AliasHandle != NULL)
|
||||||
SamCloseHandle(AliasHandle);
|
SamCloseHandle(AliasHandle);
|
||||||
|
|
||||||
if (DomainSid != NULL)
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (DomainHandle != NULL)
|
if (DomainHandle != NULL)
|
||||||
SamCloseHandle(DomainHandle);
|
SamCloseHandle(DomainHandle);
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,6 @@
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* 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"
|
#include "netapi32.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,4 +111,68 @@ done:
|
||||||
return Status;
|
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 */
|
/* EOF */
|
||||||
|
|
|
@ -2,6 +2,32 @@
|
||||||
#ifndef __WINE_NETAPI32_H__
|
#ifndef __WINE_NETAPI32_H__
|
||||||
#define __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
|
NET_API_STATUS
|
||||||
WINAPI
|
WINAPI
|
||||||
NetpNtStatusToApiStatus(NTSTATUS Status);
|
NetpNtStatusToApiStatus(NTSTATUS Status);
|
||||||
|
@ -15,4 +41,15 @@ GetAccountDomainSid(IN PUNICODE_STRING ServerName,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
GetBuiltinDomainSid(OUT PSID *BuiltinDomainSid);
|
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
|
#endif
|
|
@ -18,26 +18,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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"
|
#include "netapi32.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
|
||||||
|
@ -177,7 +157,7 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
||||||
if (UserInfo->AdminComment.Length > 0)
|
if (UserInfo->AdminComment.Length > 0)
|
||||||
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
||||||
|
|
||||||
/* FIXME: Add user comment here */
|
/* FIXME: usri10_usr_comment */
|
||||||
|
|
||||||
if (UserInfo->FullName.Length > 0)
|
if (UserInfo->FullName.Length > 0)
|
||||||
Size += UserInfo->FullName.Length + sizeof(WCHAR);
|
Size += UserInfo->FullName.Length + sizeof(WCHAR);
|
||||||
|
@ -239,9 +219,8 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
||||||
|
|
||||||
UserInfo1->usri1_password = NULL;
|
UserInfo1->usri1_password = NULL;
|
||||||
|
|
||||||
UserInfo1->usri1_password_age = 0; /* FIXME */
|
/* FIXME: UserInfo1->usri1_password_age */
|
||||||
|
/* FIXME: UserInfo1->usri1_priv */
|
||||||
UserInfo1->usri1_priv = 0; /* FIXME */
|
|
||||||
|
|
||||||
if (UserInfo->HomeDirectory.Length > 0)
|
if (UserInfo->HomeDirectory.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +289,7 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
||||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->AdminComment.Length + sizeof(WCHAR));
|
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)
|
if (UserInfo->FullName.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +302,6 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
// case 11:
|
// case 11:
|
||||||
|
|
||||||
case 20:
|
case 20:
|
||||||
|
@ -592,10 +570,7 @@ NetUserEnum(LPCWSTR servername,
|
||||||
PSAM_RID_ENUMERATION CurrentUser;
|
PSAM_RID_ENUMERATION CurrentUser;
|
||||||
PENUM_CONTEXT EnumContext = NULL;
|
PENUM_CONTEXT EnumContext = NULL;
|
||||||
LPVOID Buffer = NULL;
|
LPVOID Buffer = NULL;
|
||||||
PSID DomainSid = NULL;
|
|
||||||
|
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
SAM_HANDLE UserHandle = NULL;
|
SAM_HANDLE UserHandle = NULL;
|
||||||
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
||||||
|
|
||||||
|
@ -639,47 +614,23 @@ NetUserEnum(LPCWSTR servername,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GetAccountDomainSid((servername != NULL) ? &ServerName : NULL,
|
Status = OpenAccountDomain(EnumContext->ServerHandle,
|
||||||
&DomainSid);
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
|
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||||
|
&EnumContext->AccountDomainHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("GetAccountDomainSid failed (Status %08lx)\n", Status);
|
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = SamOpenDomain(EnumContext->ServerHandle,
|
Status = OpenBuiltinDomain(EnumContext->ServerHandle,
|
||||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||||
DomainSid,
|
&EnumContext->BuiltinDomainHandle);
|
||||||
&EnumContext->AccountDomainHandle);
|
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenBuiltinDomain 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);
|
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -871,7 +822,6 @@ NetUserGetInfo(LPCWSTR servername,
|
||||||
SAM_HANDLE ServerHandle = NULL;
|
SAM_HANDLE ServerHandle = NULL;
|
||||||
SAM_HANDLE AccountDomainHandle = NULL;
|
SAM_HANDLE AccountDomainHandle = NULL;
|
||||||
SAM_HANDLE UserHandle = NULL;
|
SAM_HANDLE UserHandle = NULL;
|
||||||
PSID DomainSid = NULL;
|
|
||||||
PULONG RelativeIds = NULL;
|
PULONG RelativeIds = NULL;
|
||||||
PSID_NAME_USE Use = NULL;
|
PSID_NAME_USE Use = NULL;
|
||||||
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
PUSER_ACCOUNT_INFORMATION UserInfo = NULL;
|
||||||
|
@ -899,24 +849,14 @@ NetUserGetInfo(LPCWSTR servername,
|
||||||
goto done;
|
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 */
|
/* Open the Account Domain */
|
||||||
Status = SamOpenDomain(ServerHandle,
|
Status = OpenAccountDomain(ServerHandle,
|
||||||
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
(servername != NULL) ? &ServerName : NULL,
|
||||||
DomainSid,
|
DOMAIN_LIST_ACCOUNTS | DOMAIN_LOOKUP,
|
||||||
&AccountDomainHandle);
|
&AccountDomainHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR("SamOpenDomain failed (Status %08lx)\n", Status);
|
ERR("OpenAccountDomain failed (Status %08lx)\n", Status);
|
||||||
ApiStatus = NetpNtStatusToApiStatus(Status);
|
ApiStatus = NetpNtStatusToApiStatus(Status);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -989,9 +929,6 @@ done:
|
||||||
if (Use != NULL)
|
if (Use != NULL)
|
||||||
SamFreeMemory(Use);
|
SamFreeMemory(Use);
|
||||||
|
|
||||||
if (DomainSid != NULL)
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DomainSid);
|
|
||||||
|
|
||||||
if (AccountDomainHandle != NULL)
|
if (AccountDomainHandle != NULL)
|
||||||
SamCloseHandle(AccountDomainHandle);
|
SamCloseHandle(AccountDomainHandle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue