windows: correct types and error values of internal GUID handling
This corrects the Windows int type to be the more correct int32 Go
analog, as well as not using GetLastError() for the error value of the
GUID string parsing function.
Change-Id: I9716f991ef649f7d299295e3f4e75d3986ec3a74
Reviewed-on: https://go-review.googlesource.com/c/sys/+/181397
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go
index f37d7d4..6c35b90 100644
--- a/windows/zsyscall_windows.go
+++ b/windows/zsyscall_windows.go
@@ -2436,21 +2436,17 @@
return
}
-func clsidFromString(lpsz *uint16, pclsid *GUID) (err error) {
- r1, _, e1 := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
- if r1 != 0 {
- if e1 != 0 {
- err = errnoErr(e1)
- } else {
- err = syscall.EINVAL
- }
+func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
+ r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
+ if r0 != 0 {
+ ret = syscall.Errno(r0)
}
return
}
-func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int) (chars int) {
+func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
- chars = int(r0)
+ chars = int32(r0)
return
}