Skip to content

Commit

Permalink
windows: add console codepage api
Browse files Browse the repository at this point in the history
Add setter/getter for console input/output codepages. This is useful to set the console expected codepage instead of converting it to UTF-16 before writing.

Change-Id: Ie0465708e7cf68d776e23dbbeeca7bcb4db7d2bf
GitHub-Last-Rev: 93c06e2
GitHub-Pull-Request: #206
Reviewed-on: https://go-review.googlesource.com/c/sys/+/599395
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Alex Brainman <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
  • Loading branch information
aymanbagabas authored and alexbrainman committed Aug 28, 2024
1 parent 9cb830b commit ed67b15
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions windows/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition
//sys GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP
//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP
//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP
//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole
Expand Down
38 changes: 38 additions & 0 deletions windows/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed67b15

Please sign in to comment.