Share via


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
);

Parameters

  • 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.

Remarks

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 IA64 and AMD64.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorDebug.idl

Library: CorGuids.lib

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Reference

ICorDebug Interface