[Bug 48449] 'CreateProcess(0, "cmd /C [...]' fails when a trailing newline follows a redirect in the cmdline

WineHQ Bugzilla wine-bugs at winehq.org
Fri Apr 23 15:45:40 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=48449

--- Comment #1 from timotheecisnard at gmail.com ---
Adding the reproducer inline since the Debian paste has had plenty of time to
expire =)

```
#include <windows.h>
#include <string>

using namespace std;

int main(int argc, char* argv[])
{
    string cmdline = "cmd.exe /Q /C \"echo 2\" >> out.txt\n";

    PROCESS_INFORMATION piProcInfo;
    STARTUPINFOA siStartInfo;
    ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
    ZeroMemory(&siStartInfo, sizeof(STARTUPINFOA));
    siStartInfo.cb = sizeof(STARTUPINFOA);
    CreateProcessA(nullptr, (char*)cmdline.data(), nullptr, nullptr, false, 0,
nullptr, nullptr, &siStartInfo, &piProcInfo);
    CloseHandle(piProcInfo.hProcess);
    CloseHandle(piProcInfo.hThread);
}
```

On Windows, this will create "out.txt" as expected, on Wine this prints
"Invalid name." and the command is not run.

-- 
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