Mostly implemented, Listdlls half way works now.
authorJames Tabor <james.tabor@reactos.org>
Mon, 9 Aug 2004 19:55:33 +0000 (19:55 +0000)
committerJames Tabor <james.tabor@reactos.org>
Mon, 9 Aug 2004 19:55:33 +0000 (19:55 +0000)
svn path=/trunk/; revision=10459

reactos/lib/ntdll/rtl/dbgbuffer.c

index bc311f8..39c75d4 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id:
+/*
  *
  * PROJECT:           ReactOS kernel
  * PURPOSE:           User-mode Debug Buffer support
  * FILE:              lib/ntdll/rtl/dbgbuffer.c
  * PROGRAMER:         James Tabor
+ * Fixme:             Add Process and Thread event pair support.
+ *                    Fix Heap support.
+ *
  */
 
 /* INCLUDES *****************************************************************/
 
 /* FUNCTIONS ***************************************************************/
 
+/*
+ * @unimplemented
+ */
 PDEBUG_BUFFER STDCALL
 RtlCreateQueryDebugBuffer(IN ULONG Size,
                           IN BOOLEAN EventPair)
 {
-       return(0);
+   PDEBUG_BUFFER Buf = NULL;
+   
+   if (Size < sizeof(DEBUG_BUFFER))
+     {
+        Size = sizeof(DEBUG_BUFFER);
+     }
+      Buf = (PDEBUG_BUFFER) RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
+      memset(Buf, 0, Size);
+
+   return Buf;
 }
 
+/*
+ * @unimplemented
+ */
 NTSTATUS STDCALL
 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER Buf)
 {
-       return(0);
+   NTSTATUS Status = STATUS_SUCCESS;
+
+   if (NULL != Buf) {
+     if (NULL != Buf->ModuleInformation)
+         RtlFreeHeap(RtlGetProcessHeap(), 0, Buf->ModuleInformation);
+
+     if (NULL != Buf->HeapInformation)
+         RtlFreeHeap(RtlGetProcessHeap(), 0, Buf->HeapInformation);
+
+     if (NULL != Buf->LockInformation)
+         RtlFreeHeap(RtlGetProcessHeap(), 0, Buf->LockInformation);
+
+     RtlFreeHeap(RtlGetProcessHeap(), 0, Buf);
+   }
+   return Status;
 }
 
+/*
+ * @unimplemented
+ */
 NTSTATUS STDCALL 
 RtlQueryProcessDebugInformation(IN ULONG ProcessId, 
                                 IN ULONG DebugInfoMask, 
                                 IN OUT PDEBUG_BUFFER Buf)
 {
-       return (0);
-}
+   NTSTATUS Status = STATUS_SUCCESS;
 
+   Buf->InfoClassMask = DebugInfoMask;
+   
+   if (DebugInfoMask & PDI_MODULES)
+     {
+        PDEBUG_MODULE_INFORMATION info = 
+          RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DEBUG_MODULE_INFORMATION));
+        memset(info, 0, sizeof(DEBUG_MODULE_INFORMATION));
+        Buf->ModuleInformation = info;
+     }
+     
+   if (DebugInfoMask & PDI_HEAPS)
+     {
+        PDEBUG_HEAP_INFORMATION info = 
+           RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DEBUG_HEAP_INFORMATION));
+        memset(info, 0, sizeof(DEBUG_HEAP_INFORMATION));
+     
+        if (DebugInfoMask & PDI_HEAP_TAGS)
+          {
+          }
+        if (DebugInfoMask & PDI_HEAP_BLOCKS)
+          {
+          }
+        Buf->HeapInformation = info;
+     }
+     
+   if (DebugInfoMask & PDI_LOCKS)
+     {
+        PDEBUG_LOCK_INFORMATION info = 
+           RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(DEBUG_LOCK_INFORMATION));
+        memset(info, 0, sizeof(DEBUG_LOCK_INFORMATION));
+        Buf->LockInformation = info;
+    }
+   return Status;
+
+}
 
+/* EOL */