ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2015
----- 2025 -----
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
535 discussions
Start a n
N
ew thread
[dquintana] 69140: [FATTEN] * Allow customizing the 8-letter volume label from the FAT header. * Make the efisys.bin have EFIBOOT as a label. * Improve a bit the help text.
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Sep 9 03:01:14 2015 New Revision: 69140 URL:
http://svn.reactos.org/svn/reactos?rev=69140&view=rev
Log: [FATTEN] * Allow customizing the 8-letter volume label from the FAT header. * Make the efisys.bin have EFIBOOT as a label. * Improve a bit the help text. Modified: trunk/reactos/boot/CMakeLists.txt trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/CMakeLists.txt?
…
[View More]
rev=69…
============================================================================== --- trunk/reactos/boot/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/CMakeLists.txt [iso-8859-1] Wed Sep 9 03:01:14 2015 @@ -16,7 +16,7 @@ endif() add_custom_target(efisys - COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi + COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 EFIBOOT -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi DEPENDS native-fatten bootmgfw fat VERBATIM) Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
============================================================================== --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Sep 9 03:01:14 2015 @@ -8,6 +8,7 @@ #include <stdio.h> #include <string.h> #include <time.h> +#include <ctype.h> #include "fatfs/ff.h" #include "fatfs/diskio.h" @@ -93,19 +94,30 @@ void print_help(char const * const name) { printf("Syntax: %s image_file [list of commands]\n\n", name); - printf("Commands: [Note: both '/' and '-' are accepted as command prefixes.] \n"); - printf(" /format <sectors> [<filesystem>] Formats the disk image.\n"); - printf(" /boot <sector file> Writes a new boot sector.\n"); - printf(" /add <src path> <dst path> Copies an external file or directory\n" - " into the image.\n"); - printf(" /extract <src path> <dst path> Copies a file or directory from the image\n" - " into an external file or directory.\n"); - printf(" /move <src path> <new path> Moves/renames a file or directory.\n"); - printf(" /copy <src path> <new path> Copies a file or directory.\n"); - printf(" /mkdir <src path> <new path> Creates a directory.\n"); - printf(" /rmdir <src path> <new path> Creates a directory.\n"); - printf(" /list [<pattern>] Lists files a directory (defaults to root).\n"); - //printf(" /recursive Enables recursive processing for directories.\n"); +#if _WIN32 + printf("Commands: [Note: both '/' and '-' are accepted as command prefixes.]\n"); +#else + printf("Commands:\n"); +#endif + printf(" -format <sectors> [<filesystem>]\n" + " Formats the disk image.\n"); + printf(" -boot <sector file> [<custom header label>]\n" + " Writes a new boot sector.\n"); + printf(" -add <src path> <dst path>\n" + " Copies an external file or directory into the image.\n"); + printf(" -extract <src path> <dst path>\n" + " Copies a file or directory from the image into an external file\n" + " or directory.\n"); + printf(" -move <src path> <new path>\n" + " Moves/renames a file or directory.\n"); + printf(" -copy <src path> <new path>\n" + " Copies a file or directory.\n"); + printf(" -mkdir <src path> <new path>\n" + " Creates a directory.\n"); + printf(" -rmdir <src path> <new path>\n" + " Creates a directory.\n"); + printf(" -list [<pattern>]\n" + " Lists files a directory (defaults to root).\n"); } #define PRINT_HELP_AND_QUIT() \ @@ -167,7 +179,7 @@ // NOTE: The fs driver detects which FAT format fits best based on size int sectors; - NEED_PARAMS(1, 1); + NEED_PARAMS(1, 2); // Arg 1: number of sectors sectors = atoi(argv[0]); @@ -188,6 +200,76 @@ { printf("ERROR: Formatting drive: %d.\n", ret); PRINT_HELP_AND_QUIT(); + } + + // Arg 2: custom header label (optional) + if (nargs > 1) + { + char label[8]; + + int i, invalid=0; + int len = strlen(argv[1]); + + if (len <= 8) + { + // Copy and verify each character + for (i = 0; i < len; i++) + { + char ch = argv[1][i]; + label[i] = ch; + + if (!isupper(ch) && !isspace(ch)) + { + invalid =1; + break; + } + } + + if (!invalid) + { + // Pad the label with spaces + while (len < 8) + { + label[len++] = ' '; + } + } + } + else + { + invalid = 1; + } + + if (invalid) + { + printf("Error: header label is limited to 8 uppercase letters and spaces."); + ret = 1; + goto exit; + } + + if (disk_read(0, buff, 0, 1)) + { + printf("Error: unable to read existing boot sector from image."); + ret = 1; + goto exit; + } + + + if (g_Filesystem.fs_type == FS_FAT32) + { + memcpy(buff + 71, label, 8); + } + else + { + memcpy(buff + 43, label, 8); + } + + if (disk_write(0, buff, 0, 1)) + { + printf("Error: unable to write new boot sector to image."); + ret = 1; + goto exit; + } + } } else if (strcmp(parg, "boot") == 0)
[View Less]
9 years, 8 months
1
0
0
0
[hbelusca] 69139: OMGWTFBBQ!!!! We can now boot our ISOs on UEFI systems!! Thanks gigaherz for the "fatten" utility!, and others for testing. [CDMAKE] - Add multi-boot CD support, following El-Tori...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Sep 9 02:11:49 2015 New Revision: 69139 URL:
http://svn.reactos.org/svn/reactos?rev=69139&view=rev
Log: OMGWTFBBQ!!!! We can now boot our ISOs on UEFI systems!! Thanks gigaherz for the "fatten" utility!, and others for testing. [CDMAKE] - Add multi-boot CD support, following El-Torito specification, such that we can the usual ISO boot sector on BIOS-based PCs, and the UEFI loader on UEFI-based PCs. - Load segment should be stored in little endian. - Fix the
…
[View More]
computation of the sector count (count in 512 byte sectors and rounded up). - Rework the command-line options to make them more compatible with CDIMAGE / OSCDIMG. CORE-10120 [BOOTDATA] - Activate the UEFI boot support for our ISOs. Modified: trunk/reactos/boot/CMakeLists.txt trunk/reactos/tools/cdmake/cdmake.c trunk/reactos/tools/cdmake/config.h trunk/reactos/tools/cdmake/dirhash.c trunk/reactos/tools/cdmake/dirhash.h Modified: trunk/reactos/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/CMakeLists.txt?rev=69…
============================================================================== --- trunk/reactos/boot/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/CMakeLists.txt [iso-8859-1] Wed Sep 9 02:11:49 2015 @@ -16,7 +16,7 @@ endif() add_custom_target(efisys - COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.EFI + COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.efi DEPENDS native-fatten bootmgfw fat VERBATIM) @@ -25,8 +25,7 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst "") add_custom_target(bootcd -# COMMAND native-cdmake -j -m -bootdata:2\#p0,e,b${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin\#pEF,e,b${CMAKE_CURRENT_BINARY_DIR}/efisys.bin @${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst REACTOS ${REACTOS_BINARY_DIR}/bootcd.iso - COMMAND native-cdmake -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin @${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst REACTOS ${REACTOS_BINARY_DIR}/bootcd.iso + COMMAND native-cdmake -j -m -bootdata:2\#p0,e,b${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin\#pEF,e,b${CMAKE_CURRENT_BINARY_DIR}/efisys.bin @${CMAKE_CURRENT_BINARY_DIR}/bootcd.lst REACTOS ${REACTOS_BINARY_DIR}/bootcd.iso DEPENDS native-cdmake efisys VERBATIM) @@ -35,8 +34,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst "") add_custom_target(bootcdregtest - COMMAND native-cdmake -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin @${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst REACTOS ${REACTOS_BINARY_DIR}/bootcdregtest.iso - DEPENDS native-cdmake + COMMAND native-cdmake -j -m -bootdata:2\#p0,e,b${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin\#pEF,e,b${CMAKE_CURRENT_BINARY_DIR}/efisys.bin @${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.lst REACTOS ${REACTOS_BINARY_DIR}/bootcdregtest.iso + DEPENDS native-cdmake efisys VERBATIM) ##livecd @@ -49,8 +48,8 @@ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/livecd.lst "Profiles/Default User/Start Menu/Programs\n") add_custom_target(livecd - COMMAND native-cdmake -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin @${CMAKE_CURRENT_BINARY_DIR}/livecd.lst REACTOS ${REACTOS_BINARY_DIR}/livecd.iso - DEPENDS native-cdmake + COMMAND native-cdmake -j -m -bootdata:2\#p0,e,b${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin\#pEF,e,b${CMAKE_CURRENT_BINARY_DIR}/efisys.bin @${CMAKE_CURRENT_BINARY_DIR}/livecd.lst REACTOS ${REACTOS_BINARY_DIR}/livecd.iso + DEPENDS native-cdmake efisys VERBATIM) ##hybridcd @@ -63,11 +62,10 @@ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default User/Start Menu/Programs\n") add_custom_target(hybridcd - COMMAND native-cdmake -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin @${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst REACTOS ${REACTOS_BINARY_DIR}/hybridcd.iso - DEPENDS native-cdmake bootcd livecd + COMMAND native-cdmake -j -m -bootdata:2\#p0,e,b${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin\#pEF,e,b${CMAKE_CURRENT_BINARY_DIR}/efisys.bin @${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst REACTOS ${REACTOS_BINARY_DIR}/hybridcd.iso + DEPENDS native-cdmake efisys bootcd livecd VERBATIM) add_subdirectory(freeldr) add_subdirectory(bootdata) add_subdirectory(environ) - Modified: trunk/reactos/tools/cdmake/cdmake.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Wed Sep 9 02:11:49 2015 @@ -68,6 +68,7 @@ #include "config.h" #include "dirhash.h" +// FIXME! FIXME! Do it in a portable way!! typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long DWORD; @@ -83,8 +84,8 @@ #define SECTOR_SIZE 2048 #define BUFFER_SIZE (8 * SECTOR_SIZE) -const BYTE HIDDEN_FLAG = 1; -const BYTE DIRECTORY_FLAG = 2; +#define HIDDEN_FLAG 1 +#define DIRECTORY_FLAG 2 struct cd_image @@ -96,6 +97,35 @@ char filespecs[128]; BYTE *buffer; }; + +typedef struct _boot_validation_header +{ + BYTE header_id; + BYTE platform_id; +} BOOT_VALIDATION_HEADER, *PBOOT_VALIDATION_HEADER; + +typedef struct boot_entry +{ + struct boot_entry *next_entry; + BYTE boot_id; + BYTE boot_emu_type; + WORD load_segment; + BYTE system_type; + WORD sector_count; // boot_image_size + DWORD load_rba; // boot_image_sector + // BYTE unused[20]; + char bootimage[512]; +} BOOT_ENTRY, *PBOOT_ENTRY; + +typedef struct boot_header +{ + struct boot_header *next_header; + BYTE header_id; + BYTE platform_id; + WORD num_entries; + // char id_string[28]; + PBOOT_ENTRY entry_list; +} BOOT_HEADER, *PBOOT_HEADER; typedef struct date_and_time { @@ -166,11 +196,12 @@ DWORD number_of_directories; DWORD bytes_in_directories; -BOOL eltorito; +BOOL eltorito; // TRUE/FALSE: bootable/non-bootable CD-ROM +BOOL multi_boot; // TRUE/FALSE: multi/single-boot CD-ROM DWORD boot_catalog_sector; -DWORD boot_image_sector; -WORD boot_image_size; // counted in 512 byte sectors -char bootimage[512]; +BOOT_VALIDATION_HEADER boot_validation_header; +BOOT_ENTRY default_boot_entry; +PBOOT_HEADER boot_header_list; BOOL joliet; DWORD joliet_path_table_size; @@ -213,10 +244,24 @@ static void release_memory(void) { + while (boot_header_list) + { + PBOOT_HEADER next_header = boot_header_list->next_header; + + while (boot_header_list->entry_list) + { + PBOOT_ENTRY next_entry = boot_header_list->entry_list->next_entry; + free(boot_header_list->entry_list); + boot_header_list->entry_list = next_entry; + } + + free(boot_header_list); + boot_header_list = next_header; + } + while (root.next_in_memory != NULL) { - struct directory_record *next = - root.next_in_memory->next_in_memory; + PDIR_RECORD next = root.next_in_memory->next_in_memory; if (joliet) free(root.next_in_memory->joliet_name); free(root.next_in_memory); @@ -224,6 +269,7 @@ } if (joliet) free(root.joliet_name); + if (cd.buffer != NULL) { free(cd.buffer); @@ -236,7 +282,7 @@ error exit point in main(). -----------------------------------------------------------------------------*/ -void error_exit(const char* fmt, ...) +static void error_exit(const char* fmt, ...) { va_list arg; @@ -356,7 +402,7 @@ write_byte(*s++); } -static void write_bytecounted_string(unsigned bytecount, char *s) +static void write_bytecounted_string(unsigned bytecount, char *s, char padding) { while (*s != 0 && bytecount != 0) { @@ -365,7 +411,7 @@ } while (bytecount != 0) { - write_byte(' '); + write_byte(padding); bytecount--; } } @@ -383,7 +429,7 @@ } } -static void write_bytecounted_string_as_big_endian_unicode(unsigned bytecount, char *s) +static void write_bytecounted_string_as_big_endian_unicode(unsigned bytecount, char *s, char padding) { unsigned wordcount = bytecount / 2; @@ -394,12 +440,12 @@ } while (wordcount != 0) { - write_big_endian_word(' '); + write_big_endian_word(padding); wordcount--; } if (bytecount % 2 != 0) - write_byte(' '); + write_byte(padding); } /*----------------------------------------------------------------------------- @@ -497,7 +543,7 @@ write_byte(d->flags); write_byte(0); // file unit size for an interleaved file write_byte(0); // interleave gap size for an interleaved file - write_both_endian_word((WORD) 1); // volume sequence number + write_both_endian_word(1); // volume sequence number write_byte((BYTE)identifier_size); switch (DirType) { @@ -575,7 +621,7 @@ #define strcasecmp stricmp #endif//_WIN32 -BOOL cdname_exists(PDIR_RECORD d) +static BOOL cdname_exists(PDIR_RECORD d) { PDIR_RECORD p = d->parent->first_record; while (p) @@ -589,7 +635,7 @@ return FALSE; } -void parse_filename_into_dirrecord(const char* filename, PDIR_RECORD d, BOOL dir) +static void parse_filename_into_dirrecord(const char* filename, PDIR_RECORD d, BOOL dir) { const char *s = filename; char *t = d->name_on_cd; @@ -608,7 +654,8 @@ if ((size_t)(t-d->name_on_cd) < sizeof(d->name_on_cd)-1) *t++ = check_for_punctuation(*s, filename); else if (!joliet) - error_exit("'%s' is not ISO-9660, aborting...", filename); + error_exit("'%s' is not ISO-9660, aborting...", filename); + if ((size_t)(n-d->name) < sizeof(d->name)-1) *n++ = *s; else if (!joliet) @@ -914,7 +961,7 @@ else { if (!getcwd(buf, sizeof(buf))) - error_exit("Can't get CWD: %s\n", strerror(errno)); + error_exit("Cannot get CWD: %s\n", strerror(errno)); strcat(buf, DIR_SEPARATOR_STRING); strcat(buf, source); strcat(buf, entry->d_name); @@ -922,7 +969,7 @@ if (stat(buf, &stbuf) == -1) { - error_exit("Can't access '%s' (%s)\n", buf, strerror(errno)); + error_exit("Cannot access '%s' (%s)\n", buf, strerror(errno)); return; } @@ -944,7 +991,7 @@ } else { - error_exit("Can't open %s\n", source); + error_exit("Cannot open %s\n", source); return; } @@ -976,14 +1023,14 @@ else { if (!getcwd(buf, sizeof(buf))) - error_exit("Can't get CWD: %s\n", strerror(errno)); + error_exit("Cannot get CWD: %s\n", strerror(errno)); strcat(buf, DIR_SEPARATOR_STRING); strcat(buf, source); } if (stat(buf, &stbuf) == -1) { - error_exit("Can't access '%s' (%s)\n", buf, strerror(errno)); + error_exit("Cannot access '%s' (%s)\n", buf, strerror(errno)); return; } new_d = new_directory_record(entry, &stbuf, d); @@ -1004,7 +1051,7 @@ } else { - error_exit("Can't open %s\n", source); + error_exit("Cannot open %s\n", source); return; } @@ -1028,7 +1075,7 @@ else { if (!getcwd(buf, sizeof(buf))) - error_exit("Can't get CWD: %s\n", strerror(errno)); + error_exit("Cannot get CWD: %s\n", strerror(errno)); strcat(buf, DIR_SEPARATOR_STRING); strcat(buf, source); strcat(buf, entry->d_name); @@ -1036,7 +1083,7 @@ if (stat(buf, &stbuf) == -1) { - error_exit("Can't access '%s' (%s)\n", buf, strerror(errno)); + error_exit("Cannot access '%s' (%s)\n", buf, strerror(errno)); return; } @@ -1087,7 +1134,7 @@ } else { - error_exit("Can't open %s\n", source); + error_exit("Cannot open %s\n", source); return; } @@ -1172,18 +1219,18 @@ FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { - error_exit("Can't open timestamp file %s\n", file->source_name); + error_exit("Cannot open timestamp file %s\n", file->source_name); } if (!get_cd_file_time(open_file, &d->date_and_time)) { - error_exit("Can't stat timestamp file %s\n", file->source_name); + error_exit("Cannot stat timestamp file %s\n", file->source_name); } CloseHandle(open_file); #else if (stat(file->target_name, &stbuf) == -1) { - error_exit("Can't stat timestamp file %s\n", file->source_name); + error_exit("Cannot stat timestamp file %s\n", file->source_name); } convert_date_and_time(&d->date_and_time, &stbuf.st_ctime); #endif @@ -1208,15 +1255,15 @@ FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { - error_exit("Can't open file %s\n", file->source_name); + error_exit("Cannot open file %s\n", file->source_name); } if (!get_cd_file_time(open_file, &new_d->date_and_time)) { - error_exit("Can't stat file %s\n", file->source_name); + error_exit("Cannot stat file %s\n", file->source_name); } if (!GetFileSizeEx(open_file, &file_size)) { - error_exit("Can't get file size of %s\n", file->source_name); + error_exit("Cannot get file size of %s\n", file->source_name); } new_d->size = new_d->joliet_size = file_size.QuadPart; new_d->orig_name = file->source_name; @@ -1224,7 +1271,7 @@ #else if (stat(file->source_name, &stbuf) == -1) { - error_exit("Can't find '%s' (target %s)\n", + error_exit("Cannot find '%s' (target %s)\n", file->source_name, file->target_name); } @@ -1296,24 +1343,32 @@ static BOOL write_from_file(FILE *file, DWORD size) { - int n; - - fseek(file, 0, SEEK_SET); - while (size > 0) - { - n = BUFFER_SIZE - cd.count; - if ((DWORD)n > size) - n = size; - - if (fread(cd.buffer + cd.count, n, 1, file) < 1) - return FALSE; - - cd.count += n; - if (cd.count == BUFFER_SIZE) - flush_buffer(); - cd.sector += n / SECTOR_SIZE; - cd.offset += n % SECTOR_SIZE; - size -= n; + if (cd.file != NULL) + { + int n; + + fseek(file, 0, SEEK_SET); + while (size > 0) + { + n = BUFFER_SIZE - cd.count; + if ((DWORD)n > size) + n = size; + + if (fread(cd.buffer + cd.count, n, 1, file) < 1) + return FALSE; + + cd.count += n; + if (cd.count == BUFFER_SIZE) + flush_buffer(); + cd.sector += n / SECTOR_SIZE; + cd.offset += n % SECTOR_SIZE; + size -= n; + } + } + else + { + cd.sector += size / SECTOR_SIZE; + cd.offset += size % SECTOR_SIZE; } return TRUE; @@ -1341,30 +1396,30 @@ write_string("\1CD001\1"); write_byte(0); - write_bytecounted_string(32, ""); // system identifier - write_bytecounted_string(32, volume_label); // volume label + write_bytecounted_string(32, "", ' '); // system identifier + write_bytecounted_string(32, volume_label, ' '); // volume label write_block(8, 0); write_both_endian_dword(total_sectors); write_block(32, 0); - write_both_endian_word((WORD) 1); // volume set size - write_both_endian_word((WORD) 1); // volume sequence number - write_both_endian_word((WORD) 2048); // sector size + write_both_endian_word(1); // volume set size + write_both_endian_word(1); // volume sequence number + write_both_endian_word(2048); // sector size write_both_endian_dword(path_table_size); write_little_endian_dword(little_endian_path_table_sector); - write_little_endian_dword((DWORD) 0); // second little endian path table + write_little_endian_dword(0); // second little endian path table write_big_endian_dword(big_endian_path_table_sector); - write_big_endian_dword((DWORD) 0); // second big endian path table + write_big_endian_dword(0); // second big endian path table write_directory_record(&root, DOT_RECORD, FALSE); - write_bytecounted_string(128, volume_label); // volume set identifier - write_bytecounted_string(128, PUBLISHER_ID); // publisher identifier - write_bytecounted_string(128, DATA_PREP_ID); // data preparer identifier - write_bytecounted_string(128, APP_ID); // application identifier - - write_bytecounted_string(37, ""); // copyright file identifier - write_bytecounted_string(37, ""); // abstract file identifier - write_bytecounted_string(37, ""); // bibliographic file identifier + write_bytecounted_string(128, volume_label, ' '); // volume set identifier + write_bytecounted_string(128, PUBLISHER_ID, ' '); // publisher identifier + write_bytecounted_string(128, DATA_PREP_ID, ' '); // data preparer identifier + write_bytecounted_string(128, APP_ID, ' '); // application identifier + + write_bytecounted_string(37, "", ' '); // copyright file identifier + write_bytecounted_string(37, "", ' '); // abstract file identifier + write_bytecounted_string(37, "", ' '); // bibliographic file identifier write_string(timestring); // volume creation write_byte(0); @@ -1382,10 +1437,9 @@ // Boot Volume Descriptor if (eltorito) { - write_byte(0); + write_byte(0); // Boot record ID write_string("CD001\1"); - write_string("EL TORITO SPECIFICATION"); // identifier - write_block(9, 0); // padding + write_bytecounted_string(32, "EL TORITO SPECIFICATION", 0); // El-Torito identifier write_block(32, 0); // unused write_little_endian_dword(boot_catalog_sector); // pointer to boot catalog fill_sector(); @@ -1396,31 +1450,31 @@ { write_string("\2CD001\1"); write_byte(0); - write_bytecounted_string_as_big_endian_unicode(32, ""); // system identifier - write_bytecounted_string_as_big_endian_unicode(32, volume_label); // volume label + write_bytecounted_string_as_big_endian_unicode(32, "", ' '); // system identifier + write_bytecounted_string_as_big_endian_unicode(32, volume_label, ' '); // volume label write_block(8, 0); write_both_endian_dword(total_sectors); write_string("%/E"); write_block(29, 0); - write_both_endian_word((WORD) 1); // volume set size - write_both_endian_word((WORD) 1); // volume sequence number - write_both_endian_word((WORD) 2048); // sector size + write_both_endian_word(1); // volume set size + write_both_endian_word(1); // volume sequence number + write_both_endian_word(2048); // sector size write_both_endian_dword(joliet_path_table_size); write_little_endian_dword(joliet_little_endian_path_table_sector); - write_little_endian_dword((DWORD) 0); // second little endian path table + write_little_endian_dword(0); // second little endian path table write_big_endian_dword(joliet_big_endian_path_table_sector); - write_big_endian_dword((DWORD) 0); // second big endian path table + write_big_endian_dword(0); // second big endian path table write_directory_record(&root, DOT_RECORD, TRUE); - write_bytecounted_string_as_big_endian_unicode(128, volume_label); // volume set identifier - write_bytecounted_string_as_big_endian_unicode(128, PUBLISHER_ID); // publisher identifier - write_bytecounted_string_as_big_endian_unicode(128, DATA_PREP_ID); // data preparer identifier - write_bytecounted_string_as_big_endian_unicode(128, APP_ID); // application identifier - - write_bytecounted_string_as_big_endian_unicode(37, ""); // copyright file identifier - write_bytecounted_string_as_big_endian_unicode(37, ""); // abstract file identifier - write_bytecounted_string_as_big_endian_unicode(37, ""); // bibliographic file identifier + write_bytecounted_string_as_big_endian_unicode(128, volume_label, ' '); // volume set identifier + write_bytecounted_string_as_big_endian_unicode(128, PUBLISHER_ID, ' '); // publisher identifier + write_bytecounted_string_as_big_endian_unicode(128, DATA_PREP_ID, ' '); // data preparer identifier + write_bytecounted_string_as_big_endian_unicode(128, APP_ID, ' '); // application identifier + + write_bytecounted_string_as_big_endian_unicode(37, "", ' '); // copyright file identifier + write_bytecounted_string_as_big_endian_unicode(37, "", ' '); // abstract file identifier + write_bytecounted_string_as_big_endian_unicode(37, "", ' '); // bibliographic file identifier write_string(timestring); // volume creation write_byte(0); @@ -1439,40 +1493,72 @@ write_string("\377CD001\1"); fill_sector(); - // Boot Catalog + // Boot Catalog and Images if (eltorito) { + PBOOT_HEADER header; + PBOOT_ENTRY entry; + + // Boot Catalog + boot_catalog_sector = cd.sector; - // Validation entry - write_byte(1); - write_byte(0); // x86 boot code + // Validation entry header + write_byte(boot_validation_header.header_id); + write_byte(boot_validation_header.platform_id); write_little_endian_word(0); // reserved - write_string("ReactOS Foundation"); - write_block(6, 0); // padding + write_bytecounted_string(24, MANUFACTURER_ID, 0); // Manufacturer identifier write_little_endian_word(0x62E); // checksum // FIXME: This is hardcoded!! write_little_endian_word(0xAA55); // signature - // default entry - write_byte(0x88); // bootable - write_byte(0); // no emulation - write_big_endian_word(0); // load segment = default (0x07c0) + // Default entry + write_byte(default_boot_entry.boot_id); + write_byte(default_boot_entry.boot_emu_type); + write_little_endian_word(default_boot_entry.load_segment); write_byte(0); // partition type write_byte(0); // unused - write_little_endian_word(boot_image_size); // sector count - write_little_endian_dword(boot_image_sector); // sector + write_little_endian_word(default_boot_entry.sector_count); + write_little_endian_dword(default_boot_entry.load_rba); + write_block(20, 0); // unused + + // Loop through each boot header + header = boot_header_list; + while (header) + { + write_byte(header->header_id); + write_byte(header->platform_id); + write_little_endian_word(header->num_entries); + write_block(28, 0); // Identifier string (unused) + + // Loop through each boot entry + entry = header->entry_list; + while (entry) + { + write_byte(entry->boot_id); + write_byte(entry->boot_emu_type); + write_little_endian_word(entry->load_segment); + write_byte(0); // partition type + write_byte(0); // unused + write_little_endian_word(entry->sector_count); + write_little_endian_dword(entry->load_rba); + write_block(20, 0); // Selection criteria (unused) + + entry = entry->next_entry; + } + + header = header->next_header; + } fill_sector(); - } - - // Boot Image - if (eltorito) - { - boot_image_sector = cd.sector; - - file = fopen(bootimage, "rb"); + + + // Boot Images + + default_boot_entry.load_rba = cd.sector; + + file = fopen(default_boot_entry.bootimage, "rb"); if (file == NULL) - error_exit("Can't open %s\n", bootimage); + error_exit("Cannot open %s\n", default_boot_entry.bootimage); fseek(file, 0, SEEK_END); size = ftell(file); if (size == 0 || (size % 2048)) @@ -1480,13 +1566,50 @@ fclose(file); error_exit("Invalid boot image size (%lu bytes)\n", size); } - boot_image_size = size / 512; + // Sector count in 512 byte sectors and rounded up + default_boot_entry.sector_count = (size + 511) / 512; if (!write_from_file(file, size)) { fclose(file); - error_exit("Read error in file %s\n", bootimage); + error_exit("Read error in file %s\n", default_boot_entry.bootimage); } fclose(file); + + // Loop through each boot header + header = boot_header_list; + while (header) + { + // Loop through each boot entry + entry = header->entry_list; + while (entry) + { + entry->load_rba = cd.sector; + + file = fopen(entry->bootimage, "rb"); + if (file == NULL) + error_exit("Cannot open %s\n", entry->bootimage); + fseek(file, 0, SEEK_END); + size = ftell(file); + if (size == 0 || (size % 2048)) + { + fclose(file); + error_exit("Invalid boot image size (%lu bytes)\n", size); + } + // Sector count in 512 byte sectors and rounded up + entry->sector_count = (size + 511) / 512; + if (!write_from_file(file, size)) + { + fclose(file); + error_exit("Read error in file %s\n", entry->bootimage); + } + fclose(file); + + entry = entry->next_entry; + } + + header = header->next_header; + } + // fill_sector(); } @@ -1495,7 +1618,7 @@ write_byte(1); write_byte(0); // number of sectors in extended attribute record write_little_endian_dword(root.sector); - write_little_endian_word((WORD) 1); + write_little_endian_word(1); write_byte(0); write_byte(0); @@ -1524,7 +1647,7 @@ write_byte(1); write_byte(0); // number of sectors in extended attribute record write_big_endian_dword(root.sector); - write_big_endian_word((WORD) 1); + write_big_endian_word(1); write_byte(0); write_byte(0); @@ -1549,7 +1672,7 @@ write_byte(1); write_byte(0); // number of sectors in extended attribute record write_little_endian_dword(root.joliet_sector); - write_little_endian_word((WORD) 1); + write_little_endian_word(1); write_byte(0); write_byte(0); @@ -1573,7 +1696,7 @@ write_byte(1); write_byte(0); // number of sectors in extended attribute record write_big_endian_dword(root.joliet_sector); - write_big_endian_word((WORD) 1); + write_big_endian_word(1); write_byte(0); write_byte(0); @@ -1659,7 +1782,7 @@ printf("Writing contents of %s\n", file_source); file = fopen(file_source, "rb"); if (file == NULL) - error_exit("Can't open %s\n", file_source); + error_exit("Cannot open %s\n", file_source); if (!write_from_file(file, size)) { fclose(file); @@ -1682,32 +1805,79 @@ "Copyright (C) Philip J. Erdelsky\n" "Copyright (C) 2003-2015 ReactOS Team\n" "\n\n" - "CDMAKE [-q] [-v] [-p] [-s N] [-m] [-b bootimage] [-j] source volume image\n" + "CDMAKE [-vN] [-p] [-s N] [-m] [-j] [-pN] [-eN] [-b bootimage]\n" + " [-bootdata:N#<defaultBootEntry>#<bootEntry1>#...#<bootEntryN>]\n" + " source volume image\n" "\n" - " source Specifications of base directory containing all files to\n" - " be written to CD-ROM image\n" - " volume Volume label\n" - " image Image file or device\n" - " -q Quiet mode - display nothing but error messages\n" - " -v Verbose mode - display file information as files are\n" - " scanned and written - overrides -p option\n" - " -p Show progress while writing\n" - " -s N Abort operation before beginning write if image will be\n" - " larger than N megabytes (i.e. 1024*1024*N bytes)\n" - " -m Accept punctuation marks other than underscores in\n" - " names and extensions\n" - " -b bootimage Create bootable ElTorito CD-ROM using 'no emulation' mode\n" - " -j Generate Joliet filename records\n"; + " -vN Verbosity level. Valid values for 'N' are:\n" + " 0: Quiet mode - display nothing but error messages.\n" + " 1: Normal mode (default).\n" + " 2: Verbose mode - display file information as files are\n" + " scanned and written. Overrides the -p option.\n" + " -p Show progress while writing.\n" + " -s N Abort operation before beginning write if image will be larger\n" + " than N megabytes (i.e. 1024*1024*N bytes).\n" + " -m Accept punctuation marks other than underscores in names and\n" + " extensions.\n" + " -j Generate Joliet filename records.\n" + "\n" + " -pN Boot platform ID in hex format (default: 00 for a BIOS system).\n" + " -eN Boot media emulation. Valid values for 'N' are:\n" + " 0 (or nothing): No emulation.\n" + " 1: 1.2Mb diskette.\n" + " 2: 1.44Mb diskette.\n" + " 3: 2.88Mb diskette.\n" + " 4: Hard disk.\n" + " -b bootimage Create a single-boot El-Torito image.\n" + " -bootdata: Create a multi-boot El-Torito image. This option cannot be\n" + " combined with the -b option.\n" + " Syntax:\n" + " -bootdata:N#<defaultBootEntry>#<bootEntry2>#...#<bootEntryN>\n" + " 'N': number of boot entries following.\n" + " defaultBootEntry: The default boot entry, needed in all cases.\n" + " Used by BIOSes which do not support additional boot entries.\n" + " bootEntryX: Additional boot entries.\n" + " - Do not use spaces.\n" + " - Each multi-boot entry must be delimited with a hash symbol (#).\n" + " - Each option for a boot entry must be delimited with a comma (,).\n" + " - Each boot entry must specify the platform ID.\n" + "\n" + " source Specifications of base directory containing all files to be\n" + " written to CD-ROM image.\n" + " volume Volume label.\n" + " image Image file or device.\n"; /*----------------------------------------------------------------------------- Program execution starts here. -----------------------------------------------------------------------------*/ +char* strtok_s(char *str, const char *delim, char **ctx) +{ + if (delim == NULL || ctx == NULL || (str == NULL && *ctx == NULL)) + { + return NULL; + } + + if (!str) + str = *ctx; + + while (*str && strchr(delim, *str)) + str++; + if (!*str) + return NULL; + + *ctx = str + 1; + while (**ctx && !strchr(delim, **ctx)) + (*ctx)++; + if (**ctx) + *(*ctx)++ = '\0'; + + return str; +} + int main(int argc, char **argv) { time_t timestamp = time(NULL); - BOOL q_option = FALSE; - BOOL v_option = FALSE; int i; char *t; @@ -1717,7 +1887,7 @@ return 1; } - // initialize root directory + // Initialize root directory cd.buffer = malloc(BUFFER_SIZE); if (cd.buffer == NULL) @@ -1728,27 +1898,57 @@ root.flags = DIRECTORY_FLAG; convert_date_and_time(&root.date_and_time, ×tamp); - // initialize CD-ROM write buffer + // Initialize CD-ROM write buffer cd.file = NULL; cd.filespecs[0] = 0; - // initialize parameters + // Initialize parameters verbosity = NORMAL; + show_progress = FALSE; size_limit = 0; - show_progress = FALSE; accept_punctuation_marks = FALSE; source[0] = 0; volume_label[0] = 0; - eltorito = FALSE; - - // scan command line arguments + // Initialize boot information + eltorito = FALSE; + multi_boot = FALSE; + boot_validation_header.header_id = 1; // Validation header ID + boot_validation_header.platform_id = 0; // x86/64 BIOS system + default_boot_entry.boot_id = 0x88; // Bootable entry + default_boot_entry.boot_emu_type = 0; // No emulation + default_boot_entry.load_segment = 0; // 0 --> use default 0x07C0 + default_boot_entry.sector_count = 0; + default_boot_entry.load_rba = 0; + default_boot_entry.bootimage[0] = '\0'; + boot_header_list = NULL; + + // Scan command line arguments for (i = 1; i < argc; i++) { - if (memcmp(argv[i], "-s", 2) == 0) + if (strncmp(argv[i], "-v", 2) == 0) + { + t = argv[i] + 2; + if (*t == 0) // Normal verbosity level. + verbosity = NORMAL; + else // Verbosity level in decimal + verbosity = strtoul(t, NULL, 10); + + // Check for validity + if (verbosity > VERBOSE) + verbosity = NORMAL; + + // Disable by default, unless we are in normal verbosity level. + // If progress is still wanted, use '-p'. + if (verbosity == QUIET || verbosity == VERBOSE) + show_progress = FALSE; + } + else if (strcmp(argv[i], "-p") == 0) + show_progress = TRUE; + else if (strncmp(argv[i], "-s", 2) == 0) { t = argv[i] + 2; if (*t == 0) @@ -1758,26 +1958,254 @@ else error_exit("Missing size limit parameter"); } + // size_limit = strtoul(t, NULL, 10); while (isdigit(*t)) size_limit = size_limit * 10 + *t++ - '0'; if (size_limit < 1 || size_limit > 800) error_exit("Invalid size limit"); size_limit <<= 9; // convert megabyte to sector count } - else if (strcmp(argv[i], "-q") == 0) - q_option = TRUE; - else if (strcmp(argv[i], "-v") == 0) - v_option = TRUE; - else if (strcmp(argv[i], "-p") == 0) - show_progress = TRUE; else if (strcmp(argv[i], "-m") == 0) accept_punctuation_marks = TRUE; else if (strcmp(argv[i], "-j") == 0) joliet = TRUE; + else if (strncmp(argv[i], "-e", 2) == 0) + { + // Check whether the multi-boot option '-bootdata:' was already set. + // If so, print an error and bail out. + if (eltorito && multi_boot) + error_exit("Single-boot and multi-boot entries cannot be combined"); + + eltorito = TRUE; + multi_boot = FALSE; + + t = argv[i] + 2; + if (*t == 0) // No emulation + default_boot_entry.boot_emu_type = 0; + else // ID in decimal + default_boot_entry.boot_emu_type = (BYTE)strtoul(t, NULL, 10); + } + else if (strncmp(argv[i], "-p", 2) == 0) + { + // Check whether the multi-boot option '-bootdata:' was already set. + // If so, print an error and bail out. + if (eltorito && multi_boot) + error_exit("Single-boot and multi-boot entries cannot be combined"); + + eltorito = TRUE; + multi_boot = FALSE; + + // Platform ID in hexadecimal + boot_validation_header.platform_id = (BYTE)strtoul(argv[i] + 2, NULL, 16); + } else if (strcmp(argv[i], "-b") == 0) { - strcpy(bootimage, argv[++i]); - eltorito = TRUE; + // Check whether the multi-boot option '-bootdata:' was already set. + // If so, print an error and bail out. + if (eltorito && multi_boot) + error_exit("Single-boot and multi-boot entries cannot be combined"); + + eltorito = TRUE; + multi_boot = FALSE; + + strncpy(default_boot_entry.bootimage, argv[++i], sizeof(default_boot_entry.bootimage)); + default_boot_entry.bootimage[sizeof(default_boot_entry.bootimage)-1] = '\0'; + } + else if (strncmp(argv[i], "-bootdata:", sizeof("-bootdata:") - 1) == 0) + { + char *bootdata, *entry_ctx, *option_ctx; + DWORD num_boot_entries = 0; + + BOOL default_entry = TRUE; // Start by setting the default boot entry + PBOOT_HEADER boot_header = NULL; // Current boot header + PBOOT_ENTRY boot_entry = NULL; // The last boot entry in the current boot header + BYTE platform_id, old_platform_id = 0; + BYTE boot_emu_type; + WORD load_segment; + char bootimage[512]; + + // Check whether the single-boot option '-b' was already set. + // If so, print an error and bail out. + if (eltorito && !multi_boot) + error_exit("Single-boot and multi-boot entries cannot be combined"); + + t = argv[i] + (sizeof("-bootdata:") - 1); + bootdata = strdup(t); + if (bootdata == NULL) + error_exit("Insufficient memory"); + + eltorito = TRUE; + multi_boot = TRUE; + + // FIXME: Paths with '#' or ',' or ' ' inside are not yet supported!! + + // Start parsing... + t = strtok_s(bootdata, "#", &entry_ctx); + if (t == NULL) + { + free(bootdata); + error_exit("Malformed bootdata command"); + } + + num_boot_entries = strtoul(t, NULL, 10); + + while (num_boot_entries--) + { + // Reset to default values + platform_id = 0; // x86/64 BIOS system + boot_emu_type = 0; // No emulation + load_segment = 0; // 0 --> use default 0x07C0 + bootimage[0] = '\0'; + + t = strtok_s(NULL, "#", &entry_ctx); + if (t == NULL) + { + free(bootdata); + error_exit("Malformed bootdata command"); + } + + t = strtok_s(t, ",", &option_ctx); + while (t != NULL) + { + switch (*t++) + { + case 'b': // Boot sector file + { + char *q; + + // Searches for any of the valid separators: + // '#' starts a new boot entry; + // ',' starts a new boot option; + // ' ' finishes the bootdata command. + q = strpbrk(t, "#, "); + if (!q) q = t + strlen(t); + strncpy(bootimage, t, q - t + 1); + break; + } + + case 'p': // Platform ID + { + // Platform ID in hexadecimal + platform_id = (BYTE)strtoul(t, NULL, 16); + break; + } + + case 'e': // No floppy-disk emulation + { + if (*t == 0) // No emulation + boot_emu_type = 0; + else // ID in decimal + boot_emu_type = (BYTE)strtoul(t, NULL, 10); + + break; + } + + case 't': // Loading segment + { + if (*t == 0) // Not specified --> use default 0x07C0 + load_segment = 0; + else // Segment in hexadecimal + load_segment = (BYTE)strtoul(t, NULL, 16); + + break; + } + + default: + free(bootdata); + error_exit("Malformed bootdata command"); + } + + t = strtok_s(NULL, ",", &option_ctx); + } + + // Create a new entry and possibly a boot header + if (default_entry) + { + // Initialize the default boot entry and header + + boot_validation_header.header_id = 1; // Validation header ID + boot_validation_header.platform_id = platform_id; + default_boot_entry.boot_id = 0x88; // Bootable entry + default_boot_entry.boot_emu_type = boot_emu_type; + default_boot_entry.load_segment = load_segment; + + strncpy(default_boot_entry.bootimage, bootimage, sizeof(default_boot_entry.bootimage)); + default_boot_entry.bootimage[sizeof(default_boot_entry.bootimage)-1] = '\0'; + + // Default entry is now initialized. + default_entry = FALSE; + } + else + { + // Initialize a new boot entry + PBOOT_ENTRY old_boot_entry = boot_entry; + + boot_entry = calloc(1, sizeof(*boot_entry)); + if (boot_entry == NULL) + error_exit("Insufficient memory"); + // boot_entry->next_entry = NULL; + + boot_entry->boot_id = 0x88; // Bootable entry + boot_entry->boot_emu_type = boot_emu_type; + boot_entry->load_segment = load_segment; + + strncpy(boot_entry->bootimage, bootimage, sizeof(boot_entry->bootimage)); + boot_entry->bootimage[sizeof(boot_entry->bootimage)-1] = '\0'; + + // Create a new boot header if we don't have one yet + if (boot_header == NULL) + { + boot_header = calloc(1, sizeof(*boot_header)); + if (boot_header == NULL) + error_exit("Insufficient memory"); + + boot_header->header_id = 0x91; // So far this is the last boot header + boot_header->platform_id = platform_id; + // boot_header->next_header = NULL; + // boot_header->num_entries = 0; + // boot_header->entry_list = NULL; + + old_boot_entry = NULL; + old_platform_id = platform_id; + + boot_header_list = boot_header; + } + else + { + // Create a new boot header if we change the platform ID + if (old_platform_id != platform_id) + { + PBOOT_HEADER prev_boot_header = boot_header; + + boot_header = calloc(1, sizeof(*boot_header)); + if (boot_header == NULL) + error_exit("Insufficient memory"); + + boot_header->header_id = 0x91; // So far this is the last boot header + boot_header->platform_id = platform_id; + // boot_header->next_header = NULL; + // boot_header->num_entries = 0; + // boot_header->entry_list = NULL; + + old_boot_entry = NULL; + old_platform_id = platform_id; + + // Link into the header list + prev_boot_header->header_id = 0x90; // The previous boot header was not the last one + prev_boot_header->next_header = boot_header; + } + } + + // Add the entry into the header + ++boot_header->num_entries; + if (old_boot_entry == NULL) + boot_header->entry_list = boot_entry; + else + old_boot_entry->next_entry = boot_entry; + } + } + + free(bootdata); } else if (i + 2 < argc) { @@ -1788,16 +2216,7 @@ else error_exit("Missing command line argument"); } - if (v_option) - { - show_progress = FALSE; - verbosity = VERBOSE; - } - else if (q_option) - { - verbosity = QUIET; - show_progress = FALSE; - } + if (source[0] == 0) error_exit("Missing source directory"); if (volume_label[0] == 0) @@ -1820,13 +2239,13 @@ } else { - char *trimmedline, *targetname, *srcname, *eq; + char *trimmedline, *targetname, *srcname, *eq, *normdir; char lineread[1024]; FILE *f = fopen(source+1, "r"); if (!f) { - error_exit("Can't open cd description %s\n", source+1); + error_exit("Cannot open cd description %s\n", source+1); } while (fgets(lineread, sizeof(lineread), f)) { @@ -1835,7 +2254,6 @@ eq = strchr(trimmedline, '='); if (!eq) { - char *normdir; /* Treat this as a directory name */ targetname = trimmedline; normdir = strdup(targetname); @@ -1852,12 +2270,12 @@ if (_access(srcname, R_OK) == 0) dir_hash_add_file(&specified_files, srcname, targetname); else - error_exit("can't access file '%s' (target %s)\n", srcname, targetname); + error_exit("Cannot access file '%s' (target %s)\n", srcname, targetname); #else if (access(srcname, R_OK) == 0) dir_hash_add_file(&specified_files, srcname, targetname); else - error_exit("can't access file '%s' (target %s)\n", srcname, targetname); + error_exit("Cannot access file '%s' (target %s)\n", srcname, targetname); #endif } } @@ -1877,7 +2295,7 @@ cd.file = NULL; cd.sector = 0; cd.offset = 0; - cd.count = 0; + cd.count = 0; // make non-writing pass over directory structure to obtain the proper // sector numbers and offsets and to determine the size of the image @@ -1909,10 +2327,10 @@ cd.file = fopen(cd.filespecs, "w+b"); if (cd.file == NULL) - error_exit("Can't open image file %s", cd.filespecs); + error_exit("Cannot open image file %s", cd.filespecs); cd.sector = 0; cd.offset = 0; - cd.count = 0; + cd.count = 0; // make writing pass over directory structure Modified: trunk/reactos/tools/cdmake/config.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/config.h?rev=…
============================================================================== --- trunk/reactos/tools/cdmake/config.h [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/config.h [iso-8859-1] Wed Sep 9 02:11:49 2015 @@ -9,6 +9,7 @@ #define DIR_SEPARATOR_STRING "\\" #endif +#define MANUFACTURER_ID "ReactOS Foundation" #define PUBLISHER_ID "ReactOS Foundation" #define DATA_PREP_ID "ReactOS Foundation" #define APP_ID "CDMAKE CD-ROM Premastering Utility" Modified: trunk/reactos/tools/cdmake/dirhash.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirhash.c?rev…
============================================================================== --- trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] Wed Sep 9 02:11:49 2015 @@ -1,3 +1,10 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CD-ROM Maker + * FILE: tools/cdmake/dirhash.c + * PURPOSE: CD-ROM Premastering Utility - Directory names hashing + * PROGRAMMERS: Art Yerkes + */ #include <string.h> #include <stdlib.h> #include <ctype.h> Modified: trunk/reactos/tools/cdmake/dirhash.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirhash.h?rev…
============================================================================== --- trunk/reactos/tools/cdmake/dirhash.h [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/dirhash.h [iso-8859-1] Wed Sep 9 02:11:49 2015 @@ -1,3 +1,10 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CD-ROM Maker + * FILE: tools/cdmake/dirhash.h + * PURPOSE: CD-ROM Premastering Utility - Directory names hashing + * PROGRAMMERS: Art Yerkes + */ #ifndef _DIRHASH_H_ #define _DIRHASH_H_
[View Less]
9 years, 8 months
1
0
0
0
[dquintana] 69138: [FATTEN] * "struct tm" uses years offset on 1900, so we only have to offset by 80 years to make it into a FAT year.
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Sep 9 01:38:21 2015 New Revision: 69138 URL:
http://svn.reactos.org/svn/reactos?rev=69138&view=rev
Log: [FATTEN] * "struct tm" uses years offset on 1900, so we only have to offset by 80 years to make it into a FAT year. Modified: trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
=================================================================
…
[View More]
============= --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Sep 9 01:38:21 2015 @@ -45,7 +45,7 @@ timeinfo->tm_hour, timeinfo->tm_mday, timeinfo->tm_mon, - timeinfo->tm_year - 1980, + timeinfo->tm_year - 80, } };
[View Less]
9 years, 8 months
1
0
0
0
[dquintana] 69137: [FATTEN] * WHO ATE THAT 'b'?! WHO?! * The jump instruction is 3 bytes long, not 2 (and dequick&dirtied a bit while at it).
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Sep 9 01:33:27 2015 New Revision: 69137 URL:
http://svn.reactos.org/svn/reactos?rev=69137&view=rev
Log: [FATTEN] * WHO ATE THAT 'b'?! WHO?! * The jump instruction is 3 bytes long, not 2 (and dequick&dirtied a bit while at it). Modified: trunk/reactos/tools/fatten/fatfs/diskio.c trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/tools/fatten/fatfs/diskio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/diskio.…
==
…
[View More]
============================================================================ --- trunk/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] Wed Sep 9 01:33:27 2015 @@ -30,7 +30,7 @@ driveHandle[0] = fopen(imageFileName, "r+b"); if (!driveHandle[0]) { - driveHandle[0] = fopen(imageFileName, "w+"); + driveHandle[0] = fopen(imageFileName, "w+b"); } if (driveHandle[0] != NULL) Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
============================================================================== --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Sep 9 01:33:27 2015 @@ -232,8 +232,10 @@ } else { - // Quick&dirty hardcoded length. - memcpy(buff + 2, temp + 2, 0x3E - 0x02); +#define FAT16_HEADER_START 3 +#define FAT16_HEADER_END 62 + + memcpy(buff + FAT16_HEADER_START, temp + FAT16_HEADER_START, FAT16_HEADER_END - FAT16_HEADER_START); } if (disk_write(0, buff, 0, 1))
[View Less]
9 years, 8 months
1
0
0
0
[hbelusca] 69136: [FATTEN]: static'ify a variable; do not hardcode array lengths.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Sep 9 00:52:01 2015 New Revision: 69136 URL:
http://svn.reactos.org/svn/reactos?rev=69136&view=rev
Log: [FATTEN]: static'ify a variable; do not hardcode array lengths. Modified: trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
============================================================================== --- trunk/reactos/tools/fatten/fatten.
…
[View More]
c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Sep 9 00:52:01 2015 @@ -11,8 +11,7 @@ #include "fatfs/ff.h" #include "fatfs/diskio.h" -FATFS g_Filesystem; - +static FATFS g_Filesystem; static int isMounted = 0; static char buff[32768]; @@ -277,7 +276,7 @@ goto exit; } - while ((rdlen = fread(buff, 1, 32768, fe)) > 0) + while ((rdlen = fread(buff, 1, sizeof(buff), fe)) > 0) { f_write(&fv, buff, rdlen, &wrlen); } @@ -316,7 +315,7 @@ goto exit; } - while ((f_read(&fe, buff, 32768, &rdlen) == 0) && (rdlen > 0)) + while ((f_read(&fe, buff, sizeof(buff), &rdlen) == 0) && (rdlen > 0)) { fwrite(buff, 1, rdlen, fv); } @@ -362,7 +361,7 @@ goto exit; } - while ((f_read(&fe, buff, 32768, &rdlen) == 0) && (rdlen > 0)) + while ((f_read(&fe, buff, sizeof(buff), &rdlen) == 0) && (rdlen > 0)) { f_write(&fv, buff, rdlen, &wrlen); }
[View Less]
9 years, 8 months
1
0
0
0
[dquintana] 69135: [FATTEN] * Change the number of FAT copies stored by the formatting code to 2. * Implement /BOOT command, to apply a boot sector to the image (FAT12/16 only, for now). * Make use...
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Sep 9 00:49:47 2015 New Revision: 69135 URL:
http://svn.reactos.org/svn/reactos?rev=69135&view=rev
Log: [FATTEN] * Change the number of FAT copies stored by the formatting code to 2. * Implement /BOOT command, to apply a boot sector to the image (FAT12/16 only, for now). * Make use of the command above to finally get the generated efisys.bin loading in 7zip as a floppy. Modified: trunk/reactos/boot/CMakeLists.txt trunk/reactos/tools/fatten/fatfs/ff.c
…
[View More]
trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/boot/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/CMakeLists.txt?rev=69…
============================================================================== --- trunk/reactos/boot/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/CMakeLists.txt [iso-8859-1] Wed Sep 9 00:49:47 2015 @@ -16,8 +16,8 @@ endif() add_custom_target(efisys - COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.EFI - DEPENDS native-fatten bootmgfw + COMMAND native-fatten ${CMAKE_CURRENT_BINARY_DIR}/efisys.bin -format 2880 -boot ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin -mkdir EFI -mkdir EFI/BOOT -add $<TARGET_FILE:bootmgfw> EFI/BOOT/boot${EFI_PLATFORM_ID}.EFI + DEPENDS native-fatten bootmgfw fat VERBATIM) ##bootcd Modified: trunk/reactos/tools/fatten/fatfs/ff.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/ff.c?re…
============================================================================== --- trunk/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] Wed Sep 9 00:49:47 2015 @@ -4058,7 +4058,7 @@ /*-----------------------------------------------------------------------*/ #define N_ROOTDIR12 224 /* Number of root directory entries for FAT12/16 */ #define N_ROOTDIR16 512 /* Number of root directory entries for FAT12/16 */ -#define N_FATS 1 /* Number of FATs (1 or 2) */ +#define N_FATS 2 /* Number of FATs (1 or 2) */ FRESULT f_mkfs ( Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
============================================================================== --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Sep 9 00:49:47 2015 @@ -193,10 +193,58 @@ } else if (strcmp(parg, "boot") == 0) { + FILE* fe; + BYTE* temp = buff + 1024; + NEED_PARAMS(1, 1); // Arg 1: boot file - printf("Not Implemented."); + + fe = fopen(argv[0], "rb"); + + if (!fe) + { + printf("Error: unable to open external file '%s' for reading.", argv[0]); + ret = 1; + goto exit; + } + + if(!fread(buff, 512, 1, fe)) + { + printf("Error: unable to read boot sector from file '%s'.", argv[0]); + ret = 1; + goto exit; + } + + NEED_MOUNT(); + + if(disk_read(0, temp, 0, 1)) + { + printf("Error: unable to read existing boot sector from image."); + ret = 1; + goto exit; + } + + if (g_Filesystem.fs_type == FS_FAT32) + { + printf("TODO: writing boot sectors for FAT32 images not yet supported."); + ret = 1; + goto exit; + } + else + { + // Quick&dirty hardcoded length. + memcpy(buff + 2, temp + 2, 0x3E - 0x02); + } + + if (disk_write(0, buff, 0, 1)) + { + printf("Error: unable to write new boot sector to image."); + ret = 1; + goto exit; + } + + fclose(fe); } else if (strcmp(parg, "add") == 0) {
[View Less]
9 years, 8 months
1
0
0
0
[sginsberg] 69134: [HAL] Remove seemingly deprecated HalPutDmaAdapter. Also reorder exports slightly towards alphabetical order.
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Sep 8 23:42:24 2015 New Revision: 69134 URL:
http://svn.reactos.org/svn/reactos?rev=69134&view=rev
Log: [HAL] Remove seemingly deprecated HalPutDmaAdapter. Also reorder exports slightly towards alphabetical order. Modified: trunk/reactos/hal/hal.spec Modified: trunk/reactos/hal/hal.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal.spec?rev=69134&r1=…
============================================================================== ---
…
[View More]
trunk/reactos/hal/hal.spec [iso-8859-1] (original) +++ trunk/reactos/hal/hal.spec [iso-8859-1] Tue Sep 8 23:42:24 2015 @@ -1,35 +1,20 @@ @ fastcall -arch=arm ExAcquireFastMutex(ptr) @ fastcall -arch=arm ExReleaseFastMutex(ptr) +@ fastcall -arch=arm ExTryToAcquireFastMutex(ptr) @ fastcall -arch=i386 ExAcquireFastMutex(ptr) ntoskrnl.ExiAcquireFastMutex @ fastcall -arch=i386 ExReleaseFastMutex(ptr) ntoskrnl.ExiReleaseFastMutex @ fastcall -arch=i386 ExTryToAcquireFastMutex(ptr) ntoskrnl.ExiTryToAcquireFastMutex -@ fastcall -arch=arm ExTryToAcquireFastMutex(ptr) -@ fastcall HalClearSoftwareInterrupt(long) -@ fastcall HalRequestSoftwareInterrupt(long) -@ fastcall HalSystemVectorDispatchEntry(long long long) -@ fastcall -arch=i386,arm KeAcquireInStackQueuedSpinLock(ptr ptr) -@ fastcall -arch=i386,arm KeAcquireInStackQueuedSpinLockRaiseToSynch(ptr ptr) -@ fastcall -arch=i386,arm KeAcquireSpinLockRaiseToSynch(ptr) -@ fastcall -arch=i386,arm KeAcquireQueuedSpinLock(ptr) -@ fastcall -arch=i386,arm KeAcquireQueuedSpinLockRaiseToSynch(ptr) -@ fastcall -arch=i386,arm KeReleaseInStackQueuedSpinLock(ptr) -@ fastcall -arch=i386,arm KeReleaseQueuedSpinLock(ptr long) -@ fastcall -arch=i386,arm KeTryToAcquireQueuedSpinLock(long ptr) -@ fastcall -arch=i386,arm KeTryToAcquireQueuedSpinLockRaiseToSynch(long ptr) -@ fastcall -arch=i386,arm KfAcquireSpinLock(ptr) -@ fastcall -arch=i386,arm KfLowerIrql(long) -@ fastcall -arch=i386,arm KfRaiseIrql(long) -@ fastcall -arch=i386,arm KfReleaseSpinLock(ptr long) @ stdcall HalAcquireDisplayOwnership(ptr) @ stdcall HalAdjustResourceList(ptr) -@ stdcall HalAllProcessorsStarted() @ stdcall HalAllocateAdapterChannel(ptr ptr long ptr) @ stdcall HalAllocateCommonBuffer(ptr long ptr long) @ stdcall HalAllocateCrashDumpRegisters(ptr ptr) +@ stdcall HalAllProcessorsStarted() @ stdcall HalAssignSlotResources(ptr ptr ptr ptr long long long ptr) @ stdcall -arch=i386,arm HalBeginSystemInterrupt(long long ptr) @ stdcall HalCalibratePerformanceCounter(ptr long long) ;@ stdcall -arch=x86_64 HalCallBios() +@ fastcall HalClearSoftwareInterrupt(long) @ stdcall HalDisableSystemInterrupt(long long) @ stdcall HalDisplayString(str) @ stdcall HalEnableSystemInterrupt(long long long) @@ -44,17 +29,17 @@ @ stdcall HalGetInterruptVector(long long long long ptr ptr) ;@ stdcall -arch=x86_64 HalHandleMcheck() @ stdcall -arch=i386,x86_64 HalHandleNMI(ptr) +@ stdcall HalInitializeProcessor(long ptr) @ stdcall HalInitSystem(long ptr) -@ stdcall HalInitializeProcessor(long ptr) ;@ stdcall -arch=x86_64 HalIsHyperThreadingEnabled() @ stdcall HalMakeBeep(long) @ stdcall HalProcessorIdle() -@ stdcall -arch=i386 HalPutDmaAdapter(ptr) @ stdcall HalQueryDisplayParameters(ptr ptr ptr ptr) @ stdcall HalQueryRealTimeClock(ptr) @ stdcall HalReadDmaCounter(ptr) @ stdcall HalReportResourceUsage() @ stdcall HalRequestIpi(long) +@ fastcall HalRequestSoftwareInterrupt(long) @ stdcall HalReturnToFirmware(long) ;@ stdcall -arch=x86_64 HalSendNMI() ;@ stdcall -arch=x86_64 HalSendSoftwareInterrupt() @@ -70,18 +55,24 @@ @ stdcall HalStopProfileInterrupt(long) @ fastcall -arch=arm HalSweepIcache() @ fastcall -arch=arm HalSweepDcache() +@ fastcall HalSystemVectorDispatchEntry(long long long) ;@ stdcall -arch=x86_64 HalSystemVectorDispatchEntry() @ stdcall HalTranslateBusAddress(long long long long ptr ptr) +@ stdcall -arch=i386,x86_64 IoAssignDriveLetters(ptr str ptr ptr) HalpAssignDriveLetters @ stdcall IoFlushAdapterBuffers(ptr ptr ptr ptr long long) @ stdcall IoFreeAdapterChannel(ptr) @ stdcall IoFreeMapRegisters(ptr ptr long) @ stdcall IoMapTransfer(ptr ptr ptr ptr ptr long) -@ stdcall -arch=i386,x86_64 IoAssignDriveLetters(ptr str ptr ptr) HalpAssignDriveLetters @ stdcall -arch=i386,x86_64 IoReadPartitionTable(ptr long long ptr) HalpReadPartitionTable @ stdcall -arch=i386,x86_64 IoSetPartitionInformation(ptr long long long) HalpSetPartitionInformation @ stdcall -arch=i386,x86_64 IoWritePartitionTable(ptr long long long ptr) HalpWritePartitionTable +@ extern KdComPortInUse +@ fastcall -arch=i386,arm KeAcquireInStackQueuedSpinLock(ptr ptr) +@ fastcall -arch=i386,arm KeAcquireInStackQueuedSpinLockRaiseToSynch(ptr ptr) +@ fastcall -arch=i386,arm KeAcquireQueuedSpinLock(ptr) +@ fastcall -arch=i386,arm KeAcquireQueuedSpinLockRaiseToSynch(ptr) @ stdcall -arch=i386,arm KeAcquireSpinLock(ptr ptr) -@ extern KdComPortInUse +@ fastcall -arch=i386,arm KeAcquireSpinLockRaiseToSynch(ptr) @ stdcall KeFlushWriteBuffer() @ stdcall -arch=i386,arm KeGetCurrentIrql() @ stdcall -arch=i386,arm KeLowerIrql(long) @@ -89,8 +80,16 @@ @ stdcall -arch=i386,arm KeRaiseIrql(long ptr) @ stdcall -arch=i386,arm KeRaiseIrqlToDpcLevel() @ stdcall -arch=i386,arm KeRaiseIrqlToSynchLevel() +@ fastcall -arch=i386,arm KeReleaseInStackQueuedSpinLock(ptr) +@ fastcall -arch=i386,arm KeReleaseQueuedSpinLock(ptr long) @ stdcall -arch=i386,arm KeReleaseSpinLock(ptr long) @ stdcall KeStallExecutionProcessor(long) +@ fastcall -arch=i386,arm KeTryToAcquireQueuedSpinLock(long ptr) +@ fastcall -arch=i386,arm KeTryToAcquireQueuedSpinLockRaiseToSynch(long ptr) +@ fastcall -arch=i386,arm KfAcquireSpinLock(ptr) +@ fastcall -arch=i386,arm KfLowerIrql(long) +@ fastcall -arch=i386,arm KfRaiseIrql(long) +@ fastcall -arch=i386,arm KfReleaseSpinLock(ptr long) @ stdcall -arch=i386,arm READ_PORT_BUFFER_UCHAR(ptr ptr long) @ stdcall -arch=i386,arm READ_PORT_BUFFER_ULONG(ptr ptr long) @ stdcall -arch=i386,arm READ_PORT_BUFFER_USHORT(ptr ptr long)
[View Less]
9 years, 8 months
1
0
0
0
[sginsberg] 69133: - While we are at it, remove a bunch of kernel exports that shouldn't exist. KiEoiHelper stays for now.
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Sep 8 22:58:28 2015 New Revision: 69133 URL:
http://svn.reactos.org/svn/reactos?rev=69133&view=rev
Log: - While we are at it, remove a bunch of kernel exports that shouldn't exist. KiEoiHelper stays for now. Modified: trunk/reactos/ntoskrnl/ntoskrnl.spec Modified: trunk/reactos/ntoskrnl/ntoskrnl.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.spec?rev…
===========================================================================
…
[View More]
=== --- trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] Tue Sep 8 22:58:28 2015 @@ -721,7 +721,7 @@ @ fastcall -arch=i386,arm KefReleaseSpinLockFromDpcLevel(ptr) @ stdcall -arch=i386 Kei386EoiHelper() @ cdecl -arch=x86_64 -private KfRaiseIrql(long) -@ fastcall -arch=i386 KiEoiHelper(ptr) +@ fastcall -arch=i386 KiEoiHelper(ptr) #ReactOS-Specific @ fastcall -arch=i386,arm KiAcquireSpinLock(ptr) @ extern KiBugCheckData @ stdcall KiCheckForKernelApcDelivery() @@ -837,7 +837,6 @@ @ extern NlsOemLeadByteInfo @ stdcall NtAddAtom(wstr long ptr) @ stdcall NtAdjustPrivilegesToken(ptr long ptr long ptr ptr) -@ stdcall -arch=i386,arm NtAlertThread(ptr) @ stdcall NtAllocateLocallyUniqueId(ptr) @ stdcall NtAllocateUuids(ptr ptr ptr ptr) @ stdcall NtAllocateVirtualMemory(ptr ptr long ptr long long) @@ -847,7 +846,6 @@ @ stdcall NtCreateEvent(ptr long ptr long long) @ stdcall NtCreateFile(ptr long ptr ptr ptr long long long long ptr long) @ stdcall NtCreateSection(ptr long ptr ptr long long ptr) -@ stdcall -arch=i386,arm NtCreateTimer(ptr long ptr long) @ stdcall NtDeleteAtom(ptr) @ stdcall NtDeleteFile(ptr) @ stdcall NtDeviceIoControlFile(ptr ptr ptr ptr ptr long ptr long ptr long) @@ -861,7 +859,6 @@ @ stdcall NtMakePermanentObject(ptr) @ stdcall NtMapViewOfSection(ptr ptr ptr long long ptr ptr long long long) @ stdcall NtNotifyChangeDirectoryFile(ptr ptr ptr ptr ptr ptr long long long) -@ stdcall -arch=i386,arm NtOpenEvent(ptr long ptr) @ stdcall NtOpenFile(ptr long ptr ptr long long) @ stdcall NtOpenProcess(ptr long ptr ptr) @ stdcall NtOpenProcessToken(ptr long ptr) @@ -905,12 +902,10 @@ @ stdcall ObCreateObjectType(ptr ptr ptr ptr) @ stdcall ObDeleteCapturedInsertInfo(ptr) @ stdcall ObDereferenceObject(ptr) -@ stdcall -arch=i386,arm ObDereferenceObjectDeferDelete(ptr) @ stdcall ObDereferenceSecurityDescriptor(ptr long) @ stdcall ObFindHandleForObject(ptr ptr ptr ptr ptr) @ stdcall ObGetObjectSecurity(ptr ptr ptr) @ stdcall ObInsertObject(ptr ptr long long ptr ptr) -@ stdcall -arch=i386,arm ObIsKernelHandle(ptr) @ stdcall ObLogSecurityDescriptor(ptr ptr long) @ stdcall ObMakeTemporaryObject(ptr) @ stdcall ObOpenObjectByName(ptr ptr long ptr long ptr ptr) @@ -1054,7 +1049,6 @@ @ stdcall RtlAddAce(ptr long long ptr long) @ stdcall RtlAddAtomToAtomTable(ptr wstr ptr) @ stdcall RtlAddRange(ptr long long long long long long ptr ptr) -@ stdcall -arch=i386,arm RtlAllocateAndInitializeSid(ptr long long long long long long long long long ptr) @ stdcall RtlAllocateHeap(ptr long long) @ stdcall RtlAnsiCharToUnicodeChar(ptr) @ stdcall RtlAnsiStringToUnicodeSize(ptr) RtlxAnsiStringToUnicodeSize @@ -1387,7 +1381,6 @@ @ stdcall SeTokenImpersonationLevel(ptr) @ stdcall SeTokenIsAdmin(ptr) @ stdcall SeTokenIsRestricted(ptr) -@ stdcall SeTokenIsWriteRestricted(ptr) @ extern SeTokenObjectType @ stdcall SeTokenType(ptr) @ stdcall SeUnlockSubjectContext(ptr) @@ -1488,7 +1481,6 @@ @ stdcall ZwQueryDriverEntryOrder(ptr ptr) @ stdcall ZwQueryEaFile(ptr ptr ptr long long ptr long ptr long) @ stdcall ZwQueryFullAttributesFile(ptr ptr) -@ stdcall -arch=i386,arm ZwQueryInformationAtom(ptr long ptr long ptr) @ stdcall ZwQueryInformationFile(ptr ptr ptr long long) @ stdcall ZwQueryInformationJobObject(ptr long ptr long ptr) @ stdcall ZwQueryInformationProcess(ptr long ptr long ptr)
[View Less]
9 years, 8 months
1
0
0
0
[dquintana] 69132: [FATTEN] * Fix the breakage I commited. Hopefully.
by dquintana@svn.reactos.org
Author: dquintana Date: Tue Sep 8 22:20:37 2015 New Revision: 69132 URL:
http://svn.reactos.org/svn/reactos?rev=69132&view=rev
Log: [FATTEN] * Fix the breakage I commited. Hopefully. Modified: trunk/reactos/tools/fatten/fatfs/diskio.c trunk/reactos/tools/fatten/fatfs/diskio.h trunk/reactos/tools/fatten/fatten.c Modified: trunk/reactos/tools/fatten/fatfs/diskio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/diskio.…
================================
…
[View More]
============================================== --- trunk/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] Tue Sep 8 22:20:37 2015 @@ -9,15 +9,56 @@ #include "diskio.h" #include <stdio.h> -extern char* g_imageFileName; - /*-----------------------------------------------------------------------*/ /* Correspondence between physical drive number and image file handles. */ +UINT sectorCount[1] = { 0 }; FILE* driveHandle[1] = { NULL }; const int driveHandleCount = sizeof(driveHandle) / sizeof(FILE*); /*-----------------------------------------------------------------------*/ +/* Open an image file a Drive */ +/*-----------------------------------------------------------------------*/ + +DSTATUS disk_openimage(BYTE pdrv, const char* imageFileName) +{ + if (pdrv < driveHandleCount) + { + if (driveHandle[0] != NULL) + return 0; + + driveHandle[0] = fopen(imageFileName, "r+b"); + if (!driveHandle[0]) + { + driveHandle[0] = fopen(imageFileName, "w+"); + } + + if (driveHandle[0] != NULL) + return 0; + } + return STA_NOINIT; +} + + +/*-----------------------------------------------------------------------*/ +/* Cleanup a Drive */ +/*-----------------------------------------------------------------------*/ + +VOID disk_cleanup( + BYTE pdrv /* Physical drive nmuber (0..) */ + ) +{ + if (pdrv < driveHandleCount) + { + if (driveHandle[pdrv] != NULL) + { + fclose(driveHandle[pdrv]); + driveHandle[pdrv] = NULL; + } + } +} + +/*-----------------------------------------------------------------------*/ /* Inidialize a Drive */ /*-----------------------------------------------------------------------*/ @@ -27,17 +68,7 @@ { if (pdrv == 0) /* only one drive (image file) supported atm. */ { - if (driveHandle[0] != NULL) - return 0; - - driveHandle[0] = fopen(g_imageFileName, "r+b"); - if(!driveHandle[0]) - { - driveHandle[0] = fopen(g_imageFileName, "w+"); - } - - if (driveHandle[0] != NULL) - return 0; + return 0; } return STA_NOINIT; } @@ -58,26 +89,6 @@ return 0; } return STA_NOINIT; -} - - - -/*-----------------------------------------------------------------------*/ -/* Cleanup a Drive */ -/*-----------------------------------------------------------------------*/ - -VOID disk_cleanup( - BYTE pdrv /* Physical drive nmuber (0..) */ - ) -{ - if (pdrv < driveHandleCount) - { - if (driveHandle[pdrv] != NULL) - { - fclose(driveHandle[pdrv]); - driveHandle[pdrv] = NULL; - } - } } /*-----------------------------------------------------------------------*/ @@ -177,18 +188,23 @@ return RES_OK; case GET_SECTOR_COUNT: { - int temp = 0; - if(fseek(driveHandle[pdrv], 0, SEEK_END)) - printf("fseek failed!\n"); - else - temp = ftell(driveHandle[pdrv]); - *(DWORD*)buff = temp/512; + if (sectorCount[pdrv] <= 0) + { + if (fseek(driveHandle[pdrv], 0, SEEK_END)) + printf("fseek failed!\n"); + else + sectorCount[pdrv] = ftell(driveHandle[pdrv]) / 512; + } + + *(DWORD*)buff = sectorCount[pdrv]; return RES_OK; } case SET_SECTOR_COUNT: { int count = *(DWORD*)buff; long size; + + sectorCount[pdrv] = count; fseek(driveHandle[pdrv], 0, SEEK_END); size = ftell(driveHandle[pdrv]) / 512; Modified: trunk/reactos/tools/fatten/fatfs/diskio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/diskio.…
============================================================================== --- trunk/reactos/tools/fatten/fatfs/diskio.h [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatfs/diskio.h [iso-8859-1] Tue Sep 8 22:20:37 2015 @@ -31,10 +31,11 @@ /*---------------------------------------*/ /* Prototypes for disk control functions */ +DSTATUS disk_openimage(BYTE pdrv, const char* imageFileName); +VOID disk_cleanup(BYTE pdrv); DSTATUS disk_initialize (BYTE pdrv); DSTATUS disk_status (BYTE pdrv); -VOID disk_cleanup (BYTE pdrv); DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); @@ -57,7 +58,7 @@ #define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ /* Custom command for image file resizing */ -#define SET_SECTOR_COUNT 253 +#define SET_SECTOR_COUNT 126 #ifdef __cplusplus } Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
============================================================================== --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Tue Sep 8 22:20:37 2015 @@ -11,8 +11,6 @@ #include "fatfs/ff.h" #include "fatfs/diskio.h" -char* g_imageFileName; - FATFS g_Filesystem; static int isMounted = 0; @@ -89,7 +87,7 @@ #define NEED_MOUNT() \ do { ret = need_mount(); if(ret) \ {\ - printf("Error: could not mount image file '%s' (%d). \n", g_imageFileName, ret); \ + printf("Error: could not mount disk (%d). \n", ret); \ PRINT_HELP_AND_QUIT(); \ } } while(0) @@ -136,7 +134,11 @@ PRINT_HELP_AND_QUIT(); } - g_imageFileName = argv[0]; + if (disk_openimage(0, argv[0])) + { + printf("Error: could not open image file '%s'. \n", argv[0]); + PRINT_HELP_AND_QUIT(); + } argc--; argv++; @@ -168,8 +170,6 @@ NEED_PARAMS(1, 1); - NEED_MOUNT(); - // Arg 1: number of sectors sectors = atoi(argv[0]); @@ -181,6 +181,8 @@ } disk_ioctl(0, SET_SECTOR_COUNT, §ors); + + NEED_MOUNT(); ret = f_mkfs("0:", 1, sectors < 4096 ? 1 : 8); if (ret)
[View Less]
9 years, 8 months
1
0
0
0
[dquintana] 69131: [FATTEN] In a failed attempt at getting 7-zip to recognize the fat images, * Updated the fatfs backing library to v0.11a, * Changed the default cluster size to 1 for floppy-sized...
by dquintana@svn.reactos.org
Author: dquintana Date: Tue Sep 8 22:01:05 2015 New Revision: 69131 URL:
http://svn.reactos.org/svn/reactos?rev=69131&view=rev
Log: [FATTEN] In a failed attempt at getting 7-zip to recognize the fat images, * Updated the fatfs backing library to v0.11a, * Changed the default cluster size to 1 for floppy-sized images (< 4096 sectors) and 8 otherwise (4096 was an invalid value), and * Changed the fatfs formatting code to generate FAT12 filesystems more windows-like. I see no reason to
…
[View More]
discard the changes, so here they are. Modified: trunk/reactos/tools/fatten/fatfs/diskio.c trunk/reactos/tools/fatten/fatfs/ff.c trunk/reactos/tools/fatten/fatfs/ff.h trunk/reactos/tools/fatten/fatfs/ffconf.h trunk/reactos/tools/fatten/fatfs/option/ccsbcs.c trunk/reactos/tools/fatten/fatten.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/tools/fatten/fatfs/diskio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/diskio.…
Modified: trunk/reactos/tools/fatten/fatfs/ff.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/ff.c?re…
Modified: trunk/reactos/tools/fatten/fatfs/ff.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/ff.h?re…
Modified: trunk/reactos/tools/fatten/fatfs/ffconf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/ffconf.…
Modified: trunk/reactos/tools/fatten/fatfs/option/ccsbcs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/option/…
Modified: trunk/reactos/tools/fatten/fatten.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=…
[View Less]
9 years, 8 months
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
...
54
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Results per page:
10
25
50
100
200