Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: fix accept/deny prompt on Windows #55

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

benma
Copy link
Contributor

@benma benma commented Aug 28, 2024

Launching the browser is prohibited from a Windows service. WTSSendMessageA seems to be the only thing that works. See comments in the commit.

@@ -17,7 +17,7 @@ release-linux:
docker run --user ${USER} --interactive --tty -v ${MOUNT} -w /bitbox-bridge ${CONTAINER} bitbox-bridge/release/linux/release.sh

release-windows:
docker run --user ${USER} --interactive --tty -v ${MOUNT} -w /bitbox-bridge ${CONTAINER} bitbox-bridge/release/windows/release.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no - I locally removed the user as I am using podman. The other repos we have are compatible with either, but this one not yet. Reverted

Comment on lines 224 to 225
message_c.as_ptr() as *const u8,
message_c.as_c_str().count_bytes() as u32,
Copy link
Contributor Author

@benma benma Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondered about encoding.

WTSSendMessageA uses ANSI encoding, while WTSSendMessageW uses UTF-16 encoding.

The message includes the origin.host() string, which could include utf8 right? In the worst case the message box would show a borked string.

I should probably try to figure out how to convert it to UTF16 and switch to WTSSendMessageW 🤔 The only question is if the WTSSendMessageW version also works in the service, the docs only mention WTSSendMessageA

Copy link
Contributor Author

@benma benma Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NickeZ I did this now and it works better than expected. I tested with this modified msg including some random unicode chars:

format!("Allow {} to connect to your BitBox Ɯ ⓴ ▗ ◕ ⚲ ⛵ ✅ ?", host), and the unicode symbols were actually all shown on my Win11:

Screenshot_2024-08-29_12-14-39

PR updated and ready for review again.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow cool

Launching the browser is prohibited from a Windows
service. `WTSSendMessageA` seems to be the only thing that works. See
comments in the commit.
Copy link
Collaborator

@NickeZ NickeZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK!

@benma benma merged commit 6338520 into BitBoxSwiss:master Sep 4, 2024
5 checks passed
@benma benma deleted the win-prompt branch September 4, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants