-- v7: ntoskrnl.exe/tests: Add KeInitializeDpc tests. include: Update definition of KDPC.
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- include/ddk/wdm.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 45503f48a4e..02dfd7ed2bd 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -83,15 +83,16 @@ typedef struct _KSEMAPHORE { } KSEMAPHORE, *PKSEMAPHORE, *PRKSEMAPHORE;
typedef struct _KDPC { - CSHORT Type; - UCHAR Number; - UCHAR Importance; - LIST_ENTRY DpcListEntry; + UCHAR Type; + UCHAR Importance; + volatile USHORT Number; + SINGLE_LIST_ENTRY DpcListEntry; + KAFFINITY ProcessorHistory; PKDEFERRED_ROUTINE DeferredRoutine; PVOID DeferredContext; PVOID SystemArgument1; PVOID SystemArgument2; - PULONG_PTR Lock; + volatile PVOID DpcData; } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
typedef enum _KDPC_IMPORTANCE {
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/ntoskrnl.exe/tests/driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index bd388a6ec9e..91b0c2acaee 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -2119,9 +2119,26 @@ static void WINAPI test_dpc_func(PKDPC Dpc, void *context, void *cpu_count, static void test_dpc(void) { void (WINAPI *pKeGenericCallDpc)(PKDEFERRED_ROUTINE routine, void *context); + void (WINAPI *pKeInitializeDpc)(PKDPC dpc, PKDEFERRED_ROUTINE routine, void *context); struct test_dpc_func_context data; KAFFINITY cpu_mask; ULONG cpu_count; + struct _KDPC Dpc = {0}; + + pKeInitializeDpc = get_proc_address("KeInitializeDpc"); + if(!pKeInitializeDpc) + { + win_skip("KeInitializeDpc is not available.\n"); + return; + } + + pKeInitializeDpc(&Dpc, test_dpc_func, &data); + + ok(Dpc.Number == 0, "Got unexpected Dpc Number %u.\n", Dpc.Number); + todo_wine ok(Dpc.Type == 0x13, "Got unexpected Dpc Type %u.\n", Dpc.Type); + todo_wine ok(Dpc.Importance == MediumImportance, "Got unexpected Dpc Importance %u.\n", Dpc.Importance); + ok(Dpc.DeferredRoutine == test_dpc_func, "Got unexpected Dpc DeferredRoutine %p.\n", Dpc.DeferredRoutine); + ok(Dpc.DeferredContext == &data, "Got unexpected Dpc DeferredContext %p.\n", Dpc.DeferredContext);
pKeGenericCallDpc = get_proc_address("KeGenericCallDpc"); if (!pKeGenericCallDpc)