Commit in reactos on MAIN
include/ntdll/ldr.h+30-261.26 -> 1.27
             /rtl.h+3-161.51 -> 1.52
lib/kernel32/misc/toolhelp.c+26-51.9 -> 1.10
lib/ntdll/ldr/utils.c+12-131.100 -> 1.101
lib/ntdll/rtl/dbgbuffer.c+15-161.5 -> 1.6
             /ppb.c+2-11.19 -> 1.20
             /process.c+2-11.35 -> 1.36
ntoskrnl/include/internal/ldr.h-11.28 -> 1.29
w32api/include/ddk/ntapi.h+2-21.11 -> 1.12
+92-81
9 modified files
1. fixed definition of the DEBUG_MODULE_INFORMATION structure
2. implemented module and heap list enumeration for toolhelp

reactos/include/ntdll
ldr.h 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- ldr.h	27 Jun 2004 12:18:19 -0000	1.26
+++ ldr.h	19 Nov 2004 01:30:34 -0000	1.27
@@ -13,6 +13,36 @@
 		  ULONG ul_reason_for_call,
 		  LPVOID lpReserved);
 
+#if defined(__USE_W32API) || defined(__NTDLL__)
+/*
+ * Fu***ng headers hell made me do this...i'm sick of it
+ */
+
+typedef struct _LOCK_INFORMATION
+{
+  ULONG LockCount;
+  DEBUG_LOCK_INFORMATION LockEntry[1];
+} LOCK_INFORMATION, *PLOCK_INFORMATION;
+
+typedef struct _HEAP_INFORMATION
+{
+  ULONG HeapCount;
+  DEBUG_HEAP_INFORMATION HeapEntry[1];
+} HEAP_INFORMATION, *PHEAP_INFORMATION;
+
+typedef struct _MODULE_INFORMATION
+{
+  ULONG ModuleCount;
+  DEBUG_MODULE_INFORMATION ModuleEntry[1];
+} MODULE_INFORMATION, *PMODULE_INFORMATION;
+
+NTSTATUS STDCALL
+LdrQueryProcessModuleInformation(IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
+				 IN ULONG Size OPTIONAL,
+				 OUT PULONG ReturnedSize);
+
+#endif /* __USE_W32API */
+
 /* Module flags */
 #define IMAGE_DLL		0x00000004
 #define LOAD_IN_PROGRESS	0x00001000
@@ -55,27 +85,6 @@
 
 #define RVA(m, b) ((ULONG)b + m)
 
-
-typedef struct _MODULE_ENTRY
-{
-  ULONG Unknown0;
-  ULONG Unknown1;
-  PVOID BaseAddress;
-  ULONG SizeOfImage;
-  ULONG Flags;
-  USHORT Unknown2;
-  USHORT Unknown3;
-  SHORT LoadCount;
-  USHORT PathLength;
-  CHAR ModuleName[256];
-} MODULE_ENTRY, *PMODULE_ENTRY;
-
-typedef struct _MODULE_INFORMATION
-{
-  ULONG ModuleCount;
-  MODULE_ENTRY ModuleEntry[1];
-} MODULE_INFORMATION, *PMODULE_INFORMATION;
-
 #ifdef KDBG
 
 VOID
@@ -141,11 +150,6 @@
 				   OUT PULONG RetunedLength OPTIONAL);
 
 NTSTATUS STDCALL
-LdrQueryProcessModuleInformation(IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
-				 IN ULONG Size OPTIONAL,
-				 OUT PULONG ReturnedSize);
-
-NTSTATUS STDCALL
 LdrShutdownProcess(VOID);
 
 NTSTATUS STDCALL

reactos/include/ntdll
rtl.h 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- rtl.h	30 Oct 2004 22:18:16 -0000	1.51
+++ rtl.h	19 Nov 2004 01:30:34 -0000	1.52
@@ -1,4 +1,4 @@
-/* $Id: rtl.h,v 1.51 2004/10/30 22:18:16 weiden Exp $
+/* $Id: rtl.h,v 1.52 2004/11/19 01:30:34 weiden Exp $
  *
  */
 
