[TCPIP] Implement enumerating UDP connections with owner PID

This commit is contained in:
Pierre Schweitzer 2018-11-24 21:09:17 +01:00
parent 2b55073360
commit 13de7f08af
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 14 additions and 5 deletions

View file

@ -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,

View file

@ -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

View file

@ -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));