+4  A: 

This can happen when your program is spawned via CreateProcess - have a look at the description for the lpCommandLine parameter. Basically it is up to the program calling CreateProcess to fill in that first parameter, so it can happen that the value isn't filled in the usual way.

From the link:

"If both lpApplicationName and lpCommandLine are non-NULL, the null-terminated string pointed to by lpApplicationName specifies the module to execute, and the null-terminated string pointed to by lpCommandLine specifies the command line. The new process can use GetCommandLine to retrieve the entire command line. Console processes written in C can use the argc and argv arguments to parse the command line. Because argv[0] is the module name, C programmers generally repeat the module name as the first token in the command line."

Similarly, this can happen if your program is started from another using the spawn family of functions. There, the documentation states:

"At least one argument, either arg0 or argv[0], must be passed to the child process. By convention, this argument is a copy of the pathname argument. However, a different value will not produce an error."

sje397
That explains it, thanks.
Jake Petroules