[TCPIP] Implement enumerating UDP connections with owner PID
authorPierre Schweitzer <pierre@reactos.org>
Sat, 24 Nov 2018 20:09:17 +0000 (21:09 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 24 Nov 2018 20:41:10 +0000 (21:41 +0100)
drivers/network/tcpip/include/info.h
drivers/network/tcpip/tcpip/info.c
drivers/network/tcpip/tcpip/ninfo.c

index c0998db..358a8b0 100644 (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,
index e29d415..b64e861 100644 (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
index 63d1d12..06eddd4 100644 (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));