Ignore:
Timestamp:
Sep 12, 2000, 6:27:45 AM (25 years ago)
Author:
bird
Message:

Added/extended some OSLib calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/oslibmisc.cpp

    r3993 r4235  
    1 /* $Id: oslibmisc.cpp,v 1.10 2000-08-11 10:56:18 sandervl Exp $ */
     1/* $Id: oslibmisc.cpp,v 1.11 2000-09-12 04:27:45 bird Exp $ */
    22/*
    33 * Misc OS/2 util. procedures
     
    134134//******************************************************************************
    135135ULONG OSLibAllocSel(ULONG size, USHORT *selector)
    136 { 
     136{
    137137   return (Dos16AllocSeg(size, selector, SEG_NONSHARED) == 0);
    138138}
     
    174174   }
    175175}
    176 //******************************************************************************
    177 //Get PIB data
    178 //******************************************************************************
    179 ULONG OSLibGetPIB(int piboff)
    180 {
    181  PTIB   ptib;
    182  PPIB   ppib;
    183  APIRET rc;
    184 
    185    rc = DosGetInfoBlocks(&ptib, &ppib);
    186    if(rc) {
    187         return 0;
    188    }
    189    switch(piboff)
    190    {
    191         case PIB_TASKHNDL:
    192                 return ppib->pib_hmte;
    193         case PIB_TASKTYPE:
    194                 if(ppib->pib_ultype == 3) {
    195                         return TASKTYPE_PM;
    196                 }
    197                 else    return TASKTYPE_VIO;
    198         default:
    199                 return 0;
    200    }
     176
     177/**
     178 * Gets a PIB data.
     179 * @returns     Requested PIB data.
     180 *              0 may indicate error or that the PIB data you requested actually is 0.
     181 * @param       iPIB    PIB data index. (one of the PIB_* defines in oslibmisc.h)
     182 * @author
     183 * @remark      Spooky error handling.
     184 */
     185ULONG OSLibGetPIB(int iPIB)
     186{
     187     PTIB   ptib;
     188     PPIB   ppib;
     189     APIRET rc;
     190
     191    rc = DosGetInfoBlocks(&ptib, &ppib);
     192    if (rc)
     193    {
     194            dprintf(("KERNEL32: OSLibGetPIB(%d): DosGetInfoBlocks failed with rc=%d\n", iPIB, rc));
     195        return 0;
     196    }
     197
     198    switch(iPIB)
     199    {
     200    case PIB_TASKHNDL:
     201        return ppib->pib_hmte;
     202
     203    case PIB_TASKTYPE:
     204        return (ppib->pib_ultype == 3) ? TASKTYPE_PM : TASKTYPE_VIO;
     205
     206    case PIB_PCHCMD:
     207        return (ULONG)ppib->pib_pchcmd;
     208
     209    default:
     210        dprintf(("KERNEL32: OSLibGetPIB(%d): Invalid PIB data index\n.", iPIB));
     211        DebugInt3();
     212        return 0;
     213    }
    201214}
    202215//******************************************************************************
     
    221234  /* @@@PH what does this function do ? Strip the path from a FQFN name ? */
    222235  char *pszFilename;
    223  
     236
    224237  pszFilename = strrchr(path, '\\');                 /* find rightmost slash */
    225238  if (pszFilename != NULL)
    226239    return (++pszFilename);              /* return pointer to next character */
    227  
     240
    228241  pszFilename = strrchr(path, '/');                  /* find rightmost slash */
    229242  if (pszFilename != NULL)
    230243    return (++pszFilename);              /* return pointer to next character */
    231  
     244
    232245  return (path);                                     /* default return value */
    233246}
     
    255268 ULONG        ulInfoLen  = 0;
    256269 APIRET       rc         = NO_ERROR;  /* Return code                         */
    257  
     270
    258271    rc = DosQueryCtryInfo(sizeof(CtryInfo), &Country,
    259272                          &CtryInfo, &ulInfoLen);
    260  
     273
    261274    if (rc != NO_ERROR) {
    262275        return -1;
Note: See TracChangeset for help on using the changeset viewer.