diff --git a/drivers/network/tcpip/include/info.h b/drivers/network/tcpip/include/info.h index 358a8b0a5a1..8866a01c5c2 100644 --- a/drivers/network/tcpip/include/info.h +++ b/drivers/network/tcpip/include/info.h @@ -80,6 +80,12 @@ typedef union TDI_INFO { TDI_PROVIDER_STATISTICS ProviderStats; } TDI_INFO, *PTDI_INFO; +typedef enum TDI_TCPUDP_CLASS_INFO { + TcpUdpClassBasic, + TcpUdpClassOwnerPid, + TcpUdpClassOwner +} TDI_TCPUDP_CLASS_INFO, *PTDI_TCPUDP_CLASS_INFO; + TDI_STATUS InfoCopyOut( PCHAR DataOut, UINT SizeOut, PNDIS_BUFFER ClientBuf, PUINT ClientBufSize ); @@ -117,12 +123,12 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, TDI_STATUS InfoTdiQueryGetConnectionTcpTable( PADDRESS_FILE AddrFile, PNDIS_BUFFER Buffer, PUINT BufferSize, - BOOLEAN Extended); + TDI_TCPUDP_CLASS_INFO Class); TDI_STATUS InfoTdiQueryGetConnectionUdpTable( PADDRESS_FILE AddrFile, PNDIS_BUFFER Buffer, PUINT BufferSize, - BOOLEAN Extended); + TDI_TCPUDP_CLASS_INFO Class); TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PVOID Buffer, diff --git a/drivers/network/tcpip/tcpip/info.c b/drivers/network/tcpip/tcpip/info.c index b64e8619ed1..674fb96049b 100644 --- a/drivers/network/tcpip/tcpip/info.c +++ b/drivers/network/tcpip/tcpip/info.c @@ -268,12 +268,12 @@ TDI_STATUS InfoTdiQueryInformationEx( return InfoTdiQueryGetAddrTable(ID->toi_entity, Buffer, BufferSize); else if (ID->toi_entity.tei_entity == CO_TL_ENTITY) if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TRUE); + return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassOwnerPid); else return TDI_INVALID_PARAMETER; else if (ID->toi_entity.tei_entity == CL_TL_ENTITY) if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TRUE); + return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassOwnerPid); else return TDI_INVALID_PARAMETER; else @@ -297,12 +297,12 @@ TDI_STATUS InfoTdiQueryInformationEx( return TDI_INVALID_PARAMETER; else if (ID->toi_entity.tei_entity == CO_TL_ENTITY) if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, FALSE); + return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassBasic); else return TDI_INVALID_PARAMETER; else if (ID->toi_entity.tei_entity == CL_TL_ENTITY) if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, FALSE); + return InfoTdiQueryGetConnectionUdpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassBasic); else return TDI_INVALID_PARAMETER; else diff --git a/drivers/network/tcpip/tcpip/ninfo.c b/drivers/network/tcpip/tcpip/ninfo.c index 5b7c706b8fe..267c43f1d9f 100644 --- a/drivers/network/tcpip/tcpip/ninfo.c +++ b/drivers/network/tcpip/tcpip/ninfo.c @@ -182,7 +182,7 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID, TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile, PNDIS_BUFFER Buffer, PUINT BufferSize, - BOOLEAN Extended) + TDI_TCPUDP_CLASS_INFO Class) { SIZE_T Size; MIB_TCPROW_OWNER_PID TcpRow; @@ -191,12 +191,13 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile, TI_DbgPrint(DEBUG_INFO, ("Called.\n")); TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId; - if (Extended) + if (Class == TcpUdpClassOwnerPid) { Size = sizeof(MIB_TCPROW_OWNER_PID); } else { + ASSERT(Class != TcpUdpClassOwner); Size = sizeof(MIB_TCPROW); } @@ -255,20 +256,30 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile, TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile, PNDIS_BUFFER Buffer, PUINT BufferSize, - BOOLEAN Extended) + TDI_TCPUDP_CLASS_INFO Class) { + SIZE_T Size; MIB_UDPROW_OWNER_PID UdpRow; TDI_STATUS Status = TDI_INVALID_REQUEST; TI_DbgPrint(DEBUG_INFO, ("Called.\n")); + if (Class == TcpUdpClassOwnerPid) + { + Size = sizeof(MIB_UDPROW_OWNER_PID); + } + else + { + ASSERT(Class != TcpUdpClassOwner); + Size = sizeof(MIB_UDPROW); + } + UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address; UdpRow.dwLocalPort = AddrFile->Port; UdpRow.dwOwningPid = (DWORD)AddrFile->ProcessId; Status = InfoCopyOut( (PCHAR)&UdpRow, - (Extended ? sizeof(MIB_UDPROW_OWNER_PID) : sizeof(MIB_UDPROW)), - Buffer, BufferSize ); + Size, Buffer, BufferSize ); TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));