Skip to content

Commit 3cdc3d1

Browse files
committed
[NETSH] Print the commands help text if a command returns ERROR_SHOW_USAGE
1 parent ad6cb32 commit 3cdc3d1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

base/applications/network/netsh/context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ ExecCommand(
339339
DPRINT("ExecCommand()\n");
340340

341341
if (dwArgCount - dwCurrentIndex != 1)
342-
return ERROR_INVALID_SYNTAX;
342+
return ERROR_SHOW_USAGE;
343343

344344
return RunScript(argv[dwCurrentIndex]);
345345
}

base/applications/network/netsh/interpreter.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ InterpretCommand(
208208
dwError = pCommand->pfnCmdHandler(NULL, argv, dwArgIndex, dwArgCount, 0, NULL, bDone);
209209
if (dwError != ERROR_SUCCESS)
210210
{
211-
ConPrintf(StdOut, L"Commnand: %S Error: %lu\n\n", pCommand->pwszCmdToken, dwError);
211+
if (dwError == ERROR_SHOW_USAGE)
212+
PrintCommandHelp(pTempContext, pCommand);
213+
else
214+
ConPrintf(StdOut, L"Commnand: %S Error: %lu\n\n", pCommand->pwszCmdToken, dwError);
212215
}
213216
}
214217

0 commit comments

Comments
 (0)