From 3138c9072b34e434c407091a04a45272af365b84 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 18 Jun 2017 22:43:24 +0000 Subject: [PATCH] [NETAPI32] Implement NetConnectionEnum(). This function calls its counterpart in the server service. svn path=/trunk/; revision=75111 --- reactos/dll/win32/netapi32/netapi32.spec | 2 +- reactos/dll/win32/netapi32/srvsvc.c | 74 ++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/netapi32/netapi32.spec b/reactos/dll/win32/netapi32/netapi32.spec index e215eeb28fc..68f47b9d1e8 100644 --- a/reactos/dll/win32/netapi32/netapi32.spec +++ b/reactos/dll/win32/netapi32/netapi32.spec @@ -113,7 +113,7 @@ @ stdcall NetConfigGet(wstr wstr wstr ptr) @ stdcall NetConfigGetAll(wstr wstr ptr) @ stdcall NetConfigSet(wstr wstr wstr long long ptr long) -@ stub NetConnectionEnum +@ stdcall NetConnectionEnum(wstr wstr long ptr long ptr ptr ptr) @ stub NetDfsAdd @ stub NetDfsAddFtRoot @ stub NetDfsAddStdRoot diff --git a/reactos/dll/win32/netapi32/srvsvc.c b/reactos/dll/win32/netapi32/srvsvc.c index a932592425f..139bcfc6f7e 100644 --- a/reactos/dll/win32/netapi32/srvsvc.c +++ b/reactos/dll/win32/netapi32/srvsvc.c @@ -70,6 +70,80 @@ SRVSVC_HANDLE_unbind(SRVSVC_HANDLE pszSystemName, } +NET_API_STATUS +WINAPI +NetConnectionEnum( + _In_ LMSTR servername, + _In_ LMSTR qualifier, + _In_ DWORD level, + _Out_ LPBYTE *bufptr, + _In_ DWORD prefmaxlen, + _Out_ LPDWORD entriesread, + _Out_ LPDWORD totalentries, + _Inout_ LPDWORD resume_handle) +{ + CONNECT_ENUM_STRUCT EnumStruct; + CONNECT_INFO_0_CONTAINER Level0Container = {0, NULL}; + CONNECT_INFO_1_CONTAINER Level1Container = {0, NULL}; + NET_API_STATUS status = 0; + + TRACE("NetConnectionEnum(%s %s %s %lu %p %lu %p %p %p)\n", + debugstr_w(servername), debugstr_w(qualifier), level, bufptr, + prefmaxlen, entriesread, totalentries, resume_handle); + + if (level > 1) + return ERROR_INVALID_LEVEL; + + EnumStruct.Level = level; + switch (level) + { + case 0: + EnumStruct.ConnectInfo.Level0 = &Level0Container; + break; + + case 1: + EnumStruct.ConnectInfo.Level1 = &Level1Container; + break; + } + + RpcTryExcept + { + status = NetrConnectionEnum(servername, + qualifier, + &EnumStruct, + prefmaxlen, + totalentries, + resume_handle); + + switch (level) + { + case 0: + if (EnumStruct.ConnectInfo.Level0->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ConnectInfo.Level0->Buffer; + *entriesread = EnumStruct.ConnectInfo.Level0->EntriesRead; + } + break; + + case 1: + if (EnumStruct.ConnectInfo.Level1->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ConnectInfo.Level1->Buffer; + *entriesread = EnumStruct.ConnectInfo.Level1->EntriesRead; + } + break; + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + NET_API_STATUS WINAPI NetFileClose(