Incorrect double quote handling in command line parameters on Win32 and Win64
Summary
When using FPC programs compiled for Win32 or Win64 every double quote toggles the "quoted" status. This means that it is impossible to pass a double quote inside the parameters on the command line.
System Information
- Operating system: Windows
- Processor architecture: x86, x86-64
- Compiler version: trunk
- Device: Computer
Steps to reproduce
compile the example project and run with the following command line: testdoublequotes.exe """Bob was here"""
Example Project
program testdoublequotes;
{$mode delphi}
var i: integer;
begin
writeln('ParamCount:', ParamCount);
for i := 1 to ParamCount do
writeln('Param(', i, '):', ParamStr(i), ';');
end.
What is the current bug behavior?
Program outputs: ParamCount:1 Param(1):Bob was here;
What is the expected (correct) behavior?
ParamCount:1 Param(1):"Bob was here";
Possible fixes
All other platforms, including WinCE and Win16, seem to handle escaping double quotes and using single quotes instead of double quotes. I will attach the patch I used to bring Win32 and Win64 parameter handling in line with WinCE and Win16. syswin.inc.p1.diff
Edited by Dean Mustakinov