Author: ekohl Date: Sun Jun 4 15:46:29 2017 New Revision: 74913
URL: http://svn.reactos.org/svn/reactos?rev=74913&view=rev Log: [NETAPI32] - 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.
Removed: trunk/reactos/dll/win32/netapi32/share.c Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/dll/win32/netapi32/srvsvc.c
Modified: trunk/reactos/dll/win32/netapi32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/CMakeLis... ============================================================================== --- trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/CMakeLists.txt [iso-8859-1] Sun Jun 4 15:46:29 2017 @@ -26,7 +26,6 @@ netapi32.c netbios.c schedule.c - share.c srvsvc.c user.c wksta.c
Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi32... ============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jun 4 15:46:29 2017 @@ -144,9 +144,9 @@ @ 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
Removed: trunk/reactos/dll/win32/netapi32/share.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/share.c?... ============================================================================== --- trunk/reactos/dll/win32/netapi32/share.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/share.c (removed) @@ -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; -}
Modified: trunk/reactos/dll/win32/netapi32/srvsvc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/srvsvc.c... ============================================================================== --- trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] Sun Jun 4 15:46:29 2017 @@ -72,14 +72,148 @@
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( _In_ LPCWSTR UncServerName, _Out_ LPBYTE *BufferPtr) { 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 @@ 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 @@ 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);