Click or drag to resize

LocalHookIsThreadIntercepted Method

Checks whether a given thread ID will be intercepted by the underlying hook.

Namespace:  EasyHook
Assembly:  EasyHook (in EasyHook.dll) Version: 2.7.6684.0 (2.7.6684.0)
Syntax
public bool IsThreadIntercepted(
	int InThreadID
)

Parameters

InThreadID
Type: SystemInt32
A native OS thread ID; or zero if you want to check the current thread.

Return Value

Type: Boolean
true if the thread is intercepted, false otherwise.
Exceptions
ExceptionCondition
ObjectDisposedException The underlying hook is already disposed.
Remarks

This method provides an interface to the internal negotiation algorithm. You may use it to check whether your ACL provides expected results.

The following is a pseudo code of how this method is implemented:

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;

See Also