Removed cgo dependency from windows implementation

This commit is contained in:
Cristian Maglie
2014-12-31 00:27:28 +01:00
parent 3415c57d6a
commit 9e85415532
2 changed files with 36 additions and 58 deletions

View File

@@ -1,4 +1,4 @@
// go build mksyscall_windows.go && ./mksyscall_windows native_windows.go
// go build mksyscall_windows.go && ./mksyscall_windows serial_windows.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package serial
@@ -7,13 +7,23 @@ import "unsafe"
import "syscall"
var (
modadvapi32 = syscall.NewLazyDLL("advapi32.dll")
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
procRegEnumValueW = modadvapi32.NewProc("RegEnumValueW")
procGetCommState = modkernel32.NewProc("GetCommState")
procSetCommState = modkernel32.NewProc("SetCommState")
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
)
func RegEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, value *uint16, valueLen *uint32) (regerrno error) {
r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(value)), uintptr(unsafe.Pointer(valueLen)), 0)
if r0 != 0 {
regerrno = syscall.Errno(r0)
}
return
}
func GetCommState(handle syscall.Handle, dcb *DCB) (err error) {
r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(dcb)), 0)
if r1 == 0 {