Detaches r77 from the specified process. The process to detach. , if this process was detached successfully; otherwise, .
(ProcessModel process)
| 127 | /// otherwise, <see langword="false" />. |
| 128 | /// </returns> |
| 129 | public static async Task<bool> Detach(ProcessModel process) |
| 130 | { |
| 131 | return await Task.Run(() => |
| 132 | { |
| 133 | if (!ProcessEx.IsRunning(process.Id)) |
| 134 | { |
| 135 | Log.Warning( |
| 136 | new LogFileItem(process.Name), |
| 137 | new LogTextItem($"(PID {process.Id}) is no longer running.") |
| 138 | ); |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | if (!HelperDll.Detach(process.Id)) |
| 143 | { |
| 144 | Log.Warning( |
| 145 | new LogTextItem("Detaching from"), |
| 146 | new LogFileItem(process.Name), |
| 147 | new LogTextItem($"(PID {process.Id}) failed.") |
| 148 | ); |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | Log.Information( |
| 153 | new LogTextItem("Detached from"), |
| 154 | new LogFileItem(process.Name), |
| 155 | new LogTextItem($"(PID {process.Id}).") |
| 156 | ); |
| 157 | return true; |
| 158 | }); |
| 159 | } |
| 160 | /// <summary> |
| 161 | /// Injects all processes with the r77 DLL using reflective DLL injection. |
| 162 | /// </summary> |
nothing calls this directly
no test coverage detected