mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-02 07:39:54 -04:00
[ms-sys] update ms-sys to current
* NB: This includes an updated Syslinux MBR
This commit is contained in:
parent
cc65d0494d
commit
b77561bb9b
15 changed files with 312 additions and 120 deletions
127
src/ms-sys/br.c
127
src/ms-sys/br.c
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************
|
||||
Copyright (C) 2009 Henrik Carlqvist
|
||||
Copyright (C) 2009-2015 Henrik Carlqvist
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,13 +20,35 @@
|
|||
#include "file.h"
|
||||
#include "br.h"
|
||||
|
||||
unsigned long ulBytesPerSector = 512;
|
||||
|
||||
void set_bytes_per_sector(unsigned long ulValue)
|
||||
{
|
||||
ulBytesPerSector = ulValue;
|
||||
if ((ulBytesPerSector < 512) || (ulBytesPerSector > 65536))
|
||||
ulBytesPerSector = 512;
|
||||
} /* set_bytes_per_sector */
|
||||
|
||||
uint32_t read_windows_disk_signature(FILE *fp)
|
||||
{
|
||||
uint32_t tWDS;
|
||||
if(!read_data(fp, 0x1b8, &tWDS, 4))
|
||||
return 0;
|
||||
return tWDS;
|
||||
} /* read_windows_disk_signature */
|
||||
|
||||
int write_windows_disk_signature(FILE *fp, uint32_t tWDS)
|
||||
{
|
||||
return write_data(fp, 0x1b8, &tWDS, 4);
|
||||
} /* write_windows_disk_signature */
|
||||
|
||||
int is_br(FILE *fp)
|
||||
{
|
||||
/* A "file" is probably some kind of boot record if it contains the magic
|
||||
chars 0x55, 0xAA at position 0x1FE */
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
return contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
} /* is_br */
|
||||
|
||||
int is_lilo_br(FILE *fp)
|
||||
|
@ -36,130 +58,128 @@ int is_lilo_br(FILE *fp)
|
|||
unsigned char aucRef[] = {'L','I','L','O'};
|
||||
|
||||
return ( contains_data(fp, 0x6, aucRef, sizeof(aucRef)) ||
|
||||
contains_data(fp, 0x2, aucRef, sizeof(aucRef)) );
|
||||
contains_data(fp, 0x2, aucRef, sizeof(aucRef)) );
|
||||
} /* is_lilo_br */
|
||||
|
||||
int is_dos_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_dos.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_dos_0x0, sizeof(mbr_dos_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_dos_mbr */
|
||||
|
||||
int is_dos_f2_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_dos_f2.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_dos_f2_0x0, sizeof(mbr_dos_f2_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_dos_f2_mbr */
|
||||
|
||||
int is_95b_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_95b.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_95b_0x0, sizeof(mbr_95b_0x0)) &&
|
||||
contains_data(fp, 0x0e0, mbr_95b_0x0e0, sizeof(mbr_95b_0x0e0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_95b_mbr */
|
||||
|
||||
int is_2000_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_2000.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_2000_0x0, sizeof(mbr_2000_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_2000_mbr */
|
||||
|
||||
int is_vista_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_vista.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_vista_0x0, sizeof(mbr_vista_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_vista_mbr */
|
||||
|
||||
int is_win7_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_win7.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_win7_0x0, sizeof(mbr_win7_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_win7_mbr */
|
||||
|
||||
int is_rufus_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_rufus.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_rufus_0x0, sizeof(mbr_rufus_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_rufus_mbr */
|
||||
|
||||
int is_reactos_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_reactos.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_reactos_0x0, sizeof(mbr_reactos_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_reactos_mbr */
|
||||
|
||||
int is_grub_mbr(FILE *fp)
|
||||
int is_grub4dos_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_grub.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_grub_0x0, sizeof(mbr_grub_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_grub_mbr */
|
||||
|
||||
int is_grub2_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_grub2.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_grub2_0x0, sizeof(mbr_grub2_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_grub2_mbr */
|
||||
|
||||
int is_kolibri_mbr(FILE *fp)
|
||||
int is_kolibrios_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_kolibri.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_kolibri_0x0, sizeof(mbr_kolibri_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_kolibri_mbr */
|
||||
|
||||
int is_syslinux_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_syslinux.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_syslinux_0x0, sizeof(mbr_syslinux_0x0)) &&
|
||||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
is_br(fp);
|
||||
} /* is_syslinux_mbr */
|
||||
|
||||
int is_syslinux_gpt_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_gpt_syslinux.h"
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_gpt_syslinux_0x0,
|
||||
sizeof(mbr_gpt_syslinux_0x0)) &&
|
||||
is_br(fp);
|
||||
} /* is_syslinux_gpt_mbr */
|
||||
|
||||
int is_zero_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_zero.h"
|
||||
|
@ -169,19 +189,37 @@ int is_zero_mbr(FILE *fp)
|
|||
/* Don't bother to check 55AA signature */
|
||||
} /* is_zero_mbr */
|
||||
|
||||
int is_zero_mbr_with_other_windows_disk_signature(FILE *fp)
|
||||
{
|
||||
#include "mbr_zero.h"
|
||||
|
||||
return
|
||||
(!contains_data(fp, 0x0, mbr_zero_0x0, sizeof(mbr_zero_0x0))) &&
|
||||
contains_data(fp, 0x0, mbr_zero_0x0, 0x1b8);
|
||||
contains_data(fp, 0x1bc, mbr_zero_0x0, 2);
|
||||
/* Don't bother to check 55AA signature */
|
||||
} /* is_zero_mbr_with_other_windows_disk_signature */
|
||||
|
||||
int is_zero_mbr_not_including_disk_signature_or_copy_protect(FILE *fp)
|
||||
{
|
||||
#include "mbr_zero.h"
|
||||
|
||||
return
|
||||
contains_data(fp, 0x0, mbr_zero_0x0, 0x1b8);
|
||||
} /* is_zero_mbr_not_including_disk_signature_or_copy_protect */
|
||||
|
||||
/* Handle nonstandard sector sizes (such as 4K) by writing
|
||||
the boot marker at every 512-2 bytes location */
|
||||
static int write_bootmark(FILE *fp)
|
||||
{
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
uint32_t pos = 0x1FE;
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
unsigned long pos = 0x1FE;
|
||||
|
||||
for (pos = 0x1FE; pos < fd->_sector_size; pos += 0x200) {
|
||||
if (!write_data(fp, pos, aucRef, sizeof(aucRef)))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
for (pos = 0x1FE; pos < ulBytesPerSector; pos += 0x200) {
|
||||
if (!write_data(fp, pos, aucRef, sizeof(aucRef)))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int write_dos_mbr(FILE *fp)
|
||||
|
@ -248,7 +286,7 @@ int write_reactos_mbr(FILE *fp)
|
|||
write_bootmark(fp);
|
||||
} /* write_reactos_mbr */
|
||||
|
||||
int write_kolibri_mbr(FILE *fp)
|
||||
int write_kolibrios_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_kolibri.h"
|
||||
|
||||
|
@ -266,7 +304,16 @@ int write_syslinux_mbr(FILE *fp)
|
|||
write_bootmark(fp);
|
||||
} /* write_syslinux_mbr */
|
||||
|
||||
int write_grub_mbr(FILE *fp)
|
||||
int write_syslinux_gpt_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_gpt_syslinux.h"
|
||||
|
||||
return
|
||||
write_data(fp, 0x0, mbr_gpt_syslinux_0x0, sizeof(mbr_gpt_syslinux_0x0)) &&
|
||||
write_bootmark(fp);
|
||||
} /* write_syslinux_gpt_mbr */
|
||||
|
||||
int write_grub4dos_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_grub.h"
|
||||
|
||||
|
@ -289,6 +336,6 @@ int write_zero_mbr(FILE *fp)
|
|||
#include "mbr_zero.h"
|
||||
|
||||
return
|
||||
write_data(fp, 0x0, mbr_zero_0x0, sizeof(mbr_zero_0x0)) &&
|
||||
write_data(fp, 0x0, mbr_zero_0x0, sizeof(mbr_zero_0x0)) &&
|
||||
write_bootmark(fp);
|
||||
} /* write_zero_mbr */
|
||||
|
|
|
@ -129,5 +129,5 @@ int write_fat_16_ros_br(FILE *fp, int bKeepLabel)
|
|||
( write_data(fp, 0x0, br_fat16_0x0, sizeof(br_fat16_0x0)) &&
|
||||
/* BIOS Parameter Block should not be overwritten */
|
||||
write_data(fp, 0x2b, label_11_char, sizeof(label_11_char)) &&
|
||||
write_data(fp, 0x3e, br_fat16_0x3e, sizeof(br_fat16_0x3e)) );
|
||||
write_data(fp, 0x3e, br_fat16_0x3e, sizeof(br_fat16_0x3e)) );
|
||||
} /* write_fat_16_ros_br */
|
||||
|
|
|
@ -172,6 +172,57 @@ int write_fat_32_nt_br(FILE *fp, int bKeepLabel)
|
|||
);
|
||||
} /* write_fat_32_nt_br */
|
||||
|
||||
/* Not used by Rufus */
|
||||
#if 0
|
||||
int entire_fat_32_pe_br_matches(FILE *fp)
|
||||
{
|
||||
#include "br_fat32_0x0.h"
|
||||
#include "br_fat32pe_0x52.h"
|
||||
#include "br_fat32pe_0x3f0.h"
|
||||
#include "br_fat32pe_0x1800.h"
|
||||
|
||||
return
|
||||
( contains_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
/* BIOS Parameter Block might differ between systems */
|
||||
contains_data(fp, 0x52, br_fat32pe_0x52, sizeof(br_fat32pe_0x52)) &&
|
||||
/* Cluster information might differ between systems */
|
||||
contains_data(fp, 0x3f0, br_fat32pe_0x3f0, sizeof(br_fat32pe_0x3f0)) &&
|
||||
contains_data(fp, 0x1800, br_fat32pe_0x1800, sizeof(br_fat32pe_0x1800))
|
||||
);
|
||||
} /* entire_fat_32_nt_br_matches */
|
||||
|
||||
int write_fat_32_pe_br(FILE *fp, int bKeepLabel)
|
||||
{
|
||||
#include "label_11_char.h"
|
||||
#include "br_fat32_0x0.h"
|
||||
#include "br_fat32pe_0x52.h"
|
||||
#include "br_fat32pe_0x3f0.h"
|
||||
#include "br_fat32pe_0x1800.h"
|
||||
|
||||
if(bKeepLabel)
|
||||
return
|
||||
( write_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
/* BIOS Parameter Block should not be overwritten */
|
||||
write_data(fp, 0x52, br_fat32pe_0x52, sizeof(br_fat32pe_0x52)) &&
|
||||
/* Cluster information is not overwritten, however, it would bo OK
|
||||
to write 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff here. */
|
||||
write_data(fp, 0x3f0, br_fat32pe_0x3f0, sizeof(br_fat32pe_0x3f0)) &&
|
||||
write_data(fp, 0x1800, br_fat32pe_0x1800, sizeof(br_fat32pe_0x1800))
|
||||
);
|
||||
else
|
||||
return
|
||||
( write_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
/* BIOS Parameter Block should not be overwritten */
|
||||
write_data(fp, 0x47, label_11_char, sizeof(label_11_char)) &&
|
||||
write_data(fp, 0x52, br_fat32pe_0x52, sizeof(br_fat32pe_0x52)) &&
|
||||
/* Cluster information is not overwritten, however, it would bo OK
|
||||
to write 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff here. */
|
||||
write_data(fp, 0x3f0, br_fat32pe_0x3f0, sizeof(br_fat32pe_0x3f0)) &&
|
||||
write_data(fp, 0x1800, br_fat32pe_0x1800, sizeof(br_fat32pe_0x1800))
|
||||
);
|
||||
} /* write_fat_32_pe_br */
|
||||
#endif
|
||||
|
||||
int entire_fat_32_ros_br_matches(FILE *fp)
|
||||
{
|
||||
#include "br_fat32_0x0.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/******************************************************************
|
||||
Copyright (C) 2009 Henrik Carlqvist
|
||||
Modified for Rufus/Windows (C) 2011-2015 Pete Batard
|
||||
Modified for Rufus/Windows (C) 2011-2016 Pete Batard
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,6 +23,8 @@
|
|||
#include "../rufus.h"
|
||||
#include "file.h"
|
||||
|
||||
extern unsigned long ulBytesPerSector;
|
||||
|
||||
/* Returns the number of bytes written or -1 on error */
|
||||
int64_t write_sectors(HANDLE hDrive, uint64_t SectorSize,
|
||||
uint64_t StartSector, uint64_t nSectors,
|
||||
|
@ -89,26 +91,37 @@ int64_t read_sectors(HANDLE hDrive, uint64_t SectorSize,
|
|||
}
|
||||
|
||||
/*
|
||||
* The following calls use a hijacked fp on Windows that contains:
|
||||
* fp->_handle: a Windows handle
|
||||
* fp->_sector_size: the sector size
|
||||
* fp->_offset: a file offset
|
||||
*/
|
||||
* The following calls use a hijacked fp on Windows that contains:
|
||||
* fp->_handle: a Windows handle
|
||||
* fp->_offset: a file offset
|
||||
*/
|
||||
|
||||
int contains_data(FILE *fp, uint64_t Position,
|
||||
const void *pData, uint64_t Len)
|
||||
const void *pData, uint64_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
|
||||
if (!read_data(fp, Position, aucBuf, Len))
|
||||
return 0;
|
||||
if (memcmp(pData, aucBuf, (size_t)Len))
|
||||
return 0;
|
||||
return 1;
|
||||
} /* contains_data */
|
||||
|
||||
int read_data(FILE *fp, uint64_t Position,
|
||||
void *pData, uint64_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
HANDLE hDrive = (HANDLE)fd->_handle;
|
||||
uint64_t SectorSize = (uint64_t)fd->_sector_size;
|
||||
uint64_t StartSector, EndSector, NumSectors;
|
||||
Position += fd->_offset;
|
||||
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
StartSector = Position/ulBytesPerSector;
|
||||
EndSector = (Position+Len+ulBytesPerSector -1)/ulBytesPerSector;
|
||||
NumSectors = (size_t)(EndSector - StartSector);
|
||||
|
||||
if((NumSectors*SectorSize) > MAX_DATA_LEN)
|
||||
if((NumSectors*ulBytesPerSector) > MAX_DATA_LEN)
|
||||
{
|
||||
uprintf("contains_data: please increase MAX_DATA_LEN in file.h\n");
|
||||
return 0;
|
||||
|
@ -120,14 +133,13 @@ int contains_data(FILE *fp, uint64_t Position,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(read_sectors(hDrive, SectorSize, StartSector,
|
||||
if(read_sectors(hDrive, ulBytesPerSector, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
|
||||
if(memcmp(pData, &aucBuf[Position - StartSector*SectorSize], (size_t)Len))
|
||||
return 0;
|
||||
memcpy(pData, &aucBuf[Position - StartSector*ulBytesPerSector], (size_t)Len);
|
||||
return 1;
|
||||
} /* contains_data */
|
||||
} /* read_data */
|
||||
|
||||
/* May read/write the same sector many times, but compatible with existing ms-sys */
|
||||
int write_data(FILE *fp, uint64_t Position,
|
||||
|
@ -136,15 +148,14 @@ int write_data(FILE *fp, uint64_t Position,
|
|||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
HANDLE hDrive = (HANDLE)fd->_handle;
|
||||
uint64_t SectorSize = (uint64_t)fd->_sector_size;
|
||||
uint64_t StartSector, EndSector, NumSectors;
|
||||
Position += fd->_offset;
|
||||
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
StartSector = Position/ulBytesPerSector;
|
||||
EndSector = (Position+Len+ulBytesPerSector-1)/ulBytesPerSector;
|
||||
NumSectors = EndSector - StartSector;
|
||||
|
||||
if((NumSectors*SectorSize) > MAX_DATA_LEN)
|
||||
if((NumSectors*ulBytesPerSector) > MAX_DATA_LEN)
|
||||
{
|
||||
uprintf("Please increase MAX_DATA_LEN in file.h\n");
|
||||
return 0;
|
||||
|
@ -157,14 +168,14 @@ int write_data(FILE *fp, uint64_t Position,
|
|||
}
|
||||
|
||||
/* Data to write may not be aligned on a sector boundary => read into a sector buffer first */
|
||||
if(read_sectors(hDrive, SectorSize, StartSector,
|
||||
if(read_sectors(hDrive, ulBytesPerSector, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
|
||||
if(!memcpy(&aucBuf[Position - StartSector*SectorSize], pData, (size_t)Len))
|
||||
if(!memcpy(&aucBuf[Position - StartSector*ulBytesPerSector], pData, (size_t)Len))
|
||||
return 0;
|
||||
|
||||
if(write_sectors(hDrive, SectorSize, StartSector,
|
||||
if(write_sectors(hDrive, ulBytesPerSector, StartSector,
|
||||
NumSectors, aucBuf) <= 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
#define BR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* Sets custom number of bytes per sector, default value is 512 */
|
||||
void set_bytes_per_sector(unsigned long ulValue);
|
||||
|
||||
/* Gets Windows Disk Signature from MBR */
|
||||
uint32_t read_windows_disk_signature(FILE *fp);
|
||||
|
||||
/* Sets a new Windows Disk Signature to MBR */
|
||||
int write_windows_disk_signature(FILE *fp, uint32_t tWDS);
|
||||
|
||||
/* returns TRUE if the file has a boot record, otherwise FALSE.
|
||||
The file position will change when this function is called! */
|
||||
|
@ -46,7 +56,7 @@ int is_reactos_mbr(FILE *fp);
|
|||
|
||||
/* returns TRUE if the file has a Grub4DOS master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
int is_grub_mbr(FILE *fp);
|
||||
int is_grub4dos_mbr(FILE *fp);
|
||||
|
||||
/* returns TRUE if the file has a Grub 2.0 master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
|
@ -54,15 +64,21 @@ int is_grub2_mbr(FILE *fp);
|
|||
|
||||
/* returns TRUE if the file has a KolibriOS master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
int is_kolibri_mbr(FILE *fp);
|
||||
int is_kolibrios_mbr(FILE *fp);
|
||||
|
||||
/* returns TRUE if the file has a syslinux master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
int is_syslinux_mbr(FILE *fp);
|
||||
|
||||
/* returns TRUE if the file has a syslinux GPT master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
int is_syslinux_gpt_mbr(FILE *fp);
|
||||
|
||||
/* returns TRUE if the file has a zeroed master boot record, otherwise
|
||||
FALSE.The file position will change when this function is called! */
|
||||
int is_zero_mbr(FILE *fp);
|
||||
int is_zero_mbr_with_other_windows_disk_signature(FILE *fp);
|
||||
int is_zero_mbr_not_including_disk_signature_or_copy_protect(FILE *fp);
|
||||
|
||||
/* Writes a dos master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
|
@ -94,7 +110,7 @@ int write_reactos_mbr(FILE *fp);
|
|||
|
||||
/* Writes a Grub4DOS master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_grub_mbr(FILE *fp);
|
||||
int write_grub4dos_mbr(FILE *fp);
|
||||
|
||||
/* Writes a Grub 2.0 master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
|
@ -102,12 +118,16 @@ int write_grub2_mbr(FILE *fp);
|
|||
|
||||
/* Writes a KolibriOS master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_kolibri_mbr(FILE *fp);
|
||||
int write_kolibrios_mbr(FILE *fp);
|
||||
|
||||
/* Writes a syslinux master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_syslinux_mbr(FILE *fp);
|
||||
|
||||
/* Writes a syslinux GPT master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_syslinux_gpt_mbr(FILE *fp);
|
||||
|
||||
/* Writes an empty (zeroed) master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_zero_mbr(FILE *fp);
|
||||
|
|
|
@ -38,6 +38,15 @@ int entire_fat_32_nt_br_matches(FILE *fp);
|
|||
FALSE */
|
||||
int write_fat_32_nt_br(FILE *fp, int bKeepLabel);
|
||||
|
||||
/* returns TRUE if the file has an exact match of the FAT32 boot record this
|
||||
program would create for NT, otherwise FALSE.
|
||||
The file position will change when this function is called! */
|
||||
int entire_fat_32_pe_br_matches(FILE *fp);
|
||||
|
||||
/* Writes a FAT32 NT boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_fat_32_pe_br(FILE *fp, int bKeepLabel);
|
||||
|
||||
/* returns TRUE if the file has an exact match of the FAT32 boot record this
|
||||
program would create for ReactOS, otherwise FALSE.
|
||||
The file position will change when this function is called! */
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
typedef struct {
|
||||
void *_handle;
|
||||
uint64_t _offset;
|
||||
uint32_t _sector_size;
|
||||
} FAKE_FD;
|
||||
|
||||
/* Checks if a file contains a data pattern of length Len at position
|
||||
|
@ -18,6 +17,11 @@ typedef struct {
|
|||
int contains_data(FILE *fp, uint64_t Position,
|
||||
const void *pData, uint64_t Len);
|
||||
|
||||
/* Reads data of length Len at position Position.
|
||||
The file pointer will change when calling this function! */
|
||||
int read_data(FILE *fp, uint64_t Position,
|
||||
void *pData, uint64_t uiLen);
|
||||
|
||||
/* Writes a data pattern of length Len at position Position.
|
||||
The file pointer will change when calling this function! */
|
||||
int write_data(FILE *fp, uint64_t Position,
|
||||
|
|
40
src/ms-sys/inc/mbr_gpt_syslinux.h
Normal file
40
src/ms-sys/inc/mbr_gpt_syslinux.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* This version is from gptmbr.bin from syslinux 6.02 */
|
||||
unsigned char mbr_gpt_syslinux_0x0[] = {
|
||||
0x33, 0xc0, 0xfa, 0x8e, 0xd8, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0x89, 0xe6,
|
||||
0x06, 0x57, 0x8e, 0xc0, 0xfb, 0xfc, 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x01,
|
||||
0xf3, 0xa5, 0xea, 0x1f, 0x06, 0x00, 0x00, 0x52, 0x89, 0xe5, 0x83, 0xec,
|
||||
0x1c, 0x6a, 0x1e, 0xc7, 0x46, 0xfa, 0x00, 0x02, 0x52, 0xb4, 0x41, 0xbb,
|
||||
0xaa, 0x55, 0x31, 0xc9, 0x30, 0xf6, 0xf9, 0xcd, 0x13, 0x5a, 0xb4, 0x08,
|
||||
0x72, 0x17, 0x81, 0xfb, 0x55, 0xaa, 0x75, 0x11, 0xd1, 0xe9, 0x73, 0x0d,
|
||||
0x66, 0xc7, 0x06, 0x59, 0x07, 0xb4, 0x42, 0xeb, 0x13, 0xb4, 0x48, 0x89,
|
||||
0xe6, 0xcd, 0x13, 0x83, 0xe1, 0x3f, 0x51, 0x0f, 0xb6, 0xc6, 0x40, 0xf7,
|
||||
0xe1, 0x52, 0x50, 0x66, 0x31, 0xc0, 0x66, 0x99, 0x40, 0xe8, 0xdc, 0x00,
|
||||
0x8b, 0x4e, 0x56, 0x8b, 0x46, 0x5a, 0x50, 0x51, 0xf7, 0xe1, 0xf7, 0x76,
|
||||
0xfa, 0x91, 0x41, 0x66, 0x8b, 0x46, 0x4e, 0x66, 0x8b, 0x56, 0x52, 0x53,
|
||||
0xe8, 0xc4, 0x00, 0xe2, 0xfb, 0x31, 0xf6, 0x5f, 0x59, 0x58, 0x66, 0x8b,
|
||||
0x15, 0x66, 0x0b, 0x55, 0x04, 0x66, 0x0b, 0x55, 0x08, 0x66, 0x0b, 0x55,
|
||||
0x0c, 0x74, 0x0c, 0xf6, 0x45, 0x30, 0x04, 0x74, 0x06, 0x21, 0xf6, 0x75,
|
||||
0x19, 0x89, 0xfe, 0x01, 0xc7, 0xe2, 0xdf, 0x21, 0xf6, 0x75, 0x2e, 0xe8,
|
||||
0xe1, 0x00, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x4f, 0x53,
|
||||
0x0d, 0x0a, 0xe8, 0xd2, 0x00, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c,
|
||||
0x65, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x20, 0x70, 0x61, 0x72,
|
||||
0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x0d, 0x0a, 0x91, 0xbf, 0xbe,
|
||||
0x07, 0x57, 0x66, 0x31, 0xc0, 0xb0, 0x80, 0x66, 0xab, 0xb0, 0xed, 0x66,
|
||||
0xab, 0x66, 0x8b, 0x44, 0x20, 0x66, 0x8b, 0x54, 0x24, 0xe8, 0x40, 0x00,
|
||||
0x66, 0x8b, 0x44, 0x28, 0x66, 0x8b, 0x54, 0x2c, 0x66, 0x2b, 0x44, 0x20,
|
||||
0x66, 0x1b, 0x54, 0x24, 0xe8, 0x70, 0x00, 0xe8, 0x2a, 0x00, 0x66, 0x0f,
|
||||
0xb7, 0xc1, 0x66, 0xab, 0xf3, 0xa4, 0x5e, 0x66, 0x8b, 0x44, 0x34, 0x66,
|
||||
0x8b, 0x54, 0x38, 0xe8, 0x22, 0x00, 0x81, 0x3e, 0xfe, 0x7d, 0x55, 0xaa,
|
||||
0x75, 0x85, 0x89, 0xec, 0x5a, 0x5f, 0x07, 0x66, 0xb8, 0x21, 0x47, 0x50,
|
||||
0x54, 0xfa, 0xff, 0xe4, 0x66, 0x21, 0xd2, 0x74, 0x04, 0x66, 0x83, 0xc8,
|
||||
0xff, 0x66, 0xab, 0xc3, 0xbb, 0x00, 0x7c, 0x66, 0x60, 0x66, 0x52, 0x66,
|
||||
0x50, 0x06, 0x53, 0x6a, 0x01, 0x6a, 0x10, 0x89, 0xe6, 0x66, 0xf7, 0x76,
|
||||
0xdc, 0xc0, 0xe4, 0x06, 0x88, 0xe1, 0x88, 0xc5, 0x92, 0xf6, 0x76, 0xe0,
|
||||
0x88, 0xc6, 0x08, 0xe1, 0x41, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x00, 0xcd,
|
||||
0x13, 0x8d, 0x64, 0x10, 0x66, 0x61, 0x72, 0x0c, 0x02, 0x7e, 0xfb, 0x66,
|
||||
0x83, 0xc0, 0x01, 0x66, 0x83, 0xd2, 0x00, 0xc3, 0xe8, 0x0c, 0x00, 0x44,
|
||||
0x69, 0x73, 0x6b, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x0d, 0x0a, 0x5e,
|
||||
0xac, 0xb4, 0x0e, 0x8a, 0x3e, 0x62, 0x04, 0xb3, 0x07, 0xcd, 0x10, 0x3c,
|
||||
0x0a, 0x75, 0xf1, 0xcd, 0x18, 0xf4, 0xeb, 0xfd, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
|
@ -1,29 +1,40 @@
|
|||
/* Public domain MBR by H. Peter Anvin supplied with Syslinux */
|
||||
/* This version from mbr.asm,v 1.6 2--2/10/03 10:02:50 */
|
||||
/* This version is from mbr.bin from syslinux 6.02 */
|
||||
unsigned char mbr_syslinux_0x0[] = {
|
||||
0xfa, 0x31, 0xc0, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0, 0xbc, 0x00, 0x7c,
|
||||
0xfb, 0xfc, 0x89, 0xe6, 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x01, 0xf3, 0xa5,
|
||||
0xea, 0x1d, 0x06, 0x00, 0x00, 0x88, 0x16, 0x00, 0x08, 0xb4, 0x08, 0xcd,
|
||||
0x13, 0x31, 0xc0, 0x88, 0xf0, 0x40, 0xa3, 0xec, 0x06, 0x80, 0xe1, 0x3f,
|
||||
0x88, 0x0e, 0xee, 0x06, 0xbe, 0xbe, 0x07, 0x31, 0xc0, 0xb9, 0x04, 0x00,
|
||||
0xf6, 0x04, 0x80, 0x74, 0x03, 0x40, 0x89, 0xf7, 0x83, 0xc6, 0x10, 0xe2,
|
||||
0xf3, 0x83, 0xf8, 0x01, 0x75, 0x73, 0x8a, 0x16, 0x00, 0x08, 0xb8, 0x00,
|
||||
0x41, 0xbb, 0xaa, 0x55, 0x31, 0xc9, 0x30, 0xf6, 0xf9, 0xcd, 0x13, 0x72,
|
||||
0x23, 0x81, 0xfb, 0x55, 0xaa, 0x75, 0x1d, 0xf6, 0xc1, 0x01, 0x74, 0x18,
|
||||
0x57, 0xbe, 0xdc, 0x06, 0x8b, 0x5d, 0x08, 0x89, 0x5c, 0x08, 0x8b, 0x5d,
|
||||
0x0a, 0x89, 0x5c, 0x0a, 0x8a, 0x16, 0x00, 0x08, 0xb4, 0x42, 0xeb, 0x2a,
|
||||
0x57, 0x8b, 0x45, 0x08, 0x8b, 0x55, 0x0a, 0xf7, 0x36, 0xee, 0x06, 0x42,
|
||||
0x89, 0xd1, 0x31, 0xd2, 0xf7, 0x36, 0xec, 0x06, 0x88, 0xc5, 0xd1, 0xe8,
|
||||
0xd1, 0xe8, 0x24, 0xc0, 0x08, 0xc1, 0x88, 0xd6, 0x8a, 0x16, 0x00, 0x08,
|
||||
0xbb, 0x00, 0x7c, 0xb8, 0x01, 0x02, 0xcd, 0x13, 0x72, 0x16, 0x5e, 0x81,
|
||||
0x3e, 0xfe, 0x7d, 0x55, 0xaa, 0x75, 0x08, 0xfa, 0xea, 0x00, 0x7c, 0x00,
|
||||
0x00, 0x77, 0x05, 0xbe, 0xf0, 0x06, 0xeb, 0x03, 0xbe, 0x0b, 0x07, 0xac,
|
||||
0x30, 0xc0, 0x74, 0x09, 0xb4, 0x0e, 0xbb, 0x07, 0x00, 0xcd, 0x10, 0xeb,
|
||||
0xf2, 0xeb, 0xfe, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d,
|
||||
0x0d, 0x0a, 0x00, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x69, 0x6e, 0x67, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x0d, 0x0a, 0x00
|
||||
0x33, 0xc0, 0xfa, 0x8e, 0xd8, 0x8e, 0xd0, 0xbc, 0x00, 0x7c, 0x89, 0xe6,
|
||||
0x06, 0x57, 0x8e, 0xc0, 0xfb, 0xfc, 0xbf, 0x00, 0x06, 0xb9, 0x00, 0x01,
|
||||
0xf3, 0xa5, 0xea, 0x1f, 0x06, 0x00, 0x00, 0x52, 0x52, 0xb4, 0x41, 0xbb,
|
||||
0xaa, 0x55, 0x31, 0xc9, 0x30, 0xf6, 0xf9, 0xcd, 0x13, 0x72, 0x13, 0x81,
|
||||
0xfb, 0x55, 0xaa, 0x75, 0x0d, 0xd1, 0xe9, 0x73, 0x09, 0x66, 0xc7, 0x06,
|
||||
0x8d, 0x06, 0xb4, 0x42, 0xeb, 0x15, 0x5a, 0xb4, 0x08, 0xcd, 0x13, 0x83,
|
||||
0xe1, 0x3f, 0x51, 0x0f, 0xb6, 0xc6, 0x40, 0xf7, 0xe1, 0x52, 0x50, 0x66,
|
||||
0x31, 0xc0, 0x66, 0x99, 0xe8, 0x66, 0x00, 0xe8, 0x35, 0x01, 0x4d, 0x69,
|
||||
0x73, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x0d,
|
||||
0x0a, 0x66, 0x60, 0x66, 0x31, 0xd2, 0xbb, 0x00, 0x7c, 0x66, 0x52, 0x66,
|
||||
0x50, 0x06, 0x53, 0x6a, 0x01, 0x6a, 0x10, 0x89, 0xe6, 0x66, 0xf7, 0x36,
|
||||
0xf4, 0x7b, 0xc0, 0xe4, 0x06, 0x88, 0xe1, 0x88, 0xc5, 0x92, 0xf6, 0x36,
|
||||
0xf8, 0x7b, 0x88, 0xc6, 0x08, 0xe1, 0x41, 0xb8, 0x01, 0x02, 0x8a, 0x16,
|
||||
0xfa, 0x7b, 0xcd, 0x13, 0x8d, 0x64, 0x10, 0x66, 0x61, 0xc3, 0xe8, 0xc4,
|
||||
0xff, 0xbe, 0xbe, 0x7d, 0xbf, 0xbe, 0x07, 0xb9, 0x20, 0x00, 0xf3, 0xa5,
|
||||
0xc3, 0x66, 0x60, 0x89, 0xe5, 0xbb, 0xbe, 0x07, 0xb9, 0x04, 0x00, 0x31,
|
||||
0xc0, 0x53, 0x51, 0xf6, 0x07, 0x80, 0x74, 0x03, 0x40, 0x89, 0xde, 0x83,
|
||||
0xc3, 0x10, 0xe2, 0xf3, 0x48, 0x74, 0x5b, 0x79, 0x39, 0x59, 0x5b, 0x8a,
|
||||
0x47, 0x04, 0x3c, 0x0f, 0x74, 0x06, 0x24, 0x7f, 0x3c, 0x05, 0x75, 0x22,
|
||||
0x66, 0x8b, 0x47, 0x08, 0x66, 0x8b, 0x56, 0x14, 0x66, 0x01, 0xd0, 0x66,
|
||||
0x21, 0xd2, 0x75, 0x03, 0x66, 0x89, 0xc2, 0xe8, 0xac, 0xff, 0x72, 0x03,
|
||||
0xe8, 0xb6, 0xff, 0x66, 0x8b, 0x46, 0x1c, 0xe8, 0xa0, 0xff, 0x83, 0xc3,
|
||||
0x10, 0xe2, 0xcc, 0x66, 0x61, 0xc3, 0xe8, 0x76, 0x00, 0x4d, 0x75, 0x6c,
|
||||
0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||
0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x0d, 0x0a, 0x66, 0x8b, 0x44, 0x08, 0x66, 0x03, 0x46, 0x1c, 0x66, 0x89,
|
||||
0x44, 0x08, 0xe8, 0x30, 0xff, 0x72, 0x27, 0x66, 0x81, 0x3e, 0x00, 0x7c,
|
||||
0x58, 0x46, 0x53, 0x42, 0x75, 0x09, 0x66, 0x83, 0xc0, 0x04, 0xe8, 0x1c,
|
||||
0xff, 0x72, 0x13, 0x81, 0x3e, 0xfe, 0x7d, 0x55, 0xaa, 0x0f, 0x85, 0xf2,
|
||||
0xfe, 0xbc, 0xfa, 0x7b, 0x5a, 0x5f, 0x07, 0xfa, 0xff, 0xe4, 0xe8, 0x1e,
|
||||
0x00, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x73,
|
||||
0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x20, 0x65,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x2e, 0x0d, 0x0a, 0x5e, 0xac, 0xb4, 0x0e, 0x8a,
|
||||
0x3e, 0x62, 0x04, 0xb3, 0x07, 0xcd, 0x10, 0x3c, 0x0a, 0x75, 0xf1, 0xcd,
|
||||
0x18, 0xf4, 0xeb, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* First 440 bytes of a zeroed MBR (disk signature is excluded) */
|
||||
/* First 446 bytes of a zeroed MBR*/
|
||||
unsigned char mbr_zero_0x0[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -36,4 +36,6 @@ unsigned char mbr_zero_0x0[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ int write_partition_number_of_heads(FILE *fp, int iHeads);
|
|||
int write_partition_start_sector_number(FILE *fp, int iStartSector);
|
||||
|
||||
/* Writes a physical disk drive id of 0x80 (for C:) to a partition */
|
||||
int write_partition_physical_disk_drive_id_fat16(FILE *fp);
|
||||
int write_partition_physical_disk_drive_id_fat32(FILE *fp);
|
||||
int write_partition_physical_disk_drive_id_fat16(FILE *fp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,13 +55,13 @@ int write_partition_start_sector_number(FILE *fp, int iStartSector)
|
|||
int write_partition_physical_disk_drive_id_fat32(FILE *fp)
|
||||
{
|
||||
unsigned char ucId = 0x80; /* C: */
|
||||
|
||||
|
||||
return write_data(fp, 0x40, &ucId, 1);
|
||||
} /* write_partition_physical_disk_drive_id_fat32 */
|
||||
|
||||
int write_partition_physical_disk_drive_id_fat16(FILE *fp)
|
||||
{
|
||||
unsigned char ucId = 0x80; /* C: */
|
||||
|
||||
|
||||
return write_data(fp, 0x24, &ucId, 1);
|
||||
} /* write_partition_physical_disk_drive_id_fat16 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue