Changeset 828 for trunk/dll/datamin.c


Ignore:
Timestamp:
Sep 3, 2007, 4:02:12 AM (18 years ago)
Author:
Gregg Young
Message:

Add DosQuerySysState as option for getting process info for kill process and Datamin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/datamin.c

    r793 r828  
    2020  30 Mar 07 GKY Remove GetPString for window class names
    2121  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     22  02 Sep 07 GKY Replaced DosQProcStatus with DosQuerySysState to fix trap in thunk code
    2223
    2324***********************************************************************/
     
    796797  case UM_SETUP5:                       // Process status
    797798    {
    798       CHAR s[134], tm[38], szQty[38];
    799 
    800       if (fUseQProcStat && !noqproc) {
     799     CHAR s[134], tm[38], szQty[38];
     800
     801     if (fUseQProcStat && !noqproc) {
    801802
    802803        PROCESSINFO *ppi;
     
    837838        }
    838839      }
     840      else if (fUseQSysState && !noqproc) {
     841
     842        QSPREC *ppi;
     843        QSPTRREC *pbh = NULL;
     844        QSLREC *pmi;
     845        ULONG numprocs = 0, numthreads = 0;
     846        APIRET rc;
     847
     848        rc = DosAllocMem((PVOID) & pbh, USHRT_MAX + 4096,
     849                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     850        if (rc)
     851          Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
     852                    GetPString(IDS_OUTOFMEMORY));
     853        else { //2 Sep 07 GKY 0x05 = process & Mod data only
     854          if (DosQuerySysState(QS_PROCESS | QS_MTE, 0, 0, 0, pbh, USHRT_MAX))
     855            noqproc = TRUE;
     856          else {
     857            ppi = pbh->pProcRec;
     858            while (ppi->RecType == 1) {
     859              pmi = pbh->pLibRec;
     860              while (pmi && ppi->hMte != pmi->hmte)
     861                pmi = pmi->pNextRec;
     862              if (pmi) {
     863                numprocs++;
     864                numthreads += ppi->cTCB;
     865              }
     866              ppi = (QSPREC *) (ppi->pThrdRec + ppi->cTCB);
     867            }
     868            commafmt(szQty, sizeof(szQty), numprocs);
     869            commafmt(tm, sizeof(tm), numthreads);
     870            sprintf(s,
     871                    " %s%s  %s%s",
     872                    GetPString(IDS_PROCSTITLETEXT),
     873                    szQty, GetPString(IDS_THRDSTITLETEXT), tm);
     874            WinSetDlgItemText(hwnd, MINI_PROC, s);
     875          }
     876          DosFreeMem(pbh);
     877        }
     878      }
    839879      else {
    840880        commafmt(szQty, sizeof(szQty),
Note: See TracChangeset for help on using the changeset viewer.