Repository navigation
winterm: replace more code for golang.org/x/windows - #53
Merged
Merged
Conversation
Sebastiaan van Stijn (thaJeztah)
force-pushed
the
more_x_win
branch
from
October 7, 2026 10:59
ff0da1d to
fc86449
Compare
2 tasks done
Sebastiaan van Stijn (thaJeztah)
force-pushed
the
more_x_win
branch
from
October 8, 2026 23:37
fc86449 to
b4910ae
Compare
Same purpose, but more idiomatic. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The syscall variant comes with a warning; > LazyDLL is subject to the same DLL preloading attacks as documented on LoadDLL. > > Use LazyDLL in `golang.org/x/sys/windows` for a secure way to load system DLLs. It does have special handling for `kernel32.dll` though, so in practice, there's no real difference, but as we're using more of golang.org/x/windows already, there's no harm in switching. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Both are now implemented in golang.org/x/sys/windows. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Key events require an updated version of golang.org/x/sys v0.33.0, which added them in golang/sys@8e9e046 Keep WAIT_TIMEOUT untyped for compatibility with the previous API, as windows.WAIT_TIMEOUT is typed as syscall.Errno. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This method is now implemented in golang.org/x/sys/windows, but our local struct definitions currently implement [fmt.Stringer], so we cannot make them a straight alias. Instead, definining them as concrete type, but use the type from x/windows, then convert them. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This method is now implemented in golang.org/x/sys/windows, but our local struct definitions currently implement [fmt.Stringer], so we cannot make them a straight alias. Instead, use x/windows for the syscall, then convert the result. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn (thaJeztah)
force-pushed
the
more_x_win
branch
from
October 8, 2026 23:49
b4910ae to
119c4d5
Compare
Sebastiaan van Stijn (thaJeztah)
marked this pull request as ready for review
October 8, 2026 23:49
Brian Goff (cpuguy83)
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
winterm: replace "use" for runtime.KeepAlive
Same purpose, but more idiomatic.
winterm: use windows.NewLazyDLL instead of syscall.NewLazyDLL
The syscall variant comes with a warning;
It does have special handling for
kernel32.dllthough, so in practice,there's no real difference, but as we're using more of golang.org/x/windows
already, there's no harm in switching.
winterm: implement GetConsoleMode, SetConsoleMode with x/sys/windows
Both are now implemented in golang.org/x/sys/windows.
winterm: alias consts to their golang.org/x/sys/windows counterparts
Key events require an updated version of golang.org/x/sys v0.33.0, which
added them in golang/sys@8e9e046
Keep WAIT_TIMEOUT untyped for compatibility with the previous API,
as windows.WAIT_TIMEOUT is typed as syscall.Errno.
winterm: implement WaitForSingleObject with x/sys/windows
winterm: implement SetConsoleCursorPosition with x/sys/windows
This method is now implemented in golang.org/x/sys/windows, but our local
struct definitions currently implement [fmt.Stringer], so we cannot make
them a straight alias.
Instead, definining them as concrete type, but use the type from x/windows,
then convert them.
winterm: implement GetConsoleScreenBufferInfo with x/sys/windows
This method is now implemented in golang.org/x/sys/windows, but our local
struct definitions currently implement [fmt.Stringer], so we cannot make
them a straight alias.
Instead, use x/windows for the syscall, then convert the result.