diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt index 9a003d73328..ef3c7c85064 100644 --- a/dll/win32/CMakeLists.txt +++ b/dll/win32/CMakeLists.txt @@ -139,6 +139,7 @@ add_subdirectory(netcfgx) add_subdirectory(netevent) add_subdirectory(netid) add_subdirectory(netmsg) +add_subdirectory(netutils) add_subdirectory(newdev) add_subdirectory(npptools) add_subdirectory(ntdsapi) diff --git a/dll/win32/netutils/CMakeLists.txt b/dll/win32/netutils/CMakeLists.txt new file mode 100644 index 00000000000..2bd1cdba37f --- /dev/null +++ b/dll/win32/netutils/CMakeLists.txt @@ -0,0 +1,14 @@ + +spec2def(netutils.dll netutils.spec) + +list(APPEND SOURCE + main.c + ${CMAKE_CURRENT_BINARY_DIR}/netutils_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/netutils.def) + +add_library(netutils MODULE ${SOURCE}) +set_module_type(netutils win32dll) +target_link_libraries(netutils wine) +add_importlibs(netutils msvcrt kernel32 ntdll) +add_cd_file(TARGET netutils DESTINATION reactos/system32 FOR all) +set_wine_module(netutils) diff --git a/dll/win32/netutils/main.c b/dll/win32/netutils/main.c new file mode 100644 index 00000000000..3c68c83f31f --- /dev/null +++ b/dll/win32/netutils/main.c @@ -0,0 +1,107 @@ +/* + * Copyright 2001 Mike McCormack + * Copyright 2002 Andriy Palamarchuk + * Copyright 2003 Juan Lang + * Copyright 2005,2006 Paul Vriens + * Copyright 2006 Robert Reif + * Copyright 2013 Hans Leidekker for CodeWeavers + * Copyright 2020 Dmitry Timoshkov + * + * 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 + + #include "ntstatus.h" + #define WIN32_NO_STATUS + #include "windef.h" + #include "winbase.h" + #ifndef __REACTOS__ + #include "winternl.h" + #endif + #include "lm.h" + #include "wine/debug.h" + #include "wine/list.h" + #include "initguid.h" + + WINE_DEFAULT_DEBUG_CHANNEL(netutils); + + /************************************************************ + * NetApiBufferAllocate (NETUTILS.@) + */ + NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID* Buffer) + { + TRACE("(%ld, %p)\n", ByteCount, Buffer); + + if (Buffer == NULL) return ERROR_INVALID_PARAMETER; + *Buffer = HeapAlloc(GetProcessHeap(), 0, ByteCount); + if (*Buffer) + return NERR_Success; + else + return GetLastError(); + } + + /************************************************************ + * NetApiBufferFree (NETUTILS.@) + */ + NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer) + { + TRACE("(%p)\n", Buffer); + HeapFree(GetProcessHeap(), 0, Buffer); + return NERR_Success; + } + + /************************************************************ + * NetApiBufferReallocate (NETUTILS.@) + */ + NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount, + LPVOID* NewBuffer) + { + TRACE("(%p, %ld, %p)\n", OldBuffer, NewByteCount, NewBuffer); + if (NewByteCount) + { + if (OldBuffer) + *NewBuffer = HeapReAlloc(GetProcessHeap(), 0, OldBuffer, NewByteCount); + else + *NewBuffer = HeapAlloc(GetProcessHeap(), 0, NewByteCount); + return *NewBuffer ? NERR_Success : GetLastError(); + } + else + { + if (!HeapFree(GetProcessHeap(), 0, OldBuffer)) return GetLastError(); + *NewBuffer = 0; + return NERR_Success; + } + } + + /************************************************************ + * NetApiBufferSize (NETUTILS.@) + */ + NET_API_STATUS WINAPI NetApiBufferSize(LPVOID Buffer, LPDWORD ByteCount) + { + DWORD dw; + + TRACE("(%p, %p)\n", Buffer, ByteCount); + if (Buffer == NULL) + return ERROR_INVALID_PARAMETER; + dw = HeapSize(GetProcessHeap(), 0, Buffer); + TRACE("size: %ld\n", dw); + if (dw != 0xFFFFFFFF) + *ByteCount = dw; + else + *ByteCount = 0; + + return NERR_Success; + } diff --git a/dll/win32/netutils/netutils.spec b/dll/win32/netutils/netutils.spec new file mode 100644 index 00000000000..a6a43198007 --- /dev/null +++ b/dll/win32/netutils/netutils.spec @@ -0,0 +1,22 @@ +@ stdcall NetApiBufferAllocate(long ptr) +@ stdcall NetApiBufferFree(ptr) +@ stdcall NetApiBufferReallocate(ptr long ptr) +@ stdcall NetApiBufferSize(ptr ptr) +@ stub NetRemoteComputerSupports +@ stdcall NetapipBufferAllocate(long ptr) NetApiBufferAllocate +@ stub NetpIsComputerNameValid +@ stub NetpIsDomainNameValid +@ stub NetpIsGroupNameValid +@ stub NetpIsRemote +@ stub NetpIsRemoteNameValid +@ stub NetpIsShareNameValid +@ stub NetpIsUncComputerNameValid +@ stub NetpIsUserNameValid +@ stub NetpwListCanonicalize +@ stub NetpwListTraverse +@ stub NetpwNameCanonicalize +@ stub NetpwNameCompare +@ stub NetpwNameValidate +@ stub NetpwPathCanonicalize +@ stub NetpwPathCompare +@ stub NetpwPathType diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index f6a62f2f45e..66c20d43b9c 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -144,6 +144,7 @@ dll/win32/msxml4 # Synced to Wine-10.0 dll/win32/msxml6 # Synced to Wine-10.0 dll/win32/nddeapi # Synced to WineStaging-3.3 dll/win32/netapi32 # Forked at Wine-1.3.34 +dll/win32/netutils # Synced to Wine-10.0 dll/win32/npptools # Synced to WineStaging-4.18 dll/win32/ntdsapi # Synced to WineStaging-4.18 dll/win32/objsel # Synced to WineStaging-4.18