Changeset 30
- Timestamp:
- Jan 26, 2016, 4:27:09 PM (10 years ago)
- Location:
- rxutilex/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
rxutilex/trunk/rxutilex.c
r29 r30 84 84 #define SZ_LIBRARY_NAME "RXUTILEX" // Name of this library 85 85 #define SZ_ERROR_NAME "SYS2ERR" // REXX variable used to store error codes 86 #define SZ_VERSION "0.1. 2" // Current version of this library86 #define SZ_VERSION "0.1.3" // Current version of this library 87 87 88 88 // Maximum string lengths... … … 108 108 // Drop list starts at index 0, load list starts at index 1 109 109 static PSZ RxFunctionTbl[] = { 110 "Sys2LoadFuncs", // Drop only 2015-05-06 sSHL110 "Sys2LoadFuncs", // Drop only 2015-05-06 SHL 111 111 "Sys2DropFuncs", 112 112 "Sys2GetClipboardText", … … 652 652 ULONG Sys2QueryProcessList( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 653 653 { 654 #ifdef USE_DQPS 655 QSPTRREC *pBuf; // Data returned by DosQProcStatus() 656 #else 657 QSPTRREC *pBuf; // Data returned by DosQuerySysState() // 2015-04-23 SHL 658 #endif 654 QSPTRREC *pBuf; // Data returned by DosQProcStatus/DosQuerySysState() // 2015-04-23 SHL 659 655 QSPREC *pPrec; // Pointer to process information block 660 656 QSTREC *pTrec; // Pointer to thread information block … … 697 693 698 694 #ifdef USE_DQPS 699 // Get running process information using DosQProcStatus()695 // Get running process information using 16-bit DosQProcStatus() 700 696 rc = DosQProcStatus( pBuf, UL_SSBUFSIZE ); 701 697 if ( rc != NO_ERROR ) { … … 704 700 return ( 0 ); 705 701 } 706 pPrec = pBuf->pProcRec; // 2015-04-23 SHL707 702 #else 708 // Get running process information using DosQuerySysState()703 // Get running process information using 32-bit DosQuerySysState() 709 704 rc = DosQuerySysState( QS_PROCESS, 0L, 0L, 0L, pBuf, UL_SSBUFSIZE ); 710 705 if ( rc != NO_ERROR ) { … … 713 708 return ( 0 ); 714 709 } 715 pPrec = pBuf->pProcRec;716 710 #endif 717 711 718 712 // Now get the list of processes 719 713 ulCount = 0; 720 while ( pPrec->RecType == 1 ) { 714 # if 1 // 2015-06-12 SHL FIXME to know if can occur 715 if ( pBuf->pProcRec == NULL ) { 716 WriteErrorCode( rc, "pBuf->pProcRec NULL"); 717 MAKERXSTRING( *prsResult, "", 0 ); 718 return ( 0 ); 719 } 720 # endif 721 722 // 2015-06-12 SHL pThrdRec can be 0 - probably when process starting or dieing 723 for (pPrec = pBuf->pProcRec; 724 ; 725 pPrec = pPrec->pThrdRec ? 726 (QSPREC *)(pPrec->pThrdRec + pPrec->cTCB) : 727 pPrec + 1 728 ) 729 730 { 731 # if 1 732 // 2015-06-19 SHL FIXME to be gone if proven that never can occur 733 if ((ULONG)pPrec < 0x10000) { 734 fprintf(stderr, "* rxutilex#%u ulCount %u pPrec %p\n", __LINE__, ulCount, pPrec); 735 break; // Avoid death 736 } 737 # endif 738 739 // 2015-06-19 SHL FIXME debug was trapping here if pThrdRec NULL 740 if (pPrec->RecType != QS_PROCESS) 741 break; 742 743 # if 1 744 /* Avoid death if no threads 745 This is undocumented but probably occurs if called while process 746 is starting or terminating 747 2015-07-31 SHL 748 */ 749 if (!pPrec->cTCB) 750 fprintf(stderr, "* rxutilex#%u ulCount %u pBuf %p pPrec %p pPrec->pThrdRec %p pPrec->cTCB %u\n", __LINE__, ulCount, pBuf, pPrec, pPrec->pThrdRec, pPrec->cTCB); 751 // 2015-07-31 SHL FIXME debug 752 if ((ULONG)(pPrec->pThrdRec) < 0x10000) { 753 fprintf(stderr, "* rxutilex#%u ulCount %u pBuf %p pPrec %p pPrec->pThrdRec %p pPrec->cTCB %u\n", __LINE__, ulCount, pBuf, pPrec, pPrec->pThrdRec, pPrec->cTCB); 754 break; // Avoid death 755 } 756 # endif 757 721 758 ulCount++; 722 759 … … 747 784 WriteStemElement( szStem, ulCount, szPInfo ); 748 785 749 pPrec = (QSPREC *) ( (PBYTE) (pPrec->pThrdRec) + ( pPrec->cTCB * sizeof(QSTREC) ) ); 750 } 786 # if 1 // 2015-07-31 SHL FIXME debug 787 // 2015-07-31 SHL FIXME debug 788 if (!pPrec->cTCB) { 789 fprintf(stderr, "* rxutilex: szPInfo %s\n", szPInfo); 790 fprintf(stderr, "* rxutilex: ulCount %u pBuf %p pPrec %p pPrec->pThrdRec %p pPrec->cTCB %u\n", ulCount, pBuf, pPrec, pPrec->pThrdRec, pPrec->cTCB); 791 fprintf(stderr, "* rxutilex: next RecType %x\n", (pPrec + 1)->RecType); 792 } 793 // 2015-07-31 SHL FIXME debug 794 if ((ULONG)pPrec->pThrdRec < 0x10000 || !pPrec->cTCB) { 795 fprintf(stderr, "* rxutilex: szPInfo %s\n", szPInfo); 796 fprintf(stderr, "* rxutilex: ulCount %u pBuf %p pPrec %p pPrec->pThrdRec %p pPrec->cTCB %u\n", ulCount, pBuf, pPrec, pPrec->pThrdRec, pPrec->cTCB); 797 fprintf(stderr, "* rxutilex: next RecType %x\n", (pPrec + 1)->RecType); 798 break; // Avoid death 799 } 800 # endif 801 } // for 751 802 752 803 // Create the "0" stem element with the number of processes found -
rxutilex/trunk/rxutilex.def
r29 r30 1 1 LIBRARY RXUTILEX INITINSTANCE TERMINSTANCE 2 2 DATA MULTIPLE NONSHARED 3 DESCRIPTION '@#Alex Taylor:0.1. 2#@##1## 27 Jan 2016 00:11:55REINFORCE::::::@@Extended REXX Utility Functions'3 DESCRIPTION '@#Alex Taylor:0.1.3#@##1## 27 Jan 2016 00:26:24 REINFORCE::::::@@Extended REXX Utility Functions' 4 4 5 5 EXPORTS Sys2LoadFuncs
Note:
See TracChangeset
for help on using the changeset viewer.