Changeset 110
- Timestamp:
- Oct 15, 2001, 11:17:25 PM (24 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh2.c
r108 r110 2255 2255 2256 2256 // get the PATH value 2257 P SZ pszPath;2257 PCSZ pcszPathValue; 2258 2258 if (!(arc = DosScanEnv((PSZ)pcszPath, 2259 &pszPath))) 2259 #if __cplusplus 2260 &pcszPathValue))) 2261 #else 2262 (PSZ*)&pcszPathValue))) 2263 #endif 2260 2264 { 2261 2265 // run thru the path components 2262 2266 PSZ pszPathCopy; 2263 if (pszPathCopy = strdup(p szPath))2267 if (pszPathCopy = strdup(pcszPathValue)) 2264 2268 { 2265 2269 PSZ pszToken = strtok(pszPathCopy, ";"); 2266 while (pszToken) // V0.9.12 (2001-05-03) [umoeller]2270 while (pszToken) 2267 2271 { 2268 2272 CHAR szFileMask[2*CCHMAXPATH]; -
trunk/src/helpers/eah.c
r108 r110 203 203 FILEFINDBUF4 ffb4; 204 204 205 arc = DosQueryPathInfo((PSZ)pcszPath, 206 FIL_QUERYEASIZE, 207 &ffb4, 208 sizeof(FILEFINDBUF4)); 209 210 if (arc == NO_ERROR) 211 { 212 // CHAR szFile[CCHMAXPATH]; 213 // PBYTE pbBuffer = malloc(ffb4.cbList); 205 if (!(arc = DosQueryPathInfo((PSZ)pcszPath, 206 FIL_QUERYEASIZE, 207 &ffb4, 208 sizeof(FILEFINDBUF4)))) 209 { 214 210 BYTE abBuf[2000]; 215 211 LONG lCount = 0; … … 218 214 lCount = -1; 219 215 220 arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH, 221 (PSZ)pcszPath, 222 1, 223 abBuf, 224 sizeof(abBuf), 225 (PULONG)&lCount, 226 ENUMEA_LEVEL_NO_VALUE); 216 if (!(arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH, 217 (PSZ)pcszPath, 218 1, 219 abBuf, 220 sizeof(abBuf), 221 (PULONG)&lCount, 222 ENUMEA_LEVEL_NO_VALUE))) 223 { 227 224 // ulCount now contains the EA count 228 225 229 pdena2 = (PDENA2)abBuf; 230 231 if (lCount > 0) 232 { 233 ulTotalEASize = pdena2->cbName + 8; 234 235 while (lCount > 0) 226 pdena2 = (PDENA2)abBuf; 227 228 if (lCount > 0) 236 229 { 237 ulTotalEASize += (pdena2->cbValue + sizeof(DENA2)); 238 lCount--; 239 pdena2 = (PDENA2) (((PBYTE) pdena2) + 240 pdena2->oNextEntryOffset); 241 230 ulTotalEASize = pdena2->cbName + 8; 231 232 while (lCount > 0) 233 { 234 ulTotalEASize += (pdena2->cbValue + sizeof(DENA2)); 235 lCount--; 236 pdena2 = (PDENA2) (((PBYTE) pdena2) + 237 pdena2->oNextEntryOffset); 238 239 } 242 240 } 243 241 } -
trunk/src/helpers/shapewin.c
r51 r110 1374 1374 // load resource bitmap 1375 1375 psb->hbm = GpiLoadBitmap(psb->hps, 1376 1377 1378 1376 hmodResource, 1377 idResource, 1378 0, 0); 1379 1379 if (psb->hbm) 1380 1380 { -
trunk/src/helpers/wphandle.c
r108 r110 99 99 100 100 APIRET wphQueryActiveHandles(HINI hiniSystem, 101 PSZ *ppszActiveHandles) 101 PSZ *ppszActiveHandles) // out: active handles string (new buffer) 102 102 { 103 103 PSZ pszActiveHandles; … … 231 231 // store PNODE in hash table 232 232 pHandlesBuf->NodeHashTable[pNode->usHandle] = pNode; 233 pCur += sizeof 233 pCur += sizeof(NODE) + pNode->usNameSize; 234 234 } 235 235 else … … 341 341 ULONG cbTotalOld = cbTotal; 342 342 cbTotal += cbBlockThis; 343 if (!(pbData = realloc(pbData, cbTotal)))343 if (!(pbData = (BYTE*)realloc(pbData, cbTotal))) 344 344 // on first call, pbData is NULL and this 345 345 // behaves like malloc() … … 417 417 return (arc); 418 418 } 419 420 /*421 *@@ wphReadAllBlocks:422 * this reads all the BLOCK's in the active handles423 * section in OS2SYS.INI into one common buffer, for424 * which sufficient memory is allocated.425 *426 * Each of these blocks is a maximum of 64 KB, hell427 * knows why, maybe the INIs can't handle more. This428 * func combines all the BLOCK's into one buffer anyways,429 * which can then be searched.430 *431 * Use wphQueryActiveHandles to pass the active handles432 * section to this function.433 *434 * This gets called by the one-shot function435 * wphQueryHandleFromPath.436 */437 438 /* BOOL wphReadAllBlocks(HINI hiniSystem, // in: can be HINI_USER or HINI_SYSTEM439 PSZ pszActiveHandles, // in: active handles section440 PBYTE* ppBlock, // in/out: pointer to buffer, which441 // will point to the allocated442 // memory afterwards443 PULONG pulSize) // out: size of the allocated buffer444 {445 PBYTE pbAllBlocks,446 pszBlockName,447 p;448 ULONG ulBlockSize;449 ULONG ulTotalSize;450 BYTE rgfBlock[100];451 BYTE szAppName[10];452 USHORT usBlockNo;453 454 pbAllBlocks = wphEnumProfileKeys(hiniSystem, pszActiveHandles, &ulBlockSize);455 if (!pbAllBlocks)456 return FALSE;457 458 // query size of all individual blocks and calculate total459 memset(rgfBlock, 0, sizeof rgfBlock);460 ulTotalSize = 0L;461 pszBlockName = pbAllBlocks;462 while (*pszBlockName)463 {464 if (!memicmp(pszBlockName, "BLOCK", 5))465 {466 usBlockNo = atoi(pszBlockName + 5);467 if (usBlockNo < 100)468 {469 rgfBlock[usBlockNo] = TRUE;470 471 if (!PrfQueryProfileSize(hiniSystem,472 pszActiveHandles,473 pszBlockName,474 &ulBlockSize))475 {476 free(pbAllBlocks);477 return FALSE;478 }479 ulTotalSize += ulBlockSize;480 }481 }482 pszBlockName += strlen(pszBlockName) + 1;483 }484 485 // *pulSize now contains the total size of all blocks486 *ppBlock = (PBYTE)malloc(ulTotalSize);487 if (!(*ppBlock))488 {489 free(pbAllBlocks);490 return FALSE;491 }492 493 // now get all blocks into the memory we allocated494 p = *ppBlock;495 (*pulSize) = 0;496 for (usBlockNo = 1; usBlockNo < 100; usBlockNo++)497 {498 if (!rgfBlock[usBlockNo])499 break;500 501 sprintf(szAppName, "BLOCK%u", (UINT)usBlockNo);502 ulBlockSize = ulTotalSize;503 if (!PrfQueryProfileData(hiniSystem,504 pszActiveHandles,505 szAppName,506 p,507 &ulBlockSize))508 {509 free(pbAllBlocks);510 free(*ppBlock);511 return FALSE;512 }513 p += ulBlockSize;514 (*pulSize) += ulBlockSize;515 ulTotalSize -= ulBlockSize;516 }517 518 free(pbAllBlocks);519 return TRUE;520 } */521 419 522 420 /* ****************************************************************** … … 688 586 { 689 587 APIRET arc = NO_ERROR; 690 PVOID pvData; 588 589 PSZ pszActiveHandles = NULL; 590 PHANDLESBUF pHandlesBuf = NULL; 691 591 692 592 TRY_LOUD(excpt1) 693 593 { 694 594 // not found there: check the handles then 695 PSZ pszActiveHandles; 595 696 596 if (arc = wphQueryActiveHandles(hiniSystem, &pszActiveHandles)) 697 597 _Pmpf((__FUNCTION__ ": wphQueryActiveHandles returned %d", arc)); 698 598 else 699 599 { 700 PHANDLESBUF pHandlesBuf;701 600 if (arc = wphLoadHandles(hiniUser, 702 601 hiniSystem, … … 719 618 else 720 619 arc = ERROR_FILE_NOT_FOUND; 721 722 wphFreeHandles(&pHandlesBuf); 723 } 724 725 free(pszActiveHandles); 620 } 726 621 } 727 622 } … … 730 625 arc = ERROR_WPH_CRASHED; 731 626 } END_CATCH(); 627 628 if (pszActiveHandles) 629 free(pszActiveHandles); 630 if (pHandlesBuf) 631 wphFreeHandles(&pHandlesBuf); 732 632 733 633 return (arc); -
trunk/src/helpers/xstring.c
r108 r110 396 396 ) 397 397 { 398 pxstr->psz = realloc(pxstr->psz,399 pxstr->ulLength + 1);398 pxstr->psz = (PSZ)realloc(pxstr->psz, 399 pxstr->ulLength + 1); 400 400 pxstr->cbAllocated = pxstr->ulLength + 1; 401 401 }
Note:
See TracChangeset
for help on using the changeset viewer.