Author Topic: CreateProcess lpCommandLine  (Read 3596 times)


  • Guest
CreateProcess lpCommandLine
« on: October 10, 2012, 11:06:53 AM »
I'm using qWords code snippet for CreateProcess

                .if !rv(CreateProcess,"c:\Windows\System32\wevtutil.exe","el",0,0,0,CREATE_NEW_CONSOLE or CREATE_NEW_PROCESS_GROUP,0,0, ADDR sui,ADDR pi)

 which works fine how ever if I add commands to the lpCommandLine I get syntax errors or nesting errors.

I've tried  ,"el"">>test.txt",
                ,"el" ">>test.txt",
                , "el" ">>" "test.txt",
                and many more

I'm trying to pipe the output to a file so that I can parse it.


  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: CreateProcess lpCommandLine
« Reply #1 on: October 10, 2012, 11:44:52 AM »
That kind of nesting with quoted strings is not possible with MASM. However, you can use escape sequences with the rvc or rvcx macros:

Code: [Select]
rvc(CreateProcess,"\\Windows\\System32\\cmd.exe","/K \q\\Windows\\System32\\ping.exe \r xyz.txt\q",0,0,0,CREATE_NEW_CONSOLE,0,0, ADDR sui,ADDR pi)
For the syntax of the macros, please take a look into hlhelp.chm.
MREAL macros - when you need floating point arithmetic while assembling!


  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: CreateProcess lpCommandLine
« Reply #2 on: October 10, 2012, 11:47:43 AM »
there are several caveats when passing the command line with parameters
read the documentation for CreateProcess - lpCommandLine in particular

what i find works best is to pass a NULL for lpApplicationName and
create the complete command line as a single string - for example...
Code: [Select]
'c:\masm32\ml.exe parm',0of course, you don't need the full path if the file is in the same folder or in the environment PATH