IDebugClient5::CreateProcess2 method (dbgeng.h)

The CreateProcess2 method executes the given command to create a new process.

Syntax

HRESULT CreateProcess2(
  [in]           ULONG64 Server,
  [in]           PSTR    CommandLine,
  [in]           PVOID   OptionsBuffer,
  [in]           ULONG   OptionsBufferSize,
  [in, optional] PCSTR   InitialDirectory,
  [in, optional] PCSTR   Environment
);

Parameters

[in] Server

Specifies the process server that will be attached to the process. If Server is zero, the engine will create the local process without using a process server.

[in] CommandLine

Specifies the command line to execute to create the new process.

[in] OptionsBuffer

Specifies the process creation options. OptionsBuffer is a pointer to a DEBUG_CREATE_PROCESS_OPTIONS structure.

[in] OptionsBufferSize

Specifies the size of the buffer OptionsBuffer. This should be set to sizeof(DEBUG_CREATE_PROCESS_OPTIONS).

[in, optional] InitialDirectory

Specifies the starting directory for the process. If InitialDirectory is NULL, the current directory for the process server is used.

[in, optional] Environment

Specifies an environment block for the new process. An environment block consists of a null-terminated block of null-terminated strings. Each string is of the form:

name=value

Note that the last two characters of the environment block are both NULL: one to terminate the string and one to terminate the block.

If Environment is set to NULL, the new process inherits the environment block of the process server. If the DEBUG_CREATE_PROCESS_THROUGH_RTL flag is set in OptionsBuffer, then Environment must be NULL.

Return value

This method may also return error values. See Return Values for more details.

Return code Description
S_OK
The method was successful.

Remarks

This method is available only for live user-mode debugging.

If CreateFlags contains either of the flags DEBUG_PROCESS or DEBUG_ONLY_THIS_PROCESS, the engine will also attach to the newly created process. This is similar to the behavior of CreateProcessAndAttach2 with its argument ProcessId set to zero.

For more information about creating and attaching to live user-mode targets, see Live User-Mode Targets.

Requirements

Requirement Value
Target Platform Desktop
Header dbgeng.h (include Dbgeng.h)

See also

.create (Create Process)

AbandonCurrentProcess

AttachProcess

ConnectProcessServer

CreateProcess2

CreateProcessAndAttach2

DetachCurrentProcess

GetRunningProcessDescription

GetRunningProcessSystemIds

IDebugClient5

TerminateCurrentProcess