| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-ID: | <41B839E2.5020803@mff.cuni.cz> |
| Date: | Thu, 09 Dec 2004 12:41:22 +0100 |
| From: | Pavel Kudrna <Pavel DOT Kudrna AT mff DOT cuni DOT cz> |
| Organization: | Charles University in Prague, Faculty of Mathematics and Physics |
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Incorrectly prepared lpCmdLine parameter of WinMain() |
The caller of WinMain() incorrectly parses the command line if e.g.
the space is present in the path or filename of the executable.
The lpCmdLine then contains part of the filename at the beginning.
/* program.c*/
#include <windows.h>
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
MessageBox(NULL, lpCmdLine, "lpCmdLine:", MB_OK );
return 0;
}
$ gcc program.c -mwin32
$ mv a.exe "a a.exe"
$ "./a a.exe" "1st parameter" 2nd\ parameter
Then MessageBox shows that lpCmdLine contains:
a.exe" "1st parameter" "2nd parameter"
If program is compiled with -mno-cygwin the bug is not present and
lpCmdLine is ok:
"1st parameter" "2nd parameter"
Pavel Kudrna
Cygwin Configuration Diagnostics
Current System Time: Thu Dec 09 10:50:59 2004
Windows XP Professional Ver 5.1 Build 2600 Service Pack 2
Cygwin DLL version info:
DLL version: 1.5.12 DLL epoch: 19
...
Cygwin Package Information
base-files 3.1-4
binutils 20040725-2
cygutils 1.2.5-1
cygwin 1.5.12-1
gcc 3.3.3-3
gcc-mingw 20040810-1
mingw-runtime 3.5-1
w32api 3.1-1
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |