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

Function Catch_NtCreateTimer2

RedEdrDll/dllmain.cpp:1111–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109 );
1110pNtCreateTimer2 Real_NtCreateTimer2 = NULL;
1111NTSTATUS NTAPI Catch_NtCreateTimer2(
1112 OUT PHANDLE TimerHandle,
1113 IN PVOID Reserved1 OPTIONAL,
1114 IN PVOID Reserved2 OPTIONAL,
1115 IN ULONG Attributes,
1116 IN ACCESS_MASK DesiredAccess
1117) {
1118 int64_t time = get_time();
1119 char buf[DATA_BUFFER_SIZE] = "";
1120
1121 if (HooksInitialized) { // dont log our own hooking
1122 int offset = 0;
1123 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "{");
1124 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"type\":\"dll\",");
1125 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"time\":%llu,", time);
1126 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"pid\":%lu,", (DWORD)GetCurrentProcessId());
1127 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"tid\":%lu,", (DWORD)GetCurrentThreadId());
1128 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"func\":\"NtCreateTimer2\",");
1129 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"attributes\":%lu,", Attributes);
1130 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "\"desired_access\":%lu", DesiredAccess);
1131 offset += sprintf_s(buf + offset, DATA_BUFFER_SIZE - offset, "}");
1132
1133 SendDllPipe(buf);
1134 }
1135 return Real_NtCreateTimer2(TimerHandle, Reserved1, Reserved2, Attributes, DesiredAccess);
1136}
1137
1138
1139/******************* CreateRemoteThread ************************/

Callers

nothing calls this directly

Calls 2

get_timeFunction · 0.85
SendDllPipeFunction · 0.85

Tested by

no test coverage detected