https://git.reactos.org/?p=reactos.git;a=commitdiff;h=13de7f08af1fa37c6f0ae…
commit 13de7f08af1fa37c6f0aeb8bd58d8971aab8d069
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Nov 24 21:09:17 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Nov 24 21:41:10 2018 +0100
[TCPIP] Implement enumerating UDP connections with owner PID
---
drivers/network/tcpip/include/info.h | 3 ++-
drivers/network/tcpip/tcpip/info.c | 7 ++++++-
drivers/network/tcpip/tcpip/ninfo.c | 9 ++++++---
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/network/tcpip/include/info.h b/drivers/network/tcpip/include/info.h
index c0998db479..358a8b0a5a 100644
--- a/drivers/network/tcpip/include/info.h
+++ b/drivers/network/tcpip/include/info.h
@@ -121,7 +121,8 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable( PADDRESS_FILE AddrFile,
TDI_STATUS InfoTdiQueryGetConnectionUdpTable( PADDRESS_FILE AddrFile,
PNDIS_BUFFER Buffer,
- PUINT BufferSize);
+ PUINT BufferSize,
+ BOOLEAN Extended);
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 e29d415a7a..b64e8619ed 100644
--- a/drivers/network/tcpip/tcpip/info.c
+++ b/drivers/network/tcpip/tcpip/info.c
@@ -271,6 +271,11 @@ TDI_STATUS InfoTdiQueryInformationEx(
return InfoTdiQueryGetConnectionTcpTable(EntityListContext,
Buffer, BufferSize, TRUE);
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);
+ else
+ return TDI_INVALID_PARAMETER;
else
return TDI_INVALID_PARAMETER;
@@ -297,7 +302,7 @@ TDI_STATUS InfoTdiQueryInformationEx(
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);
+ return InfoTdiQueryGetConnectionUdpTable(EntityListContext,
Buffer, BufferSize, FALSE);
else
return TDI_INVALID_PARAMETER;
else
diff --git a/drivers/network/tcpip/tcpip/ninfo.c b/drivers/network/tcpip/tcpip/ninfo.c
index 63d1d124c4..06eddd4baf 100644
--- a/drivers/network/tcpip/tcpip/ninfo.c
+++ b/drivers/network/tcpip/tcpip/ninfo.c
@@ -249,17 +249,20 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE
AddrFile,
TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
PNDIS_BUFFER Buffer,
- PUINT BufferSize)
+ PUINT BufferSize,
+ BOOLEAN Extended)
{
- MIB_UDPROW UdpRow;
+ MIB_UDPROW_OWNER_PID UdpRow;
TDI_STATUS Status = TDI_INVALID_REQUEST;
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
UdpRow.dwLocalPort = AddrFile->Port;
+ UdpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
- Status = InfoCopyOut( (PCHAR)&UdpRow, sizeof(UdpRow),
+ Status = InfoCopyOut( (PCHAR)&UdpRow,
+ (Extended ? sizeof(MIB_UDPROW_OWNER_PID) : sizeof(MIB_UDPROW)),
Buffer, BufferSize );
TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status));