win icon indicating copy to clipboard operation
win copied to clipboard

Parameter passing problem

Open StaticLove opened this issue 7 years ago • 2 comments

The parameters of Syscall method in syscall package of golang are defined as such:

func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)

but in the project the parameters are indeed passed as such:

func RegCloseKey(hKey HKEY) int32 {
	ret, _, _ := syscall.Syscall(regCloseKey, 1,
		uintptr(hKey),
		0,
		0)

	return int32(ret)
}

I do not quite understand why we can do that?

StaticLove avatar Jul 17 '17 06:07 StaticLove

You probably are looking at the docs at golang.org, which happen to be for Linux.

For Windows, the signature is

func Syscall(trap, nargs, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)

If you installed Go via the msi installer, you can start a local godoc with Windows specific syscall docs from your start menu or whatever your Windows version provides.

lxn avatar Jul 18 '17 15:07 lxn

So it is, thank you very much.

StaticLove avatar Jul 20 '17 02:07 StaticLove