Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 21 +++++++++++++++++++-- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/ntoskrnl_private.h | 1 + 3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 85235a444d..675ad59924 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2503,6 +2503,7 @@ static void *create_thread_object( HANDLE handle ) if (!(thread = alloc_kernel_object( PsThreadType, handle, sizeof(*thread), 0 ))) return NULL;
thread->Header.WaitListHead.Blink = INVALID_HANDLE_VALUE; + thread->critical_region = 0; return thread; }
@@ -3448,7 +3449,10 @@ void WINAPI ExReleaseResourceForThreadLite( PERESOURCE resource, ERESOURCE_THREA */ void WINAPI KeEnterCriticalRegion(void) { - FIXME(": stub\n"); + PETHREAD thread = (PETHREAD) KeGetCurrentThread(); + + /* FIXME: actually disable certain APCs */ + thread->critical_region = TRUE; }
/*********************************************************************** @@ -3456,7 +3460,10 @@ void WINAPI KeEnterCriticalRegion(void) */ void WINAPI KeLeaveCriticalRegion(void) { - FIXME(": stub\n"); + PETHREAD thread = (PETHREAD) KeGetCurrentThread(); + + /* FIXME: actually re-enable certain APCs */ + thread->critical_region = FALSE; }
/*********************************************************************** @@ -4396,3 +4403,13 @@ ULONG WINAPI ExSetTimerResolution(ULONG time, BOOLEAN set_resolution) FIXME("stub: %u %d\n", time, set_resolution); return KeQueryTimeIncrement(); } + +/********************************************************************* + * KeAreApcsDisabled (NTOSKRNL.@) + */ +BOOLEAN WINAPI KeAreApcsDisabled(void) +{ + PETHREAD thread = (PETHREAD) KeGetCurrentThread(); + + return thread->critical_region; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index f8d73450de..cd5c643259 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -520,7 +520,7 @@ @ stdcall KeAcquireSpinLockAtDpcLevel(ptr) @ stdcall -arch=arm,arm64,x86_64 KeAcquireSpinLockRaiseToDpc(ptr) @ stub KeAddSystemServiceTable -@ stub KeAreApcsDisabled +@ stdcall KeAreApcsDisabled() @ stub KeAttachProcess @ stub KeBugCheck @ stub KeBugCheckEx diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index 700738adc3..4cc0be153e 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -42,6 +42,7 @@ extern POBJECT_TYPE SeTokenObjectType;
struct _ETHREAD { DISPATCHER_HEADER Header; + BOOLEAN critical_region; };
#ifdef __i386__