LhIsThreadIntercepted() public static method

public static LhIsThreadIntercepted ( IntPtr InHandle, Int32 InThreadID, System.Boolean &OutResult ) : void
InHandle System.IntPtr
InThreadID System.Int32
OutResult System.Boolean
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Checks whether a given thread ID will be intercepted by the underlying hook.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method provides an interface to the internal negotiation algorithm.
        /// You may use it to check whether your ACL provides expected results.
        /// </para><para>
        /// The following is a pseudo code of how this method is implemented:
        /// <code>
        /// if(InThreadID == 0)
        ///     InThreadID = GetCurrentThreadId();
        ///
        /// if(GlobalACL.Contains(InThreadID))
        /// {
        ///     if(LocalACL.Contains(InThreadID))
        ///     {
        ///         if(LocalACL.IsExclusive)
        ///             return false;
        ///     }
        ///     else
        ///     {
        ///         if(GlobalACL.IsExclusive)
        ///             return false;
        ///
        ///         if(!LocalACL.IsExclusive)
        ///             return false;
        ///     }
        /// }
        /// else
        /// {
        ///     if(LocalACL.Contains(InThreadID))
        ///     {
        ///         if(LocalACL.IsExclusive)
        ///             return false;
        ///     }
        ///     else
        ///     {
        ///         if(!GlobalACL.IsExclusive)
        ///             return false;
        ///
        ///         if(!LocalACL.IsExclusive)
        ///             return false;
        ///     }
        /// }
        ///
        /// return true;
        /// </code>
        /// </para>
        /// </remarks>
        /// <param name="InThreadID">A native OS thread ID; or zero if you want to check the current thread.</param>
        /// <returns><c>true</c> if the thread is intercepted, <c>false</c> otherwise.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The underlying hook is already disposed.
        /// </exception>
        public bool IsThreadIntercepted(Int32 InThreadID)
        {
            Boolean Result;

            if (IntPtr.Zero == m_Handle)
            {
                throw new ObjectDisposedException(typeof(LocalHook).FullName);
            }

            NativeAPI.LhIsThreadIntercepted(m_Handle, InThreadID, out Result);

            return(Result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks whether a given thread ID will be intercepted by the underlying hook.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method provides an interface to the internal negotiation algorithm.
        /// You may use it to check whether your ACL provides expected results.
        /// </para><para>
        /// The following is a pseudo code of how this method is implemented:
        /// <code>
        /// if(InThreadID == 0)
        ///     InThreadID = GetCurrentThreadId();
        ///
        /// if(GlobalACL.Contains(InThreadID))
        /// {
        ///     if(LocalACL.Contains(InThreadID))
        ///     {
        ///         if(LocalACL.IsExclusive)
        ///             return false;
        ///     }
        ///     else
        ///     {
        ///         if(GlobalACL.IsExclusive)
        ///             return false;
        ///
        ///         if(!LocalACL.IsExclusive)
        ///             return false;
        ///     }
        /// }
        /// else
        /// {
        ///     if(LocalACL.Contains(InThreadID))
        ///     {
        ///         if(LocalACL.IsExclusive)
        ///             return false;
        ///     }
        ///     else
        ///     {
        ///         if(!GlobalACL.IsExclusive)
        ///             return false;
        ///
        ///         if(!LocalACL.IsExclusive)
        ///             return false;
        ///     }
        /// }
        ///
        /// return true;
        /// </code>
        /// </para>
        /// </remarks>
        /// <param name="InThreadID">A native OS thread ID; or zero if you want to check the current thread.</param>
        /// <returns><c>true</c> if the thread is intercepted, <c>false</c> otherwise.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The underlying hook is already disposed.
        /// </exception>
        public bool IsThreadIntercepted(Int32 InThreadID)
        {
            Boolean Result = false;

            if (IntPtr.Zero == m_Handle)
            {
                throw new ObjectDisposedException(typeof(LocalHook).FullName);
            }

#if SUPPORT_THEME_HOOKS
            NativeAPI.LhIsThreadIntercepted(m_Handle, InThreadID, out Result);
#endif

            return(Result);
        }