~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/gopkg.in/natefinch/npipe.v2/znpipe_windows_386.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// +build windows
 
2
// go build mksyscall_windows.go && ./mksyscall_windows npipe_windows.go
 
3
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
4
 
 
5
package npipe
 
6
 
 
7
import "unsafe"
 
8
import "syscall"
 
9
 
 
10
var (
 
11
        modkernel32 = syscall.NewLazyDLL("kernel32.dll")
 
12
 
 
13
        procCreateNamedPipeW    = modkernel32.NewProc("CreateNamedPipeW")
 
14
        procConnectNamedPipe    = modkernel32.NewProc("ConnectNamedPipe")
 
15
        procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe")
 
16
        procWaitNamedPipeW      = modkernel32.NewProc("WaitNamedPipeW")
 
17
        procCreateEventW        = modkernel32.NewProc("CreateEventW")
 
18
        procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
 
19
        procCancelIoEx          = modkernel32.NewProc("CancelIoEx")
 
20
)
 
21
 
 
22
func createNamedPipe(name *uint16, openMode uint32, pipeMode uint32, maxInstances uint32, outBufSize uint32, inBufSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) {
 
23
        r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(openMode), uintptr(pipeMode), uintptr(maxInstances), uintptr(outBufSize), uintptr(inBufSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
 
24
        handle = syscall.Handle(r0)
 
25
        if handle == syscall.InvalidHandle {
 
26
                if e1 != 0 {
 
27
                        err = error(e1)
 
28
                } else {
 
29
                        err = syscall.EINVAL
 
30
                }
 
31
        }
 
32
        return
 
33
}
 
34
 
 
35
func cancelIoEx(handle syscall.Handle, overlapped *syscall.Overlapped) (err error) {
 
36
        r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), 0)
 
37
        if r1 == 0 {
 
38
                if e1 != 0 {
 
39
                        err = error(e1)
 
40
                } else {
 
41
                        err = syscall.EINVAL
 
42
                }
 
43
        }
 
44
        return
 
45
}
 
46
 
 
47
func connectNamedPipe(handle syscall.Handle, overlapped *syscall.Overlapped) (err error) {
 
48
        r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), 0)
 
49
        if r1 == 0 {
 
50
                if e1 != 0 {
 
51
                        err = error(e1)
 
52
                } else {
 
53
                        err = syscall.EINVAL
 
54
                }
 
55
        }
 
56
        return
 
57
}
 
58
 
 
59
func disconnectNamedPipe(handle syscall.Handle) (err error) {
 
60
        r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(handle), 0, 0)
 
61
        if r1 == 0 {
 
62
                if e1 != 0 {
 
63
                        err = error(e1)
 
64
                } else {
 
65
                        err = syscall.EINVAL
 
66
                }
 
67
        }
 
68
        return
 
69
}
 
70
 
 
71
func waitNamedPipe(name *uint16, timeout uint32) (err error) {
 
72
        r1, _, e1 := syscall.Syscall(procWaitNamedPipeW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(timeout), 0)
 
73
        if r1 == 0 {
 
74
                if e1 != 0 {
 
75
                        err = error(e1)
 
76
                } else {
 
77
                        err = syscall.EINVAL
 
78
                }
 
79
        }
 
80
        return
 
81
}
 
82
 
 
83
func createEvent(sa *syscall.SecurityAttributes, manualReset bool, initialState bool, name *uint16) (handle syscall.Handle, err error) {
 
84
        var _p0 uint32
 
85
        if manualReset {
 
86
                _p0 = 1
 
87
        } else {
 
88
                _p0 = 0
 
89
        }
 
90
        var _p1 uint32
 
91
        if initialState {
 
92
                _p1 = 1
 
93
        } else {
 
94
                _p1 = 0
 
95
        }
 
96
        r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(sa)), uintptr(_p0), uintptr(_p1), uintptr(unsafe.Pointer(name)), 0, 0)
 
97
        handle = syscall.Handle(r0)
 
98
        if handle == syscall.InvalidHandle {
 
99
                if e1 != 0 {
 
100
                        err = error(e1)
 
101
                } else {
 
102
                        err = syscall.EINVAL
 
103
                }
 
104
        }
 
105
        return
 
106
}
 
107
 
 
108
func getOverlappedResult(handle syscall.Handle, overlapped *syscall.Overlapped, transferred *uint32, wait bool) (err error) {
 
109
        var _p0 uint32
 
110
        if wait {
 
111
                _p0 = 1
 
112
        } else {
 
113
                _p0 = 0
 
114
        }
 
115
        r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transferred)), uintptr(_p0), 0, 0)
 
116
        if r1 == 0 {
 
117
                if e1 != 0 {
 
118
                        err = error(e1)
 
119
                } else {
 
120
                        err = syscall.EINVAL
 
121
                }
 
122
        }
 
123
        return
 
124
}