win
win copied to clipboard
Parameter passing problem
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?
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.
So it is, thank you very much.