| 382 | } |
| 383 | |
| 384 | NTSTATUS Section::InjectDLL(DllStats* pDllStats) { |
| 385 | NTSTATUS status = STATUS_SUCCESS; |
| 386 | |
| 387 | if (!pDllStats->IsVaid()) { |
| 388 | // invalid data |
| 389 | ASSERT(NULL); |
| 390 | return STATUS_INVALID_PARAMETER_MIX; |
| 391 | } |
| 392 | // https://dennisbabkin.com/inside_nt_apc/ |
| 393 | PKAPC pApc = (PKAPC)ExAllocatePoolWithTag(NonPagedPool, sizeof(KAPC), 'cpak'); |
| 394 | |
| 395 | if (!pApc) { |
| 396 | return STATUS_MEMORY_NOT_ALLOCATED; |
| 397 | } |
| 398 | |
| 399 | /*KeInitializeApc(pApc, KeGetCurrentThread(), |
| 400 | OriginalApcEnvironment, |
| 401 | KernelRoutine, RundownRoutine, NormalRoutine, |
| 402 | KernelMode, |
| 403 | pApc, );*/ |
| 404 | |
| 405 | //Prevent our driver from unloading be incrementing its reference count |
| 406 | ObReferenceObject(g_DriverObject); |
| 407 | |
| 408 | return status; |
| 409 | } |
| 410 | |
| 411 | NTSTATUS Section::MapSectionForShellCode(DllStats* pDllStats, |
| 412 | PVOID* pBaseAddr) { |