Skip to content

Commit c74a312

Browse files
committed
Enhance argument handling in nt_6x_process_create_impl by adding quotation marks around paths
- Updated the process creation logic to include double quotation marks around the image path and process parameters when appending to argv0. - Improved clarity in the handling of DOS and NT paths by ensuring proper formatting during argument construction.
1 parent 21fd346 commit c74a312

File tree

1 file changed

+8
-0
lines changed
  • include/fast_io_hosted/process/process

1 file changed

+8
-0
lines changed

include/fast_io_hosted/process/process/nt.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ inline nt_user_process_information nt_6x_process_create_impl(void *__restrict fh
363363
if (args && !argv0_no_path_append)
364364
{
365365
// Whether argv0 is set to nullptr or points to u"" will automatically populate argv0.
366+
// Neither DOS paths nor NT paths contain double quotation marks internally.
367+
tmp_append.push_back('\"');
366368
tmp_append.append(NtImagePath->Buffer, static_cast<::std::size_t>(NtImagePath->Length / sizeof(char16_t)));
369+
tmp_append.push_back('\"');
370+
tmp_append.push_back(' ');
367371
tmp_append.append(ps_para.Buffer, static_cast<::std::size_t>(ps_para.Length / sizeof(char16_t)));
368372

369373
ps_para.Buffer = tmp_append.data();
@@ -494,7 +498,11 @@ inline nt_user_process_information nt_6x_process_create_impl(void *__restrict fh
494498
if (args && !argv0_no_path_append)
495499
{
496500
// Whether argv0 is set to nullptr or points to u"" will automatically populate argv0.
501+
// Neither DOS paths nor NT paths contain double quotation marks internally.
502+
tmp_append.push_back('\"');
497503
tmp_append.append(str_uni.Buffer, static_cast<::std::size_t>(str_uni.Length / sizeof(char16_t)));
504+
tmp_append.push_back('\"');
505+
tmp_append.push_back(' ');
498506
tmp_append.append(ps_para.Buffer, static_cast<::std::size_t>(ps_para.Length / sizeof(char16_t)));
499507

500508
ps_para.Buffer = tmp_append.data();

0 commit comments

Comments
 (0)