wok-next diff syslinux/stuff/iso2exe/win32.c @ rev 14267
syslinux/iso2exe: add boot error message
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Apr 02 08:37:23 2013 +0200 (2013-04-02) |
parents | bf8be127c60b |
children | 19258b949c1b |
line diff
1.1 --- a/syslinux/stuff/iso2exe/win32.c Mon Apr 01 09:45:40 2013 +0200 1.2 +++ b/syslinux/stuff/iso2exe/win32.c Tue Apr 02 08:37:23 2013 +0200 1.3 @@ -67,7 +67,7 @@ 1.4 fdiso = open(isoFileName, O_RDONLY|O_BINARY); 1.5 if (lseek(fdiso, 17 * 2048L, SEEK_SET) != -1 && 1.6 read(fdiso, buffer, 2048) == 2048 && 1.7 - strncmp(buffer+23,"EL TORITO SPECIFICATION",23) == 0) { 1.8 + strncmp(buffer+7,"EL TORITO SPECIFICATION",23) == 0) { 1.9 unsigned long lba = * (unsigned long *) (buffer + 71); 1.10 1.11 if (lseek(fdiso, lba * 2048L, SEEK_SET) != -1 && 1.12 @@ -118,9 +118,9 @@ 1.13 return result; 1.14 } 1.15 1.16 -static void rawrite(unsigned long drive, char *isoFileName) 1.17 +static int rawrite(unsigned long drive, char *isoFileName) 1.18 { 1.19 - int fdiso, s, dev, isohybrid = -1; 1.20 + int fdiso, s, dev; 1.21 char buffer[2048]; 1.22 1.23 if (drive == 0) return; 1.24 @@ -131,13 +131,11 @@ 1.25 int s, n = read(fdiso, buffer, sizeof(buffer)); 1.26 if (n <= 0) break; 1.27 n = (n+511)/512; 1.28 - if (s == 0) isohybrid = buffer[69]; 1.29 rdwrsector(MODE_WRITE, dev, s, n, buffer); 1.30 - if (s == isohybrid) 1.31 - rdwrsector(MODE_WRITE, dev, 0, 1, buffer); 1.32 s += n; 1.33 } 1.34 close(fdiso); 1.35 + return dev; 1.36 } 1.37 1.38 static unsigned long drives(void) 1.39 @@ -242,11 +240,14 @@ 1.40 if (new == base) { 1.41 MessageBox(NULL,"No USB stick found.","Sorry", 1.42 MB_OK|MB_ICONERROR); 1.43 - exit(1); 1.44 } 1.45 - rawrite(base ^ new, isoFileName); 1.46 + else { 1.47 + char *msg = "(hd0) is up to date."; 1.48 + msg[3] += rawrite(base ^ new, isoFileName) - 128; 1.49 + MessageBox(NULL,msg,"Finished",MB_OK); 1.50 + } 1.51 } 1.52 - if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && 1.53 + else if (header[BOOTSTRAP_SECTOR_COUNT_OFFSET] != 0 && 1.54 MessageBox(NULL,"Do you want to create a bootstrap floppy ?", 1.55 "Create a bootstrap floppy ?", 1.56 MB_YESNO|MB_ICONQUESTION) == IDYES && 1.57 @@ -257,5 +258,7 @@ 1.58 // Create a 9k bootstrap with vfat, ext2 & ntfs drivers 1.59 // to boot the ISO image on hard disk 1.60 writefloppy(isoFileName); 1.61 + MessageBox(NULL,"The bootstrap floppy is up to date.", 1.62 + "Finished",MB_OK); 1.63 } 1.64 }