@@ -54,7 +54,7 @@
 
 typedef struct _DEBUG_MODULE_INFORMATION {
 	ULONG  Reserved[2];
-	ULONG  Base;
+	PVOID  Base;
 	ULONG  Size;
 	ULONG  Flags;
 	USHORT  Index;
@@ -65,7 +65,7 @@
 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
 
 typedef struct _DEBUG_HEAP_INFORMATION {
-	ULONG  Base;
+	PVOID  Base;
 	ULONG  Flags;
 	USHORT  Granularity;
 	USHORT  Unknown;
@@ -120,19 +120,6 @@
 
 #endif /* !__USE_W32API */
 
-
-typedef struct _LOCK_INFORMATION
-{
-  ULONG LockCount;
-  DEBUG_LOCK_INFORMATION LockEntry[1];
-} LOCK_INFORMATION, *PLOCK_INFORMATION;
-
-typedef struct _HEAP_INFORMATION
-{
-  ULONG HeapCount;
-  DEBUG_HEAP_INFORMATION HeapEntry[1];
-} HEAP_INFORMATION, *PHEAP_INFORMATION;
-
 typedef struct _RTL_PROCESS_INFO
 {
    ULONG Size;

reactos/lib/kernel32/misc
toolhelp.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- toolhelp.c	5 Nov 2004 11:51:18 -0000	1.9
+++ toolhelp.c	19 Nov 2004 01:30:35 -0000	1.10
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: toolhelp.c,v 1.9 2004/11/05 11:51:18 weiden Exp $
+/* $Id: toolhelp.c,v 1.10 2004/11/19 01:30:35 weiden Exp $
  *
  * KERNEL32.DLL toolhelp functions
  *
@@ -348,8 +348,8 @@
     {
       HeapListEntry->dwSize = sizeof(HEAPLIST32);
       HeapListEntry->th32ProcessID = th32ProcessID;
-      HeapListEntry->th32HeapID = 0; /* FIXME - use the base address of the heap we're iterating */
-      HeapListEntry->dwFlags = 0; /* FIXME - use the flags of the heap we're iterating */
+      HeapListEntry->th32HeapID = (ULONG_PTR)hi->HeapEntry[i].Base;
+      HeapListEntry->dwFlags = hi->HeapEntry[i].Flags;
 
       HeapListEntry++;
     }
@@ -366,9 +366,27 @@
     for(i = 0; i < nModules; i++)
     {
       ModuleListEntry->dwSize = sizeof(MODULEENTRY32W);
+      ModuleListEntry->th32ModuleID = 1; /* no longer used, always set to one! */
       ModuleListEntry->th32ProcessID = th32ProcessID;
-
-      /* FIXME - fill the MODULEENTRY32W structure */
+      ModuleListEntry->GlblcntUsage = mi->ModuleEntry[i].LoadCount;
+      ModuleListEntry->ProccntUsage = mi->ModuleEntry[i].LoadCount;
+      ModuleListEntry->modBaseAddr = (BYTE*)mi->ModuleEntry[i].Base;
+      ModuleListEntry->modBaseSize = mi->ModuleEntry[i].Size;
+      ModuleListEntry->hModule = (HMODULE)mi->ModuleEntry[i].Base;
+      
+      MultiByteToWideChar(CP_ACP,
+                          0,
+                          &mi->ModuleEntry[i].ImageName[mi->ModuleEntry[i].ModuleNameOffset],
+                          -1,
+                          ModuleListEntry->szModule,
+                          sizeof(ModuleListEntry->szModule) / sizeof(ModuleListEntry->szModule[0]));
+      
+      MultiByteToWideChar(CP_ACP,
+                          0,
+                          mi->ModuleEntry[i].ImageName,
+                          -1,
+                          ModuleListEntry->szExePath,
+                          sizeof(ModuleListEntry->szExePath) / sizeof(ModuleListEntry->szExePath[0]));
 
       ModuleListEntry++;
     }
@@ -728,6 +746,9 @@
 }
 
 
+/*
+ * @implemented
+ */
 BOOL
 STDCALL
 Module32NextW(HANDLE hSnapshot, LPMODULEENTRY32W lpme)

reactos/lib/ntdll/ldr
utils.c 1.100 -> 1.101
diff -u -r1.100 -r1.101
--- utils.c	30 Oct 2004 14:02:03 -0000	1.100
+++ utils.c	19 Nov 2004 01:30:35 -0000	1.101
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.100 2004/10/30 14:02:03 navaraf Exp $
+/* $Id: utils.c,v 1.101 2004/11/19 01:30:35 weiden Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -2629,7 +2629,7 @@
   PLIST_ENTRY ModuleListHead;
   PLIST_ENTRY Entry;
   PLDR_MODULE Module;
-  PMODULE_ENTRY ModulePtr = NULL;
+  PDEBUG_MODULE_INFORMATION ModulePtr = NULL;
   NTSTATUS Status = STATUS_SUCCESS;
   ULONG UsedSize = sizeof(ULONG);
   ANSI_STRING AnsiString;
@@ -2666,31 +2666,30 @@
         }
       else if (ModuleInformation != NULL)
         {
-          ModulePtr->Unknown0 = 0;      // FIXME: ??
-          ModulePtr->Unknown1 = 0;      // FIXME: ??
-          ModulePtr->BaseAddress = Module->BaseAddress;
-          ModulePtr->SizeOfImage = Module->SizeOfImage;
+          ModulePtr->Reserved[0] = ModulePtr->Reserved[1] = 0;      // FIXME: ??
+          ModulePtr->Base = Module->BaseAddress;
+          ModulePtr->Size = Module->SizeOfImage;
           ModulePtr->Flags = Module->Flags;
-          ModulePtr->Unknown2 = 0;      // FIXME: load order index ??
-          ModulePtr->Unknown3 = 0;      // FIXME: ??
+          ModulePtr->Index = 0;      // FIXME: index ??
+          ModulePtr->Unknown = 0;      // FIXME: ??
           ModulePtr->LoadCount = Module->LoadCount;
 
           AnsiString.Length = 0;
           AnsiString.MaximumLength = 256;
-          AnsiString.Buffer = ModulePtr->ModuleName;
+          AnsiString.Buffer = ModulePtr->ImageName;
           RtlUnicodeStringToAnsiString(&AnsiString,
                                        &Module->FullDllName,
                                        FALSE);
-          p = strrchr(ModulePtr->ModuleName, '\\');
+          p = strrchr(ModulePtr->ImageName, '\\');
           if (p != NULL)
-            ModulePtr->PathLength = p - ModulePtr->ModuleName + 1;
+            ModulePtr->ModuleNameOffset = p - ModulePtr->ImageName + 1;
           else
-            ModulePtr->PathLength = 0;
+            ModulePtr->ModuleNameOffset = 0;
 
           ModulePtr++;
           ModuleInformation->ModuleCount++;
         }
-      UsedSize += sizeof(MODULE_ENTRY);
+      UsedSize += sizeof(DEBUG_MODULE_INFORMATION);
 
       Entry = Entry->Flink;
     }

reactos/lib/ntdll/rtl
dbgbuffer.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- dbgbuffer.c	23 Aug 2004 14:28:29 -0000	1.5
+++ dbgbuffer.c	19 Nov 2004 01:30:35 -0000	1.6
@@ -103,9 +103,9 @@
  */
 NTSTATUS STDCALL
 RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
-			IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
-                                 IN ULONG Size OPTIONAL,
-                                 OUT PULONG ReturnedSize)
+                              IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
+                              IN ULONG Size OPTIONAL,
+                              OUT PULONG ReturnedSize)
 {
   PROCESS_BASIC_INFORMATION pbiInfo;
   PPEB_LDR_DATA ppldLdrData;
@@ -113,7 +113,7 @@
   PLIST_ENTRY pleListHead;
   PLIST_ENTRY pleCurEntry;
 
-  PMODULE_ENTRY ModulePtr = NULL;
+  PDEBUG_MODULE_INFORMATION ModulePtr = NULL;
   NTSTATUS Status = STATUS_SUCCESS;
   ULONG UsedSize = sizeof(ULONG);
   ANSI_STRING AnsiString;
@@ -124,7 +124,7 @@
   /* query the process basic information (includes the PEB address) */
   Status = NtQueryInformationProcess ( ProcessHandle,
                                        ProcessBasicInformation,
-                                      &pbiInfo,
+                                       &pbiInfo,
                                        sizeof(PROCESS_BASIC_INFORMATION),
                                        NULL);
  
@@ -217,32 +217,31 @@
         }
       else if (ModuleInformation != NULL)
         {
-          ModulePtr->Unknown0    = 0;      // FIXME: ??
-          ModulePtr->Unknown1    = 0;      // FIXME: ??
-          ModulePtr->BaseAddress = lmModule.BaseAddress;
-          ModulePtr->SizeOfImage = lmModule.SizeOfImage;
+          ModulePtr->Reserved[0] = ModulePtr->Reserved[1] = 0;      // FIXME: ??
+          ModulePtr->Base        = lmModule.BaseAddress;
+          ModulePtr->Size        = lmModule.SizeOfImage;
           ModulePtr->Flags       = lmModule.Flags;
-          ModulePtr->Unknown2    = 0;      // FIXME: load order index ??
-          ModulePtr->Unknown3    = 0;      // FIXME: ??
+          ModulePtr->Index       = 0;      // FIXME:  ??
+          ModulePtr->Unknown     = 0;      // FIXME: ??
           ModulePtr->LoadCount   = lmModule.LoadCount;
 
           AnsiString.Length        = 0;
           AnsiString.MaximumLength = 256;
-          AnsiString.Buffer        = ModulePtr->ModuleName;
+          AnsiString.Buffer        = ModulePtr->ImageName;
           RtlUnicodeStringToAnsiString(&AnsiString,
                                        &Unicode,
                                        FALSE);
 
-          p = strrchr(ModulePtr->ModuleName, '\\');
+          p = strrchr(ModulePtr->ImageName, '\\');
           if (p != NULL)
-            ModulePtr->PathLength = p - ModulePtr->ModuleName + 1;
+            ModulePtr->ModuleNameOffset = p - ModulePtr->ImageName + 1;
           else
-            ModulePtr->PathLength = 0;
+            ModulePtr->ModuleNameOffset = 0;
 
           ModulePtr++;
           ModuleInformation->ModuleCount++;
         }
