[PR #17710] Use a plain char array to pass connection input #31333

Open
opened 2026-01-31 09:46:38 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17710

State: closed
Merged: Yes


HSTRING does not permit strings that aren't null-terminated.
As such we'll simply use a plain char array which compiles down to
a UINT32 and wchar_t* pointer pair. Unfortunately, cppwinrt uses
char16_t in place of wchar_t, and also offers no trivial conversion
between winrt::array_view and std::wstring_view either.
As such, most of this PR is about explicit type casting.

Closes #17697

Validation Steps Performed

  • Patch the DeviceAttributes implementation in adaptDispatch.cpp
    to respond like this:
    _api.ReturnResponse({L"ABCD", 3});
    
  • Open a WSL shell and execute this:
    printf "\e[c"; read
    
  • Doesn't crash ✅
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17710 **State:** closed **Merged:** Yes --- `HSTRING` does not permit strings that aren't null-terminated. As such we'll simply use a plain char array which compiles down to a `UINT32` and `wchar_t*` pointer pair. Unfortunately, cppwinrt uses `char16_t` in place of `wchar_t`, and also offers no trivial conversion between `winrt::array_view` and `std::wstring_view` either. As such, most of this PR is about explicit type casting. Closes #17697 ## Validation Steps Performed * Patch the `DeviceAttributes` implementation in `adaptDispatch.cpp` to respond like this: ```cpp _api.ReturnResponse({L"ABCD", 3}); ``` * Open a WSL shell and execute this: ```sh printf "\e[c"; read ``` * Doesn't crash ✅
claunia added the pull-request label 2026-01-31 09:46:38 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31333