mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[NETSH][REACTOS] Basic implementation of PreprocessCommand
Preprocess is used by the 'reset' command in the 'interface ip' command.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user