1//go:build windows
2
3// Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
4
5package pty
6
7import (
8 "syscall"
9 "unsafe"
10
11 "golang.org/x/sys/windows"
12)
13
14var _ unsafe.Pointer
15
16// Do the interface allocations only once for common
17// Errno values.
18const (
19 errnoERROR_IO_PENDING = 997
20)
21
22var (
23 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
24 errERROR_EINVAL error = syscall.EINVAL
25)
26
27// errnoErr returns common boxed Errno values, to prevent
28// allocations at runtime.
29func errnoErr(e syscall.Errno) error {
30 switch e {
31 case 0:
32 return errERROR_EINVAL
33 case errnoERROR_IO_PENDING:
34 return errERROR_IO_PENDING
35 }
36 // TODO: add more here, after collecting data on the common
37 // error values see on Windows. (perhaps when running
38 // all.bat?)
39 return e
40}
41
42var (
43 modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
44
45 procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
46 procCreatePseudoConsole = modkernel32.NewProc("CreatePseudoConsole")
47 procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
48)
49
50func closePseudoConsole(hpc windows.Handle) {
51 syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(hpc), 0, 0)
52 return
53}
54
55func _createPseudoConsole(size uint32, hInput windows.Handle, hOutput windows.Handle, dwFlags uint32, hpcon *windows.Handle) (hr error) {
56 r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(hInput), uintptr(hOutput), uintptr(dwFlags), uintptr(unsafe.Pointer(hpcon)), 0)
57 if int32(r0) < 0 {
58 if r0&0x1fff0000 == 0x00070000 {
59 r0 &= 0xffff
60 }
61 hr = syscall.Errno(r0)
62 }
63 return
64}
65
66func _resizePseudoConsole(hPc windows.Handle, size uint32) (hr error) {
67 r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(hPc), uintptr(size), 0)
68 if int32(r0) < 0 {
69 if r0&0x1fff0000 == 0x00070000 {
70 r0 &= 0xffff
71 }
72 hr = syscall.Errno(r0)
73 }
74 return
75}