mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[KMTESTS]
- decrease log buffer size because ROS has a problem with unlocking it otherwise ;) - add test for critical/guarded regions - add test for executive resources (part 1) svn path=/branches/GSoC_2011/KMTestSuite/; revision=52592
This commit is contained in:
parent
af53d3dc25
commit
363d5300d0
7 changed files with 436 additions and 7 deletions
|
@ -15,11 +15,13 @@ list(APPEND KMTEST_DRV_SOURCE
|
|||
|
||||
example/Example.c
|
||||
ntos_ex/ExPools.c
|
||||
ntos_ex/ExResource.c
|
||||
ntos_ex/ExTimer.c
|
||||
ntos_fsrtl/FsRtlExpression.c
|
||||
ntos_io/IoDeviceInterface.c
|
||||
ntos_io/IoIrp.c
|
||||
ntos_io/IoMdl.c
|
||||
ntos_ke/KeApc.c
|
||||
ntos_ke/KeDpc.c
|
||||
ntos_ke/KeIrql.c
|
||||
ntos_ke/KeProcessor.c
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define SERVICE_NAME L"Kmtest"
|
||||
#define SERVICE_PATH L"kmtest_drv.sys"
|
||||
|
||||
#define LOGBUFFER_SIZE 65000
|
||||
#define LOGBUFFER_SIZE 16364
|
||||
#define RESULTBUFFER_SIZE FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer[LOGBUFFER_SIZE])
|
||||
|
||||
HANDLE KmtestHandle;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
</directory>
|
||||
<directory name="ntos_ex">
|
||||
<file>ExPools.c</file>
|
||||
<file>ExResource.c</file>
|
||||
<file>ExTimer.c</file>
|
||||
</directory>
|
||||
<directory name="ntos_fsrtl">
|
||||
|
@ -25,6 +26,7 @@
|
|||
<file>IoMdl.c</file>
|
||||
</directory>
|
||||
<directory name="ntos_ke">
|
||||
<file>KeApc.c</file>
|
||||
<file>KeDpc.c</file>
|
||||
<file>KeIrql.c</file>
|
||||
<file>KeProcessor.c</file>
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
|
||||
KMT_TESTFUNC Test_Example;
|
||||
KMT_TESTFUNC Test_ExPools;
|
||||
KMT_TESTFUNC Test_ExResource;
|
||||
KMT_TESTFUNC Test_ExTimer;
|
||||
KMT_TESTFUNC Test_FsRtlExpression;
|
||||
KMT_TESTFUNC Test_IoDeviceInterface;
|
||||
KMT_TESTFUNC Test_IoIrp;
|
||||
KMT_TESTFUNC Test_IoMdl;
|
||||
KMT_TESTFUNC Test_KeApc;
|
||||
KMT_TESTFUNC Test_KeDpc;
|
||||
KMT_TESTFUNC Test_KeIrql;
|
||||
KMT_TESTFUNC Test_KeProcessor;
|
||||
|
@ -24,11 +26,13 @@ const KMT_TEST TestList[] =
|
|||
{
|
||||
{ "Example", Test_Example },
|
||||
{ "ExPools", Test_ExPools },
|
||||
{ "ExResource", Test_ExResource },
|
||||
{ "ExTimer", Test_ExTimer },
|
||||
{ "FsRtlExpression", Test_FsRtlExpression },
|
||||
{ "IoDeviceInterface", Test_IoDeviceInterface },
|
||||
{ "IoIrp", Test_IoIrp },
|
||||
{ "IoMdl", Test_IoMdl },
|
||||
{ "KeApc", Test_KeApc },
|
||||
{ "KeDpc", Test_KeDpc },
|
||||
{ "KeIrql", Test_KeIrql },
|
||||
{ "KeProcessor", Test_KeProcessor },
|
||||
|
|
270
kmtests/ntos_ex/ExResource.c
Normal file
270
kmtests/ntos_ex/ExResource.c
Normal file
|
@ -0,0 +1,270 @@
|
|||
/*
|
||||
* PROJECT: ReactOS kernel-mode tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Kernel-Mode Test Suite Executive Resource test
|
||||
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
|
||||
*/
|
||||
|
||||
#undef NTDDI_VERSION
|
||||
#define NTDDI_VERSION NTDDI_WS03SP1
|
||||
#include <ntddk.h>
|
||||
#include <ntifs.h>
|
||||
#include <ndk/extypes.h>
|
||||
#include <kmt_test.h>
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* TODO: this is the Windows Server 2003 version! ROS should use this!
|
||||
* This declaration can be removed once ROS headers are corrected */
|
||||
typedef struct _ERESOURCE_2K3 {
|
||||
LIST_ENTRY SystemResourcesList;
|
||||
POWNER_ENTRY OwnerTable;
|
||||
SHORT ActiveCount;
|
||||
USHORT Flag;
|
||||
volatile PKSEMAPHORE SharedWaiters;
|
||||
volatile PKEVENT ExclusiveWaiters;
|
||||
OWNER_ENTRY OwnerThreads[2];
|
||||
ULONG ContentionCount;
|
||||
USHORT NumberOfSharedWaiters;
|
||||
USHORT NumberOfExclusiveWaiters;
|
||||
#if defined(_WIN64)
|
||||
PVOID Reserved2; /* TODO: not sure if this should be in here for 2k3 */
|
||||
#endif
|
||||
_ANONYMOUS_UNION union {
|
||||
PVOID Address;
|
||||
ULONG_PTR CreatorBackTraceIndex;
|
||||
} DUMMYUNIONNAME;
|
||||
KSPIN_LOCK SpinLock;
|
||||
} ERESOURCE_2K3, *PERESOURCE_2K3;
|
||||
|
||||
#define CheckResourceFields(Res) do \
|
||||
{ \
|
||||
ok_eq_pointer((Res)->SystemResourcesList.Flink->Blink, &(Res)->SystemResourcesList); \
|
||||
ok_eq_pointer((Res)->SystemResourcesList.Blink->Flink, &(Res)->SystemResourcesList); \
|
||||
ok_eq_pointer((Res)->OwnerTable, NULL); \
|
||||
ok_eq_int((Res)->ActiveCount, 0); \
|
||||
ok_eq_uint((Res)->Flag, 0); \
|
||||
ok_eq_pointer((Res)->SharedWaiters, NULL); \
|
||||
ok_eq_pointer((Res)->ExclusiveWaiters, NULL); \
|
||||
ok_eq_pointer((PVOID)(Res)->OwnerThreads[0].OwnerThread, NULL); \
|
||||
ok_eq_ulong((Res)->OwnerThreads[0].TableSize, 0LU); \
|
||||
ok_eq_pointer((PVOID)(Res)->OwnerThreads[1].OwnerThread, NULL); \
|
||||
ok_eq_ulong((Res)->OwnerThreads[1].TableSize, 0LU); \
|
||||
ok_eq_ulong((Res)->ContentionCount, 0LU); \
|
||||
ok_eq_uint((Res)->NumberOfSharedWaiters, 0); \
|
||||
ok_eq_uint((Res)->NumberOfExclusiveWaiters, 0); \
|
||||
/* ok_eq_pointer((Res)->Reserved2, NULL); */ \
|
||||
ok_eq_pointer((Res)->Address, NULL); \
|
||||
ok_eq_pointer((PVOID)(Res)->SpinLock, NULL); \
|
||||
} while (0)
|
||||
|
||||
#define CheckResourceStatus(Res, Exclusive, Shared, ExclusiveWaiters, SharedWaiters) do \
|
||||
{ \
|
||||
if (Exclusive) \
|
||||
ok_bool_true(ExIsResourceAcquiredExclusiveLite(Res), "ExIsResourceAcquiredExclusiveLite returned"); \
|
||||
else \
|
||||
ok_bool_false(ExIsResourceAcquiredExclusiveLite(Res), "ExIsResourceAcquiredExclusiveLite returned"); \
|
||||
ok_eq_ulong(ExIsResourceAcquiredSharedLite(Res), Shared); \
|
||||
ok_eq_ulong(ExGetExclusiveWaiterCount(Res), ExclusiveWaiters); \
|
||||
ok_eq_ulong(ExGetSharedWaiterCount(Res), SharedWaiters); \
|
||||
} while (0)
|
||||
|
||||
static
|
||||
VOID
|
||||
TestResourceSharedAccess(
|
||||
IN PERESOURCE Res)
|
||||
{
|
||||
LONG Count = 0;
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
|
||||
ok_bool_true(ExAcquireResourceSharedLite(Res, TRUE), "ExAcquireResourceSharedLite returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedStarveExclusive(Res, FALSE), "ExAcquireSharedStarveExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedStarveExclusive(Res, TRUE), "ExAcquireSharedStarveExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedWaitForExclusive(Res, FALSE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedWaitForExclusive(Res, TRUE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
/* this one fails, TRUE would deadlock */
|
||||
ok_bool_false(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned");
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
/* this must not crash or deadlock (but can assert) */
|
||||
ExConvertExclusiveToSharedLite(Res);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
while (Count--)
|
||||
ExReleaseResourceLite(Res);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
TestResourceExclusiveAccess(
|
||||
IN PERESOURCE Res)
|
||||
{
|
||||
LONG Count = 0;
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned"); ++Count;
|
||||
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
ok_bool_true(ExAcquireResourceExclusiveLite(Res, TRUE), "ExAcquireResourceExclusiveLite returned"); ++Count;
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
|
||||
ok_bool_true(ExAcquireResourceSharedLite(Res, TRUE), "ExAcquireResourceSharedLite returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedStarveExclusive(Res, FALSE), "ExAcquireSharedStarveExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedStarveExclusive(Res, TRUE), "ExAcquireSharedStarveExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedWaitForExclusive(Res, FALSE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
|
||||
ok_bool_true(ExAcquireSharedWaitForExclusive(Res, TRUE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
ExConvertExclusiveToSharedLite(Res);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
while (Count--)
|
||||
ExReleaseResourceLite(Res);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
TestResourceUndocumentedShortcuts(
|
||||
IN PERESOURCE Res,
|
||||
IN BOOLEAN AreApcsDisabled)
|
||||
{
|
||||
PVOID Ret;
|
||||
LONG Count = 0;
|
||||
|
||||
ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_uint(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
|
||||
/* ExEnterCriticalRegionAndAcquireResourceShared, ExEnterCriticalRegionAndAcquireSharedWaitForExclusive */
|
||||
Count = 0;
|
||||
Ret = ExEnterCriticalRegionAndAcquireResourceShared(Res); ++Count;
|
||||
ok_eq_pointer(Ret, KeGetCurrentThread()->Win32Thread);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
Ret = ExEnterCriticalRegionAndAcquireResourceShared(Res); ++Count;
|
||||
ok_eq_pointer(Ret, KeGetCurrentThread()->Win32Thread);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
ExEnterCriticalRegionAndAcquireSharedWaitForExclusive(Res); ++Count;
|
||||
ok_eq_pointer(Ret, KeGetCurrentThread()->Win32Thread);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
while (Count-- > 1)
|
||||
{
|
||||
ExReleaseResourceAndLeaveCriticalRegion(Res);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
}
|
||||
|
||||
ExReleaseResourceAndLeaveCriticalRegion(Res);
|
||||
ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
|
||||
/* ExEnterCriticalRegionAndAcquireResourceExclusive */
|
||||
Count = 0;
|
||||
ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
Ret = ExEnterCriticalRegionAndAcquireResourceExclusive(Res); ++Count;
|
||||
ok_eq_pointer(Ret, KeGetCurrentThread()->Win32Thread);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
Ret = ExEnterCriticalRegionAndAcquireResourceExclusive(Res); ++Count;
|
||||
ok_eq_pointer(Ret, KeGetCurrentThread()->Win32Thread);
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
ExReleaseResourceAndLeaveCriticalRegion(Res); --Count;
|
||||
ok_bool_true(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);
|
||||
|
||||
ExReleaseResourceAndLeaveCriticalRegion(Res); --Count;
|
||||
ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
ok_eq_uint(KeAreAllApcsDisabled(), AreApcsDisabled);
|
||||
CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);
|
||||
}
|
||||
|
||||
START_TEST(ExResource)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ERESOURCE Res;
|
||||
KIRQL Irql;
|
||||
|
||||
/* this must be true even with the different structure versions */
|
||||
ASSERT(sizeof(ERESOURCE) == sizeof(ERESOURCE_2K3));
|
||||
|
||||
/* functional tests & internals */
|
||||
Irql = KeRaiseIrqlToDpcLevel();
|
||||
Status = ExInitializeResourceLite(&Res);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
KeLowerIrql(APC_LEVEL);
|
||||
|
||||
Status = ExDeleteResourceLite(&Res);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
KeLowerIrql(Irql);
|
||||
|
||||
memset(&Res, 0x55, sizeof Res);
|
||||
Status = ExInitializeResourceLite(&Res);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
CheckResourceFields((PERESOURCE_2K3)&Res);
|
||||
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
|
||||
TestResourceSharedAccess(&Res);
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
|
||||
TestResourceExclusiveAccess(&Res);
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
|
||||
TestResourceUndocumentedShortcuts(&Res, FALSE);
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
KeRaiseIrql(APC_LEVEL, &Irql);
|
||||
TestResourceUndocumentedShortcuts(&Res, TRUE);
|
||||
KeLowerIrql(Irql);
|
||||
ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned");
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
|
||||
/* ExReinitializeResourceLite cleans up after us */
|
||||
Status = ExReinitializeResourceLite(&Res);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
CheckResourceFields((PERESOURCE_2K3)&Res);
|
||||
CheckResourceStatus(&Res, FALSE, 0LU, 0LU, 0LU);
|
||||
|
||||
Status = ExDeleteResourceLite(&Res);
|
||||
ok_eq_hex(Status, STATUS_SUCCESS);
|
||||
|
||||
/* parameter checks */
|
||||
Status = STATUS_SUCCESS;
|
||||
_SEH2_TRY {
|
||||
ExInitializeResourceLite(NULL);
|
||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
} _SEH2_END;
|
||||
ok_eq_hex(Status, STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* these bugcheck
|
||||
ExDeleteResourceLite(NULL);
|
||||
Status = ExDeleteResourceLite(&Res);*/
|
||||
}
|
153
kmtests/ntos_ke/KeApc.c
Normal file
153
kmtests/ntos_ke/KeApc.c
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* PROJECT: ReactOS kernel-mode tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Kernel-Mode Test Suite Asynchronous Procedure Call test
|
||||
* PROGRAMMER: Thomas Faber <thfabba@gmx.de>
|
||||
*/
|
||||
|
||||
#undef NTDDI_VERSION
|
||||
#define NTDDI_VERSION NTDDI_WS03SP1
|
||||
#include <ntddk.h>
|
||||
#include <kmt_test.h>
|
||||
|
||||
#define CheckApcs(KernelApcsDisabled, SpecialApcsDisabled, Irql) do \
|
||||
{ \
|
||||
ok_eq_bool(KeAreApcsDisabled(), KernelApcsDisabled); \
|
||||
ok_eq_bool(KeAreAllApcsDisabled(), SpecialApcsDisabled); \
|
||||
ok_irql(Irql); \
|
||||
} while (0)
|
||||
|
||||
START_TEST(KeApc)
|
||||
{
|
||||
KIRQL Irql;
|
||||
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* critical region */
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* guarded region */
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* mix them */
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* raised irql - APC_LEVEL should disable APCs */
|
||||
KeRaiseIrql(APC_LEVEL, &Irql);
|
||||
CheckApcs(FALSE, TRUE, APC_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* KeAre*ApcsDisabled are documented to work up to DISPATCH_LEVEL... */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &Irql);
|
||||
CheckApcs(FALSE, TRUE, DISPATCH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* ... but also work on higher levels! */
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
/* now comes the crazy stuff */
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeEnterGuardedRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(TRUE, TRUE, PASSIVE_LEVEL);
|
||||
KeLeaveGuardedRegion();
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
CheckApcs(TRUE, FALSE, PASSIVE_LEVEL);
|
||||
KeRaiseIrql(HIGH_LEVEL, &Irql);
|
||||
CheckApcs(TRUE, TRUE, HIGH_LEVEL);
|
||||
KeLeaveCriticalRegion();
|
||||
CheckApcs(FALSE, TRUE, HIGH_LEVEL);
|
||||
KeLowerIrql(Irql);
|
||||
CheckApcs(FALSE, FALSE, PASSIVE_LEVEL);
|
||||
}
|
|
@ -82,12 +82,12 @@ START_TEST(KeDpc)
|
|||
ok_eq_uint(Dpc.Type, DpcObject);
|
||||
ok_eq_uint(Dpc.Importance, DpcImportance);
|
||||
ok_eq_uint(Dpc.Number, 0);
|
||||
ok_eq_pointer(Dpc.DpcListEntry.Flink, (LIST_ENTRY *)0x5555555555555555);
|
||||
ok_eq_pointer(Dpc.DpcListEntry.Blink, (LIST_ENTRY *)0x5555555555555555);
|
||||
ok_eq_pointer(Dpc.DpcListEntry.Flink, (LIST_ENTRY *)0x5555555555555555LL);
|
||||
ok_eq_pointer(Dpc.DpcListEntry.Blink, (LIST_ENTRY *)0x5555555555555555LL);
|
||||
ok_eq_pointer(Dpc.DeferredRoutine, DpcHandler);
|
||||
ok_eq_pointer(Dpc.DeferredContext, &Dpc);
|
||||
ok_eq_pointer(Dpc.SystemArgument1, (PVOID)0x5555555555555555);
|
||||
ok_eq_pointer(Dpc.SystemArgument2, (PVOID)0x5555555555555555);
|
||||
ok_eq_pointer(Dpc.SystemArgument1, (PVOID)0x5555555555555555LL);
|
||||
ok_eq_pointer(Dpc.SystemArgument2, (PVOID)0x5555555555555555LL);
|
||||
ok_eq_pointer(Dpc.DpcData, NULL);
|
||||
|
||||
/* simply run the Dpc a few times */
|
||||
|
@ -118,8 +118,6 @@ START_TEST(KeDpc)
|
|||
ok_dpccount();
|
||||
KeLowerIrql(Irql3);
|
||||
ok_dpccount();
|
||||
DPRINT1("This is a debug print\n");
|
||||
ok_dpccount();
|
||||
KeLowerIrql(Irql2);
|
||||
++ExpectedDpcCount;
|
||||
ok_dpccount();
|
||||
|
|
Loading…
Reference in a new issue