Skip to content

Commit

Permalink
windows: add console input api
Browse files Browse the repository at this point in the history
Add Console input API types and syscalls. Since InputRecord contains a
`union` type, we need some way to access the union members. This is done
here by extending InputRecord to return the respective type based on the
function called.

Related #98
  • Loading branch information
aymanbagabas committed Jul 18, 2024
1 parent 7bb0bf7 commit b1e55df
Show file tree
Hide file tree
Showing 3 changed files with 423 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 @@ -316,6 +316,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//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
//sys ReadConsoleInput(console Handle, buf *InputRecord, toread uint32, read *uint32) (err error) = kernel32.ReadConsoleInputW
//sys PeekConsoleInput(console Handle, buf *InputRecord, toread uint32, read *uint32) (err error) = kernel32.PeekConsoleInputW
//sys GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) = kernel32.GetNumberOfConsoleInputEvents
//sys FlushConsoleInputBuffer(console Handle) (err error) = kernel32.FlushConsoleInputBuffer
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
//sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW
//sys Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW
Expand Down
Loading

0 comments on commit b1e55df

Please sign in to comment.