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
b3982d49
"megatron/vscode:/vscode.git/clone" did not exist on "05ea0cca6b0de8caa340ea52b716a72f3bea4571"
Commit
b3982d49
authored
Jul 11, 2021
by
longpanda
Browse files
Fixed a bug when booting big boot.wim file.
parent
c280baae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
11 deletions
+56
-11
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
+56
-11
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
View file @
b3982d49
...
@@ -882,7 +882,14 @@ static int ventoy_update_before_chain(ventoy_os_param *param, char *isopath)
...
@@ -882,7 +882,14 @@ static int ventoy_update_before_chain(ventoy_os_param *param, char *isopath)
grub_crypto_hash
(
GRUB_MD_SHA1
,
wim_data
->
bin_hash
.
sha1
,
wim_data
->
jump_bin_data
,
wim_data
->
bin_raw_len
);
grub_crypto_hash
(
GRUB_MD_SHA1
,
wim_data
->
bin_hash
.
sha1
,
wim_data
->
jump_bin_data
,
wim_data
->
bin_raw_len
);
security
=
(
wim_security_header
*
)
wim_data
->
new_meta_data
;
security
=
(
wim_security_header
*
)
wim_data
->
new_meta_data
;
if
(
security
->
len
>
0
)
{
rootdir
=
(
wim_directory_entry
*
)(
wim_data
->
new_meta_data
+
((
security
->
len
+
7
)
&
0xFFFFFFF8U
));
rootdir
=
(
wim_directory_entry
*
)(
wim_data
->
new_meta_data
+
((
security
->
len
+
7
)
&
0xFFFFFFF8U
));
}
else
{
rootdir
=
(
wim_directory_entry
*
)(
wim_data
->
new_meta_data
+
8
);
}
/* update all winpeshl.exe dirent entry's hash */
/* update all winpeshl.exe dirent entry's hash */
ventoy_update_all_hash
(
node
,
wim_data
->
new_meta_data
,
rootdir
);
ventoy_update_all_hash
(
node
,
wim_data
->
new_meta_data
,
rootdir
);
...
@@ -1167,7 +1174,48 @@ static void ventoy_windows_fill_override_data_iso9660( grub_uint64_t isosize,
...
@@ -1167,7 +1174,48 @@ static void ventoy_windows_fill_override_data_iso9660( grub_uint64_t isosize,
return
;
return
;
}
}
static
void
ventoy_windows_fill_override_data_udf
(
grub_uint64_t
isosize
,
void
*
override
)
static
int
ventoy_windows_fill_udf_short_ad
(
grub_file_t
isofile
,
grub_uint32_t
curpos
,
wim_tail
*
wim_data
,
grub_uint32_t
new_wim_size
)
{
int
i
;
grub_uint32_t
total
=
0
;
grub_uint32_t
left_size
=
0
;
ventoy_udf_override
*
udf
=
NULL
;
ventoy_udf_override
tmp
[
4
];
grub_memset
(
tmp
,
0
,
sizeof
(
tmp
));
grub_file_seek
(
isofile
,
wim_data
->
override_offset
);
grub_file_read
(
isofile
,
tmp
,
sizeof
(
tmp
));
left_size
=
new_wim_size
;
udf
=
(
ventoy_udf_override
*
)
wim_data
->
override_data
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
total
+=
tmp
[
i
].
length
;
if
(
total
>=
wim_data
->
wim_raw_size
)
{
udf
->
length
=
left_size
;
udf
->
position
=
curpos
;
return
0
;
}
else
{
udf
->
length
=
tmp
[
i
].
length
;
udf
->
position
=
curpos
;
}
left_size
-=
tmp
[
i
].
length
;
curpos
+=
udf
->
length
/
2048
;
udf
++
;
wim_data
->
override_len
+=
sizeof
(
ventoy_udf_override
);
}
debug
(
"######## Too many udf ad ######
\n
"
);
return
1
;
}
static
void
ventoy_windows_fill_override_data_udf
(
grub_file_t
isofile
,
void
*
override
)
{
{
grub_uint32_t
data32
;
grub_uint32_t
data32
;
grub_uint64_t
data64
;
grub_uint64_t
data64
;
...
@@ -1178,9 +1226,8 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
...
@@ -1178,9 +1226,8 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
ventoy_override_chunk
*
cur
;
ventoy_override_chunk
*
cur
;
wim_patch
*
node
=
NULL
;
wim_patch
*
node
=
NULL
;
wim_tail
*
wim_data
=
NULL
;
wim_tail
*
wim_data
=
NULL
;
ventoy_udf_override
*
udf
=
NULL
;
sector
=
(
isosize
+
2047
)
/
2048
;
sector
=
(
iso
file
->
size
+
2047
)
/
2048
;
cur
=
(
ventoy_override_chunk
*
)
override
;
cur
=
(
ventoy_override_chunk
*
)
override
;
...
@@ -1190,7 +1237,7 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
...
@@ -1190,7 +1237,7 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
cur
++
;
cur
++
;
}
}
debug
(
"ventoy_windows_fill_override_data_udf %lu
\n
"
,
(
ulong
)
isosize
);
debug
(
"ventoy_windows_fill_override_data_udf %lu
\n
"
,
(
ulong
)
iso
file
->
size
);
for
(
node
=
g_wim_patch_head
;
node
;
node
=
node
->
next
)
for
(
node
=
g_wim_patch_head
;
node
;
node
=
node
->
next
)
{
{
...
@@ -1231,13 +1278,11 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
...
@@ -1231,13 +1278,11 @@ static void ventoy_windows_fill_override_data_udf( grub_uint64_t isosize, voi
data64
=
new_wim_size
;
data64
=
new_wim_size
;
grub_memcpy
(
cur
->
override_data
,
&
(
data64
),
8
);
grub_memcpy
(
cur
->
override_data
,
&
(
data64
),
8
);
udf
=
(
ventoy_udf_override
*
)
wim_data
->
override_data
;
/* override 3: position and length in extend data */
udf
->
length
=
new_wim_size
;
ventoy_windows_fill_udf_short_ad
(
isofile
,
(
grub_uint32_t
)
sector
-
udf_start_block
,
wim_data
,
new_wim_size
);
udf
->
position
=
(
grub_uint32_t
)
sector
-
udf_start_block
;
sector
+=
(
new_wim_size
/
2048
);
sector
+=
(
new_wim_size
/
2048
);
/* override 3: position and length in extend data */
cur
++
;
cur
++
;
cur
->
img_offset
=
wim_data
->
override_offset
;
cur
->
img_offset
=
wim_data
->
override_offset
;
cur
->
override_size
=
wim_data
->
override_len
;
cur
->
override_size
=
wim_data
->
override_len
;
...
@@ -1631,7 +1676,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
...
@@ -1631,7 +1676,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
}
}
else
else
{
{
ventoy_windows_fill_override_data_udf
(
isosiz
e
,
(
char
*
)
chain
+
chain
->
override_chunk_offset
);
ventoy_windows_fill_override_data_udf
(
fil
e
,
(
char
*
)
chain
+
chain
->
override_chunk_offset
);
}
}
/* part 5: virt chunk */
/* part 5: virt chunk */
...
...
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