Re: CreateProcess() Not Passing Command Line

Tech-Archive recommends: Fix windows errors by optimizing your registry



BOOL CreateProcess(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);

the second paramter is path to EXE file to execute.
to input parameter to open with that application, add it after the EXE file
name.
Use QueryAssocString to get open command line for a document.

Hieu


"L. Spiro" <LSpiro@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:68958C12-6F90-4575-BFA1-1AF3D4733F17@xxxxxxxxxxxxxxxx
>I am writing a program that allows me to select a file (.exe) and enter a
> command-line parameter for the file.
> My program will then use CreateProcess() to open the file.
>
>
> The file does load, but no matter what I type for a parameter, the process
> being created always seems to get a blank command line (except of course
> for
> args[0]).
>
> I have followed my code and I am correctly passing the command line.
> http://www.gwforum.ca/l-spiro/ParmsArePassed.gif
>
> It is compiling into CreateProcessA, so the string must be in char *
> format
> (which it is). I tried already with wchar_t to make sure and it would not
> compile.
>
> So what can cause CreateProcess() to "work" (the process is created) but
> fail to pass the command line?
>
> I am creating a debugger and the process will be loaded in a suspended
> state, but resumed shortly, then stopped via a breakpoint at its entry.
> Is it possible somewhere along the way I am removing the command line?
> I am not messing with the RAM of the target process at all during this
> process; even the breakpoint is hardware.
> I am also not changing the thread's EIP or otherwise doing anything
> unusual
> that might cause the command line to be skipped.
>
>
> L. Spiro


.



Relevant Pages

  • Re: system calls
    ... Writing a simple recursive file-deleter is fairly straightforward; ... If you really want to run a command line ... are better ways to do the operation from within the API, and be able to report to the user ... >I have looked at CreateProcess but found it complicated and unsatisfactory. ...
    (microsoft.public.vc.mfc)
  • CreateProcess not working as doc specifies.
    ... I am having some difficulty using CreateProcess() to run a batch file and get ... you must start the command interpreter; ... the test.bat (should return exit code 1 and does when run from the command ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How To Execute OS Commands Using CreateProcess
    ... window to not show up ... The Problem now is CreateProcess() is not running the command ... me know why CreateProcess can't execute the "mode" command in DOS. ... One way that I'm making sure if it works is the output file, ...
    (microsoft.public.vc.language)
  • Re: Starting an MFC application with CreateProcess Api
    ... You can form the command line using sprintf, ... I am trying to start a dialog based MFC application using CreateProcess ... CString cmd; ... i start my application using CreateProcess Api, ...
    (microsoft.public.vc.mfc)