[TCPIP] Stubplement returning module information for TCP and UDP connections

This commit is contained in:
Pierre Schweitzer 2018-11-27 22:27:45 +01:00
parent e486d8aaa6
commit f718b1d719
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 43 additions and 5 deletions

View file

@ -308,6 +308,23 @@ TDI_STATUS InfoTdiQueryInformationEx(
else
return TDI_INVALID_PARAMETER;
case IP_SPECIFIC_MODULE_ENTRY_ID:
if (ID->toi_type != INFO_TYPE_PROVIDER)
return TDI_INVALID_PARAMETER;
if (ID->toi_entity.tei_entity == CO_TL_ENTITY)
if ((EntityListContext = GetContext(ID->toi_entity)))
return InfoTdiQueryGetConnectionTcpTable(EntityListContext, Buffer, BufferSize, TcpUdpClassOwner);
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, TcpUdpClassOwner);
else
return TDI_INVALID_PARAMETER;
else
return TDI_INVALID_PARAMETER;
#if 0
case IP_INTFC_INFO_ID:
if (ID->toi_type != INFO_TYPE_PROVIDER)

View file

@ -185,22 +185,27 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
TDI_TCPUDP_CLASS_INFO Class)
{
SIZE_T Size;
MIB_TCPROW_OWNER_PID TcpRow;
MIB_TCPROW_OWNER_MODULE TcpRow;
TDI_STATUS Status = TDI_INVALID_REQUEST;
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
if (Class == TcpUdpClassOwnerPid)
{
Size = sizeof(MIB_TCPROW_OWNER_PID);
}
else if (Class == TcpUdpClassOwner)
{
Size = sizeof(MIB_TCPROW_OWNER_MODULE);
}
else
{
ASSERT(Class != TcpUdpClassOwner);
Size = sizeof(MIB_TCPROW);
}
TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
TcpRow.liCreateTimestamp = AddrFile->CreationTime; /* FIXME: to check */
if (AddrFile->Listener != NULL)
{
PADDRESS_FILE EndPoint;
@ -244,6 +249,12 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile,
if (NT_SUCCESS(Status))
{
if (Class == TcpUdpClassOwner)
{
/* FIXME */
RtlZeroMemory(&TcpRow.OwningModuleInfo[0], sizeof(TcpRow.OwningModuleInfo));
}
Status = InfoCopyOut( (PCHAR)&TcpRow, Size,
Buffer, BufferSize );
}
@ -259,7 +270,7 @@ TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
TDI_TCPUDP_CLASS_INFO Class)
{
SIZE_T Size;
MIB_UDPROW_OWNER_PID UdpRow;
MIB_UDPROW_OWNER_MODULE UdpRow;
TDI_STATUS Status = TDI_INVALID_REQUEST;
TI_DbgPrint(DEBUG_INFO, ("Called.\n"));
@ -268,15 +279,25 @@ TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile,
{
Size = sizeof(MIB_UDPROW_OWNER_PID);
}
else if (Class == TcpUdpClassOwner)
{
Size = sizeof(MIB_UDPROW_OWNER_MODULE);
}
else
{
ASSERT(Class != TcpUdpClassOwner);
Size = sizeof(MIB_UDPROW);
}
UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address;
UdpRow.dwLocalPort = AddrFile->Port;
UdpRow.dwOwningPid = (DWORD)AddrFile->ProcessId;
UdpRow.liCreateTimestamp = AddrFile->CreationTime; /* FIXME: to check */
UdpRow.dwFlags = 0; /* FIXME */
if (Class == TcpUdpClassOwner)
{
/* FIXME */
RtlZeroMemory(&UdpRow.OwningModuleInfo[0], sizeof(UdpRow.OwningModuleInfo));
}
Status = InfoCopyOut( (PCHAR)&UdpRow,
Size, Buffer, BufferSize );