private void Init(string path) { string pathDir = Path.GetDirectoryName(path); NativeMethods.STARTUPINFO startupInfo = new NativeMethods.STARTUPINFO(); NativeMethods.PROCESS_INFORMATION processInfo; if (!NativeMethods.CreateProcess(path, null, IntPtr.Zero, IntPtr.Zero, false, NativeMethods.CreationFlag.DEBUG_PROCESS, IntPtr.Zero, pathDir, ref startupInfo, out processInfo)) { throw new Win32Exception(); } NativeMethods.CloseHandle(processInfo.hThread); m_Process = Process.GetProcessById((int)processInfo.dwProcessId); m_hProcess = processInfo.hProcess; InitBreakpoints(); }
private void Init( string path ) { string pathDir = Path.GetDirectoryName( path ); NativeMethods.STARTUPINFO startupInfo = new NativeMethods.STARTUPINFO(); NativeMethods.PROCESS_INFORMATION processInfo; if ( !NativeMethods.CreateProcess( path, null, IntPtr.Zero, IntPtr.Zero, false, NativeMethods.CreationFlag.DEBUG_PROCESS, IntPtr.Zero, pathDir, ref startupInfo, out processInfo ) ) throw new Win32Exception(); NativeMethods.CloseHandle( processInfo.hThread ); m_Process = Process.GetProcessById( (int)processInfo.dwProcessId ); m_hProcess = processInfo.hProcess; InitBreakpoints(); }