Ignore:
Timestamp:
Jan 12, 2003, 11:49:24 AM (23 years ago)
Author:
umoeller
Message:

Misc fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/procstat.c

    r238 r240  
    497497
    498498/*
     499 *@@ prc32GetInfo2:
     500 *      nifty interface to DosQuerySysState, the 32-bit
     501 *      version of DosQProcStat.
     502 *
     503 *      This returns the head of a newly allocated buffer
     504 *      which has plenty of pointers for subsequent browing.
     505 *
     506 *      As opposed to prc32GetInfo, with this call you can
     507 *      specify the information that would like to retrieve.
     508 *
     509 *      Use prc32FreeInfo to free the buffer.
     510 *
     511 *@@added V1.0.1 (2003-01-10) [umoeller]
     512 */
     513
     514PQTOPLEVEL32 prc32GetInfo2(ULONG fl,        // in: QS32_* flags
     515                           APIRET *parc)    // out: error, ptr can be NULL
     516{
     517    APIRET          arc;
     518    PQTOPLEVEL32    pReturn = NULL;
     519
     520    #define BUFSIZE (1024 * 1024) // 1 meg
     521
     522    if (!(arc = DosAllocMem((PVOID*)&pReturn,
     523                            BUFSIZE,
     524                            PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE)))
     525    {
     526        if (arc = DosQuerySysState(fl,
     527                                   fl,      // this was missing V0.9.10 (2001-04-08) [umoeller]
     528                                   0, 0,
     529                                   (PCHAR)pReturn,
     530                                   BUFSIZE))
     531        {
     532            DosFreeMem(pReturn);
     533            pReturn = NULL;
     534        }
     535    }
     536
     537    if (parc)
     538        *parc = arc;
     539
     540    return pReturn;
     541}
     542
     543/*
    499544 *@@ prc32GetInfo:
    500  *      nifty interface to DosQuerySysState,
    501  *      the 32-bit version of DosQProcStat.
    502  *      This returns the head of a newly
    503  *      allocated buffer which has plenty
    504  *      of pointers for subsequent browing.
     545 *      nifty interface to DosQuerySysState, the 32-bit
     546 *      version of DosQProcStat.
     547 *
     548 *      This returns the head of a newly allocated buffer
     549 *      which has plenty of pointers for subsequent browing.
    505550 *
    506551 *      Use prc32FreeInfo to free the buffer.
     
    513558PQTOPLEVEL32 prc32GetInfo(APIRET *parc)     // out: error, ptr can be NULL
    514559{
    515     #define BUFSIZE (1024 * 1024) // 1 meg
    516 
    517     PCHAR pBuf = NULL; // (PCHAR)malloc(BUFSIZE);
    518 
    519     if (DosAllocMem((PVOID*)&pBuf,
    520                     BUFSIZE,
    521                     PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_TILE)
    522             == NO_ERROR)
    523         if (pBuf)
    524         {
    525             APIRET arc = DosQuerySysState(QS32_SUPPORTED,
    526                                           QS32_SUPPORTED,       // this was missing
    527                                                                 // V0.9.10 (2001-04-08) [umoeller]
    528                                           0, 0,
    529                                           (PCHAR)pBuf,
    530                                           BUFSIZE);
    531             if (parc)
    532                 *parc = arc;
    533 
    534             if (arc == NO_ERROR)
    535                 return (PQTOPLEVEL32)pBuf;
    536             else
    537                 DosFreeMem(pBuf);
    538         }
    539 
    540     return NULL;
     560    return prc32GetInfo2(QS32_SUPPORTED,
     561                         parc);
    541562}
    542563
Note: See TracChangeset for help on using the changeset viewer.