The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Astro on August 25, 2009, 08:12:33 PM

Title: Console and Command Line Options
Post by: Astro on August 25, 2009, 08:12:33 PM
Hi,

If I create a console app and start it using command-line parameters, where do the parameters I passed end up?

Best regards,
Astro.
Title: Re: Console and Command Line Options
Post by: jj2007 on August 25, 2009, 08:20:39 PM
\masm32\help\masmlib.chm - look for GetCL.
Title: Re: Console and Command Line Options
Post by: drizz on August 25, 2009, 08:33:45 PM
They end up in your process environment block (PEB), where every other information is stored. (well, the ring3 portion that is)
Common way to access cmd. line parameters is to parse GetCommandLine(A|W) result which, if you trace it with a debugger, is the same value as in PEB.
Title: Re: Console and Command Line Options
Post by: Astro on August 25, 2009, 08:38:21 PM
Thanks! Something else to research.

Best regards,
Astro.
Title: Re: Console and Command Line Options
Post by: Vortex on August 26, 2009, 06:58:36 PM
Another option is to use the __getmainargs function exported by msvcrt.dll