| 1 |  | 
|---|
| 2 | /*********************************************************************** | 
|---|
| 3 |  | 
|---|
| 4 | $Id: procstat.h 902 2008-01-05 02:47:56Z stevenhl $ | 
|---|
| 5 |  | 
|---|
| 6 | Define DosQProcStatus interface | 
|---|
| 7 |  | 
|---|
| 8 | 02 Sep 07 SHL Update for OpenWatcom | 
|---|
| 9 | 04 Jan 08 SHL Allow standalone usage | 
|---|
| 10 |  | 
|---|
| 11 | ***********************************************************************/ | 
|---|
| 12 |  | 
|---|
| 13 | /********************************************************************** | 
|---|
| 14 | * MODULE NAME :  procstat.h             AUTHOR:  Rick Fishman        * | 
|---|
| 15 | * DATE WRITTEN:   2-10-92                                            * | 
|---|
| 16 | *                                                                    * | 
|---|
| 17 | * DESCRIPTION:                                                       * | 
|---|
| 18 | *                                                                    * | 
|---|
| 19 | *  This header file contains the function prototype for the asofyet  * | 
|---|
| 20 | *  undocumented DosQProcStatus API.  It also contains the structure  * | 
|---|
| 21 | *  definitions that are used in the buffer that is returned by the   * | 
|---|
| 22 | *  API call.                                                         * | 
|---|
| 23 | *                                                                    * | 
|---|
| 24 | *  In order to invoke DosQProcStatus, your .DEF file must contain    * | 
|---|
| 25 | *  this entry:                                                       * | 
|---|
| 26 | *                                                                    * | 
|---|
| 27 | *           IMPORTS DOSQPROCSTATUS=DOSCALLS.154                      * | 
|---|
| 28 | *                                                                    * | 
|---|
| 29 | **********************************************************************/ | 
|---|
| 30 |  | 
|---|
| 31 | #if !defined(PROCSTAT_H) | 
|---|
| 32 | #define PROCSTAT_H | 
|---|
| 33 |  | 
|---|
| 34 | #if !defined(OS2_INCLUDED) | 
|---|
| 35 | #include <os2.h> | 
|---|
| 36 | #endif | 
|---|
| 37 |  | 
|---|
| 38 | #if defined(__WATCOMC__) | 
|---|
| 39 | APIRET16 APIENTRY16 DosQProcStatus(ULONG *pBuf, USHORT cbBuf); | 
|---|
| 40 | #endif | 
|---|
| 41 |  | 
|---|
| 42 | #if defined(__IBMC__) | 
|---|
| 43 | #pragma linkage( DosQProcStatus, far16 pascal ) | 
|---|
| 44 | USHORT DosQProcStatus(PVOID pvBuf, USHORT cbBuf); | 
|---|
| 45 | #endif | 
|---|
| 46 |  | 
|---|
| 47 | #define PROCESS_END_INDICATOR   3       // Indicates end of process structs | 
|---|
| 48 |  | 
|---|
| 49 | #pragma pack(1) | 
|---|
| 50 |  | 
|---|
| 51 | typedef struct _SUMMARY | 
|---|
| 52 | { | 
|---|
| 53 | ULONG ulThreadCount;          // Number of threads in system | 
|---|
| 54 | ULONG ulProcessCount;         // Number of processes in system | 
|---|
| 55 | ULONG ulModuleCount;          // Number of modules in system | 
|---|
| 56 |  | 
|---|
| 57 | } | 
|---|
| 58 | SUMMARY, *PSUMMARY; | 
|---|
| 59 |  | 
|---|
| 60 | typedef struct _THREADINFO | 
|---|
| 61 | { | 
|---|
| 62 | ULONG ulRecType;              // Record type (thread = 100) | 
|---|
| 63 | USHORT tidWithinProcess;      // TID within process (TID is 4 bytes!!) | 
|---|
| 64 | USHORT usSlot;                // Unique thread slot number | 
|---|
| 65 | ULONG ulBlockId;              // Sleep id thread is sleeping on | 
|---|
| 66 | ULONG ulPriority;             // Priority | 
|---|
| 67 | ULONG ulSysTime;              // Thread System Time | 
|---|
| 68 | ULONG ulUserTime;             // Thread User Time | 
|---|
| 69 | UCHAR uchState;               // 1=ready,2=blocked,5=running | 
|---|
| 70 | UCHAR uchPad;                 // Filler | 
|---|
| 71 | USHORT usPad;                 // Filler | 
|---|
| 72 |  | 
|---|
| 73 | } | 
|---|
| 74 | THREADINFO, *PTHREADINFO; | 
|---|
| 75 |  | 
|---|
| 76 | typedef struct _PROCESSINFO | 
|---|
| 77 | { | 
|---|
| 78 | ULONG ulEndIndicator;         // 1 means not end, 3 means last entry | 
|---|
| 79 | PTHREADINFO ptiFirst;         // Address of the 1st Thread Control Blk | 
|---|
| 80 | USHORT pid;                   // Process ID (2 bytes - PID is 4 bytes) | 
|---|
| 81 | USHORT pidParent;             // Parent's process ID | 
|---|
| 82 | ULONG ulType;                 // Process Type | 
|---|
| 83 | ULONG ulStatus;               // Process Status | 
|---|
| 84 | ULONG idSession;              // Session ID | 
|---|
| 85 | USHORT hModRef;               // Module handle of EXE | 
|---|
| 86 | USHORT usThreadCount;         // Number of threads in this process | 
|---|
| 87 | ULONG ulReserved;             // Unknown | 
|---|
| 88 | PVOID pvReserved;             // Unknown | 
|---|
| 89 | USHORT usSem16Count;          // Number of 16-bit system semaphores | 
|---|
| 90 | USHORT usDllCount;            // Number of Dlls used by process | 
|---|
| 91 | USHORT usShrMemHandles;       // Number of shared memory handles | 
|---|
| 92 | USHORT usReserved;            // Unknown | 
|---|
| 93 | PUSHORT pusSem16TableAddr;    // Address of a 16-bit semaphore table | 
|---|
| 94 | PUSHORT pusDllTableAddr;      // Address of a Dll table | 
|---|
| 95 | PUSHORT pusShrMemTableAddr;   // Address of a shared memory table | 
|---|
| 96 |  | 
|---|
| 97 | } | 
|---|
| 98 | PROCESSINFO, *PPROCESSINFO; | 
|---|
| 99 |  | 
|---|
| 100 | typedef struct _SEMINFO | 
|---|
| 101 | { | 
|---|
| 102 | struct _SEMINFO *pNext;       // Ptr to next block (NULL on last one) | 
|---|
| 103 | UINT idOwningThread;          // ID of owning thread? | 
|---|
| 104 | UCHAR fbFlags;                // Semaphore flags | 
|---|
| 105 | UCHAR uchReferenceCount;      // Number of references | 
|---|
| 106 | UCHAR uchRequestCount;        // Number of requests | 
|---|
| 107 | UCHAR uchReserved;            // Unknown | 
|---|
| 108 | ULONG ulReserved;             // Unknown | 
|---|
| 109 | UINT uiReserved;              // Unknown | 
|---|
| 110 | CHAR szSemName[1];            // ASCIIZ semaphore name | 
|---|
| 111 |  | 
|---|
| 112 | } | 
|---|
| 113 | SEMINFO, *PSEMINFO; | 
|---|
| 114 |  | 
|---|
| 115 | typedef struct _SHRMEMINFO | 
|---|
| 116 | { | 
|---|
| 117 | struct _SHRMEMINFO *pNext;    // Ptr to next block (NULL on last one) | 
|---|
| 118 | USHORT usMemHandle;           // Shared memory handle (?) | 
|---|
| 119 | SEL selMem;                   // Selector | 
|---|
| 120 | USHORT usReferenceCount;      // Number of references | 
|---|
| 121 | CHAR szMemName[1];            // ASCIIZ shared memory name | 
|---|
| 122 |  | 
|---|
| 123 | } | 
|---|
| 124 | SHRMEMINFO, *PSHRMEMINFO; | 
|---|
| 125 |  | 
|---|
| 126 | typedef struct _MODINFO | 
|---|
| 127 | { | 
|---|
| 128 | struct _MODINFO *pNext;       // Ptr to next block (NULL on last one) | 
|---|
| 129 | USHORT hMod;                  // Module handle | 
|---|
| 130 | USHORT usModType;             // Module type (0=16bit,1=32bit) | 
|---|
| 131 | ULONG ulModRefCount;          // Count of module references | 
|---|
| 132 | ULONG ulSegmentCount;         // Number of segments in module | 
|---|
| 133 | ULONG ulDontKnow1;            // | 
|---|
| 134 | PSZ szModName;                // Addr of fully qualified module name | 
|---|
| 135 | USHORT usModRef[1];           // Handles of module references | 
|---|
| 136 |  | 
|---|
| 137 | } | 
|---|
| 138 | MODINFO, *PMODINFO; | 
|---|
| 139 |  | 
|---|
| 140 | typedef struct _BUFFHEADER | 
|---|
| 141 | { | 
|---|
| 142 | PSUMMARY psumm;               // SUMMARY section ptr | 
|---|
| 143 | PPROCESSINFO ppi;             // PROCESS section ptr | 
|---|
| 144 | PSEMINFO psi;                 // SEM section ptr (add 16 to offset) | 
|---|
| 145 | PVOID pDontKnow1;             // | 
|---|
| 146 | PSHRMEMINFO psmi;             // SHARED MEMORY section ptr | 
|---|
| 147 | PMODINFO pmi;                 // MODULE section ptr | 
|---|
| 148 | PVOID pDontKnow2;             // | 
|---|
| 149 | PVOID pDontKnow3;             // | 
|---|
| 150 |  | 
|---|
| 151 | } | 
|---|
| 152 | BUFFHEADER, *PBUFFHEADER; | 
|---|
| 153 |  | 
|---|
| 154 | #pragma pack() | 
|---|
| 155 |  | 
|---|
| 156 | #endif // PROCSTAT_H | 
|---|