Ejemplo n.º 1
0
        private void GenBootCatalog(IsoFile f)
        {
            BootCatalog = this.generator.Index / LogicalBlockSize;
            // write validation entry first... see El Torito section 2.1
            var ve = new FieldValidator(this.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(this.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 (this.bootLoadSize == 0)
            {
                this.bootLoadSize = (short)((f.fileInfo.Length - 1) / 0x200 + 1);
            }
            ide.ShortLSB(this.bootLoadSize, 7, 8);  // Sector Count
            ide.IntLSB(this.boot.DataBlock, 9, 12); // Logical Block of boot image
            ide.Zero(13, 32);                       // unused

            this.generator.FinishBlock();
        }
Ejemplo n.º 2
0
        private void GenPrimaryVolumeDescriptor()         // ( 8.4 )
        {
            PrimaryVolumeDescriptor = this.generator.Index / LogicalBlockSize;
            var pvd = new FieldValidator(this.generator);

            pvd.Byte(1, 1);                                                               // Volume Descriptor Type ( 8.4.1 )
            pvd.AString("CD001", 2, 6);                                                   // Standard Identifier ( 8.4.2 )
            pvd.Byte(1, 7);                                                               // Volume Descriptor Version ( 8.4.3 )
            pvd.Zero(8, 8);                                                               // Unused Field ( 8.4.4 )
            pvd.AString("?", 9, 40);                                                      // System Identifier ( 8.4.5 )
            pvd.DString(this.volumeLabel, 41, 72);                                        // Volume Identifier ( 8.4.6 )
            pvd.Zero(73, 80);                                                             // Unused Field ( 8.4.7 )
            pvd.IntLSBMSB((TotalSize + LogicalBlockSize - 1) / LogicalBlockSize, 81, 88); // Volume Space Size ( 8.4.8 )
            pvd.Zero(89, 120);                                                            // Unused Field ( 8.4.9 )
            pvd.ShortLSBMSB(1, 121, 124);                                                 // Volume Set Size ( 8.4.10 )
            pvd.ShortLSBMSB(1, 125, 128);                                                 // Volume Sequence Number ( 8.4.11 )
            pvd.ShortLSBMSB(LogicalBlockSize, 129, 132);                                  // Logical Block Size ( 8.4.12 )
            pvd.IntLSBMSB(PathTableSize, 133, 140);                                       // Path Table Size ( 8.4.13 )
            pvd.IntLSB(LPathTable, 141, 144);                                             // L Path Table ( 8.4.14 )
            pvd.IntLSB(0, 145, 148);                                                      // Optional L Path Table ( 8.4.15 )
            pvd.IntMSB(MPathTable, 149, 152);                                             // M Path Table ( 8.4.16 )
            pvd.IntMSB(0, 153, 156);                                                      // Optional M Path Table ( 8.4.17 )
            pvd.BeginField(157);
            DirectoryRecord(".", this.isoRoot, 1);                                        // Directory Record for Root Directory ( 8.4.18 )
            pvd.EndField(190);
            pvd.DupByte(0x20, 191, 318);                                                  // Volume Set Identifier ( 8.4.19 )
            pvd.DupByte(0x20, 319, 446);                                                  // Publisher Identifier ( 8.4.20 )
            pvd.DupByte(0x20, 447, 574);                                                  // Data Preparer ( 8.4.21 )
            pvd.DupByte(0x20, 575, 702);                                                  // Application Identifier ( 8.4.22 )
            pvd.DupByte(0x20, 703, 739);                                                  // Copyright File Identifier ( 8.4.23 )
            pvd.DupByte(0x20, 740, 776);                                                  // Abstract File Identifier ( 8.4.24 )
            pvd.DupByte(0x20, 777, 813);                                                  // Bibliographic File Identifier ( 8.4.25 )
            System.DateTime now = System.DateTime.Now;
            pvd.AnsiDateTime(now, 814, 830);                                              // Volume Creation Date and Time ( 8.4.26 )
            pvd.AnsiDateTime(now, 831, 847);                                              // Volume Modification Date and Time ( 8.4.27 )
            pvd.Zero(848, 864);                                                           // Volume Expiration Date and Time ( 8.4.28 )
            pvd.Zero(865, 881);                                                           // Volume Effective Date and Time ( 8.4.29 )
            pvd.Byte(1, 882);                                                             // File Structure Version ( 8.4.30 )
            pvd.Zero(883, 883);                                                           // Reserved ( 8.4.31 )
            pvd.Zero(884, 1395);                                                          // Application Use ( 8.4.32 )
            pvd.Zero(1396, 2048);                                                         // Reserved for Future Standardization ( 8.4.33 )
        }
Ejemplo n.º 3
0
		private void GenBootCatalog(IsoFile f)
		{
			BootCatalog = this.generator.Index / LogicalBlockSize;
			// write validation entry first... see El Torito section 2.1
			var ve = new FieldValidator(this.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(this.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 (this.bootLoadSize == 0)
				this.bootLoadSize = (short)((f.fileInfo.Length - 1) / 0x200 + 1);
			ide.ShortLSB(this.bootLoadSize, 7, 8); // Sector Count
			ide.IntLSB(this.boot.DataBlock, 9, 12); // Logical Block of boot image
			ide.Zero(13, 32); // unused

			this.generator.FinishBlock();
		}
Ejemplo n.º 4
0
		private void GenPrimaryVolumeDescriptor() // ( 8.4 )
		{
			PrimaryVolumeDescriptor = this.generator.Index / LogicalBlockSize;
			var pvd = new FieldValidator(this.generator);
			pvd.Byte(1, 1); // Volume Descriptor Type ( 8.4.1 )
			pvd.AString("CD001", 2, 6); // Standard Identifier ( 8.4.2 )
			pvd.Byte(1, 7); // Volume Descriptor Version ( 8.4.3 )
			pvd.Zero(8, 8); // Unused Field ( 8.4.4 )
			pvd.AString("?", 9, 40); // System Identifier ( 8.4.5 )
			pvd.DString(this.volumeLabel, 41, 72); // Volume Identifier ( 8.4.6 )
			pvd.Zero(73, 80); // Unused Field ( 8.4.7 )
			pvd.IntLSBMSB((TotalSize + LogicalBlockSize - 1) / LogicalBlockSize, 81, 88); // Volume Space Size ( 8.4.8 )
			pvd.Zero(89, 120); // Unused Field ( 8.4.9 )
			pvd.ShortLSBMSB(1, 121, 124); // Volume Set Size ( 8.4.10 )
			pvd.ShortLSBMSB(1, 125, 128); // Volume Sequence Number ( 8.4.11 )
			pvd.ShortLSBMSB(LogicalBlockSize, 129, 132); // Logical Block Size ( 8.4.12 )
			pvd.IntLSBMSB(PathTableSize, 133, 140); // Path Table Size ( 8.4.13 )
			pvd.IntLSB(LPathTable, 141, 144); // L Path Table ( 8.4.14 )
			pvd.IntLSB(0, 145, 148); // Optional L Path Table ( 8.4.15 )
			pvd.IntMSB(MPathTable, 149, 152); // M Path Table ( 8.4.16 )
			pvd.IntMSB(0, 153, 156); // Optional M Path Table ( 8.4.17 )
			pvd.BeginField(157);
			DirectoryRecord(".", this.isoRoot, 1); // Directory Record for Root Directory ( 8.4.18 )
			pvd.EndField(190);
			pvd.DupByte(0x20, 191, 318); // Volume Set Identifier ( 8.4.19 )
			pvd.DupByte(0x20, 319, 446); // Publisher Identifier ( 8.4.20 )
			pvd.DupByte(0x20, 447, 574); // Data Preparer ( 8.4.21 )
			pvd.DupByte(0x20, 575, 702); // Application Identifier ( 8.4.22 )
			pvd.DupByte(0x20, 703, 739); // Copyright File Identifier ( 8.4.23 )
			pvd.DupByte(0x20, 740, 776); // Abstract File Identifier ( 8.4.24 )
			pvd.DupByte(0x20, 777, 813); // Bibliographic File Identifier ( 8.4.25 )
			System.DateTime now = System.DateTime.Now;
			pvd.AnsiDateTime(now, 814, 830); // Volume Creation Date and Time ( 8.4.26 )
			pvd.AnsiDateTime(now, 831, 847); // Volume Modification Date and Time ( 8.4.27 )
			pvd.Zero(848, 864); // Volume Expiration Date and Time ( 8.4.28 )
			pvd.Zero(865, 881); // Volume Effective Date and Time ( 8.4.29 )
			pvd.Byte(1, 882); // File Structure Version ( 8.4.30 )
			pvd.Zero(883, 883); // Reserved ( 8.4.31 )
			pvd.Zero(884, 1395); // Application Use ( 8.4.32 )
			pvd.Zero(1396, 2048); // Reserved for Future Standardization ( 8.4.33 )
		}