protected override Boolean ReleaseHandle() { return(NativeAPI.TryCloseFindHandle(this.handle)); }
private static NativeNormalHandle HandleCopy(Int32 pID, IntPtr remoteHandle, Boolean removeSourceHandle = false) { NativeNormalHandle pHandle = null; try { if (NativeAPI.TryOpenProcess(pID, out pHandle) && NativeAPI.TryDuplicateHandle(pHandle, remoteHandle, NativeAPI.GetCurrentProcess(), out var lHandle, removeSourceHandle)) { return(lHandle); } return(null); } finally { if (pHandle != null) { pHandle.Close(); } } }