Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
1c3fcbdf
Commit
1c3fcbdf
authored
Feb 15, 2022
by
longpanda
Browse files
Skip System Volume Information directory for F2 browser.
parent
7d37cab2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
73 deletions
+87
-73
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
+87
-73
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
View file @
1c3fcbdf
...
@@ -138,62 +138,6 @@ static browser_node * ventoy_browser_find_top_node(int dir)
...
@@ -138,62 +138,6 @@ static browser_node * ventoy_browser_find_top_node(int dir)
return
sel
;
return
sel
;
}
}
static
int
ventoy_browser_check_filename
(
const
char
*
filename
,
int
len
,
int
*
type
)
{
if
(
len
<
4
)
{
return
0
;
}
if
(
FILE_FLT
(
ISO
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".iso"
))
{
*
type
=
img_type_iso
;
}
else
if
(
FILE_FLT
(
WIM
)
&&
g_wimboot_enable
&&
(
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".wim"
)))
{
*
type
=
img_type_wim
;
}
else
if
(
FILE_FLT
(
VHD
)
&&
g_vhdboot_enable
&&
(
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".vhd"
)
||
(
len
>=
5
&&
0
==
grub_strcasecmp
(
filename
+
len
-
5
,
".vhdx"
))))
{
*
type
=
img_type_vhd
;
}
#ifdef GRUB_MACHINE_EFI
else
if
(
FILE_FLT
(
EFI
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".efi"
))
{
*
type
=
img_type_efi
;
}
#endif
else
if
(
FILE_FLT
(
IMG
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".img"
))
{
if
(
len
==
18
&&
grub_strncmp
(
filename
,
"ventoy_"
,
7
)
==
0
)
{
if
(
grub_strncmp
(
filename
+
7
,
"wimboot"
,
7
)
==
0
||
grub_strncmp
(
filename
+
7
,
"vhdboot"
,
7
)
==
0
)
{
return
0
;
}
}
*
type
=
img_type_img
;
}
else
if
(
FILE_FLT
(
VTOY
)
&&
len
>=
5
&&
0
==
grub_strcasecmp
(
filename
+
len
-
5
,
".vtoy"
))
{
*
type
=
img_type_vtoy
;
}
else
{
return
0
;
}
if
(
g_filt_dot_underscore_file
&&
filename
[
0
]
==
'.'
&&
filename
[
1
]
==
'_'
)
{
return
0
;
}
return
1
;
}
static
int
ventoy_browser_iterate_partition
(
struct
grub_disk
*
disk
,
const
grub_partition_t
partition
,
void
*
data
)
static
int
ventoy_browser_iterate_partition
(
struct
grub_disk
*
disk
,
const
grub_partition_t
partition
,
void
*
data
)
{
{
char
partname
[
64
];
char
partname
[
64
];
...
@@ -272,6 +216,91 @@ static int ventoy_browser_iterate_disk(const char *name, void *data)
...
@@ -272,6 +216,91 @@ static int ventoy_browser_iterate_disk(const char *name, void *data)
return
0
;
return
0
;
}
}
static
int
ventoy_browser_valid_dirname
(
const
char
*
name
,
int
len
)
{
if
((
len
==
1
&&
name
[
0
]
==
'.'
)
||
(
len
==
2
&&
name
[
0
]
==
'.'
&&
name
[
1
]
==
'.'
))
{
return
0
;
}
if
(
!
ventoy_img_name_valid
(
name
,
len
))
{
return
0
;
}
if
(
name
[
0
]
==
'$'
)
{
if
(
0
==
grub_strncmp
(
name
,
"$RECYCLE.BIN"
,
12
)
||
0
==
grub_strncasecmp
(
name
,
"$Extend"
,
7
))
{
return
0
;
}
}
if
(
len
==
25
&&
grub_strncmp
(
name
,
"System Volume Information"
,
25
)
==
0
)
{
return
0
;
}
return
1
;
}
static
int
ventoy_browser_valid_filename
(
const
char
*
filename
,
int
len
,
int
*
type
)
{
if
(
len
<
4
)
{
return
0
;
}
if
(
FILE_FLT
(
ISO
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".iso"
))
{
*
type
=
img_type_iso
;
}
else
if
(
FILE_FLT
(
WIM
)
&&
g_wimboot_enable
&&
(
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".wim"
)))
{
*
type
=
img_type_wim
;
}
else
if
(
FILE_FLT
(
VHD
)
&&
g_vhdboot_enable
&&
(
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".vhd"
)
||
(
len
>=
5
&&
0
==
grub_strcasecmp
(
filename
+
len
-
5
,
".vhdx"
))))
{
*
type
=
img_type_vhd
;
}
#ifdef GRUB_MACHINE_EFI
else
if
(
FILE_FLT
(
EFI
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".efi"
))
{
*
type
=
img_type_efi
;
}
#endif
else
if
(
FILE_FLT
(
IMG
)
&&
0
==
grub_strcasecmp
(
filename
+
len
-
4
,
".img"
))
{
if
(
len
==
18
&&
grub_strncmp
(
filename
,
"ventoy_"
,
7
)
==
0
)
{
if
(
grub_strncmp
(
filename
+
7
,
"wimboot"
,
7
)
==
0
||
grub_strncmp
(
filename
+
7
,
"vhdboot"
,
7
)
==
0
)
{
return
0
;
}
}
*
type
=
img_type_img
;
}
else
if
(
FILE_FLT
(
VTOY
)
&&
len
>=
5
&&
0
==
grub_strcasecmp
(
filename
+
len
-
5
,
".vtoy"
))
{
*
type
=
img_type_vtoy
;
}
else
{
return
0
;
}
if
(
g_filt_dot_underscore_file
&&
filename
[
0
]
==
'.'
&&
filename
[
1
]
==
'_'
)
{
return
0
;
}
return
1
;
}
static
int
ventoy_browser_iterate_dir
(
const
char
*
filename
,
const
struct
grub_dirhook_info
*
info
,
void
*
data
)
static
int
ventoy_browser_iterate_dir
(
const
char
*
filename
,
const
struct
grub_dirhook_info
*
info
,
void
*
data
)
{
{
int
type
;
int
type
;
...
@@ -284,26 +313,11 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
...
@@ -284,26 +313,11 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
if
(
info
->
dir
)
if
(
info
->
dir
)
{
{
if
((
len
==
1
&&
filename
[
0
]
==
'.'
)
||
if
(
!
ventoy_browser_valid_dirname
(
filename
,
len
))
(
len
==
2
&&
filename
[
0
]
==
'.'
&&
filename
[
1
]
==
'.'
))
{
{
return
0
;
return
0
;
}
}
if
(
!
ventoy_img_name_valid
(
filename
,
len
))
{
return
0
;
}
if
(
filename
[
0
]
==
'$'
)
{
if
(
0
==
grub_strncmp
(
filename
,
"$RECYCLE.BIN"
,
12
)
||
0
==
grub_strncasecmp
(
filename
,
"$Extend"
,
7
))
{
return
0
;
}
}
node
=
grub_zalloc
(
sizeof
(
browser_node
));
node
=
grub_zalloc
(
sizeof
(
browser_node
));
if
(
!
node
)
if
(
!
node
)
{
{
...
@@ -322,7 +336,7 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
...
@@ -322,7 +336,7 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
{
{
grub_uint64_t
fsize
=
info
->
size
;
grub_uint64_t
fsize
=
info
->
size
;
if
(
ventoy_browser_
check
_filename
(
filename
,
len
,
&
type
)
==
0
)
if
(
!
ventoy_browser_
valid
_filename
(
filename
,
len
,
&
type
))
{
{
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment