I thought about that, but since the only documented way to access it is from the current thread.

On Wed, Apr 24, 2019 at 10:32 AM Dmitry Timoshkov <dmitry@baikal.ru> wrote:
Derek Lesho <dereklesho52@gmail.com> wrote:

>  void WINAPI KeEnterCriticalRegion(void)
>  {
> -    FIXME(": stub\n");
> +    TRACE(": semi-stub\n");
> +    KeGetCurrentThread()->critical_region_count++;
>  }
...
>  void WINAPI KeLeaveCriticalRegion(void)
>  {
> -    FIXME(": stub\n");
> +    TRACE(": semi-stub\n");
> +    KeGetCurrentThread()->critical_region_count--;
>  }
...
> +BOOLEAN WINAPI KeAreApcsDisabled(void)
> +{
> +    return !!KeGetCurrentThread()->critical_region_count;
> +}

Shouldn't these APIs use interlocked operations?

--
Dmitry.