This repository has been archived by the owner on Jan 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzsyscall_windows.go
84 lines (70 loc) · 2.63 KB
/
zsyscall_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Code generated by 'go generate'; DO NOT EDIT.
package wlanapi
import (
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
var _ unsafe.Pointer
// Do the interface allocations only once for common
// Errno values.
const (
errnoERROR_IO_PENDING = 997
)
var (
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
)
// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e syscall.Errno) error {
switch e {
case 0:
return nil
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}
// TODO: add more here, after collecting data on the common
// error values see on Windows. (perhaps when running
// all.bat?)
return e
}
var (
modwlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanFreeMemory = modwlanapi.NewProc("WlanFreeMemory")
procWlanOpenHandle = modwlanapi.NewProc("WlanOpenHandle")
procWlanCloseHandle = modwlanapi.NewProc("WlanCloseHandle")
procWlanEnumInterfaces = modwlanapi.NewProc("WlanEnumInterfaces")
procWlanSetProfileEapXmlUserData = modwlanapi.NewProc("WlanSetProfileEapXmlUserData")
)
func wlanFreeMemory(memory unsafe.Pointer) {
syscall.Syscall(procWlanFreeMemory.Addr(), 1, uintptr(memory), 0, 0)
return
}
func wlanOpenHandle(clientVersion uint32, reserved uintptr, negotiatedVersion *uint32, clientHandle *windows.Handle) (ret error) {
r0, _, _ := syscall.Syscall6(procWlanOpenHandle.Addr(), 4, uintptr(clientVersion), uintptr(reserved), uintptr(unsafe.Pointer(negotiatedVersion)), uintptr(unsafe.Pointer(clientHandle)), 0, 0)
if r0 != 0 {
ret = syscall.Errno(r0)
}
return
}
func wlanCloseHandle(clientHandle windows.Handle, reserved uintptr) (ret error) {
r0, _, _ := syscall.Syscall(procWlanCloseHandle.Addr(), 2, uintptr(clientHandle), uintptr(reserved), 0)
if r0 != 0 {
ret = syscall.Errno(r0)
}
return
}
func wlanEnumInterfaces(clientHandle windows.Handle, reserved uintptr, interfaceList **InterfaceInfoList) (ret error) {
r0, _, _ := syscall.Syscall(procWlanEnumInterfaces.Addr(), 3, uintptr(clientHandle), uintptr(reserved), uintptr(unsafe.Pointer(interfaceList)))
if r0 != 0 {
ret = syscall.Errno(r0)
}
return
}
func wlanSetProfileEAPXMLUserData(clientHandle windows.Handle, interfaceGUID *windows.GUID, profileName *uint16, flags uint32, eapXMLUserData *uint16, reserved uintptr) (ret error) {
r0, _, _ := syscall.Syscall6(procWlanSetProfileEapXmlUserData.Addr(), 6, uintptr(clientHandle), uintptr(unsafe.Pointer(interfaceGUID)), uintptr(unsafe.Pointer(profileName)), uintptr(flags), uintptr(unsafe.Pointer(eapXMLUserData)), uintptr(reserved))
if r0 != 0 {
ret = syscall.Errno(r0)
}
return
}