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