Added handle type to object name translation in qsi.
authorEmanuele Aliberti <ea@iol.it>
Sun, 28 May 2000 17:44:53 +0000 (17:44 +0000)
committerEmanuele Aliberti <ea@iol.it>
Sun, 28 May 2000 17:44:53 +0000 (17:44 +0000)
svn path=/trunk/; revision=1166

rosapps/sysutils/makefile
rosapps/sysutils/qsi.c
rosapps/sysutils/regnav.c

index 49a81dd..875c114 100644 (file)
@@ -1,9 +1,9 @@
-# $Id: makefile,v 1.4 2000/04/25 23:22:57 ea Exp $
+# $Id: makefile,v 1.5 2000/05/28 17:44:51 ea Exp $
 #
 # ReactOS System Utilities
 #
 # 1999-02-16 (Emanuele Aliberti)
-#      Added chkdskx.c and formatx.c by by Mark Russinovich
+#      Added chkdskx.c and formatx.c by Mark Russinovich
 #      (mark@sysinternals.com) and shutdown.c
 #
 # 1999-03-03 (Emanuele Aliberti)
@@ -27,6 +27,7 @@ ROS_LIB=$(ROS_DIR)/lib
 IMPORT_NTDLL=$(ROS_LIB)/ntdll/ntdll.a
 IMPORT_FMIFS=$(ROS_LIB)/fmifs/fmifs.a
 IMPORT_KERNEL32=$(ROS_LIB)/kernel32/kernel32.a
+IMPORT_ADVAPI32=$(ROS_LIB)/advapi32/advapi32.a
 IMPORT_USER32=$(ROS_LIB)/user32/user32.a
 IMPORT_CRTDLL=$(ROS_LIB)/crtdll/crtdll.a
 
@@ -82,6 +83,7 @@ regnav.exe: regnav.o win32err.o
                regnav.o \
                win32err.o \
                $(IMPORT_KERNEL32) \
+               $(IMPORT_ADVAPI32) \
                $(IMPORT_CRTDLL) \
                -o regnav.exe
        $(NM) --numeric-sort regnav.exe > regnav.sym
@@ -98,7 +100,6 @@ shutdown.exe: shutdown.o win32err.o
        $(NM) --numeric-sort shutdown.exe > shutdown.sym
 
 qsi.exe: qsi.o
-       echo $(BASE_CFLAGS)
        $(CC) \
                qsi.o \
                $(IMPORT_NTDLL) \
index ac05c74..d3ce07a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: qsi.c,v 1.2 2000/04/27 23:39:49 ea Exp $
+/* $Id: qsi.c,v 1.3 2000/05/28 17:44:51 ea Exp $
  *
  * PROJECT    : ReactOS Operating System (see http://www.reactos.com/)
  * DESCRIPTION: Tool to query system information
@@ -163,6 +163,55 @@ DumpData (int Size, PVOID pData )
        printf ("\n");
 }
 
+/* --- */
+
+static
+LPTSTR
+KernelObjectName [] =
+{
+       _T("0"),                /* FIXME */
+       _T("1"),                /* FIXME */
+       _T("Directory"),
+       _T("SymbolicLink"),
+       _T("Token"),
+       _T("Process"),
+       _T("Thread"),
+       _T("Event"),
+       _T("8"),                /* FIXME */
+       _T("Mutant"),
+       _T("Semaphore"),
+       _T("Timer"),
+       _T("12"),               /* FIXME */
+       _T("WindowStation"),
+       _T("Desktop"),
+       _T("Section"),
+       _T("Key"),
+       _T("Port"),
+       _T("18"),               /* FIXME */
+       _T("19"),               /* FIXME */
+       _T("20"),               /* FIXME */
+       _T("21"),               /* FIXME */
+       _T("IoCompletion"),
+       _T("File"),
+       NULL
+};
+
+
+LPTSTR
+STDCALL
+HandleTypeToObjectName (
+       DWORD   HandleType
+       )
+{
+       if (HandleType > 23)    /* FIXME: use a symbol not a literal */
+       {
+               return _T("Unknown");
+       }
+       return KernelObjectName [HandleType];
+}
+
+
+/* --- */
 
 int
 STDCALL
@@ -1191,7 +1240,7 @@ CMD_DEF(Handle)
        LONG                            Length = 0;
        INT                             Index;
        const PCHAR                     hr =
-               "-------- -------- ---- -------- -------- --------\n";
+               "-------- -------- -------- -------- -------- ----------\n";
        CHAR                            FlagsString [9] = {0};
 
        pInfo = GlobalAlloc (GMEM_ZEROINIT, BUFFER_SIZE_DEFAULT);
@@ -1245,7 +1294,7 @@ CMD_DEF(Handle)
                GlobalFree (pInfo);
                return EXIT_FAILURE;
        }
-       printf ("Handle   OwnerPID Type ObjPtr   Access   Flags\n");
+       printf ("Handle   OwnerPID ObjPtr   Access   Flags    Type\n");
        printf (hr);
 
        for (   Index = 0;
@@ -1254,16 +1303,16 @@ CMD_DEF(Handle)
                )
        {
                printf (
-                       "%8x %8x %4d %8x %8x %s\n",
+                       "%8x %8x %8x %8x %s %s\n",
                        pInfo->Handle[Index].HandleValue,
                        pInfo->Handle[Index].OwnerPid,
-                       pInfo->Handle[Index].ObjectType,
                        pInfo->Handle[Index].ObjectPointer,
                        pInfo->Handle[Index].AccessMask,
                        ByteToBinaryString (
                                pInfo->Handle[Index].HandleFlags,
                                FlagsString
-                               )
+                               ),
+                       HandleTypeToObjectName (pInfo->Handle[Index].ObjectType)
                        );
        }
        printf (hr);
index e311172..0b92089 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: regnav.c,v 1.2 1999/05/28 19:49:46 ea Exp $
+/* $Id: regnav.c,v 1.3 2000/05/28 17:44:53 ea Exp $
  * 
  * regnav.c
  * 
@@ -28,6 +28,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <tchar.h>
 #include <assert.h>
 #include "win32err.h"