diff --git a/src/windows-emulator/emulator_utils.hpp b/src/windows-emulator/emulator_utils.hpp index a05c5881..5e0b1b25 100644 --- a/src/windows-emulator/emulator_utils.hpp +++ b/src/windows-emulator/emulator_utils.hpp @@ -137,7 +137,7 @@ public: result.Buffer = reinterpret_cast(string_buffer); result.Length = static_cast(total_length); - result.MaximumLength = result.Length; + result.MaximumLength = static_cast(total_length + element_size); } emulator_object make_unicode_string(const std::wstring_view str) diff --git a/src/windows-emulator/windows_emulator.cpp b/src/windows-emulator/windows_emulator.cpp index bd94666e..5e73bb46 100644 --- a/src/windows-emulator/windows_emulator.cpp +++ b/src/windows-emulator/windows_emulator.cpp @@ -235,8 +235,10 @@ namespace command_line.append(arg); } + const auto current_folder = canonical(absolute(file).parent_path()).make_preferred().wstring() + L"\\"; + allocator.make_unicode_string(proc_params.CommandLine, command_line); - //gs.make_unicode_string(proc_params.CurrentDirectory.DosPath, file.parent_path().wstring()); + allocator.make_unicode_string(proc_params.CurrentDirectory.DosPath, current_folder); allocator.make_unicode_string(proc_params.ImagePathName, file.wstring()); const auto total_length = allocator.get_next_address() - context.process_params.value();