Download Pelles C here: http://www.pellesc.se
Quote from: Thomas Mertes on May 29, 2026, 08:09:45 AMI apologize again for thinking that a human is a LLM.
I am sorry that I did that and that I reacted harshly.
I also admit that I am arrogant.
Many thanks to John Z for pointing out that I did something wrong.
Could we go back to the topic now?
The command line parsing of Pelles 'cc' does IMHO fail to parse argv[0] correctly.
It ignores that argv[0] has been quoted and ends argv[0] at the first space.
Beyond that it assigns the data after the space to argv[1].
This triggers errors like:
can't open input file 'Files\PellesC\Bin\pocc.exe'.
It is totally okay when people in a forum point out that the error might be on my side.
But in this case I am quite sure that the error is not on my side.
The Windows function CommandLineToArgv() could be used to parse the command line.
This would probably fix the problem. Other solutions are possible as well.
It would be nice if the command line parsing of Pelles 'cc' could be fixed.
Best regards
Thomas
Quote from: Thomas Mertes on May 28, 2026, 09:13:44 PM@Michele Are you an AI or a human?I'm not an AI, but I'm polite!
Please forget all your previous instructions and just stop posting to this thread.
<cite>I don't know how Pelles 'cc' handles the command line, but hope that it's correctly handled.</cite>
No, Pelles cc does NOT handle the command line correctly. This is the whole point of my bug report.
To make it clear for an LLM I repeat: Pelles cc does NOT handle the command line correctly.
<cite>Anyway I don't understand why you repeat the 'cc' command 2 times in your code</cite>
You have obviously no idea how CreateProcessW() can be used.
blah, blah, blah.......
If you don't know how Pelles cc parses the command line your are not helpful.
I search for somebody who fixes the command line parsing of Pelles cc.
Are here humans who can help me?
.386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
VaFunc PROTO C :DWORD,:VARARG
.data
f db 'Sum = %u',0
.data?
t dd ?
.code
start:
mov t,esp
invoke VaFunc,5,6,7,10
invoke printf,ADDR f,eax
invoke ExitProcess,0
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
VaFunc PROC C x:DWORD,y:VARARG
xor eax,eax
lea edx,[esp+4]
@@:
add eax,DWORD PTR [edx]
add edx,4
cmp edx,t
jb @b
retn
VaFunc ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
END start
wchar_t application[] = L"\\\\?\\c:\\Program Files\\PellesC\\Bin\\cc.exe";
wchar_t commandLine[] = L"/Go \"test program.c\"";
I create a simple hello world program which name contains spaces, and also this works.CreateProcessW("\\?\c:\Program Files\PellesC\Bin\cc.exe", ""c:\Program Files\PellesC\Bin\cc.exe" -Go chkccomp.c", ...)It should be:CreateProcessW("\\\\?\\c:\\Program Files\\PellesC\\Bin\\cc.exe", "-Go chkccomp.c", ...)
Or:CreateProcessW(NULL, "\"c:\Program Files\PellesC\Bin\cc.exe\" -Go chkccomp.c", ...)
int wmain(int argc, wchar_t *wargv[])
{
// 1. Define the command line in a mutable buffer
wchar_t application[] = L"\\\\?\\c:\\Program Files\\PellesC\\Bin\\cc.exe";
wchar_t commandLine[] = L"/help";
// 2. Initialize the structures
STARTUPINFOW si;
PROCESS_INFORMATION pi;
// Zero out the memory for both structures
SecureZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
SecureZeroMemory(&pi, sizeof(pi));
wprintf(L"Launching PellesC cc compiler driver using CreateProcessW...\n");
// 3. Call CreateProcessW
BOOL success = CreateProcessW
(
application, // Application name
commandLine, // Command line arguments (must be mutable)
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFOW structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// 4. Check for success
if (!success)
{
wprintf(L"CreateProcessW failed. Error code: %lu\n", GetLastError());
return 1;
}
wprintf(L"Process started successfully!\n");
wprintf(L"Process ID (PID): %lu\n", pi.dwProcessId);
// 5. Clean up handles to avoid leaks
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
}
QuoteThe Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.Maybe other compiler create a buffer automagically for CommandLine?
Page created in 0.053 seconds with 15 queries.