[Bug 46721] New: Two quotes together (in outer quotes) not parsed correctly in argv
wine-bugs at winehq.org
wine-bugs at winehq.org
Tue Feb 26 02:12:55 CST 2019
https://bugs.winehq.org/show_bug.cgi?id=46721
Bug ID: 46721
Summary: Two quotes together (in outer quotes) not parsed
correctly in argv
Product: Wine
Version: 4.2
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: kernel32
Assignee: wine-bugs at winehq.org
Reporter: brendan at redmandi.com
Distribution: ---
Created attachment 63693
--> https://bugs.winehq.org/attachment.cgi?id=63693
kernel32: Allow double quote style escape in argv
In Windows, two quotes together (within outer quotes) represents a
single quote (with the first quote - of the inner quotes - acting as an escape
character).
Thus calling 'CreateProcessA' with four quotes as a parameter (i.e. '""""')
will represent a single quote (i.e. '"'). In wine, this is currently being
treated as two separate sets of quotes and thus results in a empty value.
The attached patch fixes the problem.
This can be tested with the following (just copy and paste):
cat << END > test.c
#include <windows.h>
#include <stdio.h>
int main(int argc, const char *argv[])
{
PROCESS_INFORMATION processInfo;
STARTUPINFO startupInfo;
memset(&startupInfo, 0, sizeof startupInfo);
startupInfo.cb = sizeof startupInfo;
if (!CreateProcessA(
NULL,
"printArgs.exe \"\"\"\"",
0,
0,
TRUE,
0,
NULL,
NULL,
&startupInfo,
&processInfo)) {
DWORD dwLastError = GetLastError();
fprintf(stderr, "failed to execute printArgs.exe (%lu)\n",
dwLastError);
return 1;
}
return 0;
}
END
cat << END > printArgs.c
#include <stdio.h>
int main(int argc, const char *argv[]) {
for (int i = 0; i < argc; i++)
printf("%s\n", argv[i]);
return 0;
}
END
x86_64-w64-mingw32-gcc test.c -o test.exe
x86_64-w64-mingw32-gcc printArgs.c -o printArgs.exe
wine64 test
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list