Solved

How do I get createprocess to work?

Posted on 1998-08-04
3
175 Views
Last Modified: 2013-11-19
I am trying to launch a console app hidden.  Here is the code I am using:  

PROCESS_INFORMATION pi;
STARTUPINFO si;
si.wShowWindow =  SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW;

ProcessResult = CreateProcess("c:\\winnt\\system32\\write",NULL,NULL,NULL,true,NULL, NULL,NULL,&si,&pi);

Can someone provide me with an example, or a hint to what I am doing wrong?  The code executes, but returns with error code 0 - Nothing happens.

Thanks in advance.
0
Comment
Question by:jerryross
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
trestan earned 100 total points
Comment Utility
PROCESS_INFORMATION pi={0};
STARTUPINFO si={0};
si.wShowWindow =  SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW;

ProcessResult = CreateProcess(NULL, "c:\\winnt\\system32\\write",NULL,NULL,TRUE,NULL, NULL,NULL,&si,&pi);
I think you should set the first para as NULL. Use the second as command line input.
0
 
LVL 8

Expert Comment

by:trestan
Comment Utility
Also add: si.cb = sizeof(si);
0
 

Author Comment

by:jerryross
Comment Utility
Thank you!  I really needed that to work.  Now, if I can make sure that I am closing all of the appropriate handles for the newly created process then It'll be working great!  I am closing the thread handle, and the process handle, but I think there is also a window handle to close.  If I can get that and close it that should work.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now