// Code generated by 'go generate'; DO NOT EDIT.

package winwlanapi

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)
	errERROR_EINVAL     error = syscall.EINVAL
)

// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e syscall.Errno) error {
	switch e {
	case 0:
		return errERROR_EINVAL
	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")

	procWlanCloseHandle          = modwlanapi.NewProc("WlanCloseHandle")
	procWlanEnumInterfaces       = modwlanapi.NewProc("WlanEnumInterfaces")
	procWlanFreeMemory           = modwlanapi.NewProc("WlanFreeMemory")
	procWlanOpenHandle           = modwlanapi.NewProc("WlanOpenHandle")
	procWlanQueryInterface       = modwlanapi.NewProc("WlanQueryInterface")
	procWlanRegisterNotification = modwlanapi.NewProc("WlanRegisterNotification")
)

func wlanCloseHandle(clientHandle windows.Handle, reserved uintptr) (ret uint32) {
	r0, _, _ := syscall.Syscall(procWlanCloseHandle.Addr(), 2, uintptr(clientHandle), uintptr(reserved), 0)
	ret = uint32(r0)
	return
}

func wlanEnumInterfaces(clientHandle windows.Handle, reserved uintptr, interfaceList **InterfaceInfoList) (ret uint32) {
	r0, _, _ := syscall.Syscall(procWlanEnumInterfaces.Addr(), 3, uintptr(clientHandle), uintptr(reserved), uintptr(unsafe.Pointer(interfaceList)))
	ret = uint32(r0)
	return
}

func wlanFreeMemory(memory uintptr) {
	syscall.Syscall(procWlanFreeMemory.Addr(), 1, uintptr(memory), 0, 0)
	return
}

func wlanOpenHandle(clientVersion uint32, reserved uintptr, negotiatedVersion *uint32, clientHandle *windows.Handle) (ret uint32) {
	r0, _, _ := syscall.Syscall6(procWlanOpenHandle.Addr(), 4, uintptr(clientVersion), uintptr(reserved), uintptr(unsafe.Pointer(negotiatedVersion)), uintptr(unsafe.Pointer(clientHandle)), 0, 0)
	ret = uint32(r0)
	return
}

func wlanQueryInterface(clientHandle windows.Handle, interfaceGuid *windows.GUID, opCode uint32, reserved uintptr, dataSize *uint32, data *uintptr, opcodeValueType *uint32) (ret uint32) {
	r0, _, _ := syscall.Syscall9(procWlanQueryInterface.Addr(), 7, uintptr(clientHandle), uintptr(unsafe.Pointer(interfaceGuid)), uintptr(opCode), uintptr(reserved), uintptr(unsafe.Pointer(dataSize)), uintptr(unsafe.Pointer(data)), uintptr(unsafe.Pointer(opcodeValueType)), 0, 0)
	ret = uint32(r0)
	return
}

func wlanRegisterNotification(clientHandle windows.Handle, notificationSource uint32, ignoreDuplicate bool, callback uintptr, callbackContext uintptr, reserved uintptr, prevNotificationSource *uint32) (ret uint32) {
	var _p0 uint32
	if ignoreDuplicate {
		_p0 = 1
	}
	r0, _, _ := syscall.Syscall9(procWlanRegisterNotification.Addr(), 7, uintptr(clientHandle), uintptr(notificationSource), uintptr(_p0), uintptr(callback), uintptr(callbackContext), uintptr(reserved), uintptr(unsafe.Pointer(prevNotificationSource)), 0, 0)
	ret = uint32(r0)
	return
}
