ntoskrnl.exe: Implement KeAreApcsDisabled.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2019-05-30 13:11:42 +02:00 committed by Alexandre Julliard
parent f748d6794d
commit 51a732163f
5 changed files with 40 additions and 3 deletions

View File

@ -3569,7 +3569,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++;
}
/***********************************************************************
@ -3577,7 +3578,18 @@ void WINAPI KeEnterCriticalRegion(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;
}
/***********************************************************************

View File

@ -523,7 +523,7 @@
@ stdcall KeAcquireSpinLockAtDpcLevel(ptr)
@ stdcall -arch=arm,arm64,x86_64 KeAcquireSpinLockRaiseToDpc(ptr)
@ stub KeAddSystemServiceTable
@ stub KeAreApcsDisabled
@ stdcall KeAreApcsDisabled()
@ stub KeAttachProcess
@ stub KeBugCheck
@ stub KeBugCheckEx

View File

@ -41,6 +41,7 @@ struct _KTHREAD
DISPATCHER_HEADER header;
PEPROCESS process;
CLIENT_ID id;
unsigned int critical_region;
};
struct _ETHREAD

View File

@ -370,6 +370,27 @@ static void test_current_thread(BOOL is_system)
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)
{
LARGE_INTEGER timeout;
@ -1490,6 +1511,7 @@ static void WINAPI main_test_task(DEVICE_OBJECT *device, void *context)
main_test_work_item = NULL;
test_current_thread(TRUE);
test_critical_region(FALSE);
test_call_driver(device);
test_cancel_irp(device);
@ -1546,6 +1568,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
test_irp_struct(irp, device);
test_current_thread(FALSE);
test_critical_region(TRUE);
test_mdl_map();
test_init_funcs();
test_load_driver();

View File

@ -216,6 +216,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 *);