Esempio n. 1
0
		private void GenPathTableEx(IsoFolder parentFolder, IsoFolder thisFolder, bool lsb)
		{
			var di = new FieldValidator(generator);

			// Path table record ( ECMA-119 section 9.4 )
			byte[] b_di = generator.IsoName(thisFolder.Name, true);
			di.Byte((byte)b_di.Length, 1);
			di.Byte(0, 2); // Extended Attribute Record Length
			if (lsb)
			{
				di.IntLSB(thisFolder.DataBlock, 3, 6); // Location of Extent
				di.ShortLSB(parentFolder.PathTableEntry, 7, 8); // Parent Directory Number
			}
			else
			{
				di.IntMSB(thisFolder.DataBlock, 3, 6); // Location of Extent
				di.ShortMSB(parentFolder.PathTableEntry, 7, 8); // Parent Directory Number
			}
			di.Bytes(b_di, 9, 8 + b_di.Length); // Directory Identifier
			if ((b_di.Length & 1) != 0)
				di.Byte(0, 9 + b_di.Length); // optional padding if LEN_DI is odd

			foreach (KeyValuePair<string, IsoEntry> it in thisFolder.entries)
				if (it.Value.IsFolder)
					GenPathTableEx(thisFolder, (IsoFolder)it.Value, lsb);
		}
Esempio n. 2
0
		private void GenBootCatalog(IsoFile f)
		{
			BootCatalog = generator.Index / LogicalBlockSize;

			// write validation entry first... see El Torito section 2.1
			var ve = new FieldValidator(generator);
			ve.Byte(1, 1); // Header ID, must be 0x01
			ve.Byte(0, 2); // 0 == x86 - TODO FIXME: 1 == PowerPC, 2 == Mac, see El Torito figure 2
			ve.DupByte(0, 3, 4); // Reserved
			ve.DupByte(0, 5, 0x1C); // Manufacturer/Developer of CD-ROM, see El Torito figure 2
			ve.ShortLSB(0x55AA, 0x1D, 0x1E); // checksum - TODO FIXME - allow custom Manufacturer string - calculate checksum dynamically
			ve.Byte(0x55, 0x1F); // 1st Key Byte
			ve.Byte(0xAA, 0x20); // 2nd Key Byte

			// initial/default entry... see El Torito section 2.2 and figure 3
			var ide = new FieldValidator(generator);
			ide.Byte(0x88, 1); // 0x88 = bootable, 0x00 = not bootable

			// TODO FIXME - this is extremely hackish... fix me...
			ide.Byte(0, 2); // no emulation
			/*if ( f.fileInfo.Length <= 1182720 )
				ide.Byte(1, 2); // 1.2 meg diskette
			else if ( f.fileInfo.Length <= 1440 * 1024 )
				ide.Byte(2,2); // 1.44 meg diskette
			else if ( f.fileInfo.Length <= 2880 * 1024 )
				ide.Byte(3,2); // 2.88 meg diskette
			else
				ide.Byte(4,2);*/

			// Hard Disk ( drive 80 )

			ide.ShortLSB(0, 3, 4); // Load Segment - 0 == default of 0x7C0
			ide.Byte(0, 5); // System Type, according to El Torito figure 3 this MUST be a copy of the "System Type" from the boot image. In practice this appears to not be the case.
			ide.Byte(0, 6); // Unused, must be 0
			if (bootLoadSize == 0)
				bootLoadSize = (short)((f.fileInfo.Length - 1) / 0x200 + 1);
			ide.ShortLSB(bootLoadSize, 7, 8); // Sector Count
			ide.IntLSB(boot.DataBlock, 9, 12); // Logical Block of boot image
			ide.Zero(13, 32); // unused

			generator.FinishBlock();
		}