/// <summary> /// Gets the thread corresponding to an id. /// </summary> /// <param name="threadId">The unique identifier of the thread to get.</param> /// <returns>A new instance of a <see cref="RemoteThread"/> class.</returns> public RemoteThread this[int threadId] { get { return(new RemoteThread(MemorySharp, NativeThreads.First(t => t.Id == threadId))); } }
/// <summary> /// Creates a thread that runs in the remote process. /// </summary> /// <param name="address"> /// A pointer to the application-defined function to be executed by the thread and represents /// the starting address of the thread in the remote process. /// </param> /// <param name="isStarted">Sets if the thread must be started just after being created.</param> /// <returns>A new instance of the <see cref="RemoteThread" /> class.</returns> public IRemoteThread Create(IntPtr address, bool isStarted = true) { //Create the thread var ret = ThreadHelper.NtQueryInformationThread( ThreadHelper.CreateRemoteThread(Process.Handle, address, IntPtr.Zero, ThreadCreationFlags.Suspended)); // Find the managed object corresponding to this thread // TODO (int) cast may be unnecessary and/or problematic. Suggest coming back for proper fix later var result = new RemoteThread(Process, NativeThreads.First(t => t.Id == (int)ret.ClientId.UniqueThread)); // If the thread must be started if (isStarted) { result.Resume(); } return(result); }
/// <summary> /// Gets the thread corresponding to an id. /// </summary> /// <param name="threadId">The unique identifier of the thread to get.</param> /// <returns>A new instance of a <see cref="RemoteThread" /> class.</returns> public IRemoteThread this[int threadId] { get { return(new RemoteThread(_process, NativeThreads.First(t => t.Id == threadId))); } }
/// <summary> /// Gets a thread by its id in the remote process. /// </summary> /// <param name="id">The id of the thread.</param> /// <returns>A new instance of the <see cref="RemoteThread" /> class.</returns> public IRemoteThread GetThreadById(int id) { return(new RemoteThread(_process, NativeThreads.First(t => t.Id == id))); }
/// <summary> /// Gets a thread by its id in the remote process. /// </summary> /// <param name="id">The id of the thread.</param> /// <returns>A new instance of the <see cref="RemoteThread"/> class.</returns> public RemoteThread GetThreadById(int id) { return(new RemoteThread(MemorySharp, NativeThreads.First(t => t.Id == id))); }