Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/sync.c | 33 +++++++++++++++++++++++++++++ include/ddk/wdm.h | 7 ++++++ 3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index b2d7d8b9640..37ac3effad3 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -564,7 +564,7 @@ @ stub KeI386ReleaseLid @ stub KeI386SetGdtSelector @ stub KeIcacheFlushCount -@ stub KeInitializeApc +@ stdcall KeInitializeApc(ptr ptr long ptr ptr ptr long ptr) @ stub KeInitializeDeviceQueue @ stdcall KeInitializeDpc(ptr ptr ptr) @ stdcall KeInitializeEvent(ptr long long) diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 7f19ce7571b..c67c4f01573 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -33,6 +33,7 @@ #include "wine/asm.h" #include "wine/debug.h" #include "wine/heap.h" +#include "wine/server.h"
#include "ntoskrnl_private.h"
@@ -663,6 +664,38 @@ void WINAPI KeReleaseInStackQueuedSpinLock( KLOCK_QUEUE_HANDLE *queue ) } #endif
+/*********************************************************************** + * KeInitializeApc (NTOSKRNL.EXE.@) + */ +void WINAPI KeInitializeApc(PRKAPC apc, PRKTHREAD thread, KAPC_ENVIRONMENT env, PKKERNEL_ROUTINE krnl_routine, + PKRUNDOWN_ROUTINE rundown_routine, PKNORMAL_ROUTINE normal_routine, KPROCESSOR_MODE apc_mode, PVOID ctx) +{ + TRACE("apc %p thread %p env %u krnl_routine %p rundown_routine %p normal_routine %p apc_mode %u ctx %p\n", + apc, thread, env, krnl_routine, rundown_routine, normal_routine, apc_mode, ctx); + + if (env != OriginalApcEnvironment) + FIXME("Unhandled APC_ENVIRONMENT\n"); + + apc->Type = 18; + apc->Size = sizeof(*apc); + apc->Thread = thread; + apc->ApcStateIndex = env; + apc->KernelRoutine = krnl_routine; + apc->RundownRoutine = rundown_routine; + apc->NormalRoutine = normal_routine; + apc->Inserted = FALSE; + if (apc->NormalRoutine) + { + apc->ApcMode = apc_mode; + apc->NormalContext = ctx; + } + else + { + apc->ApcMode = KernelMode; + apc->NormalContext = NULL; + } +} + static KSPIN_LOCK cancel_lock;
/*********************************************************************** diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 176b432644a..9fcb1387012 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -464,6 +464,13 @@ typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; /* Irp definitions */ typedef UCHAR KIRQL, *PKIRQL; typedef CCHAR KPROCESSOR_MODE; +typedef enum _KAPC_ENVIRONMENT +{ + OriginalApcEnvironment, + AttachedApcEnvironment, + CurrentApcEnvironment, + InsertApcEnvironment +} KAPC_ENVIRONMENT, *PKAPC_ENVIRONMENT;
typedef VOID (WINAPI *PDRIVER_CANCEL)( IN struct _DEVICE_OBJECT *DeviceObject,