just a last question (that I didn't check) what if the process name contains spaces like: C:\Program Files\foo\bar.exe what does Windows do ? returns in argv[0] "C:\Program" or "C:\Program Files". The later would also require testing of existence of the directories (doing a more semantical approach while current implementation is purely syntaxical)
A+
Here's another version that uses GlobalLock... I also retested in Windows and I believe the comment about spaces was wrong.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ It really galls me that most of the computer power in the world is wasted on screen savers. Chris Caldwell from the GIMPS project http://www.mersenne.org/prime.htm
--------------- Eric Pouech (http://perso.wanadoo.fr/eric.pouech/) The future will be better tomorrow, Vice President Dan Quayle
__________________________________________________________ Faites un voeu et puis Voila ! www.voila.fr Pendant tout l'été, gagnez une Ford Ka sur Voila Gratter ! http://cybergrattage.voila.fr/voila
On Wed, 10 Oct 2001, Eric Pouech wrote:
just a last question (that I didn't check) what if the process name contains spaces like: C:\Program Files\foo\bar.exe what does Windows do ? returns in argv[0] "C:\Program" or "C:\Program Files". The later would also require testing of existence of the directories (doing a more semantical approach while current implementation is purely syntaxical)
CommandLineToArgvW returns "C:\Program" and "Files" and does not test for the existence of the file. The best way to see that, is to use my 'main' testing program (posted with the original cmdline patch) in interactive mode: "main -i".
Then you can type any string you want CommandLineToArgvW to convert and get the result:
C:>main -i Type command line to convert (quit to quit): C:\Program Files CommandLineToArgvW -> wargv=00133808 wargc=2 0 00133810 [C:\Program] 1 00133826 [Files] 2 003A0043 Type command line to convert (quit to quit): "C:\Program Files" CommandLineToArgvW -> wargv=00133808 wargc=1 0 0013380C [C:\Program Files] 1 003A0043 Type command line to convert (quit to quit): a b CommandLineToArgvW -> wargv=00133840 wargc=2 0 00133848 [a] 1 0013384C [b] 2 00000061 Type command line to convert (quit to quit): "a b " c"d e CommandLineToArgvW -> wargv=00132918 wargc=3 0 00132924 [a b ] 1 0013292E [c"d] 2 00132936 [e] 3 00200061 Type command line to convert (quit to quit): quit
Etc, etc...
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Cahn's Axiom: When all else fails, read the instructions.