Skip to content

Commit b1e55df

Browse files
committed
windows: add console input api
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
1 parent 7bb0bf7 commit b1e55df

File tree

3 files changed

+423
-0
lines changed

3 files changed

+423
-0
lines changed

windows/syscall_windows.go

+4
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
316316
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
317317
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
318318
//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole
319+
//sys ReadConsoleInput(console Handle, buf *InputRecord, toread uint32, read *uint32) (err error) = kernel32.ReadConsoleInputW
320+
//sys PeekConsoleInput(console Handle, buf *InputRecord, toread uint32, read *uint32) (err error) = kernel32.PeekConsoleInputW
321+
//sys GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) = kernel32.GetNumberOfConsoleInputEvents
322+
//sys FlushConsoleInputBuffer(console Handle) (err error) = kernel32.FlushConsoleInputBuffer
319323
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
320324
//sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW
321325
//sys Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW

0 commit comments

Comments
 (0)