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