Bug? GetCommandLineW() missing arguments in 64 bit Cygwin.

Kaz Kylheku kaz@kylheku.com
Sun Jan 19 20:07:17 GMT 2025


Hi All, 

In a (admittedly not current) version of 64 bit Cygwin, I'm observing a funny
behavior:

The GetCommandLineW function returns a command line which consists of the
executable name only; the arguments are missing.

This issue goes away when the program is run under GDB; the arguments
prepared by GDB do then appear in the command line.

The issue is not seen under 32 bits.

The repro program uses WinMain; I've not compared whether using
main makes a difference:

#include <windows.h>
#include <stdio.h>
#include <wchar.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nShowCmd)
{
  int argc, i;
  LPWSTR cmdline = GetCommandLineW();
  wprintf(L"cmdline = %ls\n", cmdline);
  return 0;
}


More information about the Cygwin mailing list