public 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; m_Address = FindBreakpoint(); if (m_Address == 0) { throw new Exception("Cannot find hash function!"); } InitBreakpoints(); }
public 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; m_Address = FindBreakpoint(); if ( m_Address == 0 ) throw new Exception( "Cannot find hash function!" ); InitBreakpoints(); }