[syslinux] Syslinux patch

Joel Ebel jbebel at ncsu.edu
Wed Sep 1 10:25:46 PDT 2004

I sent the info in your first comment to Richard Woodbury, who knows far 
more about these things than I do.  He replied with the following:

I was actually mistaken about the STORAGE_DEVICE_NUMBER struct not being
on my system (cygwin).  The Microsoft docs say to include ntddstor.h,
but when I tried the compiler said it was not found.  I took that at
face value.  After some investigation, I found that it is available
under /usr/include/w32api/ddk/ and it can be referenced thusly:

#include <ddk/ntddstor.h>

However, I don't know if that will be compatible with all compilers
(i.e. Visual C++).  But it should be compatible with mingw since the
w32api with cygwin is actually from the mingw project, and that is the
normal way this project is built.

Unfortunately, after trying to build with that header, I got lots and
lots of errors.  I fiddled with it for some time, but there seems to be
some sort of problem with the that header file or the other headers that
it includes.  This data structure (and the whole header file) is a
relatively new addition to the Microsoft Win32 SDK.  The latest version
of Visual C++ to which I have access is from 1998, which does not have
this header file.  So I have not been able to test this under the
Microsoft environment to ensure that it isn't something I'm doing wrong.
But in all reality I can't imagine what I'm doing wrong, so I feel
confident there is something wrong with the headers in the mingw w32api,
especially since these are new and somewhat esoteric features to the

The comment in the code should probably be changed to reflect this new
// This data structure is from ddk/ntddstor.h, but is being explicitly
// defined here as there was a problem with the related w32api headers
// at the time of this writing that prevented successful compilation.

Joel Ebel

Lars Munch wrote:
> On Thu, Aug 19, 2004 at 05:50:16PM -0400, Joel Ebel wrote:
>>Out of necessity, a friend of mine and I have created a patch for
>>syslinux to allow it to modify the mbr and partition table in windows.
>>It adds a -m option to syslinux.  If given, it will overwrite the MBR of
>>the drive specified with the mbr.bin provided in syslinux, and if the
>>bootable flag is not set on the partition being syslinuxed, it will set
>>it.  This was done to distribute with my USB based distribution so that
>>a user can run syslinux from within windows to perform all steps
>>necessary to make the pen drive bootable.  The patch only adds the
>>option to the windows syslinux because performing these steps is much
>>easier in linux, and there was no simple tool I knew of to it in windows
>>at all.  However, adding this functionality to the linux version of
>>syslinux would also be possible.  Enjoy, and Peter, if you like it,
>>please feel free to modify it and merge it with syslinux.
>>The patch can be found here:
>>If you're interested, my USB distribution is RUNT.
>>Joel Ebel
>>Patch written by Richard Woodbury III
> Hello
> I had a quick view on the patch:
> 1. STORAGE_DEVICE_NUMBER should be made conditional. I have it in both
>    my cygwin -> mingw cross compiler and in my linux -> mingw cross
>    compiler.
> 2. A small typo
>    printf( "Error: MBR will not fit; now writing\n" );
>                                        ^
> Otherwise the patch looks fine to me.
> -- Lars Munch

More information about the Syslinux mailing list