Paul Gofman : ntoskrnl.exe: Support DPCs with timers.

Alexandre Julliard julliard at winehq.org
Thu May 28 17:11:11 CDT 2020


Module: wine
Branch: master
Commit: a4a903f97a11625ea36a8eb0425f89be44d853c0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a4a903f97a11625ea36a8eb0425f89be44d853c0

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Thu May 28 12:15:19 2020 +0300

ntoskrnl.exe: Support DPCs with timers.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/sync.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index 36fa12fe00..5e06ab2f2b 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -392,9 +392,15 @@ LONG WINAPI KeReleaseMutex( PRKMUTEX mutex, BOOLEAN wait )
 static void CALLBACK ke_timer_complete_proc(PTP_CALLBACK_INSTANCE instance, void *timer_, PTP_TIMER tp_timer)
 {
     KTIMER *timer = timer_;
+    KDPC *dpc = timer->Dpc;
 
     TRACE("instance %p, timer %p, tp_timer %p.\n", instance, timer, tp_timer);
 
+    if (dpc && dpc->DeferredRoutine)
+    {
+        TRACE("Calling dpc->DeferredRoutine %p, dpc->DeferredContext %p.\n", dpc->DeferredRoutine, dpc->DeferredContext);
+        dpc->DeferredRoutine(dpc, dpc->DeferredContext, dpc->SystemArgument1, dpc->SystemArgument2);
+    }
     EnterCriticalSection( &sync_cs );
     timer->Header.SignalState = TRUE;
     if (timer->Header.WaitListHead.Blink)
@@ -435,12 +441,6 @@ BOOLEAN WINAPI KeSetTimerEx( KTIMER *timer, LARGE_INTEGER duetime, LONG period,
     TRACE("timer %p, duetime %s, period %d, dpc %p.\n",
         timer, wine_dbgstr_longlong(duetime.QuadPart), period, dpc);
 
-    if (dpc)
-    {
-        FIXME("Unhandled DPC %p.\n", dpc);
-        return FALSE;
-    }
-
     EnterCriticalSection( &sync_cs );
 
     if ((ret = timer->Header.Inserted))
@@ -456,6 +456,7 @@ BOOLEAN WINAPI KeSetTimerEx( KTIMER *timer, LARGE_INTEGER duetime, LONG period,
 
     timer->DueTime.QuadPart = duetime.QuadPart;
     timer->Period = period;
+    timer->Dpc = dpc;
 
     SetThreadpoolTimer((TP_TIMER *)timer->TimerListEntry.Blink, (FILETIME *)&duetime, period, 0);
     LeaveCriticalSection( &sync_cs );




More information about the wine-cvs mailing list