mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-02 07:39:54 -04:00
parent
ffc9a4e80a
commit
b6bc17b7f4
15 changed files with 204 additions and 23 deletions
|
@ -29,6 +29,7 @@
|
|||
<ClInclude Include="..\inc\br_fat16_0x3e.h" />
|
||||
<ClInclude Include="..\inc\br_fat32fd_0x3f0.h" />
|
||||
<ClInclude Include="..\inc\br_fat32fd_0x52.h" />
|
||||
<ClInclude Include="..\inc\br_fat32kos_0x52.h" />
|
||||
<ClInclude Include="..\inc\br_fat32nt_0x1800.h" />
|
||||
<ClInclude Include="..\inc\br_fat32nt_0x3f0.h" />
|
||||
<ClInclude Include="..\inc\br_fat32nt_0x52.h" />
|
||||
|
@ -49,6 +50,7 @@
|
|||
<ClInclude Include="..\inc\mbr_95b.h" />
|
||||
<ClInclude Include="..\inc\mbr_dos.h" />
|
||||
<ClInclude Include="..\inc\mbr_dos_f2.h" />
|
||||
<ClInclude Include="..\inc\mbr_kolibri.h" />
|
||||
<ClInclude Include="..\inc\mbr_reactos.h" />
|
||||
<ClInclude Include="..\inc\mbr_rufus.h" />
|
||||
<ClInclude Include="..\inc\mbr_syslinux.h" />
|
||||
|
|
|
@ -125,6 +125,12 @@
|
|||
<ClInclude Include="..\inc\mbr_rufus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\br_fat32kos_0x52.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\mbr_kolibri.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\br.c">
|
||||
|
|
|
@ -120,6 +120,16 @@ int is_reactos_mbr(FILE *fp)
|
|||
contains_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
} /* is_reactos_mbr */
|
||||
|
||||
int is_kolibri_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_kolibri_mbr */
|
||||
|
||||
int is_syslinux_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_syslinux.h"
|
||||
|
@ -210,6 +220,16 @@ int write_reactos_mbr(FILE *fp)
|
|||
write_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
} /* write_reactos_mbr */
|
||||
|
||||
int write_kolibri_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_kolibri.h"
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
|
||||
return
|
||||
write_data(fp, 0x0, mbr_kolibri_0x0, sizeof(mbr_kolibri_0x0)) &&
|
||||
write_data(fp, 0x1FE, aucRef, sizeof(aucRef));
|
||||
} /* write_kolibri_mbr */
|
||||
|
||||
int write_syslinux_mbr(FILE *fp)
|
||||
{
|
||||
#include "mbr_syslinux.h"
|
||||
|
|
|
@ -220,3 +220,30 @@ int write_fat_32_ros_br(FILE *fp, int bKeepLabel)
|
|||
write_data(fp, 0x1c00, br_fat32ros_0x1c00, sizeof(br_fat32ros_0x1c00))
|
||||
);
|
||||
} /* write_fat_32_ros_br */
|
||||
|
||||
int entire_fat_32_kos_br_matches(FILE *fp)
|
||||
{
|
||||
#include "br_fat32_0x0.h"
|
||||
#include "br_fat32kos_0x52.h"
|
||||
|
||||
return
|
||||
( contains_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
contains_data(fp, 0x52, br_fat32kos_0x52, sizeof(br_fat32kos_0x52)) );
|
||||
} /* entire_fat_32_kos_br_matches */
|
||||
|
||||
int write_fat_32_kos_br(FILE *fp, int bKeepLabel)
|
||||
{
|
||||
#include "label_11_char.h"
|
||||
#include "br_fat32_0x0.h"
|
||||
#include "br_fat32kos_0x52.h"
|
||||
|
||||
if(bKeepLabel)
|
||||
return
|
||||
( write_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
write_data(fp, 0x52, br_fat32kos_0x52, sizeof(br_fat32kos_0x52)) );
|
||||
else
|
||||
return
|
||||
( write_data(fp, 0x0, br_fat32_0x0, sizeof(br_fat32_0x0)) &&
|
||||
write_data(fp, 0x47, label_11_char, sizeof(label_11_char)) &&
|
||||
write_data(fp, 0x52, br_fat32kos_0x52, sizeof(br_fat32kos_0x52)) );
|
||||
} /* write_fat_32_kos_br */
|
||||
|
|
|
@ -44,6 +44,10 @@ int is_rufus_mbr(FILE *fp);
|
|||
FALSE.The file position will change when this function is called! */
|
||||
int is_reactos_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);
|
||||
|
||||
/* 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);
|
||||
|
@ -80,6 +84,10 @@ int write_rufus_mbr(FILE *fp);
|
|||
FALSE */
|
||||
int write_reactos_mbr(FILE *fp);
|
||||
|
||||
/* Writes a KolibriOS master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_kolibri_mbr(FILE *fp);
|
||||
|
||||
/* Writes a syslinux master boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_syslinux_mbr(FILE *fp);
|
||||
|
|
38
src/ms-sys/inc/br_fat32kos_0x52.h
Normal file
38
src/ms-sys/inc/br_fat32kos_0x52.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
unsigned char br_fat32kos_0x52[] = {
|
||||
0x46, 0x41, 0x54, 0x33, 0x32, 0x20, 0x20, 0x20, 0x80, 0x3C, 0x80, 0x75,
|
||||
0x09, 0x66, 0x8B, 0x44, 0x08, 0x2E, 0x66, 0xA3, 0x1C, 0x7C, 0x66, 0x31,
|
||||
0xC0, 0x8E, 0xD8, 0x8E, 0xD0, 0xBC, 0x00, 0x7C, 0x89, 0xE5, 0x88, 0x16,
|
||||
0x08, 0x7A, 0xFC, 0xFB, 0x68, 0x00, 0x08, 0x07, 0x66, 0x0F, 0xB7, 0x5E,
|
||||
0x0E, 0x66, 0x89, 0x1E, 0x00, 0x7A, 0x8A, 0x46, 0x10, 0x66, 0xF7, 0x66,
|
||||
0x24, 0x66, 0x01, 0xD8, 0x66, 0x0F, 0xB6, 0x5E, 0x0D, 0x01, 0xDB, 0x66,
|
||||
0x29, 0xD8, 0x66, 0xA3, 0x04, 0x7A, 0x66, 0x8B, 0x46, 0x2C, 0x66, 0x25,
|
||||
0xFF, 0xFF, 0xFF, 0x0F, 0x31, 0xDB, 0x89, 0xDF, 0x66, 0x50, 0xE8, 0x62,
|
||||
0x00, 0x0F, 0xB6, 0x4E, 0x0D, 0xC1, 0xE1, 0x04, 0x26, 0x80, 0x3D, 0x00,
|
||||
0x74, 0x4D, 0x51, 0x57, 0xB9, 0x0B, 0x00, 0xBE, 0xCB, 0x7D, 0xF3, 0xA6,
|
||||
0x5F, 0x59, 0x74, 0x0E, 0x83, 0xC7, 0x20, 0xE2, 0xE7, 0x66, 0x58, 0xE8,
|
||||
0x8D, 0x00, 0x73, 0x33, 0x72, 0xCE, 0x66, 0x58, 0x26, 0x8B, 0x45, 0x14,
|
||||
0x25, 0xFF, 0x0F, 0x66, 0xC1, 0xE0, 0x10, 0x26, 0x8B, 0x45, 0x1A, 0x31,
|
||||
0xDB, 0x66, 0x50, 0xE8, 0x21, 0x00, 0x8C, 0xC0, 0x0F, 0xB6, 0x4E, 0x0D,
|
||||
0xC1, 0xE1, 0x05, 0x01, 0xC8, 0x8E, 0xC0, 0x66, 0x58, 0xE8, 0x5F, 0x00,
|
||||
0x72, 0xE5, 0xEA, 0x00, 0x80, 0x00, 0x00, 0xBE, 0xBA, 0x7D, 0xE8, 0x98,
|
||||
0x00, 0xEB, 0xFE, 0x66, 0x0F, 0xB6, 0x4E, 0x0D, 0x66, 0xF7, 0xE1, 0x66,
|
||||
0x03, 0x06, 0x04, 0x7A, 0x66, 0x03, 0x46, 0x1C, 0x06, 0x66, 0x60, 0x6A,
|
||||
0x00, 0x6A, 0x00, 0x66, 0x50, 0x06, 0x53, 0x83, 0xE9, 0x7F, 0x19, 0xC0,
|
||||
0x21, 0xC8, 0x83, 0xC0, 0x7F, 0x50, 0xC1, 0xE0, 0x05, 0x8C, 0xC1, 0x01,
|
||||
0xC1, 0x8E, 0xC1, 0x6A, 0x10, 0xB8, 0x00, 0x42, 0x8A, 0x16, 0x08, 0x7A,
|
||||
0x89, 0xE6, 0xCD, 0x13, 0xBE, 0xD9, 0x7D, 0x72, 0xB9, 0x61, 0x66, 0x61,
|
||||
0x66, 0x83, 0xC0, 0x7F, 0x83, 0xE9, 0x7F, 0x77, 0xC4, 0x07, 0xC3, 0x06,
|
||||
0x1E, 0x07, 0xBB, 0x00, 0x7E, 0x66, 0x50, 0x66, 0xC1, 0xE8, 0x07, 0x66,
|
||||
0x3B, 0x06, 0xF9, 0x7D, 0x74, 0x0F, 0x66, 0xA3, 0xF9, 0x7D, 0x66, 0x03,
|
||||
0x06, 0x00, 0x7A, 0xB9, 0x01, 0x00, 0xE8, 0x9B, 0xFF, 0x66, 0x58, 0x66,
|
||||
0x83, 0xE0, 0x7F, 0x67, 0x66, 0x8B, 0x04, 0x85, 0x00, 0x7E, 0x00, 0x00,
|
||||
0x66, 0x25, 0xFF, 0xFF, 0xFF, 0x0F, 0x66, 0x3D, 0xF7, 0xFF, 0xFF, 0x0F,
|
||||
0xBE, 0xEB, 0x7D, 0x0F, 0x84, 0x67, 0xFF, 0x07, 0xC3, 0xAC, 0x84, 0xC0,
|
||||
0x74, 0x09, 0xB4, 0x0E, 0xBB, 0x07, 0x00, 0xCD, 0x10, 0xEB, 0xF2, 0xC3,
|
||||
0x43, 0x61, 0x6E, 0x6E, 0x6F, 0x74, 0x20, 0x66, 0x69, 0x6E, 0x64, 0x20,
|
||||
0x66, 0x69, 0x6C, 0x65, 0x20, 0x4D, 0x54, 0x4C, 0x44, 0x5F, 0x46, 0x33,
|
||||
0x32, 0x20, 0x20, 0x20, 0x0D, 0x0A, 0x00, 0x44, 0x69, 0x73, 0x6B, 0x20,
|
||||
0x72, 0x65, 0x61, 0x64, 0x20, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x0D, 0x0A,
|
||||
0x00, 0x42, 0x61, 0x64, 0x20, 0x63, 0x6C, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x0D, 0x0A, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x55, 0xAA
|
||||
};
|
|
@ -47,4 +47,13 @@ int entire_fat_32_ros_br_matches(FILE *fp);
|
|||
FALSE */
|
||||
int write_fat_32_ros_br(FILE *fp, int bKeepLabel);
|
||||
|
||||
/* returns TRUE if the file has an exact match of the FAT32 boot record this
|
||||
program would create for KolibriOS, otherwise FALSE.
|
||||
The file position will change when this function is called! */
|
||||
int entire_fat_32_kos_br_matches(FILE *fp);
|
||||
|
||||
/* Writes a FAT32 KolibriOS boot record to a file, returns TRUE on success, otherwise
|
||||
FALSE */
|
||||
int write_fat_32_kos_br(FILE *fp, int bKeepLabel);
|
||||
|
||||
#endif
|
||||
|
|
40
src/ms-sys/inc/mbr_kolibri.h
Normal file
40
src/ms-sys/inc/mbr_kolibri.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* First 440 bytes of MBR from KolibriOS */
|
||||
unsigned char mbr_kolibri_0x0[] = {
|
||||
0x33, 0xC0, 0x8E, 0xD0, 0xBC, 0x00, 0x7C, 0xFB, 0x50, 0x07, 0x50, 0x1F,
|
||||
0xFC, 0xBE, 0x1B, 0x7C, 0xBF, 0x1B, 0x06, 0x50, 0x57, 0xB9, 0xE5, 0x01,
|
||||
0xF3, 0xA4, 0xCB, 0xBD, 0xBE, 0x07, 0xB1, 0x04, 0x38, 0x6E, 0x00, 0x7C,
|
||||
0x09, 0x75, 0x13, 0x83, 0xC5, 0x10, 0xE2, 0xF4, 0xCD, 0x18, 0x8B, 0xF5,
|
||||
0x83, 0xC6, 0x10, 0x49, 0x74, 0x19, 0x38, 0x2C, 0x74, 0xF6, 0xA0, 0xB5,
|
||||
0x07, 0xB4, 0x07, 0x8B, 0xF0, 0xAC, 0x3C, 0x00, 0x74, 0xFC, 0xBB, 0x07,
|
||||
0x00, 0xB4, 0x0E, 0xCD, 0x10, 0xEB, 0xF2, 0x88, 0x4E, 0x10, 0xE8, 0x46,
|
||||
0x00, 0x73, 0x2A, 0xFE, 0x46, 0x10, 0x80, 0x7E, 0x04, 0x0B, 0x74, 0x0B,
|
||||
0x80, 0x7E, 0x04, 0x0C, 0x74, 0x05, 0xA0, 0xB6, 0x07, 0x75, 0xD2, 0x80,
|
||||
0x46, 0x02, 0x06, 0x83, 0x46, 0x08, 0x06, 0x83, 0x56, 0x0A, 0x00, 0xE8,
|
||||
0x21, 0x00, 0x73, 0x05, 0xA0, 0xB6, 0x07, 0xEB, 0xBC, 0x81, 0x3E, 0xFE,
|
||||
0x7D, 0x55, 0xAA, 0x74, 0x0B, 0x80, 0x7E, 0x10, 0x00, 0x74, 0xC8, 0xA0,
|
||||
0xB7, 0x07, 0xEB, 0xA9, 0x8B, 0xFC, 0x1E, 0x57, 0x8B, 0xF5, 0xCB, 0xBF,
|
||||
0x05, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0xBB, 0xAA, 0x55, 0xB4, 0x41, 0xCD,
|
||||
0x13, 0x72, 0x36, 0x81, 0xFB, 0x55, 0xAA, 0x75, 0x30, 0xF6, 0xC1, 0x01,
|
||||
0x74, 0x2B, 0x61, 0x60, 0x6A, 0x00, 0x6A, 0x00, 0xFF, 0x76, 0x0A, 0xFF,
|
||||
0x76, 0x08, 0x6A, 0x00, 0x68, 0x00, 0x7C, 0x6A, 0x01, 0x6A, 0x10, 0xB4,
|
||||
0x42, 0x8B, 0xF4, 0xCD, 0x13, 0x61, 0x61, 0x73, 0x0E, 0x4F, 0x74, 0x0B,
|
||||
0x32, 0xE4, 0x52, 0xCD, 0x13, 0x5A, 0x90, 0xEB, 0xD6, 0x61, 0xF9, 0xC3,
|
||||
0x49, 0x6E, 0x76, 0x61, 0x6C, 0x69, 0x64, 0x20, 0x70, 0x61, 0x72, 0x74,
|
||||
0x69, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x00,
|
||||
0x45, 0x72, 0x72, 0x6F, 0x72, 0x20, 0x6C, 0x6F, 0x61, 0x64, 0x69, 0x6E,
|
||||
0x67, 0x20, 0x6F, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67, 0x20,
|
||||
0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 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, 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, 0x2C, 0x44, 0x63
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue