Author: ekohl
Date: Tue Sep 26 09:03:27 2017
New Revision: 75972

URL: http://svn.reactos.org/svn/reactos?rev=75972&view=rev
Log:
[NETAPI32]
Implement NetStatisticsGet() and move NetpNtStatusToApiStatus().

Added:
    trunk/reactos/dll/win32/netapi32/misc.c   (with props)
Modified:
    trunk/reactos/dll/win32/netapi32/CMakeLists.txt
    trunk/reactos/dll/win32/netapi32/netapi32.c

Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/CMakeLists.txt?rev=75972&r1=75971&r2=75972&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/CMakeLists.txt     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/CMakeLists.txt     [iso-8859-1] Tue Sep 26 
09:03:27 2017
@@ -20,6 +20,7 @@
     dssetup.c
     group.c
     local_group.c
+    misc.c
     nbcmdqueue.c
     nbnamecache.c
     nbt.c

Added: trunk/reactos/dll/win32/netapi32/misc.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/misc.c?rev=75972
==============================================================================
--- trunk/reactos/dll/win32/netapi32/misc.c     (added)
+++ trunk/reactos/dll/win32/netapi32/misc.c     [iso-8859-1] Tue Sep 26 
09:03:27 2017
@@ -0,0 +1,115 @@
+/*
+ * PROJECT:     NetAPI DLL
+ * LICENSE:     GPL-2.0 (https://spdx.org/licenses/GPL-2.0)
+ * PURPOSE:     Miscellaneous functions
+ * COPYRIGHT:   Copyright 2017 Eric Kohl ([email protected])
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include "netapi32.h"
+
+#include <rpc.h>
+#include "srvsvc_c.h"
+#include "wkssvc_c.h"
+
+
+WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
+
+/* FUNCTIONS *****************************************************************/
+
+NET_API_STATUS
+WINAPI
+NetStatisticsGet(
+    _In_ LPWSTR server,
+    _In_ LPWSTR service,
+    _In_ DWORD level,
+    _In_ DWORD options,
+    _Out_ LPBYTE *bufptr)
+{
+    NET_API_STATUS status = ERROR_NOT_SUPPORTED;
+
+    TRACE("NetStatisticsGet(%s %s %lu %lu %p)\n",
+          debugstr_w(server), debugstr_w(service), level, options, bufptr);
+
+    *bufptr = NULL;
+
+    if (_wcsicmp(service, L"LanmanWorkstation") == 0)
+    {
+        if (level != 0)
+            return ERROR_INVALID_LEVEL;
+
+        if (options != 0)
+            return ERROR_INVALID_PARAMETER;
+
+        RpcTryExcept
+        {
+            status = NetrWorkstationStatisticsGet(server,
+                                                  L"LanmanWorkstation",
+                                                  level,
+                                                  options,
+                                                  
(LPSTAT_WORKSTATION_0*)bufptr);
+        }
+        RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+        {
+            status = I_RpcMapWin32Status(RpcExceptionCode());
+        }
+        RpcEndExcept;
+    }
+    else if (_wcsicmp(service, L"LanmanServer") == 0)
+    {
+        if (level != 0)
+            return ERROR_INVALID_LEVEL;
+
+        if (options != 0)
+            return ERROR_INVALID_PARAMETER;
+
+        RpcTryExcept
+        {
+            status = NetrServerStatisticsGet(server,
+                                             L"LanmanServer",
+                                             level,
+                                             options,
+                                             (LPSTAT_SERVER_0 *)bufptr);
+        }
+        RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+        {
+            status = I_RpcMapWin32Status(RpcExceptionCode());
+        }
+        RpcEndExcept;
+    }
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetpNtStatusToApiStatus(
+    _In_ NTSTATUS Status)
+{
+    NET_API_STATUS ApiStatus;
+
+    switch (Status)
+    {
+        case STATUS_SUCCESS:
+            ApiStatus = NERR_Success;
+            break;
+
+        case STATUS_INVALID_ACCOUNT_NAME:
+            ApiStatus = NERR_BadUsername;
+            break;
+
+        case STATUS_PASSWORD_RESTRICTION:
+            ApiStatus = NERR_PasswordTooShort;
+            break;
+
+        default:
+            ApiStatus = RtlNtStatusToDosError(Status);
+            break;
+    }
+
+    return ApiStatus;
+}
+
+/* EOF */

Propchange: trunk/reactos/dll/win32/netapi32/misc.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/win32/netapi32/netapi32.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32.c?rev=75972&r1=75971&r2=75972&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.c [iso-8859-1] Tue Sep 26 
09:03:27 2017
@@ -101,42 +101,3 @@
     return ret;
 }
 
-
-/************************************************************
- *                NetStatisticsGet  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetStatisticsGet(LMSTR server, LMSTR service,
-                                       DWORD level, DWORD options,
-                                       LPBYTE *bufptr)
-{
-    TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr);
-    return NERR_InternalError;
-}
-
-NET_API_STATUS
-WINAPI
-NetpNtStatusToApiStatus(NTSTATUS Status)
-{
-    NET_API_STATUS ApiStatus;
-
-    switch (Status)
-    {
-        case STATUS_SUCCESS:
-            ApiStatus = NERR_Success;
-            break;
-
-        case STATUS_INVALID_ACCOUNT_NAME:
-            ApiStatus = NERR_BadUsername;
-            break;
-
-        case STATUS_PASSWORD_RESTRICTION:
-            ApiStatus = NERR_PasswordTooShort;
-            break;
-
-        default:
-            ApiStatus = RtlNtStatusToDosError(Status);
-            break;
-    }
-
-    return ApiStatus;
-}


Reply via email to