I'd expect that replacing that code block with the following one works, although I haven't tested and couldn't clearly figure out how that program handles invalid arguments.
case 'f':
case 'F': {
//
// f:"filename"
// ^
if (lpCmdLine[iCmd++] != ':') goto f_parse_error;
//
// f:"filename"
// ^
BOOL isQuoted = FALSE; // Whether double-quote (") is used
if (lpCmdLine[iCmd] == '"') {
iCmd++;
isQuoted = TRUE;
}
//
// f:"filename"
// ^^^^^^^^
UINT iEnd = iCmd; // Final index of this argument
while (true) {
// No closing quote
if (isQuoted && lpCmdLine[iEnd] == 0) goto f_parse_error;
// Found a closing quote without a starting quote
if (!isQuoted && lpCmdLine[iEnd] == '"') goto f_parse_error;
// End of this argument
if (!isQuoted && (lpCmdLine[iEnd] == 0 || lpCmdLine[iEnd] == ' ')) break;
// Closing quote
if (isQuoted && lpCmdLine[iEnd] == '"') {
// Unexpected continuation
if (lpCmdLine[iEnd] != ' ' && lpCmdLine[iEnd] != 0) goto f_parse_error;
break;
}
iEnd++;
}
// File name is empty
if (iCmd == iEnd) goto f_parse_error;
lpCmdLine[iEnd] = 0;
m_AppParams.lpszTargetFileName = _tcsdup(&lpCmdLine[iCmd]);
iCmd = iEnd;
break;
f_parse_error:
CHelpDlg dlg;
dlg.DoModal();
break;
}
Replace each emoticon with a closing parenthesis.
)