go-netstat icon indicating copy to clipboard operation
go-netstat copied to clipboard

feature windows 32bit support

Open foxever opened this issue 4 years ago • 3 comments

Is there any reason that only windows 64 bit is supported?

https://github.com/cakturk/go-netstat/blob/master/netstat/netstat_windows.go#L1

foxever avatar Feb 20 '21 03:02 foxever

No, but I haven't tested the code on a 32-bit Windows machine. I'm not sure the memory layouts and alignment requirements are the same. If you tested it on a 32-bit Windows machine and you are sure it works, we can remove the build constraint.

cakturk avatar Feb 20 '21 09:02 cakturk

No, but I haven't tested the code on a 32-bit Windows machine. I'm not sure the memory layouts and alignment requirements are the same. If you tested it on a 32-bit Windows machine and you are sure it works, we can remove the build constraint.

I have test 32-bit binary (build on ubuntu 18.04) on windows 10 64-bit and it works fine, I think it should work if remove the build constrain

$ GOOS=windows GOARCH=386 go build -o go-netstat.exe main.go
$ file go-netstat.exe
go-netstat.exe: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows

and it works

❯ .\go-netstat.exe -lis
Not all processes could be identified, you would have to be root to see it all.
Proto Local Addr              Foreign Addr            State        PID/Program name
tcp   0.0.0.0:135             0.0.0.0:0               LISTEN       1420/svchost.exe

foxever avatar Feb 23 '21 08:02 foxever