From a9707cfdf18e5d4463a90f2b63ed2020870b81db Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 Jun 2023 10:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3configfile=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog_chenall.txt | 4 ++++ stage2/asm.S | 31 +++++++++---------------------- stage2/builtins.c | 21 +++++++++++++-------- stage2/console.c | 3 ++- stage2/stage2.c | 4 ++-- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/ChangeLog_chenall.txt b/ChangeLog_chenall.txt index a757bc5..7656587 100644 --- a/ChangeLog_chenall.txt +++ b/ChangeLog_chenall.txt @@ -1,4 +1,8 @@ 更新说明: +2023-06-15 (yaya) + 修正configfile函数文件名溢出。 + 改进color函数帮助信息。issues #414 + 2023-06-05 (yaya) 使用gcc-11高版本编译 diff --git a/stage2/asm.S b/stage2/asm.S index bf2310d..f3c7bff 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -122,35 +122,18 @@ VARIABLE(force_lba) VARIABLE(version_string) .string VERSION -VARIABLE(config_file) +VARIABLE(config_file) //0x821e 配置文件 最长65字节 .string "/menu.lst" - . = EXT_C(main) + 0x34 //0x8234 0x8238-0x8243 12字节未使用!! - - .word 0x14C /* CPU type for i386 and compatibles */ - .word 1 /* there is 1 section */ -VARIABLE(ext_timer) //0x8238 外部定时器 int* - .long 0 -VARIABLE(cursor_state) //0x823C 鼠标状态 int - .long 0 // bit 0=1 show cursor,bit 1=1 show splashimage -VARIABLE(grub_timeout) //0x8240 倒计时 int - .long -1 - - . = EXT_C(main) + 0x44 //0x8244 0x824e-0x8259 18字节未使用!! - - .word 0x00 /* size of optional header */ - .word 3 /* flags: "no relocation" and "valid executable" */ - .word 0x722E /* section name for resources */ - .word 0x7273 - .word 0x63 - . = EXT_C(main) + 0x60 VARIABLE(hotkey_func) //int* //0x8260 外置热键功能 .long 0 - .long 0 //未使用 - .long 0 //未使用 +VARIABLE(ext_timer) //0x8264 外部定时器 int* + .long 0 +VARIABLE(grub_timeout) //0x8268 倒计时 int + .long -1 /* Utilities may use this to locate the bss starting address, * where the "bootlace" signature is placed and preset-menu @@ -379,6 +362,7 @@ VARIABLE(buf_track) VARIABLE(buf_drive) .long -1 VARIABLE(current_x_resolution) //0x834c 当前水平像素 int + .long 0 . = EXT_C(main) + 0x150 @@ -392,6 +376,9 @@ VARIABLE(count_ms) .word 0 VARIABLE(beep_frequency) .word 0 + .byte 0 //0x835b 未使用 +VARIABLE(cursor_state) //0x835C 鼠标状态 int + .long 0 // bit 0=1 show cursor,bit 1=1 show splashimage . = EXT_C(main) + 0x160 diff --git a/stage2/builtins.c b/stage2/builtins.c index 6258b42..4f13e96 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -3370,15 +3370,17 @@ static struct builtin builtin_color = "If you omit HELPTEXT and/or HEADING, then NORMAL is used.\n" "1. Assign colors by target, the order can not be messed up.\n" " The color can be replaced by a placeholder n.\n" - "e.g. color 0x888800000000 0x888800ffff00 0x888800880000 0x88880000ff00. (64 bit number.)\n" + "e.g. color 0x0000888800000000 0x0000888800ffff00 0x0000888800880000 0x000088880000ff00. (64 bit number." + " The upper 32 bits are the background color, and the lower 32 bits are the foreground color.)\n" "2. Can assign colors to a specified target. NORMAL should be in the first place.\n" - "e.g. color normal=0x888800000000. (The rest is the same as NORMAL.)\n" - "e.g. color normal=0x4444440000ffff helptext=0xff0000 highlight=0x00ffff heading=0xffff00\n" - " border=0x00ff00. (Background color from NORMAL.)\n" - "e.g. color standard=0xFFFFFF. (Change the console color.)\n" + "e.g. color normal=0x0000888800000000. (The rest is the same as NORMAL.)\n" + "e.g. color normal=0x004444440000ffff helptext=0xff0000 highlight=0x00ffff heading=0xffff00" + " border=0x0000ff00. (Background color from NORMAL.)\n" + "e.g. color standard=0x00FFFFFF. (Change the console color.)\n" "e.g. color --64bit 0x30. (Make numbers less than 0x100 treated in 64-bit color.)\n" "Display color list if no parameters.\n" - "Use 'echo -rrggbb' to view colors." + "Use 'echo -rrggbb' to view colors.\n" + "note that if in graphics hi-res mode, the background colour for normal text and help text will be ignored and will be set to transparent." }; @@ -3424,8 +3426,11 @@ configfile_func (char *arg, int flags) nul_terminate (arg); /* check possible filename overflow */ - if (grub_strlen (arg) >= ((char *)0x8270 - new_config)) - return ! (errnum = ERR_WONT_FIT); + if (grub_strlen (arg) >= 0x49) //0x821e-0x825f + { + printf_errinfo ("The full path of the configuration file should be less than 73\n"); + return ! (errnum = 0x1234); + } /* Check if the file ARG is present. */ if (! grub_open (arg)) diff --git a/stage2/console.c b/stage2/console.c index 1329045..83113d5 100644 --- a/stage2/console.c +++ b/stage2/console.c @@ -51,7 +51,8 @@ unsigned long long console_color_64bit[COLOR_STATE_MAX] = { /* represents the user defined colors for heading line */ [COLOR_STATE_HEADING] = 0xAAAAAA, /* represents the user defined colors for notes */ - [COLOR_STATE_BORDER] = 0x3399 +// [COLOR_STATE_BORDER] = 0x3399 + [COLOR_STATE_BORDER] = 0xAAAAAA }; diff --git a/stage2/stage2.c b/stage2/stage2.c index bb480b2..59a30bd 100644 --- a/stage2/stage2.c +++ b/stage2/stage2.c @@ -3104,8 +3104,8 @@ extern int graphicsmode_func (char *, int); pxe_restart_config = 1; /* pxe_detect will use configfile to run menu */ /* go ahead and make sure the terminal is setup */ - if (current_term->startup) - (*current_term->startup)(); +// if (current_term->startup) 无用 2023-06-13 +// (*current_term->startup)(); if (! num_entries) {