Skip to content

Commit 33f89fc

Browse files
Copilotadamsitnik
andauthored
Add comment explaining ERROR_ACCESS_DENIED handling in TerminateProcessCore
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/1a601c8b-3c5f-4596-9b8f-5e11188e35ae Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
1 parent d2f68c9 commit 33f89fc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.Windows.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ private bool TerminateProcessCore()
753753

754754
int error = Marshal.GetLastPInvokeError();
755755

756+
// If the process has already exited, TerminateProcess fails with ERROR_ACCESS_DENIED.
756757
if (error == Interop.Errors.ERROR_ACCESS_DENIED &&
757758
Interop.Kernel32.GetExitCodeProcess(this, out int exitCode) &&
758759
exitCode != Interop.Kernel32.HandleOptions.STILL_ACTIVE)

0 commit comments

Comments
 (0)