| 977 | ); |
| 978 | pNtCreateProcessEx Real_NtCreateProcessEx = NULL; |
| 979 | NTSTATUS NTAPI Catch_NtCreateProcessEx( |
| 980 | OUT PHANDLE ProcessHandle, |
| 981 | IN ACCESS_MASK DesiredAccess, |
| 982 | IN POBJECT_ATTRIBUTES ObjectAttributes, |
| 983 | IN HANDLE ParentProcess, |
| 984 | IN ULONG Flags, |
| 985 | IN HANDLE SectionHandle, |
| 986 | IN HANDLE DebugPort, |
| 987 | IN HANDLE ExceptionPort, |
| 988 | IN BOOLEAN InJob |
| 989 | ) { |
| 990 | int64_t time = get_time(); |
| 991 | char buf[DATA_BUFFER_SIZE] = ""; |
| 992 | |
| 993 | if (HooksInitialized) { // dont log our own hooking |
| 994 | int offset = 0; |
| 995 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "{"); |
| 996 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"type\":\"dll\","); |
| 997 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"time\":%llu,", time); |
| 998 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"pid\":%lu,", (DWORD)GetCurrentProcessId()); |
| 999 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"tid\":%lu,", (DWORD)GetCurrentThreadId()); |
| 1000 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"func\":\"NtCreateProcessEx\","); |
| 1001 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"handle\":%lld,", (long long) ProcessHandle); |
| 1002 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"parent_process\":%llu,", (unsigned long long) ParentProcess); |
| 1003 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"flags\":%lu,", Flags); |
| 1004 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"section_handle\":%llu,", (unsigned long long) SectionHandle); |
| 1005 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"debug_port\":%llu,", (unsigned long long) DebugPort); |
| 1006 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"exception_port\":%llu,", (unsigned long long) ExceptionPort); |
| 1007 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"in_job\":%d,", InJob); |
| 1008 | offset += LogMyStackTrace(&buf[offset], DATA_BUFFER_SIZE - offset); |
| 1009 | offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "}"); |
| 1010 | SendDllPipe(buf); |
| 1011 | } |
| 1012 | return Real_NtCreateProcessEx(ProcessHandle, DesiredAccess, ObjectAttributes, ParentProcess, Flags, SectionHandle, DebugPort, ExceptionPort, InJob); |
| 1013 | } |
| 1014 | |
| 1015 | |
| 1016 | /******************* NtCreateEvent ************************/ |
nothing calls this directly
no test coverage detected