Esempio n. 1
0
 protected override Boolean ReleaseHandle()
 {
     return(NativeAPI.TryCloseFindHandle(this.handle));
 }
Esempio n. 2
0
        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();
                }
            }
        }