Changeset 67775 in vbox for trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
- Timestamp:
- Jul 4, 2017 1:06:39 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
r67774 r67775 464 464 * @param pbSys The system area of the directory record. 465 465 * @param cbSys The number of bytes present in the sys area. 466 * @param fContinuationRecord Set if we're processing a continuation record in 467 * living in the abRockBuf. 468 * @param fIsFirstDirRec Set if this is the '.' directory entry in the 469 * root directory. (Some entries applies only to 470 * it.) 466 471 */ 467 472 static void rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(PRTFSISOMKIMPORTER pThis, PRTFSOBJINFO pObjInfo, 468 uint8_t const *pbSys, size_t cbSys) 473 uint8_t const *pbSys, size_t cbSys, bool fContinuationRecord, 474 bool fIsFirstDirRec) 469 475 { 470 476 RT_NOREF(pObjInfo); 471 477 472 478 /* 473 * Skip and check the signature of the first record.479 * Do skipping if specified. 474 480 */ 475 481 if (pThis->offSuspSkip) … … 480 486 cbSys -= pThis->offSuspSkip; 481 487 } 482 if (cbSys < 4) 483 return; 488 489 while (cbSys >= 4) 490 { 491 /* 492 * Check header length and advance the sys variables. 493 */ 494 PCISO9660SUSPUNION pUnion = (PCISO9660SUSPUNION)pbSys; 495 if (pUnion->Hdr.cbEntry > cbSys) 496 { 497 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: cbEntry=%#x cbSys=%#x (%#x %#x)\n", 498 pUnion->Hdr.cbEntry, cbSys, pUnion->Hdr.bSig1, pUnion->Hdr.bSig2)); 499 return; 500 } 501 pbSys += pUnion->Hdr.cbEntry; 502 cbSys += pUnion->Hdr.cbEntry; 503 504 /* 505 * Process fields. 506 */ 507 #define MAKE_SIG(a_bSig1, a_bSig2) \ 508 ( ((uint16_t)(a_bSig1) & 0x1f) \ 509 | (((uint16_t)(a_bSig2) ^ 0x40) << 5) \ 510 | ((((uint16_t)(a_bSig1) ^ 0x40) & 0xe0) << (5+8)) ) 511 512 uint16_t const uSig = MAKE_SIG(pUnion->Hdr.bSig1, pUnion->Hdr.bSig2); 513 switch (uSig) 514 { 515 /* 516 * General SUSP stuff. 517 */ 518 case MAKE_SIG(ISO9660SUSPCE_SIG1, ISO9660SUSPCE_SIG2): 519 { 520 if (RT_BE2H_U32(pUnion->CE.offBlock.be) != RT_LE2H_U32(pUnion->CE.offBlock.le)) 521 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: Invalid CE offBlock field: be=%#x vs le=%#x\n", 522 RT_BE2H_U32(pUnion->CE.offBlock.be), RT_LE2H_U32(pUnion->CE.offBlock.le))); 523 else if (RT_BE2H_U32(pUnion->CE.cbData.be) != RT_LE2H_U32(pUnion->CE.cbData.le)) 524 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: Invalid CE cbData field: be=%#x vs le=%#x\n", 525 RT_BE2H_U32(pUnion->CE.cbData.be), RT_LE2H_U32(pUnion->CE.cbData.le))); 526 else if (RT_BE2H_U32(pUnion->CE.offData.be) != RT_LE2H_U32(pUnion->CE.offData.le)) 527 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: Invalid CE offData field: be=%#x vs le=%#x\n", 528 RT_BE2H_U32(pUnion->CE.offData.be), RT_LE2H_U32(pUnion->CE.offData.le))); 529 else if (!fContinuationRecord) 530 { 531 uint64_t offData = ISO9660_GET_ENDIAN(&pUnion->CE.offBlock) * (uint64_t)ISO9660_SECTOR_SIZE; 532 offData += ISO9660_GET_ENDIAN(&pUnion->CE.offData); 533 uint32_t cbData = ISO9660_GET_ENDIAN(&pUnion->CE.cbData); 534 if (cbData <= sizeof(pThis->abRockBuf) - (uint32_t)(offData & ISO9660_SECTOR_OFFSET_MASK)) 535 { 536 AssertCompile(sizeof(pThis->abRockBuf) == ISO9660_SECTOR_SIZE); 537 uint64_t offDataBlock = offData & ~(uint64_t)ISO9660_SECTOR_OFFSET_MASK; 538 if (pThis->offRockBuf == offDataBlock) 539 rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(pThis, pObjInfo, 540 &pThis->abRockBuf[offData & ISO9660_SECTOR_OFFSET_MASK], 541 cbData, true /*fContinuationRecord*/, fIsFirstDirRec); 542 else 543 { 544 int rc = RTVfsFileReadAt(pThis->hSrcFile, offDataBlock, pThis->abRockBuf, sizeof(pThis->abRockBuf), NULL); 545 if (RT_SUCCESS(rc)) 546 rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(pThis, pObjInfo, 547 &pThis->abRockBuf[offData & ISO9660_SECTOR_OFFSET_MASK], 548 cbData, true /*fContinuationRecord*/, fIsFirstDirRec); 549 else 550 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: Error reading continuation record at %#RX64: %Rrc\n", 551 offDataBlock, rc)); 552 } 553 } 554 else 555 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: continuation record isn't within a sector! offData=%#RX64 cbData=%#RX32\n", 556 cbData, offData)); 557 } 558 else 559 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: nested continuation record!\n")); 560 break; 561 } 562 563 case MAKE_SIG(ISO9660SUSPPD_SIG1, ISO9660SUSPPD_SIG2): /* PD - ignored */ 564 case MAKE_SIG(ISO9660SUSPST_SIG1, ISO9660SUSPST_SIG2): /* ST - ignore for now */ 565 case MAKE_SIG(ISO9660SUSPES_SIG1, ISO9660SUSPES_SIG2): /* ES - ignore for now */ 566 break; 567 568 case MAKE_SIG(ISO9660SUSPSP_SIG1, ISO9660SUSPSP_SIG2): /* SP */ 569 if (!fIsFirstDirRec) 570 { 571 LogRel(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: \n")); 572 break; 573 } 574 break; 575 576 case MAKE_SIG(ISO9660SUSPER_SIG1, ISO9660SUSPER_SIG2): /* ER */ 577 break; 578 579 default: 580 Log(("rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge: Unknown SUSP entry: %#x %#x\n", 581 pUnion->Hdr.bSig1, pUnion->Hdr.bSig2)); 582 break; 583 } 484 584 #if 0 485 while (cbSys >= 4) 486 { 487 488 489 /* SUSP: */ 585 /* 586 SUSP: */ 490 587 if (pbSys[0] == 'C' && pbSys[1] == 'E') 491 588 { … … 511 608 else if (pbSys[0] == 'A' && pbSys[1] == 'B') 512 609 else if (pbSys[0] == 'A' && pbSys[1] == 'S') 513 514 }515 610 #endif 611 612 } 516 613 } 517 614 … … 868 965 869 966 pThis->szRockNameBuf[0] = '\0'; 870 if (cbSys > 0) 871 rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(pThis, &ObjInfo, pbSys, cbSys); 967 if (cbSys > 0 && !(pThis->fFlags & RTFSISOMK_IMPORT_F_NO_ROCK_RIDGE)) 968 rtFsIsoImportProcessIso9660TreeWorkerParseRockRidge(pThis, &ObjInfo, pbSys, cbSys, 969 false /*fContinuationRecord*/, false /*fIsFirstDirRec*/); 872 970 873 971 /* … … 1671 1769 if (RT_SUCCESS(rc)) 1672 1770 { 1673 uint64_t cbImage = 0;1674 RTFsIsoMakerObjQueryDataSize(pThis->hIsoMaker, idxImageObj, &cbImage);1675 LogRel(("ISO import: boot catalog #%#x: bMediaType=%#x (%#x) bSystemType=%#x idxImageObj=%#x size=%#RX64\n",1676 iEntry, bMediaType, pEntry->bBootMediaType, pEntry->bSystemType, idxImageObj, cbImage));1677 1678 1771 pThis->pResults->cBootCatEntries += 1 + *pcSkip; 1679 1772 rc = rtFsIsoImportProcessElToritoImage(pThis, idxImageObj, offBootImage);
Note:
See TracChangeset
for help on using the changeset viewer.