summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-19 16:30:09 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-19 16:30:09 -0700
commit0fa4369624b4637a7e36ed22e89a759031f08327 (patch)
tree4aa1cf5c87d36153cee3c727d5f77498c0042983 /win32
parentc9ad266f64f9ee81a859bdf70c1190ee0cc1bc19 (diff)
downloadsyslinux-0fa4369624b4637a7e36ed22e89a759031f08327.tar.gz
FAT: change DOS installer to EXE; additional 32K limit fixes
Additional fixes for the 32K limits in the installers. In the case of the DOS installer, that means changing it from COM format to EXE format (since COM format has a 63K hard limit); retain the name syslinux.com for user compatibility, though (DOS doesn't care what the extension except for pathname search; if it finds an MZ EXE header it will use it.) With the change to EXE means having to handle more than one segment. Since we don't have a real DOS compiler we have to wing it a bit. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'win32')
-rw-r--r--win32/syslinux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/win32/syslinux.c b/win32/syslinux.c
index 1699125b..7a0fafb2 100644
--- a/win32/syslinux.c
+++ b/win32/syslinux.c
@@ -36,7 +36,6 @@ void error(char* msg);
#include <winioctl.h>
-#define SECTOR_SIZE 512
#define PART_TABLE 0x1be
#define PART_SIZE 0x10
#define PART_COUNT 4
@@ -252,7 +251,9 @@ int main(int argc, char *argv[])
static char ldlinux_name[] = "?:\\ldlinux.sys" ;
const char *errmsg;
struct libfat_filesystem *fs;
- libfat_sector_t s, *secp, sectors[65]; /* 65 is maximum possible */
+ libfat_sector_t s, *secp;
+ libfat_sector_t *sectors;
+ int ldlinux_sectors;
uint32_t ldlinux_cluster;
int nsectors;
const char *bootsecfile = NULL;
@@ -414,12 +415,14 @@ int main(int argc, char *argv[])
}
/* Map the file (is there a better way to do this?) */
+ ldlinux_sectors = (syslinux_ldlinux_len+SECTOR_SIZE-1) >> SECTOR_BITS;
+ sectors = calloc(ldlinux_sectors, sizeof *sectors);
fs = libfat_open(libfat_readfile, (intptr_t)d_handle);
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);
secp = sectors;
nsectors = 0;
s = libfat_clustertosector(fs, ldlinux_cluster);
- while ( s && nsectors < 65 ) {
+ while ( s && nsectors < ldlinux_sectors ) {
*secp++ = s;
nsectors++;
s = libfat_nextsector(fs, s);