[Eltoritoextract-loginfo] ElToritoExtractor/src main.c, 1.2, 1.3 main.h, 1.2, 1.3 version.h, 1.2, 1
Brought to you by:
marcoratto
From: Marco R. <mar...@us...> - 2006-11-01 11:16:17
|
Update of /cvsroot/eltoritoextract/ElToritoExtractor/src In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv12095 Modified Files: main.c main.h version.h Log Message: Updated Index: main.h =================================================================== RCS file: /cvsroot/eltoritoextract/ElToritoExtractor/src/main.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.h 23 Oct 2006 14:17:56 -0000 1.2 --- main.h 1 Nov 2006 11:16:11 -0000 1.3 *************** *** 17,39 **** */ ! /* Sector Position on a ISO file */ ! #define CD_SEC_SIZE 0x800 ! /* ! * Virtual Sector - Is a sector of data on an emulated device. ! * This document only addresses 200 byte device (for emulation) ! */ #define CD_VIRT_SEC_SIZE 0x200 ! /* chapter 2.0 ! * This âBoot Recordâ must reside at sector 11 (17 decimal) in the last ! * session on the CD. ! */ ! #define CD_BOOT_RECORD_VOL_SEC 0x11 ! ! /* buffer will be MAXSECTORBUFFERSIZE * CD_VIRT_SEC_SIZE bytes */ ! #define MAXSECTORBUFFERSIZE 1000 ! /* Version */ ! void version(); --- 17,46 ---- */ ! /* ! * Sector Position on a ISO file ! * ! * From âEl Toritoâ Bootable CD-ROM Format Specification Version 1.0 ! */ ! /* chapter 1.5 */ ! /* Sector - Is a sector of data on a CD. This is in all cases 800 bytes. ! */ ! #define CD_SEC_SIZE 0x800 ! /* ! * Virtual Sector - Is a sector of data on an emulated device. ! * This document only addresses 200 byte device (for emulation) ! */ #define CD_VIRT_SEC_SIZE 0x200 + + /* chapter 2.0 */ + /* This âBoot Recordâ must reside at sector 11 (17 decimal) in the last + * session on the CD. + */ + #define CD_BOOT_RECORD_VOL_SEC 0x11 ! /* buffer will be MAXSECTORBUFFERSIZE * CD_VIRT_SEC_SIZE bytes */ ! #define MAX_SECTOR_BUFFER_SIZE 1000 ! /* Version */ ! void version(); Index: main.c =================================================================== RCS file: /cvsroot/eltoritoextract/ElToritoExtractor/src/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.c 22 Oct 2006 14:36:51 -0000 1.2 --- main.c 1 Nov 2006 11:16:11 -0000 1.3 *************** *** 241,246 **** } ! switch(buffer[1]) ! { case 0: verbose (_("PlatformID:%s\n"), "80x86"); --- 241,245 ---- } ! switch(buffer[1]) { case 0: verbose (_("PlatformID:%s\n"), "80x86"); *************** *** 286,292 **** } ! long startingSector = * ((long *) &buffer[0x28]); ! int virtSectorCount = * ((int *) &buffer[0x26]); ! int segment = * ((int *) &buffer[0x22]); int readSecCount = virtSectorCount; --- 285,291 ---- } ! long startingSector = * ((long *) &buffer[0x28]) & 0xFFFFFFFF; ! int virtSectorCount = * ((int *) &buffer[0x26]) & 0xFFFF; ! int segment = * ((int *) &buffer[0x22]) & 0xFFFF; int readSecCount = virtSectorCount; *************** *** 296,315 **** break; case 1: ! verbose("%s", _("Floppy 1.2MB")); readSecCount = 0x50 * 0x02 * 0x0F; break; case 2: ! verbose("%s", _("Floppy 1.44MB\n")); readSecCount = 0x50 * 0x02 * 0x12; break; case 3: ! verbose("%s", _("Floppy 2.88MB\n")); readSecCount = 0x50 * 0x02 * 0x24; break; case 4: ! verbose("%s", _("Hard disk (drive 80)\n")); break; default: ! verbose("%s", _("Unknown\n")); break; } --- 295,314 ---- break; case 1: ! verbose("%s\n", _("Floppy 1.2MB")); readSecCount = 0x50 * 0x02 * 0x0F; break; case 2: ! verbose("%s\n", _("Floppy 1.44MB")); readSecCount = 0x50 * 0x02 * 0x12; break; case 3: ! verbose("%s\n", _("Floppy 2.88MB")); readSecCount = 0x50 * 0x02 * 0x24; break; case 4: ! verbose("%s\n", _("Hard disk (drive 80)")); break; default: ! verbose("%s\n", _("Unknown")); break; } *************** *** 322,336 **** int floppySize = readSecCount * CD_VIRT_SEC_SIZE; ! // allocate memory to contain the whole file. ! verbose(_("malloc: %d bytes of memory.\n"), floppySize); ! bufferFloppy = (char*) malloc (floppySize); if (bufferFloppy == NULL) { ! fprintf(stderr, _("ERROR:Can't allocate %d bytes in memory.\n"), floppySize); ! exit (3); } ! read(source, CD_SEC_SIZE * startingSector, floppySize, bufferFloppy); ! write(target, floppySize, bufferFloppy); fprintf(stderr, _("Floppy %s saved.\n"), targetFile); --- 321,349 ---- int floppySize = readSecCount * CD_VIRT_SEC_SIZE; ! int floppyBufferSize = (readSecCount > MAX_SECTOR_BUFFER_SIZE) ? MAX_SECTOR_BUFFER_SIZE * CD_VIRT_SEC_SIZE : floppySize; ! verbose(_("buffer size set to %d.\n"), floppyBufferSize); ! ! int bufferToRead = (readSecCount % MAX_SECTOR_BUFFER_SIZE) + 1; ! verbose(_("%d buffer(s) to read.\n"), bufferToRead); ! ! // allocate memory for the buffer ! verbose(_("malloc: %d bytes of memory for floppyBufferSize.\n"), floppyBufferSize); ! bufferFloppy = (char*) malloc (floppyBufferSize); if (bufferFloppy == NULL) { ! fprintf(stderr, _("ERROR:Can't allocate %d bytes in memory.\n"), floppyBufferSize); ! exit (3); } ! verbose(_("fseek: position to %ld\n"), CD_SEC_SIZE * startingSector); ! if (fseek(source, CD_SEC_SIZE * startingSector, SEEK_SET) == -1) { ! exit (4); ! } ! int i = 0; ! for (i=0; i<bufferToRead; i++) { ! fread(bufferFloppy, 1, floppyBufferSize, source); ! fwrite(bufferFloppy, 1, floppyBufferSize, target); ! } ! verbose(_("ferror: %d.\n"), ferror(source)); fprintf(stderr, _("Floppy %s saved.\n"), targetFile); Index: version.h =================================================================== RCS file: /cvsroot/eltoritoextract/ElToritoExtractor/src/version.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version.h 22 Oct 2006 14:27:57 -0000 1.2 --- version.h 1 Nov 2006 11:16:11 -0000 1.3 *************** *** 3,12 **** #define PROG_NAME "ElToritoExtractor" #define PROG_AUTHOR "Marco Ratto <mar...@us...>" ! #define PROG_VERSION "1.0.1" #define VERSION_DATE "2006" ! #define COMPILE_DATE "10/22/06" ! #define COMPILE_TIME "15:53:35" ! #define COMPILE_BY "root" #define COMPILE_HOST "marco" #define CC_VERSION "gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)" ! #define CODE_LINES 324 --- 3,12 ---- #define PROG_NAME "ElToritoExtractor" #define PROG_AUTHOR "Marco Ratto <mar...@us...>" ! #define PROG_VERSION "1.1" #define VERSION_DATE "2006" ! #define COMPILE_DATE "11/01/06" ! #define COMPILE_TIME "12:04:01" ! #define COMPILE_BY "rattom" #define COMPILE_HOST "marco" #define CC_VERSION "gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)" ! #define CODE_LINES 335 |