[NETAPI32]
[reactos.git] / reactos / dll / win32 / netapi32 / wksta_new.c
index 6228047..0841ef6 100644 (file)
@@ -139,7 +139,48 @@ WKSSVC_IMPERSONATE_HANDLE_unbind(WKSSVC_IMPERSONATE_HANDLE pszSystemName,
 
 
 NET_API_STATUS
-NET_API_FUNCTION
+WINAPI
+NetAddAlternateComputerName(
+    _In_opt_ LPCWSTR Server,
+    _In_ LPCWSTR AlternateName,
+    _In_opt_ LPCWSTR DomainAccount,
+    _In_opt_ LPCWSTR DomainAccountPassword,
+    _In_ ULONG Reserved)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetAddAlternateComputerName(%s %s %s %s 0x%lx)\n",
+          debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
+          debugstr_w(DomainAccountPassword), Reserved);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrAddAlternateComputerName(BindingHandle,
+                                              (PWSTR)Server,
+                                              (PWSTR)AlternateName,
+                                              (PWSTR)DomainAccount,
+                                              EncryptedPassword,
+                                              Reserved);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+#if 0
+NET_API_STATUS
+WINAPI
 NetGetJoinInformation(
     LPCWSTR Server,
     LPWSTR *Name,
@@ -167,6 +208,249 @@ NetGetJoinInformation(
 
     return status;
 }
+#endif
+
+
+NET_API_STATUS
+WINAPI
+NetGetJoinableOUs(
+    _In_ LPCWSTR lpServer,
+    _In_ LPCWSTR lpDomain,
+    _In_ LPCWSTR lpAccount,
+    _In_ LPCWSTR lpPassword,
+    _Out_ DWORD *OUCount,
+    _Out_ LPWSTR **OUs)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetGetJoinableOUs(%s %s %s %s %p %p)\n",
+          debugstr_w(lpServer), debugstr_w(lpDomain), debugstr_w(lpAccount),
+          debugstr_w(lpPassword), OUCount, OUs);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrGetJoinableOUs2(BindingHandle,
+                                     (PWSTR)lpServer,
+                                     (PWSTR)lpDomain,
+                                     (PWSTR)lpAccount,
+                                     EncryptedPassword,
+                                     OUCount,
+                                     OUs);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetJoinDomain(
+    _In_ LPCWSTR lpServer,
+    _In_ LPCWSTR lpDomain,
+    _In_ LPCWSTR lpAccountOU,
+    _In_ LPCWSTR lpAccount,
+    _In_ LPCWSTR lpPassword,
+    _In_ DWORD fJoinOptions)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetJoinDomain(%s %s %s %s 0x%lx)\n",
+          debugstr_w(lpServer), debugstr_w(lpDomain), debugstr_w(lpAccountOU),
+          debugstr_w(lpAccount), debugstr_w(lpPassword), fJoinOptions);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrJoinDomain2(BindingHandle,
+                                 (PWSTR)lpServer,
+                                 (PWSTR)lpDomain,
+                                 (PWSTR)lpAccountOU,
+                                 (PWSTR)lpAccount,
+                                 EncryptedPassword,
+                                 fJoinOptions);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetRemoveAlternateComputerName(
+    _In_opt_ LPCWSTR Server,
+    _In_ LPCWSTR AlternateName,
+    _In_opt_ LPCWSTR DomainAccount,
+    _In_opt_ LPCWSTR DomainAccountPassword,
+    _In_ ULONG Reserved)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetRemoveAlternateComputerName(%s %s %s %s 0x%lx)\n",
+          debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
+          debugstr_w(DomainAccountPassword), Reserved);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrRemoveAlternateComputerName(BindingHandle,
+                                                 (PWSTR)Server,
+                                                 (PWSTR)AlternateName,
+                                                 (PWSTR)DomainAccount,
+                                                 EncryptedPassword,
+                                                 Reserved);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetRenameMachineInDomain(
+    _In_ LPCWSTR lpServer,
+    _In_ LPCWSTR lpNewMachineName,
+    _In_ LPCWSTR lpAccount,
+    _In_ LPCWSTR lpPassword,
+    _In_ DWORD fRenameOptions)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetRenameMachineInDomain(%s %s %s %s 0x%lx)\n",
+          debugstr_w(lpServer), debugstr_w(lpNewMachineName), debugstr_w(lpAccount),
+          debugstr_w(lpPassword), fRenameOptions);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrRenameMachineInDomain2(BindingHandle,
+                                            (PWSTR)lpServer,
+                                            (PWSTR)lpNewMachineName,
+                                            (PWSTR)lpAccount,
+                                            EncryptedPassword,
+                                            fRenameOptions);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetSetPrimaryComputerName(
+    _In_opt_ LPCWSTR Server,
+    _In_ LPCWSTR PrimaryName,
+    _In_opt_ LPCWSTR DomainAccount,
+    _In_opt_ LPCWSTR DomainAccountPassword,
+    _In_ ULONG Reserved)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetSetPrimaryComputerName(%s %s %s %s %lu)\n",
+          debugstr_w(Server), debugstr_w(PrimaryName), debugstr_w(DomainAccount),
+          debugstr_w(DomainAccountPassword), Reserved);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrSetPrimaryComputerName(BindingHandle,
+                                            (PWSTR)Server,
+                                            (PWSTR)PrimaryName,
+                                            (PWSTR)DomainAccount,
+                                            EncryptedPassword,
+                                            Reserved);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetUnjoinDomain(
+    _In_ LPCWSTR lpServer,
+    _In_ LPCWSTR lpAccount,
+    _In_ LPCWSTR lpPassword,
+    _In_ DWORD fUnjoinOptions)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetUnjoinDomain(%s %s %s %s 0x%lx)\n",
+          debugstr_w(lpServer), debugstr_w(lpAccount),
+          debugstr_w(lpPassword), fUnjoinOptions);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrUnjoinDomain2(BindingHandle,
+                                   (PWSTR)lpServer,
+                                   (PWSTR)lpAccount,
+                                   EncryptedPassword,
+                                   fUnjoinOptions);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
 
 
 NET_API_STATUS
