MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / DbgkpCloseObject

Function DbgkpCloseObject

KernelLibrary/kDbgSys.cpp:2142–2195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2140}
2141
2142VOID DbgkpCloseObject(
2143 _In_ PEPROCESS Process,
2144 _In_ PVOID Object,
2145 _In_ ACCESS_MASK GrantedAccess,
2146 _In_ ULONG_PTR ProcessHandleCount,
2147 _In_ ULONG_PTR SystemHandleCount
2148) {
2149 PDEBUG_OBJECT DebugObject = (PDEBUG_OBJECT)Object;
2150 PDEBUG_EVENT DebugEvent;
2151 PLIST_ENTRY Entry;
2152 BOOLEAN Deref;
2153
2154 if (SystemHandleCount > 1) {
2155 return;
2156 }
2157
2158 ExAcquireFastMutex(&DebugObject->Mutex);
2159
2160 DebugObject->Flags |= DEBUG_OBJECT_DELETE_PENDING;
2161
2162 Entry = DebugObject->EventList.Flink;
2163 InitializeListHead(&DebugObject->EventList);
2164 ExReleaseFastMutex(&DebugObject->Mutex);
2165
2166 KeSetEvent(&DebugObject->EventsPresent, 0, FALSE);
2167
2168 // ö��ϵͳ�ڵ����н��̣��������ij�����̵�DebugObject�ֶε�ֵ��Ҫ�رյĶ�����ͬ��������Ϊ0
2169 for (Process = PsGetNextProcess(nullptr); Process != nullptr; Process = PsGetNextProcess(Process)) {
2170 auto process = Process;
2171 /*if (process->DebugPort == DebugObject) {
2172 Deref = FALSE;
2173 ExAcquireFastMutex(&DbgkpProcessDebugPortMutex);
2174 if (process->DebugPort == DebugObject) {
2175 process->DebugPort = nullptr;
2176 Deref = TRUE;
2177 }
2178 ExReleaseFastMutex(&DbgkpProcessDebugPortMutex);
2179
2180 if (Deref) {
2181 if (DebugObject->Flags & DEBUG_OBJECT_KILL_ON_CLOSE) {
2182 PsTerminateProcess(Process, STATUS_DEBUGGER_INACTIVE);
2183 }
2184 ObDereferenceObject(DebugObject);
2185 }
2186 }*/
2187 }
2188
2189 while (Entry != &DebugObject->EventList) {
2190 DebugEvent = CONTAINING_RECORD(Entry, DEBUG_EVENT, EventList);
2191 Entry = Entry->Flink;
2192 DebugEvent->Status = STATUS_DEBUGGER_INACTIVE;
2193 DbgkpWakeTarget(DebugEvent);
2194 }
2195}

Callers

nothing calls this directly

Calls 3

InitializeListHeadFunction · 0.85
PsGetNextProcessFunction · 0.85
DbgkpWakeTargetFunction · 0.85

Tested by

no test coverage detected