[syslinux] Syslinux-4.03.exe?

Bryan.James.Krone-EXT at jci.com Bryan.James.Krone-EXT at jci.com
Sun Oct 9 05:33:52 PDT 2011


syslinux-bounces at zytor.com wrote on 09/01/2011 01:50:56 PM:

> [image removed] 
> 
> Re: [syslinux] Syslinux-4.03.exe?
> 
> Paulo Cezar 
> 
> to:
> 
> For discussion of Syslinux and tftp-hpa
> 
> 09/01/2011 01:53 PM
> 
> Sent by:
> 
> syslinux-bounces at zytor.com
> 
> Please respond to For discussion of Syslinux and tftp-hpa
> 
> On Thu, Sep 1, 2011 at 3:30 PM, <Bryan.James.Krone-EXT at jci.com> wrote:
> 
> > I'm using SYSLINUX 4.03 from Linux and setting data in the ADV. I then 
run
> > "C:\Syslinux-4.03.exe --reset-adv C:\" from Windows and I get this:
> >
> > "At least one specified option not yet implemented for this 
installer."
> >
> > Is the --reset-adv option not implemented in the Windows version??
> >
> >
> Yes - there are many command-line options that are missing on the
> Windows installer.
> 
> I pretend to implement these missing options in the mean time.
> 
> 
>                       Paulo
> 
> 

Would this work for windows to --reset-adv:

#include <cstdlib>
#include <iostream>

int clearAdv();
int clearAdvInFile(FILE * advFile);

////
// Summary: Entry point for the application.. just calls clearAdv
int main(int argc, char *argv[])
{
        return clearAdv();
}

////
// Summary: Opens the ldlinux file and clears the adv sectors out of it.
int clearAdv()
{
        // Open the file that needs to be edited.
        FILE * advFile = fopen("c:\\ldlinux.sys", "rb+");
        if(advFile == NULL) return -1;
 
        // Clear the adv data in the file.
        int retVal = clearAdvInFile(advFile);
 
        // Close the file.
        fclose(advFile);
        return retVal;
}

////
// Summary: Clears the adv sectors out of the ldlinux file.
int clearAdvInFile(FILE * advFile)
{
        // This is the data that needs to be written to clear the adv 
sector.
        unsigned char newData[16] = { 0xA5, 0x2F, 0x2D, 0x5A, 0x67, 0x17, 
0x04, 0xA3,
                                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00 };
 
        // Seek to 0x7C00 and write the new data.
        if(fseek(advFile, 0x7c00, 0) != 0)
                return -2;
        if(fwrite(&newData, sizeof(newData), 1, advFile) != 1)
                return -3;

        // Seek to 0x7E00 and write the new data.
        if(fseek(advFile, 0x7e00, 0) != 0)
                return -4;
        if(fwrite(&newData, sizeof(newData), 1, advFile) != 1)
                return -5;

        // Everything seemed to work. Success.
        return 0;
}



More information about the Syslinux mailing list