From d0f2efa8fa0ed33b76d05bf50e0b6578d229cd1f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 1 Jun 2026 23:25:08 +0200 Subject: [PATCH] [NETSH] Improve MatchTagsInCmdLine - Remove the tag name after the a tagged argument has been identified. --- base/applications/network/netsh/netsh.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/applications/network/netsh/netsh.c b/base/applications/network/netsh/netsh.c index 09531289537..497ef88a814 100644 --- a/base/applications/network/netsh/netsh.c +++ b/base/applications/network/netsh/netsh.c @@ -359,6 +359,7 @@ MatchEnumTag( for (i = 0; i < dwNumArg; i++) { + DPRINT("%S -- %S\n", pwcArg, pEnumTable[i].pwszToken); if (MatchToken(pwcArg, pEnumTable[i].pwszToken)) { *pdwValue = pEnumTable[i].dwValue; @@ -390,6 +391,7 @@ MatchTagsInCmdLine( for (i = dwCurrentIndex; i < dwArgCount; i++) { DPRINT("Argument %lu: %S\n", i, ppwcArguments[i]); + pdwTagType[i - dwCurrentIndex] = (DWORD)-1; /* Skip arguments that do not have a tag */ pszEqual = wcschr(ppwcArguments[i], L'='); @@ -403,13 +405,16 @@ MatchTagsInCmdLine( pdwTagType[i - dwCurrentIndex] = (DWORD)-1; for (j = 0; j < dwTagCount; j++) { - DPRINT("Test tag %S\n", pttTags[j].pwszTag); + DPRINT("Test tag %S -- %S\n", pttTags[j].pwszTag, ppwcArguments[i]); if ((wcslen(pttTags[j].pwszTag) == dwTagLength) && (_wcsnicmp(ppwcArguments[i], pttTags[j].pwszTag, dwTagLength) == 0)) { DPRINT("Found tag %S\n", pttTags[j].pwszTag); pttTags[j].bPresent = TRUE; pdwTagType[i - dwCurrentIndex] = j; + + /* Remove the tag name from the argument */ + wcscpy(ppwcArguments[i], pszEqual + 1); } } }