[NETSH][REACTOS] Implement and export NsGetFriendlyNameFromIfName

Running the 'interface ip show address' command on XPs ifmon.dll now fails in netcfgx.dll.
This commit is contained in:
Eric Kohl
2025-10-16 14:19:11 +02:00
parent ac4d7351f9
commit 38afa1a48f
5 changed files with 55 additions and 2 deletions
@@ -20,7 +20,7 @@ set_target_properties(netsh
set_module_type(netsh win32cui UNICODE)
target_link_libraries(netsh conutils ${PSEH_LIB})
add_importlibs(netsh advapi32 msvcrt user32 kernel32 ntdll)
add_importlibs(netsh iphlpapi advapi32 msvcrt user32 kernel32 ntdll)
add_pch(netsh precomp.h SOURCE)
add_cd_file(TARGET netsh DESTINATION reactos/system32 FOR all)
+37
View File
@@ -237,6 +237,43 @@ MatchToken(
return (_wcsnicmp(pwszUserToken, pwszCmdToken, wcslen(pwszUserToken)) == 0) ? TRUE : FALSE;
}
DWORD
WINAPI
NsGetFriendlyNameFromIfName(
_In_ DWORD dwUnknown1,
_In_ PWSTR pszIfName,
_Inout_ PWSTR pszFriendlyName,
_Inout_ PDWORD pdwFriendlyName)
{
UNICODE_STRING UnicodeIfName;
GUID InterfaceGuid;
NTSTATUS Status;
DWORD ret;
DPRINT("NsGetFriendlyNameFromIfName(%lx %S %p %p)\n",
dwUnknown1, pszIfName, pszFriendlyName, pdwFriendlyName);
RtlInitUnicodeString(&UnicodeIfName, pszIfName);
Status = RtlGUIDFromString(&UnicodeIfName,
&InterfaceGuid);
if (!NT_SUCCESS(Status))
{
DPRINT1("RtlGUIDFromString failed 0x%08lx\n", Status);
return RtlNtStatusToDosError(Status);
}
ret = NhGetInterfaceNameFromDeviceGuid(&InterfaceGuid,
pszFriendlyName,
pdwFriendlyName,
0, 0);
if (ret != ERROR_SUCCESS)
{
DPRINT1("NhGetInterfaceNameFromDeviceGuid() failed %lu\n", ret);
}
return ret;
}
DWORD
WINAPI
PreprocessCommand(
+1 -1
View File
@@ -14,7 +14,7 @@
@ stdcall MatchEnumTag(ptr wstr long ptr ptr)
@ stub MatchTagsInCmdLine
@ stdcall MatchToken(wstr wstr)
@ stub NsGetFriendlyNameFromIfName
@ stdcall NsGetFriendlyNameFromIfName(long wstr ptr ptr)
@ stub NsGetIfNameFromFriendlyName
@ stdcall PreprocessCommand(ptr ptr long long ptr long long long ptr)
@ varargs PrintError(ptr long)
@@ -14,17 +14,21 @@
#include <stdlib.h>
#include <stdarg.h>
#include <ndk/rtlfuncs.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wincon.h>
#include <winuser.h>
#include <iphlpapi_undoc.h>
#include <errno.h>
#include <conutils.h>
#include <netsh.h>
#include <netsh_undoc.h>
#include "resource.h"
+12
View File
@@ -0,0 +1,12 @@
#ifndef __NETSH_UNDOC_H__
#define __NETSH_UNDOC_H__
DWORD
WINAPI
NsGetFriendlyNameFromIfName(
_In_ DWORD dwParam1,
_In_ PWSTR pszIfName,
_Inout_ PWSTR pszFriendlyName,
_Inout_ PDWORD pdwFriendlyName);
#endif /* __NETSH_UNDOC_H__ */