@@ -30,14 +30,14 @@ internal static TcpTable GetExtendedTcpTable(IpVersion ipVersion)
3030 int tcpTableLength = 0 ;
3131
3232 int ipVersionValue = ipVersion == IpVersion . Ipv4 ? NativeMethods . AfInet : NativeMethods . AfInet6 ;
33+ int allPid = ( int ) NativeMethods . TcpTableType . OwnerPidAll ;
3334
34- if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , false , ipVersionValue , ( int ) NativeMethods . TcpTableType . OwnerPidAll , 0 ) != 0 )
35+ if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , false , ipVersionValue , allPid , 0 ) != 0 )
3536 {
3637 try
3738 {
3839 tcpTable = Marshal . AllocHGlobal ( tcpTableLength ) ;
39- if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , true , ipVersionValue , ( int ) NativeMethods . TcpTableType . OwnerPidAll , 0 ) ==
40- 0 )
40+ if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , true , ipVersionValue , allPid , 0 ) == 0 )
4141 {
4242 var table = ( NativeMethods . TcpTable ) Marshal . PtrToStructure ( tcpTable , typeof ( NativeMethods . TcpTable ) ) ;
4343
@@ -72,14 +72,14 @@ internal static TcpRow GetTcpRowByLocalPort(IpVersion ipVersion, int localPort)
7272 int tcpTableLength = 0 ;
7373
7474 int ipVersionValue = ipVersion == IpVersion . Ipv4 ? NativeMethods . AfInet : NativeMethods . AfInet6 ;
75+ int allPid = ( int ) NativeMethods . TcpTableType . OwnerPidAll ;
7576
76- if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , false , ipVersionValue , ( int ) NativeMethods . TcpTableType . OwnerPidAll , 0 ) != 0 )
77+ if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , false , ipVersionValue , allPid , 0 ) != 0 )
7778 {
7879 try
7980 {
8081 tcpTable = Marshal . AllocHGlobal ( tcpTableLength ) ;
81- if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , true , ipVersionValue , ( int ) NativeMethods . TcpTableType . OwnerPidAll , 0 ) ==
82- 0 )
82+ if ( NativeMethods . GetExtendedTcpTable ( tcpTable , ref tcpTableLength , true , ipVersionValue , allPid , 0 ) == 0 )
8383 {
8484 var table = ( NativeMethods . TcpTable ) Marshal . PtrToStructure ( tcpTable , typeof ( NativeMethods . TcpTable ) ) ;
8585
0 commit comments