Shaddy Baddah | 1 Nov 2005 05:33

: How does Windows pass non-ascii filename to executable?

Hi,

This question doesn't really describe a Cygwin topic (thus the use of
cygwin-talk), but it's probably as relevant for Cygwin as for regular
native Windows executables. Any assistance would be greatly appreciated.

Ok, what I want to know is, how does Windows pass non-ascii filenames to
executables? Here is the scenario. I have attached a quite simplistic C
test application.

I compile it under either MingW or Cygwin like so:

gcc -o nonasciifilenameargs nonasciifilenameargs.c

I then go to the Windows file explorer and drag a file with Traditional
Chinese characters in it, onto nonasciifilenameargs.exe.

I see this output:

argc == 2
argv[0] == "d:\home\shaddy\throwaway scripts\nonasciifilenameargs.exe"
strlen(argv[0]) == "57"
argv[1] == "G:\?? - Susan?.mp3"
strlen(argv[1]) == "18"

This is not a mystery to me. I get it that the encoding conversion to
the local codepage (which is latin1) drops question mark (?) characters
that are outside the codepage/set.

However, I can double click on the same file, and Winamp picks it up
(Continue reading)

Shaddy Baddah | 1 Nov 2005 05:40

: How does Windows pass non-ascii filename to executable?

Hi,

Shaddy Baddah wrote:
..
> executables? Here is the scenario. I have attached a quite simplistic C
> test application.

Guess what I done? Sorry about that. Please find it attached here.

Regards,
Shaddy
#include <stdio.h>

int
main(int argc, char* argv[])
{
  int idx;
  char dummy[1024];
  printf("argc == %d\n", argc);
  for (idx = 0; idx < argc; idx++)
    {
      printf("argv[%d] == \"%s\"\n", idx, argv[idx]);
      printf("strlen(argv[%d]) == \"%d\"\n", idx, strlen(argv[idx]));
    }
  fflush(stdout);
  fgets(dummy, sizeof(dummy), stdin);
  return 0;
}
(Continue reading)

Igor Pechtchanski | 1 Nov 2005 07:00

: How does Windows pass non-ascii filename to executable?

On Tue, 1 Nov 2005, Shaddy Baddah wrote:

> Hi,
>
> This question doesn't really describe a Cygwin topic (thus the use of
> cygwin-talk), but it's probably as relevant for Cygwin as for regular
> native Windows executables. Any assistance would be greatly appreciated.
>
> Ok, what I want to know is, how does Windows pass non-ascii filenames to
> executables?

Microsoft uses jumping hippos to cram wide characters into narrow
applications.  This is all described quite clearly in this MSDN article:
<http://msdn.microsoft.com/library/en-us/vccelng/htm/basic_20.asp>.  Don't
worry if you don't see the hippos right away -- Microsoft is very adept at
hiding them.  You have to use your side vision -- try staring at the
top-right corner of the screen for a while, and you'll see them running
between the lines.

> [snip]
> What is that way? I am vaguely familiar with a facility in Windows to
> enter an executable at a different entry point then main()... as I
> recall (eg. for XEmacs), to make the app non-console. Is this how it is
> done? Any pointers to documentation would be greatly appreciated.

Making the app non-console has nothing to do with this.  Even with WinMain
(which is probably what you were thinking about), you have to use the
hippos (i.e., the initial "w") to make it Unicode.
	Igor
--

-- 
(Continue reading)

Shaddy Baddah | 1 Nov 2005 07:19

: How does Windows pass non-ascii filename to executable?

Hi Igor,

Igor Pechtchanski wrote:
[snip]
> Microsoft uses jumping hippos to cram wide characters into narrow
                 ^

Bah! Typical Microsoft. All they needed to do was use a h instead of a
j, and they would have had a far more effective solution.

> applications.  This is all described quite clearly in this MSDN article:
> <http://msdn.microsoft.com/library/en-us/vccelng/htm/basic_20.asp>.  Don't

Thanks very much for that.

> Making the app non-console has nothing to do with this.  Even with WinMain
> (which is probably what you were thinking about), you have to use the
> hippos (i.e., the initial "w") to make it Unicode.

And equally so for this.

Best regards,
Shaddy

Corinna Vinschen | 1 Nov 2005 11:10

: How does Windows pass non-ascii filename to executable?

On Nov  1 01:00, Igor Pechtchanski wrote:
> Making the app non-console has nothing to do with this.  Even with WinMain
> (which is probably what you were thinking about), you have to use the
> hippos (i.e., the initial "w") to make it Unicode.

Igor, that's Unicorn, not Unicode.  However, beats me how hippos can
help to make unicorns.  Well, I guess they are near relatives, what with
the natural grace and everything, but on the genetic side I see a
problem or two...

Corinna

Igor Pechtchanski | 1 Nov 2005 13:55

: How does Windows pass non-ascii filename to executable?

On Tue, 1 Nov 2005, Corinna Vinschen wrote:

> On Nov  1 01:00, Igor Pechtchanski wrote:
> > Making the app non-console has nothing to do with this.  Even with WinMain
> > (which is probably what you were thinking about), you have to use the
> > hippos (i.e., the initial "w") to make it Unicode.
>
> Igor, that's Unicorn, not Unicode.  However, beats me how hippos can
> help to make unicorns.  Well, I guess they are near relatives, what with
> the natural grace and everything, but on the genetic side I see a
> problem or two...

I don't.  A Unicorn is a Hippo on a diet, whose wife cheated on him once.
	Igor
--

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha <at> cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor <at> watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

Dave Korn | 1 Nov 2005 15:20
Favicon

FW: Question / Fiscal Printer device.

Douglas Schilling Landgraf wrote:
> Hi guys,
> 
> 
> I have a question, I have a *fiscal* printer connected to a parallel port.
> On Linux I can print [ ... ]

... realistic forgeries of currency?

    cheers,
      DaveK
--

-- 
Can't think of a witty .sigline today....

Brian Dessent | 1 Nov 2005 16:23

: How does Windows pass non-ascii filename to executable?

Corinna Vinschen wrote:

> Igor, that's Unicorn, not Unicode.  However, beats me how hippos can
> help to make unicorns.  Well, I guess they are near relatives, what with
> the natural grace and everything, but on the genetic side I see a
> problem or two...

You just can't possibly hope to explain everything that His Noodliness
has created.  These so-called scientists may have theories that involve
hippos struggling for survival and over thousands of generations and
mutating into unicorns, but that's obviously hogwash.  If that were true
why are there no unicorn fossils?  Obviously, they were both created by
the Hand Of Meatball, and there's just no other way that it could have
happened.

Brian

Shankar Unni | 2 Nov 2005 00:23

Re: Question / Fiscal Printer device.

Douglas Schilling Landgraf wrote:

> I have a question, I have a *fiscal* printer connected to a parallel port.

"*fiscal*"? I'm sure the Secret Service would have something to say 
about that..

Christopher Faylor | 2 Nov 2005 00:51
Favicon

Re: Question / Fiscal Printer device.

On Tue, Nov 01, 2005 at 03:23:30PM -0800, Shankar Unni wrote:
>Douglas Schilling Landgraf wrote:
>>I have a question, I have a *fiscal* printer connected to a parallel
>>port.
>
>"*fiscal*"?  I'm sure the Secret Service would have something to say
>about that..

Are you actually threatening fiscal violence?  Tsk, tsk.

cgf


Gmane