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

Function LogProcessTelemetryLoggingFlags

RedEdrDriver/kcallbacks.c:125–175  ·  view source on GitHub ↗

Query and debug-log the current PROCESS_LOGGING_INFORMATION flags for a process.

Source from the content-addressed store, hash-verified

123
124// Query and debug-log the current PROCESS_LOGGING_INFORMATION flags for a process.
125static void LogProcessTelemetryLoggingFlags(PEPROCESS Process, HANDLE pid) {
126 HANDLE hProcess = NULL;
127 NTSTATUS status;
128
129 status = ObOpenObjectByPointer(
130 Process,
131 OBJ_KERNEL_HANDLE,
132 NULL,
133 PROCESS_ALL_ACCESS,
134 *PsProcessType,
135 KernelMode,
136 &hProcess
137 );
138 if (!NT_SUCCESS(status)) {
139 LOG_A(LOG_INFO, "[RedEdr] LogProcessTelemetryLoggingFlags: ObOpenObjectByPointer failed for pid %llu: 0x%08X\n", (ULONG64)pid, status);
140 return;
141 }
142
143 if (g_ZwQueryInformationProcess == NULL) {
144 ZwClose(hProcess);
145 return;
146 }
147
148 PROCESS_LOGGING_INFORMATION loggingInfo = { 0 };
149 ULONG returnLength = 0;
150 status = g_ZwQueryInformationProcess(
151 hProcess,
152 ProcessLoggingInformation,
153 &loggingInfo,
154 sizeof(loggingInfo),
155 &returnLength
156 );
157 ZwClose(hProcess);
158
159 if (!NT_SUCCESS(status)) {
160 LOG_A(LOG_INFO, "[RedEdr] LogProcessTelemetryLoggingFlags: ZwQueryInformationProcess failed for pid %llu: 0x%08X\n", (ULONG64)pid, status);
161 return;
162 }
163
164 LOG_A(LOG_INFO, "[RedEdr] pid %llu ETW-TI flags=0x%02X: ReadVM=%d WriteVM=%d ProcSuspRes=%d ThrSuspRes=%d LocalExecProt=%d RemoteExecProt=%d Impersonation=%d reserved=0x%02X\n",
165 (ULONG64)pid,
166 loggingInfo.Flags,
167 loggingInfo.Bits.EnableReadVmLogging,
168 loggingInfo.Bits.EnableWriteVmLogging,
169 loggingInfo.Bits.EnableProcessSuspendResumeLogging,
170 loggingInfo.Bits.EnableThreadSuspendResumeLogging,
171 loggingInfo.Bits.EnableLocalExecProtectVmLogging,
172 loggingInfo.Bits.EnableRemoteExecProtectVmLogging,
173 loggingInfo.Bits.EnableImpersonationLogging,
174 loggingInfo.Bits.Reserved);
175}
176
177
178// Enumerate all running processes and call EnableProcessTelemetryLogging for

Callers 1

Calls 1

LOG_AFunction · 0.70

Tested by

no test coverage detected