Changeset 240 for trunk/src/helpers
- Timestamp:
- Jan 12, 2003, 11:49:24 AM (23 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh.c
r238 r240 1657 1657 ) 1658 1658 { 1659 CHAR szTemp[ 30] = "?:\\long.name.file";1659 CHAR szTemp[] = "?:\\long.name.file"; 1660 1660 szTemp[0] = ulLogicalDrive + 'A' - 1; 1661 1661 if (!(arc = DosOpen(szTemp, … … 4014 4014 + PDOSHPERFSYS pPerf = NULL; 4015 4015 + APIRET arc; 4016 + if (!(arc = arc =doshPerfOpen(&pPerf)))4016 + if (!(arc = doshPerfOpen(&pPerf))) 4017 4017 + { 4018 4018 + // this should really be in a timer, … … 4043 4043 4044 4044 // allocate DOSHPERFSYS structure 4045 *ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS)); 4046 if (!*ppPerfSys) 4045 if (!(*ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS)))) 4047 4046 arc = ERROR_NOT_ENOUGH_MEMORY; 4048 4047 else -
trunk/src/helpers/dosh2.c
r238 r240 383 383 } 384 384 385 return (ERROR_BUFFER_OVERFLOW);385 return ERROR_BUFFER_OVERFLOW; 386 386 } 387 387 … … 607 607 { 608 608 // try additional things then 609 PSZ psz2 = (PSZ)malloc(strlen(pcszCommand) + 20);610 if (psz2 )609 PSZ psz2; 610 if (psz2 = (PSZ)malloc(strlen(pcszCommand) + 20)) 611 611 { 612 612 ULONG ul; -
trunk/src/helpers/exeh.c
r236 r240 257 257 &cbFile, 258 258 &pFile))) 259 // file opened successfully:260 259 ) 261 260 { 261 // file opened successfully: 262 262 pExec->pFile = pFile; 263 263 pExec->cbDosExeHeader = sizeof(DOSEXEHEADER); … … 505 505 } // end if (fLoadNewHeader) 506 506 507 if (arc != NO_ERROR)507 if (arc) 508 508 // error: clean up 509 509 exehClose(&pExec); -
trunk/src/helpers/gpih.c
r238 r240 2807 2807 * 2808 2808 * This function may relieve this a bit. This 2809 * creates a memory DC, a nmemory PS, and a bitmap,2809 * creates a memory DC, a memory PS, and a bitmap, 2810 2810 * and selects the bitmap into the memory PS. 2811 2811 * You can then use any GPI function on the memory … … 2820 2820 * Example: 2821 2821 * 2822 + PXBITMAP pbmp = gpihCreateXBitmap(hab, 100, 100);2823 + if (pbmp )2822 + PXBITMAP pbmp; 2823 + if (pbmp = gpihCreateXBitmap(hab, 100, 100)) 2824 2824 + { 2825 2825 + GpiMove(pbmp->hpsMem, ...); … … 2845 2845 { 2846 2846 BOOL fOK = FALSE; 2847 PXBITMAP pbmp = (PXBITMAP)malloc(sizeof(XBITMAP));2848 if (pbmp )2847 PXBITMAP pbmp; 2848 if (pbmp = (PXBITMAP)malloc(sizeof(XBITMAP))) 2849 2849 { 2850 2850 memset(pbmp, 0, sizeof(XBITMAP)); -
trunk/src/helpers/procstat.c
r238 r240 497 497 498 498 /* 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 514 PQTOPLEVEL32 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 /* 499 544 *@@ prc32GetInfo: 500 * nifty interface to DosQuerySysState, 501 * the 32-bitversion of DosQProcStat.502 * This returns the head of a newly503 * allocated buffer which has plenty504 * 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. 505 550 * 506 551 * Use prc32FreeInfo to free the buffer. … … 513 558 PQTOPLEVEL32 prc32GetInfo(APIRET *parc) // out: error, ptr can be NULL 514 559 { 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); 541 562 } 542 563 -
trunk/src/helpers/stringh.c
r238 r240 178 178 *string1 = '\0'; 179 179 return string1; 180 } 181 182 /* 183 *@@ strhCopyBuf: 184 * copies pcszSource to pszTarget, taking 185 * its length into account. 186 * 187 * Returns: 188 * 189 * -- NO_ERROR 190 * 191 * -- ERROR_INVALID_PARAMETER: pcszSource is 192 * null or points to a null byte. 193 * 194 * -- ERROR_FILENAME_EXCED_RANGE: pcszSource 195 * is too long to fit into pszTarget. 196 * 197 *@@added V1.0.1 (2003-01-05) [umoeller] 198 */ 199 200 APIRET strhCopyBuf(PSZ pszTarget, 201 PCSZ pcszSource, 202 ULONG cbTarget) 203 { 204 ULONG cb; 205 if (!pcszSource || !*pcszSource) 206 return ERROR_INVALID_PARAMETER; 207 cb = strlen(pcszSource) + 1; 208 if (cb > cbTarget) 209 return ERROR_FILENAME_EXCED_RANGE; 210 211 memcpy(pszTarget, 212 pcszSource, 213 cb); 214 return NO_ERROR; 180 215 } 181 216
Note:
See TracChangeset
for help on using the changeset viewer.