From 52902553ce326253a20b6ac33068447638870e33 Mon Sep 17 00:00:00 2001 From: Myun2 Date: Thu, 12 Aug 2010 00:14:36 +0900 Subject: [PATCH] =?utf8?q?eltorito.hpp=20=E3=82=B5=E3=83=A8=E3=83=8A?= =?utf8?q?=E3=83=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast_ex/include/roast/file/iso9660/eltorito.hpp | 139 ----------------------- 1 file changed, 139 deletions(-) delete mode 100644 roast_ex/include/roast/file/iso9660/eltorito.hpp diff --git a/roast_ex/include/roast/file/iso9660/eltorito.hpp b/roast_ex/include/roast/file/iso9660/eltorito.hpp deleted file mode 100644 index 98eb9810..00000000 --- a/roast_ex/include/roast/file/iso9660/eltorito.hpp +++ /dev/null @@ -1,139 +0,0 @@ -// Roast+ License - -/* - El Torito Bootable CD Specification -*/ -#ifndef __SFJP_ROAST_EX__file__iso9660__eltorito_HPP__ -#define __SFJP_ROAST_EX__file__iso9660__eltorito_HPP__ - -#include -#include "roast/lexical/string_rule.hpp" -#include "roast/math/endian.hpp" -#include "roast/memory/sized_ptr.hpp" - -namespace roast -{ - namespace iso9660 - { - namespace eltorito - { - using namespace ::roast::lexical::rule; - - //class str_CD001 : public fixed_string{ public: str_CD001() - ROAST_LEXICAL_FIXSTR(str_CD001, "CD001") - ROAST_LEXICAL_FIXSTR(str_ELTORITOSPEC, "EL TORITO SPECIFICATION") // 23byte - - enum - { - _brvd_sector_no = 17, // Boot Record Volume Descriptor - _boot_catalog_sector_no = 18, - _boot_sector_no = 19 - }; - - // Zero Padding Sector - typedef soft_repeat< unibyte<0>, 2048 > zero_padding_sector; - - - // Boot Record Volume Descriptor Sector - typedef seq< - unibyte<0>, // Volume Descriptor Type - str_CD001, - unibyte<1>, // Volume Descriptor Version - - // System Descriptor (32byte) - str_ELTORITOSPEC, // String 23byte - /* - soft_repeat< unibyte<0>, 9 >, // Zero Padding (9byte) - - // Volume Discriminator - Zero Padding (32byte) - soft_repeat< unibyte<0>, 32 >, - */ - soft_repeat< unibyte<0>, 9 + 32 >, - - // [El Torito Only] Boot Record Volume Descriptor - fixed_uint< fixed_little_endian::value >, // Boot Record Volume is No.18 Sector - - // Zero Padding Sector Rest - soft_repeat< unibyte<0>, 2048 - 0x4B > - > brvd_sector; - - - // Boot Catalog Sector - typedef seq< - unibyte<1>, // Volume Descriptor Type -> 1(PVD) - unibyte<0>, // 0:80x86 - hard_repeat< unibyte<0>, 2 >, // reserved - soft_repeat< unibyte<0>, 24 >, // auther - - fixed_ushort< fixed_little_endian::value >, // Checksum (0x000-0x01f, Volume Descriptor Type - auther) - unibyte<0x55>, // Signature - unibyte<0xAA>, // Signature - - unibyte<0x88>, // 0x88:Bootable, 0x00:Not Bootable - - unibyte<0x02>, // 0: NO Emulation, - // 1: 1.2MB FDD Emulate, - // 2: 1.44MB FDD Emulate, - // 3: 2.88MB FDD Emulate, - // 4: HDD Emulate - - fixed_ushort< 0x0000 >, // Read Segment: 0 is Default (0x07c0) - unibyte<0x00>, // ? - unibyte<0x00>, // reserved - fixed_ushort< 0x0001 >, // Boot Sector Count - fixed_uint<_boot_sector_no>, // Boot Sector No. - - // Zero Padding Sector Rest - soft_repeat< unibyte<0>, 2048 - 0x2C > - > boot_catalog_sector; - - // Boot Sector - class boot_sector - { - public: - template - bool generate(_Strm& strm, sized_ptr& sp) - { - strm.write((const char*)sp.ptr, sp.size); - - for(int i=sp.size; i<2048; i++) - { - unibyte<0> ub; - if ( ub.generate(strm,sp) == false ) - return false; - } - return true; - } - }; - - // rule - typedef seq< - soft_repeat< zero_padding_sector, _brvd_sector_no >, // Zero Padding 17 Sectors - brvd_sector, // Boot Record Volume Descriptor Sector - boot_catalog_sector, // Boot Catalog Sector - boot_sector - > rule; - } - - //////////////////////////////////////////////////////// - - class eltorito_writer - { - public: - bool write(const char* filename, const unsigned char* boot_img, size_t size ) - { - ::std::fstream fs(filename, std::ios::out | std::ios::binary); - if ( fs.fail() ) - return false; - - eltorito::rule rl; - if ( rl.generate(fs, sized_ptr((void*)boot_img,size) ) == false ) - return false; - - return true; - } - }; - } -} - -#endif//__SFJP_ROAST_EX__file__iso9660__eltorito_HPP__ -- 2.11.0