Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Pascal
Expertise: Beginner
Jan 18, 1999



Application Security Testing: An Integral Part of DevOps

CreateProcess in Windows NT

I am using CreateProcess to run applications in Windows NT. I cannot start any applications that are located in the directory Program Files. The user properties are set the same for every directory. Is there another way to start the applications?

There is not another way to start the applications that I'd recommend. However, here's a wrapper function that I use in my own programs:

{Supply a fully qualified path name in ProgramName
 and any arguments on the command line. As the help file
 states: "If lpApplicationName is NULL, the first white space-delimited 
 token of the command line specifies the module name..." In English,
 the characters before the first space encountered (or if no space is
 encountered as in a single program call) is interpreted as the
 EXE to execute. The rest of the string is the argument line.}
procedure ExecNewProcess(ProgramName : String);
  StartInfo  : TStartupInfo;
  ProcInfo   : TProcessInformation;
  CreateOK   : Boolean;

  { fill with known state }
  StartInfo.cb := SizeOf(TStartupInfo);

  CreateOK := CreateProcess(nil, PChar(ProgramName), nil, nil,False,
              nil, nil, StartInfo, ProcInfo);

  { check to see if successful }
  if CreateOK then
    //may or may not be needed. Usually wait for child processes
    WaitForSingleObject(ProcInfo.hProcess, INFINITE);
Compare this code to what you've written and see if there are any differences. I use it a lot and it works just fine.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date