github.com/wencode/hack@v0.2.9/proc/proc_windows.go (about) 1 package proc 2 3 import ( 4 "syscall" 5 ) 6 7 func Call(fn uintptr, a ...uintptr) uintptr { 8 var ret uintptr = 0xFFFFFFFFFFFFFFFF 9 switch len(a) { 10 case 0: 11 ret, _, _ = syscall.Syscall(fn, uintptr(len(a)), 0, 0, 0) 12 case 1: 13 ret, _, _ = syscall.Syscall(fn, uintptr(len(a)), a[0], 0, 0) 14 case 2: 15 ret, _, _ = syscall.Syscall(fn, uintptr(len(a)), a[0], a[1], 0) 16 case 3: 17 ret, _, _ = syscall.Syscall(fn, uintptr(len(a)), a[0], a[1], a[2]) 18 case 4: 19 ret, _, _ = syscall.Syscall6(fn, uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0) 20 case 5: 21 ret, _, _ = syscall.Syscall6(fn, uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0) 22 case 6: 23 ret, _, _ = syscall.Syscall6(fn, uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5]) 24 default: 25 panic("call() with too many arguments") 26 } 27 return ret 28 }