| 517 | ); |
| 518 | pNtQueueApcThread Real_NtQueueApcThread = NULL; |
| 519 | NTSTATUS NTAPI Catch_NtQueueApcThread( |
| 520 | IN HANDLE ThreadHandle, |
| 521 | IN PIO_APC_ROUTINE ApcRoutine, |
| 522 | IN PVOID ApcRoutineContext OPTIONAL, |
| 523 | IN PIO_STATUS_BLOCK ApcStatusBlock OPTIONAL, |
| 524 | IN ULONG ApcReserved OPTIONAL |
| 525 | ) { |
| 526 | int64_t time = get_time(); |
| 527 | char buf[DATA_BUFFER_SIZE] = ""; |
| 528 | |
| 529 | if (HooksInitialized) { // dont log our own hooking |
| 530 | int offset = 0; |
| 531 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "{"); |
| 532 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"type\":\"dll\","); |
| 533 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"time\":%llu,", time); |
| 534 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"pid\":%lu,", (DWORD)GetCurrentProcessId()); |
| 535 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"tid\":%lu,", (DWORD)GetCurrentThreadId()); |
| 536 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"func\":\"NtQueueApcThread\","); |
| 537 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"thread_handle\":%lld,", ThreadHandle); |
| 538 | offset += LogMyStackTrace(&buf[offset], DATA_BUFFER_SIZE - offset); |
| 539 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "}"); |
| 540 | |
| 541 | SendDllPipe(buf); |
| 542 | } |
| 543 | return Real_NtQueueApcThread(ThreadHandle, ApcRoutine, ApcRoutineContext, ApcStatusBlock, ApcReserved); |
| 544 | } |
| 545 | |
| 546 | |
| 547 | /******************* NtQueueApcThreadEx ************************/ |
nothing calls this directly
no test coverage detected