if (!DebugObject->DebuggerInactive)
{
/* Add the event into the object's list */
- DBGKTRACE(DBGK_MESSAGE_DEBUG, "Inserting: %lx %p\n",
+ DBGKTRACE(DBGK_MESSAGE_DEBUG, "Inserting: %p %d\n",
DebugEvent, Message->ApiNumber);
InsertTailList(&DebugObject->EventList, &DebugEvent->EventList);
ObDereferenceObject(Process);
/* Free the debug event */
- ExFreePool(DebugEvent);
+ ExFreePoolWithTag(DebugEvent, 'EgbD');
}
}
BOOLEAN UseLpc = FALSE;
PAGED_CODE();
DBGKTRACE(DBGK_EXCEPTION_DEBUG,
- "ExceptionRecord: %p Port: %p\n", ExceptionRecord, DebugPort);
+ "ExceptionRecord: %p Port: %u\n", ExceptionRecord, DebugPort);
/* Setup the API Message */
ApiMessage.h.u1.Length = sizeof(DBGKM_MSG) << 16 |
/* Dereference process and thread and free the event */
ObDereferenceObject(DebugEvent->Process);
ObDereferenceObject(DebugEvent->Thread);
- ExFreePool(DebugEvent);
+ ExFreePoolWithTag(DebugEvent, 'EgbD');
}
VOID
ObjectTypeInitializer.GenericMapping = DbgkDebugObjectMapping;
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = DEBUG_OBJECT_ALL_ACCESS;
- ObjectTypeInitializer.UseDefaultObject = TRUE;
+ ObjectTypeInitializer.SecurityRequired = TRUE;
ObjectTypeInitializer.CloseProcedure = DbgkpCloseObject;
ObjectTypeInitializer.DeleteProcedure = DbgkpDeleteObject;
ObCreateObjectType(&Name,
&DbgkDebugObjectType);
}
+NTSTATUS
+NTAPI
+DbgkOpenProcessDebugPort(IN PEPROCESS Process,
+ IN KPROCESSOR_MODE PreviousMode,
+ OUT HANDLE *DebugHandle)
+{
+ PDEBUG_OBJECT DebugObject;
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ /* If there's no debug port, just exit */
+ if (!Process->DebugPort) return STATUS_PORT_NOT_SET;
+
+ /* Otherwise, acquire the lock while we grab the port */
+ ExAcquireFastMutex(&DbgkpProcessDebugPortMutex);
+
+ /* Grab it and reference it if it exists */
+ DebugObject = Process->DebugPort;
+ if (DebugObject) ObReferenceObject(DebugObject);
+
+ /* Release the lock now */
+ ExReleaseFastMutex(&DbgkpProcessDebugPortMutex);
+
+ /* Bail out if it doesn't exist */
+ if (!DebugObject) return STATUS_PORT_NOT_SET;
+
+ /* Now get a handle to it */
+ Status = ObOpenObjectByPointer(DebugObject,
+ 0,
+ NULL,
+ MAXIMUM_ALLOWED,
+ DbgkDebugObjectType,
+ PreviousMode,
+ DebugHandle);
+ if (!NT_SUCCESS(Status)) ObDereferenceObject(DebugObject);
+
+ /* Return status */
+ return Status;
+}
+
/* PUBLIC FUNCTIONS **********************************************************/
/*
BOOLEAN NeedsWake = FALSE;
CLIENT_ID ClientId;
PAGED_CODE();
- DBGKTRACE(DBGK_OBJECT_DEBUG, "Handle: %p Status: %p\n",
+ DBGKTRACE(DBGK_OBJECT_DEBUG, "Handle: %p Status: %d\n",
DebugHandle, ContinueStatus);
/* Check if we were called from user mode*/