| 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 | 
 | 
|---|
| 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 | 
 | 
|---|
| 30 | #if defined(__WATCOMC__)
 | 
|---|
| 31 | APIRET16 APIENTRY16 DosQProcStatus(ULONG *pBuf, USHORT cbBuf);
 | 
|---|
| 32 | #endif
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #if defined(__IBMC__)
 | 
|---|
| 35 | #pragma linkage( DosQProcStatus, far16 pascal )
 | 
|---|
| 36 | USHORT DosQProcStatus(PVOID pvBuf, USHORT cbBuf);
 | 
|---|
| 37 | #endif
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #define PROCESS_END_INDICATOR   3       // Indicates end of process structs
 | 
|---|
| 40 | 
 | 
|---|
| 41 | #pragma pack(1)
 | 
|---|
| 42 | 
 | 
|---|
| 43 | typedef struct _SUMMARY
 | 
|---|
| 44 | {
 | 
|---|
| 45 |   ULONG ulThreadCount;          // Number of threads in system
 | 
|---|
| 46 |   ULONG ulProcessCount;         // Number of processes in system
 | 
|---|
| 47 |   ULONG ulModuleCount;          // Number of modules in system
 | 
|---|
| 48 | 
 | 
|---|
| 49 | }
 | 
|---|
| 50 | SUMMARY, *PSUMMARY;
 | 
|---|
| 51 | 
 | 
|---|
| 52 | typedef struct _THREADINFO
 | 
|---|
| 53 | {
 | 
|---|
| 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
 | 
|---|
| 64 | 
 | 
|---|
| 65 | }
 | 
|---|
| 66 | THREADINFO, *PTHREADINFO;
 | 
|---|
| 67 | 
 | 
|---|
| 68 | typedef struct _PROCESSINFO
 | 
|---|
| 69 | {
 | 
|---|
| 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
 | 
|---|
| 88 | 
 | 
|---|
| 89 | }
 | 
|---|
| 90 | PROCESSINFO, *PPROCESSINFO;
 | 
|---|
| 91 | 
 | 
|---|
| 92 | typedef struct _SEMINFO
 | 
|---|
| 93 | {
 | 
|---|
| 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
 | 
|---|
| 103 | 
 | 
|---|
| 104 | }
 | 
|---|
| 105 | SEMINFO, *PSEMINFO;
 | 
|---|
| 106 | 
 | 
|---|
| 107 | typedef struct _SHRMEMINFO
 | 
|---|
| 108 | {
 | 
|---|
| 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
 | 
|---|
| 114 | 
 | 
|---|
| 115 | }
 | 
|---|
| 116 | SHRMEMINFO, *PSHRMEMINFO;
 | 
|---|
| 117 | 
 | 
|---|
| 118 | typedef struct _MODINFO
 | 
|---|
| 119 | {
 | 
|---|
| 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
 | 
|---|
| 128 | 
 | 
|---|
| 129 | }
 | 
|---|
| 130 | MODINFO, *PMODINFO;
 | 
|---|
| 131 | 
 | 
|---|
| 132 | typedef struct _BUFFHEADER
 | 
|---|
| 133 | {
 | 
|---|
| 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;             //
 | 
|---|
| 142 | 
 | 
|---|
| 143 | }
 | 
|---|
| 144 | BUFFHEADER, *PBUFFHEADER;
 | 
|---|
| 145 | 
 | 
|---|
| 146 | #pragma pack()
 | 
|---|