From: Shenghou Ma Date: Sat, 2 Feb 2013 17:42:17 +0000 (+0800) Subject: syscall: (*Proc).Call should return nil error when no error occurs X-Git-Tag: go1.1rc2~1182 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dcf16bd83d3c36430771f36df53044be3dda67fa;p=gostls13.git syscall: (*Proc).Call should return nil error when no error occurs Fixes #4686. R=alex.brainman, rsc CC=golang-dev https://golang.org/cl/7174047 --- diff --git a/src/pkg/syscall/dll_windows.go b/src/pkg/syscall/dll_windows.go index 09111ab75c..d29e9921cf 100644 --- a/src/pkg/syscall/dll_windows.go +++ b/src/pkg/syscall/dll_windows.go @@ -114,8 +114,14 @@ func (p *Proc) Addr() uintptr { return p.addr } -// Call executes procedure p with arguments a. -func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, err error) { +// Call executes procedure p with arguments a. It will panic, if more then 15 arguments +// are supplied. +// +// The returned error is always non-nil, constructed from the result of GetLastError. +// Callers must inspect the primary return value to decide whether an error occurred +// (according to the semantics of the specific function being called) before consulting +// the error. The error will be guaranteed to contain syscall.Errno. +func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { switch len(a) { case 0: return Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0) @@ -260,8 +266,14 @@ func (p *LazyProc) Addr() uintptr { return p.proc.Addr() } -// Call executes procedure p with arguments a. -func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, err error) { +// Call executes procedure p with arguments a. It will panic, if more then 15 arguments +// are supplied. +// +// The returned error is always non-nil, constructed from the result of GetLastError. +// Callers must inspect the primary return value to decide whether an error occurred +// (according to the semantics of the specific function being called) before consulting +// the error. The error will be guaranteed to contain syscall.Errno. +func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { p.mustFind() return p.proc.Call(a...) }