[NETAPI32]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 4 Jun 2017 15:46:29 +0000 (15:46 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 4 Jun 2017 15:46:29 +0000 (15:46 +0000)
- Implement NetFileClose, NetFileEnum and NetFileGetInfo. These functions call their counterparts in the server service.
- Get rid of share.c as it is no longer needed.

svn path=/trunk/; revision=74913

reactos/dll/win32/netapi32/CMakeLists.txt
reactos/dll/win32/netapi32/netapi32.spec
reactos/dll/win32/netapi32/share.c [deleted file]
reactos/dll/win32/netapi32/srvsvc.c

index 9f8c3d5..f382b80 100644 (file)
@@ -26,7 +26,6 @@ list(APPEND SOURCE
     netapi32.c
     netbios.c
     schedule.c
-    share.c
     srvsvc.c
     user.c
     wksta.c
index 5697831..38b6902 100644 (file)
 @ stub NetErrorLogClear
 @ stub NetErrorLogRead
 @ stub NetErrorLogWrite
-@ stub NetFileClose
+@ stdcall NetFileClose(wstr long)
 @ stdcall NetFileEnum(wstr wstr wstr long ptr long ptr ptr ptr)
-@ stub NetFileGetInfo
+@ stdcall NetFileGetInfo(wstr long long ptr)
 @ stdcall NetGetAnyDCName(wstr wstr ptr)
 @ stdcall NetGetDCName(wstr wstr ptr)
 @ stub NetGetDisplayInformationIndex
diff --git a/reactos/dll/win32/netapi32/share.c b/reactos/dll/win32/netapi32/share.c
deleted file mode 100644 (file)
index 52463e3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2006 Paul Vriens
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "netapi32.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(share);
-
-/************************************************************
- *                NetFileEnum  (NETAPI32.@)
- */
-NET_API_STATUS WINAPI NetFileEnum(
-    LPWSTR ServerName, LPWSTR BasePath, LPWSTR UserName,
-    DWORD Level, LPBYTE* BufPtr, DWORD PrefMaxLen,
-    LPDWORD EntriesRead, LPDWORD TotalEntries, PDWORD_PTR ResumeHandle)
-{
-    FIXME("(%s, %s, %s, %u): stub\n", debugstr_w(ServerName), debugstr_w(BasePath),
-        debugstr_w(UserName), Level);
-    return ERROR_NOT_SUPPORTED;
-}
index 2b0d179..6b3374d 100644 (file)
@@ -70,6 +70,140 @@ SRVSVC_HANDLE_unbind(SRVSVC_HANDLE pszSystemName,
 }
 
 
+NET_API_STATUS
+WINAPI
+NetFileClose(
+    _In_ LMSTR servername,
+    _In_ DWORD fileid)
+{
+    NET_API_STATUS status;
+
+    TRACE("NetFileClose(%s %lu)\n",
+          debugstr_w(servername), fileid);
+
+    RpcTryExcept
+    {
+        status = NetrFileClose(servername,
+                               fileid);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetFileEnum(
+    _In_ LMSTR servername,
+    _In_ LMSTR basepath,
+    _In_ LMSTR username,
+    _In_ DWORD level,
+    _Out_ LPBYTE *bufptr,
+    _In_ DWORD prefmaxlen,
+    _Out_ LPDWORD entriesread,
+    _Out_ LPDWORD totalentries,
+    _Inout_ PDWORD_PTR resume_handle)
+{
+    FILE_ENUM_STRUCT EnumStruct;
+    FILE_INFO_2_CONTAINER Level2Container = {0, NULL};
+    FILE_INFO_3_CONTAINER Level3Container = {0, NULL};
+    NET_API_STATUS status;
+
+    TRACE("NetFileEnum(%s %s %s %lu %p %lu %p %p %p)\n",
+          debugstr_w(servername), debugstr_w(basepath), debugstr_w(username),
+          level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
+
+    if (level != 2 && level != 3)
+        return ERROR_INVALID_LEVEL;
+
+    EnumStruct.Level = level;
+    switch (level)
+    {
+        case 2:
+            EnumStruct.FileInfo.Level2 = &Level2Container;
+            break;
+
+        case 3:
+            EnumStruct.FileInfo.Level3 = &Level3Container;
+            break;
+    }
+
+    RpcTryExcept
+    {
+        status = NetrFileEnum(servername,
+                              basepath,
+                              username,
+                              &EnumStruct,
+                              prefmaxlen,
+                              totalentries,
+                              (PDWORD)resume_handle);
+
+        switch (level)
+        {
+            case 2:
+                if (EnumStruct.FileInfo.Level2->Buffer != NULL)
+                {
+                    *bufptr = (LPBYTE)EnumStruct.FileInfo.Level2->Buffer;
+                    *entriesread = EnumStruct.FileInfo.Level2->EntriesRead;
+                }
+                break;
+
+            case 3:
+                if (EnumStruct.FileInfo.Level3->Buffer != NULL)
+                {
+                    *bufptr = (LPBYTE)EnumStruct.FileInfo.Level3->Buffer;
+                    *entriesread = EnumStruct.FileInfo.Level3->EntriesRead;
+                }
+                break;
+        }
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetFileGetInfo(
+    _In_ LMSTR servername,
+    _In_ DWORD fileid,
+    _In_ DWORD level,
+    _Out_ LPBYTE *bufptr)
+{
+    NET_API_STATUS status;
+
+    TRACE("NetFileGetInfo(%s %lu %lu %p)\n",
+          debugstr_w(servername), fileid, level, bufptr);
+
+    *bufptr = NULL;
+
+    RpcTryExcept
+    {
+        status = NetrFileGetInfo(servername,
+                                 fileid,
+                                 level,
+                                 (LPFILE_INFO)bufptr);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
 NET_API_STATUS
 WINAPI
 NetRemoteTOD(
@@ -78,8 +212,8 @@ NetRemoteTOD(
 {
     NET_API_STATUS status;
 
-    TRACE("NetRemoteTOD(%s, %p)\n", debugstr_w(UncServerName),
-          BufferPtr);
+    TRACE("NetRemoteTOD(%s %p)\n",
+          debugstr_w(UncServerName), BufferPtr);
 
     *BufferPtr = NULL;
 
@@ -147,7 +281,7 @@ NetSessionEnum(
     SESSION_INFO_502_CONTAINER Level502Container = {0, NULL};
     NET_API_STATUS status;
 
-    FIXME("NetSessionEnum(%s %s %s %lu %p %lu %p %p %p)\n",
+    TRACE("NetSessionEnum(%s %s %s %lu %p %lu %p %p %p)\n",
           debugstr_w(servername), debugstr_w(UncClientName), debugstr_w(username),
           level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
 
@@ -264,7 +398,7 @@ NetSessionGetInfo(
     DWORD dwTotalEntries;
     NET_API_STATUS status;
 
-    FIXME("NetSessionGetInfo(%s %s %s %lu %p)\n",
+    TRACE("NetSessionGetInfo(%s %s %s %lu %p)\n",
           debugstr_w(servername), debugstr_w(UncClientName),
           debugstr_w(username), level, bufptr);