From bfee65f62c8240cb51554a445a9c54bc4565c69f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 17 Oct 2025 15:12:44 +0200 Subject: [PATCH] [NETSH] Implement MakeQuotedString() and FreeQuotedString() These functions are used by WinXPs ifmon.dll. --- base/applications/network/netsh/netsh.c | 26 ++++++++++++++++++++++ base/applications/network/netsh/netsh.spec | 4 ++-- sdk/include/reactos/netsh_undoc.h | 10 +++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/base/applications/network/netsh/netsh.c b/base/applications/network/netsh/netsh.c index 6e88499ba8f..6e6a221afe7 100644 --- a/base/applications/network/netsh/netsh.c +++ b/base/applications/network/netsh/netsh.c @@ -194,6 +194,32 @@ done: return result; } +VOID +WINAPI +FreeQuotedString( + _In_ LPWSTR pszQuotedString) +{ + DPRINT("FreeQuotedString(%S)\n", pszQuotedString); + HeapFree(GetProcessHeap(), 0, pszQuotedString); +} + +LPWSTR +WINAPI +MakeQuotedString( + _In_ LPWSTR pszString) +{ + LPWSTR pszQuotedString; + + DPRINT("MakeQuotedString(%S)\n", pszString); + + pszQuotedString = HeapAlloc(GetProcessHeap(), 0, (wcslen(pszString) + 3) * sizeof(WCHAR)); + if (pszQuotedString == NULL) + return NULL; + + swprintf(pszQuotedString, L"\"%s\"", pszQuotedString); + + return pszQuotedString; +} DWORD WINAPI diff --git a/base/applications/network/netsh/netsh.spec b/base/applications/network/netsh/netsh.spec index ea2d57ce410..282ce19d7a6 100644 --- a/base/applications/network/netsh/netsh.spec +++ b/base/applications/network/netsh/netsh.spec @@ -2,13 +2,13 @@ @ stub ConvertStringToGuid @ stub DisplayMessageM @ stub DisplayMessageToConsole -@ stub FreeQuotedString +@ stdcall FreeQuotedString(wstr) @ stub FreeString @ stub GenericMonitor @ stub GetEnumString @ stub GetHostMachineInfo @ stub InitializeConsole -@ stub MakeQuotedString +@ stdcall MakeQuotedString(wstr) @ stub MakeString @ stub MatchCmdLine @ stdcall MatchEnumTag(ptr wstr long ptr ptr) diff --git a/sdk/include/reactos/netsh_undoc.h b/sdk/include/reactos/netsh_undoc.h index 2562cdf9516..7736b64d113 100644 --- a/sdk/include/reactos/netsh_undoc.h +++ b/sdk/include/reactos/netsh_undoc.h @@ -1,6 +1,16 @@ #ifndef __NETSH_UNDOC_H__ #define __NETSH_UNDOC_H__ +VOID +WINAPI +FreeQuotedString( + _In_ LPWSTR pszQuotedString); + +LPWSTR +WINAPI +MakeQuotedString( + _In_ LPWSTR pszString); + DWORD WINAPI NsGetFriendlyNameFromIfName(