Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Windows Threading > Creating Processes

Creating Processes

To create a new process, the first process calls CreateProcess(), which takes a number of parameters. The three critical parameters are the name (and any parameters) of the process to be run, together with a pointer to a STARTUPINFO structure and a PROCESS_INFORMATION structure. Table 6.4 shows the full parameters to this function.

Table 6.4. Parameters Passed to CreateProcess()
Parameter TypeComment
LPCWSTRName of the application.
LPWSTRCommand line.
LPSECURITY_ATTRIBUTESPointer to security attributes for the child process.
LPSECURITY_ATTRIBUTESPointer to security attributes for the first thread in the child process.
BOOLA boolean that indicates whether the created process should inherit the handles from the calling process.
DWORDAn optional set of process creation flags and process priority flags. These flags control various characteristics of the created process such as whether the process has a window or whether the main thread is created in the suspended state. The flags also control the scheduling priority for the process, which in turn determines how much share of the CPU the process is given.
LPVOIDAn optional pointer to a new set of runtime environment strings. If this is null, the new process will inherit the runtime environment of the calling process.
LPCWSTRAn optional pointer to a string containing the current directory for the process. If this parameter is null, the process inherits the runtime directory of the calling process.
LPSTARTUPINFOWPointer to the STARTUPINFO structure.
LPPROCESS_INFORMATIONPointer to the PROCESS_INFORMATION structure.



  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint