ICorDebug::CreateProcess Method

Launches a process and its primary thread under the control of the debugger.

HRESULT CreateProcess (
    [in]  LPCWSTR                     lpApplicationName,
    [in]  LPWSTR                      lpCommandLine,
    [in]  LPSECURITY_ATTRIBUTES       lpProcessAttributes,
    [in]  LPSECURITY_ATTRIBUTES       lpThreadAttributes,
    [in]  BOOL                        bInheritHandles,
    [in]  DWORD                       dwCreationFlags,
    [in]  PVOID                       lpEnvironment,
    [in]  LPCWSTR                     lpCurrentDirectory,
    [in]  LPSTARTUPINFOW              lpStartupInfo,
    [in]  LPPROCESS_INFORMATION       lpProcessInformation,
    [in]  CorDebugCreateProcessFlags  debuggingFlags,
    [out] ICorDebugProcess            **ppProcess


  • lpApplicationName
    [in] Pointer to a null-terminated string that specifies the module to be executed by the launched process. The module is executed in the security context of the calling process.

  • lpCommandLine
    [in] Pointer to a null-terminated string that specifies the command line to be executed by the launched process.

  • lpProcessAttributes
    [in] Pointer to a Win32 SECURITY_ATTRIBUTES structure that specifies the security descriptor for the process. If lpProcessAttributes is null, the process gets a default security descriptor.

  • lpThreadAttributes
    [in] Pointer to a Win32 SECURITY_ATTRIBUTES structure that specifies the security descriptor for the primary thread of the process. If lpThreadAttributes is null, the thread gets a default security descriptor.

  • bInheritHandles
    [in] Set to true to indicate that each inheritable handle in the calling process is inherited by the launched process, or false to indicate that the handles are not inherited. The inherited handles have the same value and access rights as the original handles.

  • dwCreationFlags
    [in] A bitwise combination of the Win32 Process Creation Flags that control the priority class and the behavior of the launched process.

  • lpEnvironment
    [in] Pointer to an environment block for the new process.

  • lpCurrentDirectory
    [in] Pointer to a null-terminated string that specifies the full path to the current directory for the process. If this parameter is null, the new process will have the same current drive and directory as the calling process.

  • lpStartupInfo
    [in] Pointer to a Win32 STARTUPINFOW structure that specifies the window station, desktop, standard handles, and appearance of the main window for the launched process.

  • lpProcessInformation
    [in] Pointer to a Win32 PROCESS_INFORMATION structure that specifies the identification information about the process to be launched.

  • debuggingFlags
    [in] A value of the CorDebugCreateProcessFlags enumeration that specifies the debugging options.

  • ppProcess
    [out] A pointer to the address of a ICorDebugProcess object that represents the process.


The parameters of this method are the same as those of the Win32 CreateProcess method.

To enable unmanaged mixed-mode debugging, set dwCreationFlags to DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS. If you want to use only managed debugging, do not set these flags.

If the debugger and the process to be debugged (the attached process) share a single console, and if interop debugging is used, it is possible for the attached process to hold console locks and stop at a debug event. The debugger will then block any attempt to use the console. To avoid this problem, set the CREATE_NEW_CONSOLE flag in the dwCreationFlags parameter.

Interop debugging is not supported on Win9x and non-x86 platforms such as IA-64-based and AMD64-based platforms.


Platforms: See .NET Framework System Requirements.

Header: CorDebug.idl, CorDebug.h

Library: CorGuids.lib

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0

See Also


ICorDebug Interface