home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sherlock.zip / PROCSTAT.H < prev    next >
C/C++ Source or Header  |  1994-06-29  |  6KB  |  150 lines

  1. /**********************************************************************
  2.  * MODULE NAME :  procstat.h             AUTHOR:  Rick Fishman        *
  3.  * DATE WRITTEN:   2-10-92                          *
  4.  *                                      *
  5.  * Patches to fix structure definitions:                  *
  6.  *  AUTHOR: Edmund Harfmann                          *
  7.  *  DATE:   1-1-93                              *
  8.  *                                                                    *
  9.  * DESCRIPTION:                                                       *
  10.  *                                                                    *
  11.  *  This header file contains the function prototype for the asofyet  *
  12.  *  undocumented DosQProcStatus API.  It also contains the structure  *
  13.  *  definitions that are used in the buffer that is returned by the   *
  14.  *  API call.                                                         *
  15.  *                                                                    *
  16.  *  In order to invoke DosQProcStatus, your .DEF file must contain    *
  17.  *  this entry:                                                       *
  18.  *                                                                    *
  19.  *           IMPORTS DOSQPROCSTATUS=DOSCALLS.154                      *
  20.  *                                                                    *
  21.  **********************************************************************/
  22.  
  23. #pragma linkage( DosQProcStatus, far16 pascal )
  24. USHORT DosQProcStatus( PVOID pvBuf, USHORT cbBuf );
  25.  
  26. #define PROCESS_END_INDICATOR   3       // Indicates end of process structs
  27.  
  28. #pragma pack(1)
  29.  
  30. typedef struct _SUMMARY
  31. {
  32.     ULONG   ulThreadCount;              // Number of threads in system
  33.     ULONG   ulProcessCount;             // Number of processes in system
  34.     ULONG   ulModuleCount;              // Number of modules in system
  35.  
  36. } SUMMARY, *PSUMMARY;
  37.  
  38.  
  39. typedef struct _THREADINFO
  40. {
  41.     UCHAR   uchDontKnow1;               //
  42.     UCHAR   uchDontKnow2;               //
  43.     USHORT  usDontKnow3;                //
  44.     USHORT  tidWithinProcess;           // TID within process (TID is 4 bytes!!)
  45.     USHORT  tidWithinSystem;            // TID within system
  46.     ULONG   ulBlockId;                  // Block ID (?)
  47.     USHORT  usPriority;                 // Priority
  48.     USHORT  usDontKnow4;                //
  49.     USHORT  usDontKnow5;                //
  50.     USHORT  usDontKnow6;                //
  51.     USHORT  usDontKnow7;                //
  52.     USHORT  usDontKnow8;                //
  53.     USHORT  usThreadStatus;             // 2=blocked or ready, 5=running
  54.     USHORT  usDontKnow9;                //
  55.  
  56. } THREADINFO, *PTHREADINFO;
  57.  
  58.  
  59. typedef struct _PROCESSINFO
  60. {
  61.     ULONG       ulEndIndicator;         // 1 means not end, 3 means last entry
  62.     PTHREADINFO ptiFirst;               // Address of the 1st Thread Control Blk
  63.     USHORT      pid;                    // Process ID (2 bytes - PID is 4 bytes)
  64.     USHORT      pidParent;              // Parent's process ID
  65.     USHORT      usDontKnow2;            //
  66.     USHORT      usDontKnow3;            //
  67.     USHORT      usDontKnow4;            //
  68.     USHORT      usDontKnow5;            //
  69.     USHORT      idSession;              // Session ID
  70.     USHORT      usDontKnow6;            //
  71.     USHORT      hModRef;                // Module handle of EXE
  72.     USHORT      usThreadCount;          // Number of threads in this process
  73.     USHORT      usSessionType;          // Session type (SSF_TYPE_xx)
  74.     CHAR        achDontKnow7[ 6 ];      //
  75.     USHORT      usThreadIdCount;        // Number of USHORTs in Thread id table?
  76.     USHORT      usModCount;             // Number of USHORTs in ModHandle table?
  77.     USHORT      usUshortCount;          // Number of USHORTs in Ushort table?
  78.     USHORT      usDontKnow8;            //
  79.     ULONG       ulThreadIdTableAddr;    // Maybe the address of a TID table
  80.     PUSHORT    pModHandleTable;    // Address of a ModHandle table (DLLS?)
  81.     ULONG       ulUshortTableAddr;      // Address of a table of USHORTs (?)
  82.  
  83. } PROCESSINFO, *PPROCESSINFO;
  84.  
  85.  
  86. typedef struct _SEMHEADER
  87. {
  88.     USHORT   ownPid;            // 0 Owner PID
  89.     USHORT   achDontKnow1;        // 2
  90.     ULONG    achDontKnow2[2];        // 4
  91.     USHORT   usIndex;            // C Semaphore Index
  92.     USHORT   achDontKnow3;        // E
  93.                     // 10
  94. } SEMHEADER, *PSEMHEADER;
  95.  
  96. typedef struct _SEMINFO
  97. {
  98.     struct _SEMINFO *pNext;        // 0 Pointer to next block
  99.     USHORT   fsFlags;            // 4 (MSB-LSB)
  100.     UCHAR    achDontKnow1[1];        // 6
  101.     UCHAR    uchReferenceCount;     // 7 Number of references
  102.     UCHAR    uchRequestCount;        // 8 Number of requests
  103.     CHAR     achDontKnow2[3];        // 9
  104.     USHORT   usIndex;            // c Semaphore Index
  105.     CHAR     szSemName[ 1 ];        // e ASCIIZ semaphore name
  106.                     // ?
  107. } SEMINFO, *PSEMINFO;
  108.  
  109. typedef struct _SHRMEMINFO
  110. {
  111.     struct _SHRMEMINFO *pNext;           // Pointer to next block
  112.     USHORT      usMemHandle;             // Shared memory handle (?)
  113.     SEL         selMem;                  // Selector
  114.     USHORT      usReferenceCount;        // Number of references
  115.     CHAR        szMemName[ 1 ];          // ASCIIZ shared memory name
  116.  
  117. } SHRMEMINFO, *PSHRMEMINFO;
  118.  
  119.  
  120. typedef struct _MODINFO
  121. {
  122.     struct _MODINFO *pNext;              // Pointer to next block
  123.     USHORT   hMod;                       // Module handle
  124.     USHORT   usModType;                  // Module type (0=16bit,1=32bit)
  125.     ULONG    ulModRefCount;              // Count of module references
  126.     ULONG    ulSegmentCount;             // Number of segments in module
  127.     ULONG    ulDontKnow1;                //
  128.     PSZ      szModName;                  // Addr of fully qualified module name
  129.     USHORT   usModRef[ 1 ];              // Handles of module references
  130.  
  131. } MODINFO, *PMODINFO;
  132.  
  133.  
  134. typedef struct _BUFFHEADER
  135. {
  136.     PSUMMARY        psumm;        // Pointer to SUMMARY section
  137.     PPROCESSINFO    ppi;        // Pointer to PROCESS section
  138.     PSEMINFO        psi;        // Pointer to SEMAPHORE section
  139.     PVOID        pDontKnow1;     // Unknown
  140.     PSHRMEMINFO     psmi;        // Pointer to SHARED MEMORY section
  141.     PMODINFO        pmi;        // Pointer to MODULE section
  142.     PVOID        pDontKnow2;     //
  143.     PVOID        pDontKnow3;     //
  144.  
  145. } BUFFHEADER, *PBUFFHEADER;
  146.  
  147. #pragma pack()
  148.  
  149. void dumpPStat(void);
  150.