Author: ekohl
Date: Sun Mar 1 15:41:11 2015
New Revision: 66523
URL:
http://svn.reactos.org/svn/reactos?rev=66523&view=rev
Log:
[NETAPI32]
Implement the Directory Service Setup (dssetup) client interface.
Added:
trunk/reactos/dll/win32/netapi32/dssetup.c (with props)
Modified:
trunk/reactos/dll/win32/netapi32/CMakeLists.txt
trunk/reactos/dll/win32/netapi32/ds.c
Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] Sun Mar 1 15:41:11 2015
@@ -5,13 +5,16 @@
add_definitions(-D__WINESRC__)
spec2def(netapi32.dll netapi32.spec ADD_IMPORTLIB)
-add_rpc_files(client ${REACTOS_SOURCE_DIR}/include/reactos/idl/wkssvc.idl)
+add_rpc_files(client
+ ${REACTOS_SOURCE_DIR}/include/reactos/idl/dssetup.idl
+ ${REACTOS_SOURCE_DIR}/include/reactos/idl/wkssvc.idl)
list(APPEND SOURCE
access.c
apibuf.c
browsr.c
ds.c
+ dssetup.c
group.c
local_group.c
misc.c
@@ -25,6 +28,7 @@
wksta.c
wksta_new.c
netapi32.h
+ ${CMAKE_CURRENT_BINARY_DIR}/dssetup_c.c
${CMAKE_CURRENT_BINARY_DIR}/wkssvc_c.c)
add_library(netapi32 SHARED
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] Sun Mar 1 15:41:11 2015
@@ -65,113 +65,3 @@
TRACE("(%p)\n", Buffer);
HeapFree(GetProcessHeap(), 0, Buffer);
}
-
-/************************************************************
- * DsRoleGetPrimaryDomainInformation (NETAPI32.@)
- *
- * PARAMS
- * lpServer [I] Pointer to UNICODE string with ComputerName
- * InfoLevel [I] Type of data to retrieve
- * Buffer [O] Pointer to to the requested data
- *
- * RETURNS
- *
- * NOTES
- * When lpServer is NULL, use the local computer
- */
-DWORD WINAPI DsRoleGetPrimaryDomainInformation(
- LPCWSTR lpServer, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
- PBYTE* Buffer)
-{
- DWORD ret;
-
- FIXME("(%p, %d, %p) stub\n", lpServer, InfoLevel, Buffer);
-
- /* Check some input parameters */
-
- if (!Buffer) return ERROR_INVALID_PARAMETER;
- if ((InfoLevel < DsRolePrimaryDomainInfoBasic) || (InfoLevel >
DsRoleOperationState)) return ERROR_INVALID_PARAMETER;
-
- *Buffer = NULL;
- switch (InfoLevel)
- {
- case DsRolePrimaryDomainInfoBasic:
- {
- LSA_OBJECT_ATTRIBUTES ObjectAttributes;
- LSA_HANDLE PolicyHandle;
- PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo;
- NTSTATUS NtStatus;
- int logon_domain_sz;
- DWORD size;
- PDSROLE_PRIMARY_DOMAIN_INFO_BASIC basic;
-
- ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));
- NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes,
- POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle);
- if (NtStatus != STATUS_SUCCESS)
- {
- TRACE("LsaOpenPolicyFailed with NT status %x\n",
- LsaNtStatusToWinError(NtStatus));
- return ERROR_OUTOFMEMORY;
- }
- LsaQueryInformationPolicy(PolicyHandle,
- PolicyAccountDomainInformation, (PVOID*)&DomainInfo);
- logon_domain_sz = lstrlenW(DomainInfo->DomainName.Buffer) + 1;
- LsaClose(PolicyHandle);
-
- size = sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC) +
- logon_domain_sz * sizeof(WCHAR);
- basic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
- if (basic)
- {
- basic->MachineRole = DsRole_RoleStandaloneWorkstation;
- basic->DomainNameFlat = (LPWSTR)((LPBYTE)basic +
- sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
- lstrcpyW(basic->DomainNameFlat, DomainInfo->DomainName.Buffer);
- ret = ERROR_SUCCESS;
- }
- else
- ret = ERROR_OUTOFMEMORY;
- *Buffer = (PBYTE)basic;
- LsaFreeMemory(DomainInfo);
- }
- break;
-
- case DsRoleUpgradeStatus:
- {
- PDSROLE_UPGRADE_STATUS_INFO buffer;
-
- buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(DSROLE_UPGRADE_STATUS_INFO));
- if (buffer)
- {
- buffer->OperationState = 0;
- buffer->PreviousServerState = 0;
- ret = ERROR_SUCCESS;
- }
- else
- ret = ERROR_OUTOFMEMORY;
- *Buffer = (PBYTE)buffer;
- }
- break;
-
- case DsRoleOperationState:
- {
- PDSROLE_OPERATION_STATE_INFO buffer;
-
- buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(DSROLE_OPERATION_STATE_INFO));
- if (buffer)
- {
- buffer->OperationState = DsRoleOperationIdle;
- ret = ERROR_SUCCESS;
- }
- else
- ret = ERROR_OUTOFMEMORY;
- *Buffer = (PBYTE)buffer;
- }
- break;
-
- default:
- ret = ERROR_CALL_NOT_IMPLEMENTED;
- }
- return ret;
-}
Added: trunk/reactos/dll/win32/netapi32/dssetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/dssetup…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/dssetup.c (added)
+++ trunk/reactos/dll/win32/netapi32/dssetup.c [iso-8859-1] Sun Mar 1 15:41:11 2015
@@ -0,0 +1,128 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: NetAPI DLL
+ * FILE: reactos/dll/win32/netapi32/dssetup.c
+ * PURPOSE: Directory Service Setup interface code
+ * PROGRAMMERS: Eric Kohl
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "netapi32.h"
+
+#include <rpc.h>
+#include "dssetup_c.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
+
+/* FUNCTIONS *****************************************************************/
+
+static
+RPC_STATUS
+DsSetupBind(
+ LPWSTR lpServerName,
+ handle_t *hBinding)
+{
+ LPWSTR pszStringBinding;
+ RPC_STATUS status;
+
+ TRACE("DsSetupBind() called\n");
+
+ *hBinding = NULL;
+
+ status = RpcStringBindingComposeW(NULL,
+ L"ncacn_np",
+ lpServerName,
+ L"\\pipe\\lsarpc",
+ NULL,
+ &pszStringBinding);
+ if (status)
+ {
+ TRACE("RpcStringBindingCompose returned 0x%x\n", status);
+ return status;
+ }
+
+ /* Set the binding handle that will be used to bind to the server. */
+ status = RpcBindingFromStringBindingW(pszStringBinding,
+ hBinding);
+ if (status)
+ {
+ TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
+ }
+
+ status = RpcStringFreeW(&pszStringBinding);
+ if (status)
+ {
+ TRACE("RpcStringFree returned 0x%x\n", status);
+ }
+
+ return status;
+}
+
+
+static
+void
+DsSetupUnbind(
+ handle_t hBinding)
+{
+ RPC_STATUS status;
+
+ TRACE("DsSetupUnbind()\n");
+
+ status = RpcBindingFree(&hBinding);
+ if (status)
+ {
+ TRACE("RpcBindingFree returned 0x%x\n", status);
+ }
+}
+
+
+DWORD
+WINAPI
+DsRoleGetPrimaryDomainInformation(
+ LPCWSTR lpServer,
+ DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
+ PBYTE* Buffer)
+{
+ handle_t hBinding = NULL;
+ NET_API_STATUS status;
+
+ TRACE("DsRoleGetPrimaryDomainInformation(%p, %d, %p)\n",
+ lpServer, InfoLevel, Buffer);
+
+ /* Check some input parameters */
+
+ if (!Buffer)
+ return ERROR_INVALID_PARAMETER;
+
+ if ((InfoLevel < DsRolePrimaryDomainInfoBasic) || (InfoLevel >
DsRoleOperationState))
+ return ERROR_INVALID_PARAMETER;
+
+ *Buffer = NULL;
+
+ status = DsSetupBind((LPWSTR)lpServer, &hBinding);
+ if (status)
+ {
+ TRACE("DsSetupBind() failed (Status %lu\n)", status);
+ return status;
+ }
+
+ RpcTryExcept
+ {
+ status = DsRolerGetPrimaryDomainInformation(hBinding,
+ InfoLevel,
+ (PDSROLER_PRIMARY_DOMAIN_INFORMATION
*)Buffer);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ if (hBinding != NULL)
+ DsSetupUnbind(hBinding);
+
+ return status;
+}
+
+/* EOF */
Propchange: trunk/reactos/dll/win32/netapi32/dssetup.c
------------------------------------------------------------------------------
svn:eol-style = native