-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathProcessorExecute.cpp
39 lines (30 loc) · 956 Bytes
/
ProcessorExecute.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "stdafx.h"
#include "ProcessorExecute.h"
extern"C"
{
VOID NTAPI KeGenericCallDpc(
__in PKDEFERRED_ROUTINE Routine,
__in_opt PVOID Context);
LOGICAL KeSignalCallDpcSynchronize(
__in PVOID SystemArgument2);
VOID KeSignalCallDpcDone(
__in PVOID SystemArgument1);
}
auto ProcessorExecute($ProcessorrExecuteRoutine aRoutine, void * aContext)
-> void
{
struct DpcContext
{
$ProcessorrExecuteRoutine Routine;
PVOID Context;
};
auto vContext = DpcContext{ aRoutine, aContext };
KeGenericCallDpc([](
PKDPC /*aDpc*/, PVOID aContext, PVOID aBarrier, PVOID aReverseBarrier) -> void
{
auto vContext = static_cast<DpcContext*>(aContext);
vContext->Routine(KeGetCurrentProcessorNumber(), vContext->Context);
KeSignalCallDpcSynchronize(aReverseBarrier);
KeSignalCallDpcDone(aBarrier);
}, &vContext);
}