Commit 51a73216 authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

ntoskrnl.exe: Implement KeAreApcsDisabled.

parent f748d679
...@@ -3569,7 +3569,8 @@ NTSTATUS WINAPI IoCsqInitialize(PIO_CSQ csq, PIO_CSQ_INSERT_IRP insert_irp, PIO_ ...@@ -3569,7 +3569,8 @@ NTSTATUS WINAPI IoCsqInitialize(PIO_CSQ csq, PIO_CSQ_INSERT_IRP insert_irp, PIO_
*/ */
void WINAPI KeEnterCriticalRegion(void) void WINAPI KeEnterCriticalRegion(void)
{ {
FIXME(": stub\n"); TRACE( "semi-stub\n" );
KeGetCurrentThread()->critical_region++;
} }
/*********************************************************************** /***********************************************************************
...@@ -3577,7 +3578,18 @@ void WINAPI KeEnterCriticalRegion(void) ...@@ -3577,7 +3578,18 @@ void WINAPI KeEnterCriticalRegion(void)
*/ */
void WINAPI KeLeaveCriticalRegion(void) void WINAPI KeLeaveCriticalRegion(void)
{ {
FIXME(": stub\n"); TRACE( "semi-stub\n" );
KeGetCurrentThread()->critical_region--;
}
/***********************************************************************
* KeAreApcsDisabled (NTOSKRNL.@)
*/
BOOLEAN WINAPI KeAreApcsDisabled(void)
{
unsigned int critical_region = KeGetCurrentThread()->critical_region;
TRACE( "%u\n", critical_region );
return !!critical_region;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -523,7 +523,7 @@ ...@@ -523,7 +523,7 @@
@ stdcall KeAcquireSpinLockAtDpcLevel(ptr) @ stdcall KeAcquireSpinLockAtDpcLevel(ptr)
@ stdcall -arch=arm,arm64,x86_64 KeAcquireSpinLockRaiseToDpc(ptr) @ stdcall -arch=arm,arm64,x86_64 KeAcquireSpinLockRaiseToDpc(ptr)
@ stub KeAddSystemServiceTable @ stub KeAddSystemServiceTable
@ stub KeAreApcsDisabled @ stdcall KeAreApcsDisabled()
@ stub KeAttachProcess @ stub KeAttachProcess
@ stub KeBugCheck @ stub KeBugCheck
@ stub KeBugCheckEx @ stub KeBugCheckEx
......
...@@ -41,6 +41,7 @@ struct _KTHREAD ...@@ -41,6 +41,7 @@ struct _KTHREAD
DISPATCHER_HEADER header; DISPATCHER_HEADER header;
PEPROCESS process; PEPROCESS process;
CLIENT_ID id; CLIENT_ID id;
unsigned int critical_region;
}; };
struct _ETHREAD struct _ETHREAD
......
...@@ -370,6 +370,27 @@ static void test_current_thread(BOOL is_system) ...@@ -370,6 +370,27 @@ static void test_current_thread(BOOL is_system)
ok(!ret, "ZwClose failed: %#x\n", ret); ok(!ret, "ZwClose failed: %#x\n", ret);
} }
static void test_critical_region(BOOL is_dispatcher)
{
BOOLEAN result;
KeEnterCriticalRegion();
KeEnterCriticalRegion();
result = KeAreApcsDisabled();
ok(result == TRUE, "KeAreApcsDisabled returned %x\n", result);
KeLeaveCriticalRegion();
result = KeAreApcsDisabled();
ok(result == TRUE, "KeAreApcsDisabled returned %x\n", result);
KeLeaveCriticalRegion();
result = KeAreApcsDisabled();
todo_wine_if(is_dispatcher)
ok(result == is_dispatcher || broken(is_dispatcher && !result),
"KeAreApcsDisabled returned %x\n", result);
}
static void sleep(void) static void sleep(void)
{ {
LARGE_INTEGER timeout; LARGE_INTEGER timeout;
...@@ -1490,6 +1511,7 @@ static void WINAPI main_test_task(DEVICE_OBJECT *device, void *context) ...@@ -1490,6 +1511,7 @@ static void WINAPI main_test_task(DEVICE_OBJECT *device, void *context)
main_test_work_item = NULL; main_test_work_item = NULL;
test_current_thread(TRUE); test_current_thread(TRUE);
test_critical_region(FALSE);
test_call_driver(device); test_call_driver(device);
test_cancel_irp(device); test_cancel_irp(device);
...@@ -1546,6 +1568,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st ...@@ -1546,6 +1568,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
test_irp_struct(irp, device); test_irp_struct(irp, device);
test_current_thread(FALSE); test_current_thread(FALSE);
test_critical_region(TRUE);
test_mdl_map(); test_mdl_map();
test_init_funcs(); test_init_funcs();
test_load_driver(); test_load_driver();
......
...@@ -216,6 +216,7 @@ NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_ ...@@ -216,6 +216,7 @@ NTSTATUS WINAPI IoQueryDeviceDescription(PINTERFACE_TYPE,PULONG,PCONFIGURATION_
PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID); PCONFIGURATION_TYPE,PULONG,PIO_QUERY_DEVICE_ROUTINE,PVOID);
void WINAPI IoRegisterDriverReinitialization(PDRIVER_OBJECT,PDRIVER_REINITIALIZE,PVOID); void WINAPI IoRegisterDriverReinitialization(PDRIVER_OBJECT,PDRIVER_REINITIALIZE,PVOID);
NTSTATUS WINAPI IoRegisterShutdownNotification(PDEVICE_OBJECT); NTSTATUS WINAPI IoRegisterShutdownNotification(PDEVICE_OBJECT);
BOOLEAN WINAPI KeAreApcsDisabled(void);
NTSTATUS WINAPI KeExpandKernelStackAndCallout(PEXPAND_STACK_CALLOUT,void*,SIZE_T); NTSTATUS WINAPI KeExpandKernelStackAndCallout(PEXPAND_STACK_CALLOUT,void*,SIZE_T);
void WINAPI KeSetTargetProcessorDpc(PRKDPC,CCHAR); void WINAPI KeSetTargetProcessorDpc(PRKDPC,CCHAR);
BOOLEAN WINAPI MmIsAddressValid(void *); BOOLEAN WINAPI MmIsAddressValid(void *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment