[NETSH][REACTOS] Basic implementation of PreprocessCommand

Preprocess is used by the 'reset' command in the 'interface ip' command.
This commit is contained in:
Eric Kohl
2026-06-21 00:59:22 +02:00
parent a6133d2b44
commit ac06652ab6
2 changed files with 41 additions and 4 deletions
+40 -3
View File
@@ -377,7 +377,7 @@ MatchTagsInCmdLine(
_Inout_ LPWSTR *ppwcArguments,
_In_ DWORD dwCurrentIndex,
_In_ DWORD dwArgCount,
_In_ TAG_TYPE *pttTags,
_Inout_ TAG_TYPE *pttTags,
_In_ DWORD dwTagCount,
_Out_ DWORD *pdwTagType)
{
@@ -546,13 +546,50 @@ PreprocessCommand(
_Inout_ LPWSTR *ppwcArguments,
_In_ DWORD dwCurrentIndex,
_In_ DWORD dwArgCount,
_In_ TAG_TYPE *pttTags,
_Inout_ TAG_TYPE *pttTags,
_In_ DWORD dwTagCount,
_In_ DWORD dwMinArgs,
_In_ DWORD dwMaxArgs,
_Out_ DWORD *pdwTagType)
{
DPRINT1("PreprocessCommand()\n");
DWORD i;
DWORD dwError = ERROR_SUCCESS;
DPRINT("PreprocessCommand()\n");
if ((ppwcArguments == NULL) || (pttTags == NULL) || (pdwTagType == NULL))
return ERROR_INVALID_PARAMETER;
if (((dwArgCount - dwCurrentIndex) < dwMinArgs) || ((dwArgCount - dwCurrentIndex) > dwMaxArgs))
return ERROR_INVALID_SYNTAX;
for (i = 0; i < dwTagCount; i++)
{
pttTags[i].bPresent = FALSE;
}
if ((dwArgCount - dwCurrentIndex) > 0)
{
dwError = MatchTagsInCmdLine(hModule,
ppwcArguments,
dwCurrentIndex,
dwArgCount,
pttTags,
dwTagCount,
pdwTagType);
if (dwError != ERROR_SUCCESS)
{
return dwError;
}
}
/* Fail, if a required tag is missing */
for (i = 0; i < dwTagCount; i++)
{
if ((pttTags[i].dwRequired & NS_REQ_PRESENT) && (pttTags[i].bPresent == FALSE))
return ERROR_INVALID_SYNTAX;
}
return 0;
}
+1 -1
View File
@@ -30,7 +30,7 @@ MatchTagsInCmdLine(
_Inout_ LPWSTR *ppwcArguments,
_In_ DWORD dwCurrentIndex,
_In_ DWORD dwArgCount,
_In_ TAG_TYPE *pttTags,
_Inout_ TAG_TYPE *pttTags,
_In_ DWORD dwTagCount,
_Out_ DWORD *pdwTagType);