I am new to Go, and I need to catch net information in Windows. I tried to call GetExtendedTcpTable()
with pointers to byte arrays as params but get nothing after the call.
var (
iphelp = syscall.NewLazyDLL("iphlpapi.dll")
tcptable = iphelp.NewProc("GetExtendedTcpTable")
)
var (
buffer [20000]byte
table [20000]byte
length int
)
res1, res2, err := tcptable.Call(
uintptr(unsafe.Pointer(&buffer)),
uintptr(unsafe.Pointer(&length)),
1,
syscall.AF_INET,
uintptr(unsafe.Pointer(&table)),
0,
)
I expected some data in 'buffer' and 'table', but there are only 0. What am I doing wrong?