-      UsedSize += sizeof(MODULE_ENTRY);
+      UsedSize += sizeof(DEBUG_MODULE_INFORMATION);
 
       /* address of the next module in the list */
       pleCurEntry = lmModule.InLoadOrderModuleList.Flink;

reactos/lib/ntdll/rtl
ppb.c 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- ppb.c	29 Sep 2004 08:41:39 -0000	1.19
+++ ppb.c	19 Nov 2004 01:30:35 -0000	1.20
@@ -1,4 +1,4 @@
-/* $Id: ppb.c,v 1.19 2004/09/29 08:41:39 weiden Exp $
+/* $Id: ppb.c,v 1.20 2004/11/19 01:30:35 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -12,6 +12,7 @@
 /* INCLUDES ****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <windows.h>
 #include <ntdll/ldr.h>
 #include <napi/teb.h>
 #include <ntdll/base.h>

reactos/lib/ntdll/rtl
process.c 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- process.c	12 Sep 2003 17:51:48 -0000	1.35
+++ process.c	19 Nov 2004 01:30:35 -0000	1.36
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.35 2003/09/12 17:51:48 vizzini Exp $
+/* $Id: process.c,v 1.36 2004/11/19 01:30:35 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -12,6 +12,7 @@
 /* INCLUDES ****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <windows.h>
 #include <napi/i386/segment.h>
 #include <ntdll/ldr.h>
 #include <ntdll/base.h>

reactos/ntoskrnl/include/internal
ldr.h 1.28 -> 1.29
diff -u -r1.28 -r1.29
--- ldr.h	26 Aug 2004 16:04:50 -0000	1.28
+++ ldr.h	19 Nov 2004 01:30:35 -0000	1.29
@@ -10,7 +10,6 @@
 
 #include <pe.h>
 #include <internal/io.h>
-#include <ntdll/ldr.h>
 #include <internal/module.h>
 
 #define  KERNEL_MODULE_NAME  L"ntoskrnl.exe"

reactos/w32api/include/ddk
ntapi.h 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- ntapi.h	6 Nov 2004 11:45:47 -0000	1.11
+++ ntapi.h	19 Nov 2004 01:30:35 -0000	1.12
@@ -1644,7 +1644,7 @@
 
 typedef struct _DEBUG_MODULE_INFORMATION {
 	ULONG  Reserved[2];
-	ULONG  Base;
+	PVOID  Base;
 	ULONG  Size;
 	ULONG  Flags;
 	USHORT  Index;
@@ -1655,7 +1655,7 @@
 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
 
 typedef struct _DEBUG_HEAP_INFORMATION {
-	ULONG  Base;
+	PVOID  Base;
 	ULONG  Flags;
 	USHORT  Granularity;
 	USHORT  Unknown;
CVSspam 0.2.8