[Wine-patches] [eter-2.1] netapi32: Better stub NetStatisticsGet().

Dmitry Timoshkov dtimoshkov на etersoft.ru
Пн Май 29 08:31:31 MSK 2017


From: Bruno Jesus <00cpxxx на gmail.com>
---
 dlls/netapi32/netapi32.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/dlls/netapi32/netapi32.c b/dlls/netapi32/netapi32.c
index a24320c2d3..f07280a2b8 100644
--- a/dlls/netapi32/netapi32.c
+++ b/dlls/netapi32/netapi32.c
@@ -178,8 +178,51 @@ 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;
+    int res;
+    static const WCHAR SERVICE_WORKSTATION[] = {
+                 'L', 'a', 'n', 'm', 'a', 'n',
+                 'W', 'o', 'r', 'k', 's', 't', 'a', 't', 'i', 'o', 'n', '\0'};
+    static const WCHAR SERVICE_SERVER[] = {
+                 'L', 'a', 'n', 'm', 'a', 'n',
+                 'S', 'e', 'r', 'v', 'e', 'r', '\0'};
+    union
+    {
+        STAT_WORKSTATION_0 workst;
+        STAT_SERVER_0 server;
+    } *stat;
+    void *dataptr;
+
+    TRACE("(server %s, service %s, level %d, options %d, buffer %p): stub\n",
+          debugstr_w(server), debugstr_w(service), level, options, bufptr);
+
+    res = NetApiBufferAllocate(sizeof(*stat), &dataptr);
+    if (res != NERR_Success) return res;
+
+    res = NERR_InternalError;
+    stat = dataptr;
+    switch (level)
+    {
+        case 0:
+            if (!lstrcmpW(service, SERVICE_WORKSTATION))
+            {
+                /* Fill the struct STAT_WORKSTATION_0 properly */
+                memset(&stat->workst, 0, sizeof(stat->workst));
+                res = NERR_Success;
+            }
+            else if (!lstrcmpW(service, SERVICE_SERVER))
+            {
+                /* Fill the struct STAT_SERVER_0 properly */
+                memset(&stat->server, 0, sizeof(stat->server));
+                res = NERR_Success;
+            }
+            break;
+    }
+    if (res != NERR_Success)
+        NetApiBufferFree(dataptr);
+    else
+        *bufptr = dataptr;
+
+    return res;
 }
 
 DWORD WINAPI NetpNetBiosStatusToApiStatus(DWORD nrc)
-- 
2.12.2



Подробная информация о списке рассылки Wine-patches