From d3b8aa728e8f4eced69f95a500d8af091b9b43f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sat, 17 Feb 2024 11:01:37 +0100 Subject: [PATCH] * Patch by Martin Friebe: mark duplicated handle for close instead of original --- packages/fcl-process/src/win/process.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/fcl-process/src/win/process.inc b/packages/fcl-process/src/win/process.inc index b1b40f0885..06ba33fc9b 100644 --- a/packages/fcl-process/src/win/process.inc +++ b/packages/fcl-process/src/win/process.inc @@ -370,8 +370,9 @@ begin DUPLICATE_SAME_ACCESS ); if Res then begin - if (IOType=iotHandle) and not FAutoCloseCustomHandle then - FCloseHandleOnExecute:=True // AutoCloseCustomHandle protects the original Handle + // Either AutoCloseCustomHandle or set in OnGetHandle + if (IOType=iotHandle) and not FCloseHandleOnExecute then + FCloseHandleOnExecute:=True // the original CustomHandle is kept open / Set True for the duplicate handle else Res:=CloseHandle(oldHandle); end;