MCPcopy Create free account
hub / github.com/dobin/RedEdr / Catch_NtCreateTimer

Function Catch_NtCreateTimer

RedEdrDll/dllmain.cpp:1074–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072 );
1073pNtCreateTimer Real_NtCreateTimer = NULL;
1074NTSTATUS NTAPI Catch_NtCreateTimer(
1075 OUT PHANDLE TimerHandle,
1076 IN ACCESS_MASK DesiredAccess,
1077 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
1078 IN TIMER_TYPE TimerType
1079) {
1080 int64_t time = get_time();
1081 char buf[DATA_BUFFER_SIZE] = "";
1082
1083 if (HooksInitialized) { // dont log our own hooking
1084 int offset = 0;
1085 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "{");
1086 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"type\":\"dll\",");
1087 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"time\":%llu,", time);
1088 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"pid\":%lu,", (DWORD)GetCurrentProcessId());
1089 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"tid\":%lu,", (DWORD)GetCurrentThreadId());
1090 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"func\":\"NtCreateTimer\",");
1091 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"desired_access\":%lu,", DesiredAccess);
1092 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"timer_type\":%d", TimerType);
1093 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "}");
1094
1095 SendDllPipe(buf);
1096 }
1097 return Real_NtCreateTimer(TimerHandle, DesiredAccess, ObjectAttributes, TimerType);
1098}
1099
1100
1101/******************* NtCreateTimer2 ************************/

Callers

nothing calls this directly

Calls 2

get_timeFunction · 0.85
SendDllPipeFunction · 0.85

Tested by

no test coverage detected