Changeset 4235 for trunk/src/kernel32/oslibmisc.cpp
- Timestamp:
- Sep 12, 2000, 6:27:45 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/oslibmisc.cpp
r3993 r4235 1 /* $Id: oslibmisc.cpp,v 1.1 0 2000-08-11 10:56:18 sandervlExp $ */1 /* $Id: oslibmisc.cpp,v 1.11 2000-09-12 04:27:45 bird Exp $ */ 2 2 /* 3 3 * Misc OS/2 util. procedures … … 134 134 //****************************************************************************** 135 135 ULONG OSLibAllocSel(ULONG size, USHORT *selector) 136 { 136 { 137 137 return (Dos16AllocSeg(size, selector, SEG_NONSHARED) == 0); 138 138 } … … 174 174 } 175 175 } 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 */ 185 ULONG 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 } 201 214 } 202 215 //****************************************************************************** … … 221 234 /* @@@PH what does this function do ? Strip the path from a FQFN name ? */ 222 235 char *pszFilename; 223 236 224 237 pszFilename = strrchr(path, '\\'); /* find rightmost slash */ 225 238 if (pszFilename != NULL) 226 239 return (++pszFilename); /* return pointer to next character */ 227 240 228 241 pszFilename = strrchr(path, '/'); /* find rightmost slash */ 229 242 if (pszFilename != NULL) 230 243 return (++pszFilename); /* return pointer to next character */ 231 244 232 245 return (path); /* default return value */ 233 246 } … … 255 268 ULONG ulInfoLen = 0; 256 269 APIRET rc = NO_ERROR; /* Return code */ 257 270 258 271 rc = DosQueryCtryInfo(sizeof(CtryInfo), &Country, 259 272 &CtryInfo, &ulInfoLen); 260 273 261 274 if (rc != NO_ERROR) { 262 275 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.