/// <summary> /// Executes the specified assembler in the remote process and waits for exit /// </summary> /// <param name="assembler">The assembler to run</param> /// <param name="cleanup">If the memory should be cleaned up</param> /// <returns>The thread exit code</returns> /// <exception cref="InvalidOperationException">Thrown if there is no process handle</exception> /// <exception cref="ThreadCreationException">Thrown if thread could not be created</exception> /// <exception cref="MemoryAllocationException">Thrown if memory can't be allocated</exception> /// <exception cref="MemoryWriteException">Thrown if memory write fails</exception> /// <exception cref="ThreadExitCodeException">Thrown if GetExitCodeThread fails</exception> public async Task <IntPtr> ExecuteAndWait(Assembler assembler, bool cleanup = true) { return(await ExecuteAndWait(assembler.ToByteArray(), cleanup)); }
/// <summary> /// Executes the specified assembler in the remote process /// </summary> /// <param name="assembler">The assembler to run</param> /// <exception cref="InvalidOperationException">Thrown if there is no process handle</exception> /// <exception cref="ThreadCreationException">Thrown if thread could not be created</exception> /// <exception cref="MemoryAllocationException">Thrown if memory can't be allocated</exception> /// <exception cref="MemoryWriteException">Thrown if memory write fails</exception> /// /// <returns>The thread handle</returns> public IntPtr Execute(Assembler assembler) { return(Execute(assembler.ToByteArray())); }