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
d05eab2b
Commit
d05eab2b
authored
May 08, 2021
by
longpanda
Browse files
support boot Windows VHD(x) at local disk
parent
849dfb46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
+34
-2
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
View file @
d05eab2b
...
@@ -150,9 +150,12 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
...
@@ -150,9 +150,12 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
static
int
ventoy_vhd_read_parttbl
(
const
char
*
filename
,
ventoy_gpt_info
*
gpt
,
int
*
index
)
static
int
ventoy_vhd_read_parttbl
(
const
char
*
filename
,
ventoy_gpt_info
*
gpt
,
int
*
index
)
{
{
int
i
;
int
ret
=
1
;
int
ret
=
1
;
grub_uint64_t
start
;
grub_file_t
file
=
NULL
;
grub_file_t
file
=
NULL
;
grub_disk_t
disk
=
NULL
;
grub_disk_t
disk
=
NULL
;
grub_uint8_t
zeroguid
[
16
]
=
{
0
};
file
=
grub_file_open
(
filename
,
VENTOY_FILE_TYPE
);
file
=
grub_file_open
(
filename
,
VENTOY_FILE_TYPE
);
if
(
!
file
)
if
(
!
file
)
...
@@ -166,9 +169,38 @@ static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, i
...
@@ -166,9 +169,38 @@ static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, i
goto
end
;
goto
end
;
}
}
*
index
=
file
->
device
->
disk
->
partition
->
index
;
grub_disk_read
(
disk
,
0
,
0
,
sizeof
(
ventoy_gpt_info
),
gpt
);
grub_disk_read
(
disk
,
0
,
0
,
sizeof
(
ventoy_gpt_info
),
gpt
);
start
=
file
->
device
->
disk
->
partition
->
start
;
if
(
grub_memcmp
(
gpt
->
Head
.
Signature
,
"EFI PART"
,
8
)
==
0
)
{
debug
(
"GPT part start: %llu
\n
"
,
(
ulonglong
)
start
);
for
(
i
=
0
;
i
<
128
;
i
++
)
{
if
(
grub_memcmp
(
gpt
->
PartTbl
[
i
].
PartGuid
,
zeroguid
,
16
))
{
if
(
start
==
gpt
->
PartTbl
[
i
].
StartLBA
)
{
*
index
=
i
;
break
;
}
}
}
}
else
{
debug
(
"MBR part start: %llu
\n
"
,
(
ulonglong
)
start
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
((
grub_uint32_t
)
start
==
gpt
->
MBR
.
PartTbl
[
i
].
StartSectorId
)
{
*
index
=
i
;
break
;
}
}
}
ret
=
0
;
ret
=
0
;
end:
end:
...
...
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