summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-22 16:52:32 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-22 16:52:32 -0700
commita73b14259504d25e782df6cef4331fbd8710f575 (patch)
tree8bb189a08cf9b705af566d0f1f7e9f21fbba0ece /win32
parentad0d53c9ed34da93d7b9ce96ffaf5570c7c2a95b (diff)
downloadsyslinux-a73b14259504d25e782df6cef4331fbd8710f575.tar.gz
win32: vacuous ADV support
Install an empty ADV in the Windows installer to keep it from being broken. In order to do that, separate the Unix-specific ADV I/O functions from the generic data structure manipulation. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile1
-rw-r--r--win32/syslinux.c20
2 files changed, 14 insertions, 7 deletions
diff --git a/win32/Makefile b/win32/Makefile
index 9009ccd0..a077b30c 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -49,6 +49,7 @@ SRCS = syslinux.c
OBJS = $(patsubst %.c,%.obj,$(notdir $(SRCS)))
LIBSRC = ../libinstaller/fat.c \
../libinstaller/syslxmod.c \
+ ../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
diff --git a/win32/syslinux.c b/win32/syslinux.c
index 297b97b5..ca98d78b 100644
--- a/win32/syslinux.c
+++ b/win32/syslinux.c
@@ -23,6 +23,7 @@
#include "syslinux.h"
#include "libfat.h"
+#include "setadv.h"
#ifdef __GNUC__
# define noreturn void __attribute__((noreturn))
@@ -384,6 +385,9 @@ int main(int argc, char *argv[])
/* Just ignore error if the file do not exists */
DeleteFile(ldlinux_name);
+ /* Initialize the ADV -- this should be smarter */
+ syslinux_reset_adv(syslinux_adv);
+
/* Create ldlinux.sys file */
f_handle = CreateFile(ldlinux_name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -397,15 +401,16 @@ int main(int argc, char *argv[])
}
/* Write ldlinux.sys file */
- if (!WriteFile
- (f_handle, syslinux_ldlinux, syslinux_ldlinux_len, &bytes_written,
- NULL)) {
+ if (!WriteFile(f_handle, syslinux_ldlinux, syslinux_ldlinux_len,
+ &bytes_written, NULL) ||
+ bytes_written != syslinux_ldlinux_len) {
error("Could not write ldlinux.sys");
exit(1);
}
-
- if (bytes_written != syslinux_ldlinux_len) {
- fprintf(stderr, "Could not write whole ldlinux.sys\n");
+ if (!WriteFile(f_handle, syslinux_adv, 2 * ADV_SIZE,
+ &bytes_written, NULL) ||
+ bytes_written != 2 * ADV_SIZE) {
+ error("Could not write ADV to ldlinux.sys");
exit(1);
}
@@ -416,7 +421,8 @@ 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_SHIFT;
+ ldlinux_sectors = (syslinux_ldlinux_len + 2 * ADV_SIZE + SECTOR_SIZE - 1)
+ >> SECTOR_SHIFT;
sectors = calloc(ldlinux_sectors, sizeof *sectors);
fs = libfat_open(libfat_readfile, (intptr_t) d_handle);
ldlinux_cluster = libfat_searchdir(fs, 0, "LDLINUX SYS", NULL);