Exemple #1
0
        protected volumeHeader getVolumeHeader(byte[] rawHeader)
        {
            volumeHeader vh = new volumeHeader();

            vh.signature  = BitConverter.ToUInt16(rawHeader, 0);
            vh.version    = BitConverter.ToUInt16(rawHeader, 2);
            vh.attributes = BitConverter.ToUInt32(rawHeader, 4);
            volAttributes volAttr = new volAttributes();

            byte[] attrBytes = new byte[4];
            Array.Copy(rawHeader, 4, attrBytes, 0, 4);

            volAttr.kHFSVolumeHardwareLockBit     = ((vh.attributes & 0x80000000) == 0x80000000);
            volAttr.kHFSVolumeUnmountedBit        = ((vh.attributes & 0x00010000) == 0x00010000);
            volAttr.kHFSVolumeSparedBlocksBit     = ((vh.attributes & 0x00020000) == 0x00020000);
            volAttr.kHFSVolumeNoCacheRequiredBit  = ((vh.attributes & 0x00040000) == 0x00040000);
            volAttr.kHFSBootVolumeInconsistentBit = ((vh.attributes & 0x0008000) == 0x00080000);
            volAttr.kHFSCatalogNodeIDsReusedBit   = ((vh.attributes & 0x00100000) == 0x00100000);
            volAttr.kHFSVolumeJournaledBit        = ((vh.attributes & 0x00200000) == 0x00200000);
            volAttr.kHFSVolumeSoftwareLockBit     = ((vh.attributes & 0x00800000) == 0x00800000);

            vh.volAttr = volAttr;

            vh.lastMountedVersion = BitConverter.ToUInt32(rawHeader, 8);
            vh.journalInfoBlock   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 12));

            vh.createDate  = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 16)));
            vh.modifyDate  = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 20)));
            vh.backupDate  = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 24)));
            vh.checkedDate = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 28)));

            vh.fileCount   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 32));
            vh.folderCount = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 36));

            vh.blockSize   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 40));
            this.blockSize = vh.blockSize;

            vh.totalBlocks = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 44));
            vh.freeBlocks  = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 48));

            vh.nextAllocation  = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 52));
            vh.rsrcClumpSize   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 56));
            vh.dataClumpSize   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 60));
            vh.nextCatalogID   = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 64));
            vh.writeCount      = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 68));
            vh.encodingsBitmap = BitConverter.ToUInt64(rawHeader, 72);

            vh.finderInfo = new UInt32[8];

            for (int i = 0; i < 8; i++)
            {
                vh.finderInfo[i] = BitConverter.ToUInt32(rawHeader, 80 + (4 * i));
            }

            hfsPlusForkData volAllocationFile = new hfsPlusForkData(ref rawHeader, 112);
            hfsPlusForkData volExtentsFile    = new hfsPlusForkData(ref rawHeader, 192);
            hfsPlusForkData volCatalogFile    = new hfsPlusForkData(ref rawHeader, 272);
            hfsPlusForkData volAttributesFile = new hfsPlusForkData(ref rawHeader, 352);
            hfsPlusForkData volStartupFile    = new hfsPlusForkData(ref rawHeader, 432);

            vh.allocationFile = volAllocationFile;
            vh.extentsFile    = volExtentsFile;
            vh.catalogFile    = volCatalogFile;
            vh.attributesFile = volAttributesFile;
            vh.startupFile    = volStartupFile;

            vh.partitionNo = this.partitionNo;
            vh.path        = this.path;

            return(vh);
        }
Exemple #2
0
        protected volumeHeader getVolumeHeader(byte[] rawHeader)
        {
            volumeHeader vh = new volumeHeader();

            vh.signature = BitConverter.ToUInt16(rawHeader, 0);
            vh.version = BitConverter.ToUInt16(rawHeader, 2);
            vh.attributes = BitConverter.ToUInt32(rawHeader, 4);
            volAttributes volAttr = new volAttributes();
            byte[] attrBytes = new byte[4];
            Array.Copy(rawHeader, 4, attrBytes, 0, 4);

            volAttr.kHFSVolumeHardwareLockBit = ((vh.attributes & 0x80000000) == 0x80000000);
            volAttr.kHFSVolumeUnmountedBit = ((vh.attributes & 0x00010000) == 0x00010000);
            volAttr.kHFSVolumeSparedBlocksBit = ((vh.attributes & 0x00020000) == 0x00020000);
            volAttr.kHFSVolumeNoCacheRequiredBit = ((vh.attributes & 0x00040000) == 0x00040000);
            volAttr.kHFSBootVolumeInconsistentBit = ((vh.attributes & 0x0008000) == 0x00080000);
            volAttr.kHFSCatalogNodeIDsReusedBit = ((vh.attributes & 0x00100000) == 0x00100000);
            volAttr.kHFSVolumeJournaledBit = ((vh.attributes & 0x00200000) == 0x00200000);
            volAttr.kHFSVolumeSoftwareLockBit = ((vh.attributes & 0x00800000) == 0x00800000);

            vh.volAttr = volAttr;

            vh.lastMountedVersion = BitConverter.ToUInt32(rawHeader, 8);
            vh.journalInfoBlock = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 12));

            vh.createDate = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 16)));
            vh.modifyDate = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 20)));
            vh.backupDate = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 24)));
            vh.checkedDate = FromHFSPlusTime(dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 28)));

            vh.fileCount = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 32));
            vh.folderCount = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 36));

            vh.blockSize = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 40));
            this.blockSize = vh.blockSize;

            vh.totalBlocks = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 44));
            vh.freeBlocks = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 48));

            vh.nextAllocation = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 52));
            vh.rsrcClumpSize = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 56));
            vh.dataClumpSize = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 60));
            vh.nextCatalogID = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 64));
            vh.writeCount = dataOperations.convToLE(BitConverter.ToUInt32(rawHeader, 68));
            vh.encodingsBitmap = BitConverter.ToUInt64(rawHeader, 72);

            vh.finderInfo = new UInt32[8];

            for (int i = 0; i < 8; i++)
            {
                vh.finderInfo[i]= BitConverter.ToUInt32(rawHeader, 80+(4*i));
            }

            hfsPlusForkData volAllocationFile = new hfsPlusForkData(ref rawHeader, 112);
            hfsPlusForkData volExtentsFile = new hfsPlusForkData(ref rawHeader, 192);
            hfsPlusForkData volCatalogFile = new hfsPlusForkData(ref rawHeader, 272);
            hfsPlusForkData volAttributesFile = new hfsPlusForkData(ref rawHeader, 352);
            hfsPlusForkData volStartupFile = new hfsPlusForkData(ref rawHeader, 432);

            vh.allocationFile = volAllocationFile;
            vh.extentsFile = volExtentsFile;
            vh.catalogFile = volCatalogFile;
            vh.attributesFile = volAttributesFile;
            vh.startupFile = volStartupFile;

            vh.partitionNo = this.partitionNo;
            vh.path = this.path;

            return vh;
        }