| 166 | } |
| 167 | |
| 168 | void QueueThreadedDpc(bool(*Callback)(void* Arg), void* Arg, unsigned char ProcessorNumber) |
| 169 | { |
| 170 | struct DPC_DATA |
| 171 | { |
| 172 | KDPC Dpc; |
| 173 | decltype(Callback) Callback; |
| 174 | void* Arg; |
| 175 | }; |
| 176 | |
| 177 | constexpr ULONG DpcTag = 'CPDT'; // TDPC = Threaded DPC |
| 178 | DPC_DATA* DpcData = reinterpret_cast<DPC_DATA*>(ExAllocatePoolWithTag(NonPagedPool, sizeof(*DpcData), DpcTag)); |
| 179 | memset(DpcData, 0, sizeof(*DpcData)); |
| 180 | DpcData->Callback = Callback; |
| 181 | DpcData->Arg = Arg; |
| 182 | |
| 183 | KeInitializeThreadedDpc(&DpcData->Dpc, [](PKDPC Dpc, PVOID Arg, PVOID SystemArgument1, PVOID SystemArgument2) |
| 184 | { |
| 185 | UNREFERENCED_PARAMETER(Dpc); |
| 186 | UNREFERENCED_PARAMETER(SystemArgument1); |
| 187 | UNREFERENCED_PARAMETER(SystemArgument2); |
| 188 | DPC_DATA* DpcData = reinterpret_cast<DPC_DATA*>(Arg); |
| 189 | DpcData->Callback(DpcData->Arg); |
| 190 | ExFreePoolWithTag(Dpc, DpcTag); |
| 191 | }, DpcData); |
| 192 | |
| 193 | KeSetImportanceDpc(&DpcData->Dpc, HighImportance); |
| 194 | KeSetTargetProcessorDpc(&DpcData->Dpc, ProcessorNumber); |
| 195 | |
| 196 | KeInsertQueueDpc(&DpcData->Dpc, NULL, NULL); |
| 197 | } |
| 198 | |
| 199 | void QueueWaitThreadedDpc(bool(*Callback)(void* Arg), void* Arg, unsigned char ProcessorNumber) |
| 200 | { |
nothing calls this directly
no outgoing calls
no test coverage detected