[DISKPART] Support quoted command options in script files

This commit is contained in:
Eric Kohl 2022-06-25 15:20:40 +02:00
parent 3a72a52ce8
commit d4a398fb13

View file

@ -185,21 +185,26 @@ InterpretScript(LPWSTR input_line)
LPWSTR args_vector[MAX_ARGS_COUNT];
INT args_count = 0;
BOOL bWhiteSpace = TRUE;
BOOL bQuote = FALSE;
LPWSTR ptr;
memset(args_vector, 0, sizeof(args_vector));
bQuote = FALSE;
ptr = input_line;
while (*ptr != 0)
{
if (iswspace(*ptr) || *ptr == L'\n')
if (*ptr == L'"')
bQuote = !bQuote;
if ((iswspace(*ptr) && (bQuote == FALSE))|| *ptr == L'\n')
{
*ptr = 0;
bWhiteSpace = TRUE;
}
else
{
if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
if ((bWhiteSpace != FALSE) && (bQuote == FALSE) && (args_count < MAX_ARGS_COUNT))
{
args_vector[args_count] = ptr;
args_count++;