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 0365634772..191dbafdeb 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2484,6 +2484,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; }
@@ -3383,7 +3385,8 @@ NTSTATUS WINAPI IoCsqInitialize(PIO_CSQ csq, PIO_CSQ_INSERT_IRP insert_irp, PIO_ */ void WINAPI KeEnterCriticalRegion(void) { - FIXME(": stub\n"); + TRACE(": semi-stub\n"); + KeGetCurrentThread()->critical_region = TRUE; }
/*********************************************************************** @@ -3391,7 +3394,8 @@ void WINAPI KeEnterCriticalRegion(void) */ void WINAPI KeLeaveCriticalRegion(void) { - FIXME(": stub\n"); + TRACE(": semi-stub\n"); + KeGetCurrentThread()->critical_region = FALSE; }
/*********************************************************************** @@ -4323,3 +4327,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 e08abb4150..ebba812a4e 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 f5a76284cb..bfe4707265 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 *);