@@ -310,6 +594,46 @@ NetUseEnum(
 }
 
 
+NET_API_STATUS
+WINAPI
+NetValidateName(
+    _In_ LPCWSTR lpServer,
+    _In_ LPCWSTR lpName,
+    _In_ LPCWSTR lpAccount,
+    _In_ LPCWSTR lpPassword,
+    _In_ NETSETUP_NAME_TYPE NameType)
+{
+    PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+    handle_t BindingHandle;
+    NET_API_STATUS status;
+
+    TRACE("NetValidateName(%s %s %s %s %u)\n",
+          debugstr_w(lpServer), debugstr_w(lpName), debugstr_w(lpAccount),
+          debugstr_w(lpPassword), NameType);
+
+    /* FIXME */
+    BindingHandle = NULL;
+    EncryptedPassword = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrValidateName2(BindingHandle,
+                                   (PWSTR)lpServer,
+                                   (PWSTR)lpName,
+                                   (PWSTR)lpAccount,
+                                   EncryptedPassword,
+                                   NameType);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
 NET_API_STATUS
 WINAPI
 NetUseGetInfo(
@@ -342,6 +666,7 @@ NetUseGetInfo(
 }
 
 
+#if 0
 NET_API_STATUS
 WINAPI
 NetWkstaGetInfo(
@@ -354,6 +679,9 @@ NetWkstaGetInfo(
     TRACE("NetWkstaGetInfo(%s, %d, %p)\n", debugstr_w(servername),
           level, bufptr);
 
+    if (bufptr == NULL)
+        return ERROR_INVALID_PARAMETER;
+
     *bufptr = NULL;
 
     RpcTryExcept
@@ -370,6 +698,7 @@ NetWkstaGetInfo(
 
     return status;
 }
+#endif
 
 
 NET_API_STATUS
@@ -460,6 +789,7 @@ NetWkstaTransportDel(
 }
 
 
+#if 0
 NET_API_STATUS
 WINAPI
 NetWkstaTransportEnum(
@@ -621,6 +951,7 @@ NetWkstaUserGetInfo(
 
     return status;
 }
+#endif
 
 
 NET_API_STATUS