Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 16 ++++++++++++++-- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/ntoskrnl_private.h | 1 + include/ddk/ntddk.h | 1 + 4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 770bdfd4fa..49592c6dc1 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2497,6 +2497,8 @@ static void *create_thread_object( HANDLE handle ) if (!NtQueryInformationThread( handle, ThreadBasicInformation, &info, sizeof(info), NULL )) thread->id = info.ClientId;
+ thread->critical_region = FALSE; + return thread; }
@@ -3431,7 +3433,8 @@ void WINAPI ExReleaseResourceForThreadLite( PERESOURCE resource, ERESOURCE_THREA */ void WINAPI KeEnterCriticalRegion(void) { - FIXME(": stub\n"); + TRACE(": semi-stub\n"); + KeGetCurrentThread()->critical_region = TRUE; }
/*********************************************************************** @@ -3439,7 +3442,8 @@ void WINAPI KeEnterCriticalRegion(void) */ void WINAPI KeLeaveCriticalRegion(void) { - FIXME(": stub\n"); + TRACE(": semi-stub\n"); + KeGetCurrentThread()->critical_region = FALSE; }
/*********************************************************************** @@ -4379,3 +4383,11 @@ ULONG WINAPI ExSetTimerResolution(ULONG time, BOOLEAN set_resolution) FIXME("stub: %u %d\n", time, set_resolution); return KeQueryTimeIncrement(); } + +/********************************************************************* + * KeAreApcsDisabled (NTOSKRNL.@) + */ +BOOLEAN WINAPI KeAreApcsDisabled(void) +{ + return KeGetCurrentThread()->critical_region; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 601506246e..08de49e760 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 152fde9320..ce2a402902 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -32,6 +32,7 @@ struct _KTHREAD { DISPATCHER_HEADER header; CLIENT_ID id; + BOOLEAN critical_region; };
void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG ref ) DECLSPEC_HIDDEN; diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index 719ba67c6a..f09f879032 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -213,6 +213,7 @@ NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_ PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID); void WINAPI IoRegisterDriverReinitialization(PDRIVER_OBJECT,PDRIVER_REINITIALIZE,PVOID); NTSTATUS WINAPI IoRegisterShutdownNotification(PDEVICE_OBJECT); +BOOLEAN WINAPI KeAreApcsDisabled(void); NTSTATUS WINAPI KeExpandKernelStackAndCallout(PEXPAND_STACK_CALLOUT,void*,SIZE_T); void WINAPI KeSetTargetProcessorDpc(PRKDPC,CCHAR); BOOLEAN WINAPI MmIsAddressValid(void *);