Add new "walk" command options to list processes and modref's.

diff --git a/debugger/dbg.y b/debugger/dbg.y
index 99822e6..cdbab33 100644
--- a/debugger/dbg.y
+++ b/debugger/dbg.y
@@ -74,6 +74,7 @@
 %token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
 %token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT tDEBUGMSG
 %token tCLASS tMAPS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
+%token tPROCESS tMODREF
 %token tEOL tSTRING tDEBUGSTR
 %token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY tDISASSEMBLE
 %token tSTEPI tNEXTI tFINISH tSHOW tDIR
@@ -313,6 +314,8 @@
     | tWALK tQUEUE tEOL         { QUEUE_WalkQueues(); }
     | tWALK tWND tEOL           { WIN_WalkWindows( 0, 0 ); }
     | tWALK tWND tNUM tEOL      { WIN_WalkWindows( $3, 0 ); }
+    | tWALK tPROCESS tEOL       { PROCESS_WalkProcess(); }
+    | tWALK tMODREF expr_value tEOL   { MODULE_WalkModref( $3 ); }
 
 
 type_cast: 
diff --git a/debugger/debug.l b/debugger/debug.l
index a77b17d..669f652 100644
--- a/debugger/debug.l
+++ b/debugger/debug.l
@@ -156,6 +156,8 @@
 <INFO_CMD,WALK_CMD>class|clas|cla                  { return tCLASS; }
 <INFO_CMD,WALK_CMD>module|modul|modu|mod  { return tMODULE; }
 <INFO_CMD,WALK_CMD>queue|queu|que			{ return tQUEUE; }
+<INFO_CMD,WALK_CMD>process|proces|proce|proc   		{ return tPROCESS; }
+<INFO_CMD,WALK_CMD>modref|modre|modr			{ return tMODREF; }
 <INFO_CMD>registers|regs|reg|re		{ return tREGS; }
 <INFO_CMD>segments|segment|segm|seg|se	{ return tSEGMENTS; }
 <INFO_CMD>stack|stac|sta|st     		{ return tSTACK; }
diff --git a/debugger/info.c b/debugger/info.c
index a4ea51e..b71c0c2 100644
--- a/debugger/info.c
+++ b/debugger/info.c
@@ -142,7 +142,8 @@
 "  delete display <disnum>                debugmsg <class>[-+]<type>\n",
 
 "Wine-specific commands:",
-"  mode [16,32]                           walk [wnd,class,queue,module]",
+"  mode [16,32]                           walk [wnd,class,queue,module,",
+"                                               process,modref <pid>]",
 "  info (see 'help info' for options)\n",
 
 "The 'x' command accepts repeat counts and formats (including 'i') in the",
diff --git a/include/module.h b/include/module.h
index 3a49ece..dcfffc4 100644
--- a/include/module.h
+++ b/include/module.h
@@ -187,6 +187,7 @@
 extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
 extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
 extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
+extern void MODULE_WalkModref( DWORD id );
 
 /* resource.c */
 extern INT       WINAPI AccessResource(HMODULE,HRSRC); 
diff --git a/include/process.h b/include/process.h
index 224f352..7b5f0a1 100644
--- a/include/process.h
+++ b/include/process.h
@@ -165,6 +165,7 @@
                             BOOL inherit, DWORD flags,
                             STARTUPINFOA *startup, PROCESS_INFORMATION *info );
 extern void PROCESS_FreePDB( PDB *pdb );
+extern void PROCESS_WalkProcess( void );
 
 /* scheduler/debugger.c */
 extern DWORD DEBUG_SendExceptionEvent( EXCEPTION_RECORD *rec, BOOL first_chance );
diff --git a/loader/module.c b/loader/module.c
index feb4974..44d600e 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -35,6 +35,35 @@
 DECLARE_DEBUG_CHANNEL(module)
 DECLARE_DEBUG_CHANNEL(win32)
 
+/*************************************************************************
+ *		MODULE_WalkModref
+ * Walk MODREFs for input process ID
+ */
+void MODULE_WalkModref( DWORD id )
+{
+    int i;
+    WINE_MODREF  *zwm, *prev = NULL;
+    PDB *pdb = PROCESS_IdToPDB( id );
+
+    if (!pdb) {
+        MESSAGE("Invalid process id (pid)\n");
+        return;
+    }
+
+    MESSAGE("Modref list for process pdb=%p\n", pdb);
+    MESSAGE("Modref     next       prev        handle  deps  flags  name\n");
+    for ( zwm = pdb->modref_list; zwm; zwm = zwm->next) {
+        MESSAGE("%p %p %p %04x %5d %04x %s\n", zwm, zwm->next, zwm->prev,
+               zwm->module, zwm->nDeps, zwm->flags, zwm->modname);
+        for ( i = 0; i < zwm->nDeps; i++ ) {
+            if ( zwm->deps[i] )
+                MESSAGE("    %d %p %s\n", i, zwm->deps[i], zwm->deps[i]->modname);
+	}
+        if (prev != zwm->prev) 
+            MESSAGE("   --> modref corrupt, previous pointer wrong!!\n");
+        prev = zwm;
+    }
+}
 
 /*************************************************************************
  *		MODULE32_LookupHMODULE
diff --git a/scheduler/process.c b/scheduler/process.c
index 0933768..8866e9f 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -37,6 +37,30 @@
 static PDB *PROCESS_First = &initial_pdb;
 
 /***********************************************************************
+ *           PROCESS_WalkProcess
+ */
+void PROCESS_WalkProcess(void)
+{
+    PDB  *pdb;
+    char *name;
+
+    pdb = PROCESS_First;
+    MESSAGE( " pid        PDB         #th  modref     module \n" );
+    while(pdb)
+    {
+        if (pdb == &initial_pdb)
+            name = "initial PDB";
+        else
+            name = (pdb->exe_modref) ? pdb->exe_modref->shortname : "";
+
+        MESSAGE( " %8p %8p %5d  %8p %s\n", pdb->server_pid, pdb,
+               pdb->threads, pdb->exe_modref, name);
+        pdb = pdb->next;
+    }
+    return;
+}
+
+/***********************************************************************
  *           PROCESS_Current
  */
 PDB *PROCESS_Current(void)