iphlpapi: Add partial support for UDP_TABLE_OWNER_MODULE in GetExtendedUdpTable.
This commit is contained in:
parent
18ba68ea62
commit
bc8876f9ce
|
@ -1935,11 +1935,15 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder,
|
||||||
if (!pdwSize) return ERROR_INVALID_PARAMETER;
|
if (!pdwSize) return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (ulAf != AF_INET ||
|
if (ulAf != AF_INET ||
|
||||||
(TableClass != UDP_TABLE_BASIC && TableClass != UDP_TABLE_OWNER_PID))
|
(TableClass != UDP_TABLE_BASIC && TableClass != UDP_TABLE_OWNER_PID &&
|
||||||
|
TableClass != UDP_TABLE_OWNER_MODULE))
|
||||||
{
|
{
|
||||||
FIXME("ulAf = %u, TableClass = %u not supported\n", ulAf, TableClass);
|
FIXME("ulAf = %u, TableClass = %u not supported\n", ulAf, TableClass);
|
||||||
return ERROR_NOT_SUPPORTED;
|
return ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
if (TableClass == UDP_TABLE_OWNER_MODULE)
|
||||||
|
FIXME("UDP_TABLE_OWNER_MODULE not fully supported\n");
|
||||||
|
|
||||||
if ((ret = build_udp_table(TableClass, &table, bOrder, GetProcessHeap(), 0, &size)))
|
if ((ret = build_udp_table(TableClass, &table, bOrder, GetProcessHeap(), 0, &size)))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -1837,6 +1837,12 @@ static DWORD get_udp_table_sizes( UDP_TABLE_CLASS class, DWORD row_count, DWORD
|
||||||
if (row_size) *row_size = sizeof(MIB_UDPROW_OWNER_PID);
|
if (row_size) *row_size = sizeof(MIB_UDPROW_OWNER_PID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case UDP_TABLE_OWNER_MODULE:
|
||||||
|
{
|
||||||
|
table_size = FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE, table[row_count]);
|
||||||
|
if (row_size) *row_size = sizeof(MIB_UDPROW_OWNER_MODULE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
ERR("unhandled class %u\n", class);
|
ERR("unhandled class %u\n", class);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1846,7 +1852,7 @@ static DWORD get_udp_table_sizes( UDP_TABLE_CLASS class, DWORD row_count, DWORD
|
||||||
|
|
||||||
static MIB_UDPTABLE *append_udp_row( UDP_TABLE_CLASS class, HANDLE heap, DWORD flags,
|
static MIB_UDPTABLE *append_udp_row( UDP_TABLE_CLASS class, HANDLE heap, DWORD flags,
|
||||||
MIB_UDPTABLE *table, DWORD *count,
|
MIB_UDPTABLE *table, DWORD *count,
|
||||||
const MIB_UDPROW_OWNER_PID *row, DWORD row_size )
|
const MIB_UDPROW_OWNER_MODULE *row, DWORD row_size )
|
||||||
{
|
{
|
||||||
if (table->dwNumEntries >= *count)
|
if (table->dwNumEntries >= *count)
|
||||||
{
|
{
|
||||||
|
@ -1881,7 +1887,7 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
|
||||||
DWORD *size )
|
DWORD *size )
|
||||||
{
|
{
|
||||||
MIB_UDPTABLE *table;
|
MIB_UDPTABLE *table;
|
||||||
MIB_UDPROW_OWNER_PID row;
|
MIB_UDPROW_OWNER_MODULE row;
|
||||||
DWORD ret = NO_ERROR, count = 16, table_size, row_size;
|
DWORD ret = NO_ERROR, count = 16, table_size, row_size;
|
||||||
|
|
||||||
if (!(table_size = get_udp_table_sizes( class, count, &row_size )))
|
if (!(table_size = get_udp_table_sizes( class, count, &row_size )))
|
||||||
|
@ -1904,7 +1910,8 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
|
||||||
unsigned int dummy, num_entries = 0;
|
unsigned int dummy, num_entries = 0;
|
||||||
int inode;
|
int inode;
|
||||||
|
|
||||||
if (class == UDP_TABLE_OWNER_PID) map = get_pid_map( &num_entries );
|
if (class == UDP_TABLE_OWNER_PID || class == UDP_TABLE_OWNER_MODULE)
|
||||||
|
map = get_pid_map( &num_entries );
|
||||||
|
|
||||||
/* skip header line */
|
/* skip header line */
|
||||||
ptr = fgets( buf, sizeof(buf), fp );
|
ptr = fgets( buf, sizeof(buf), fp );
|
||||||
|
@ -1914,7 +1921,7 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
|
||||||
&row.dwLocalAddr, &row.dwLocalPort, &inode ) != 4)
|
&row.dwLocalAddr, &row.dwLocalPort, &inode ) != 4)
|
||||||
continue;
|
continue;
|
||||||
row.dwLocalPort = htons( row.dwLocalPort );
|
row.dwLocalPort = htons( row.dwLocalPort );
|
||||||
if (class == UDP_TABLE_OWNER_PID)
|
if (class == UDP_TABLE_OWNER_PID || class == UDP_TABLE_OWNER_MODULE)
|
||||||
row.dwOwningPid = find_owning_pid( map, num_entries, inode );
|
row.dwOwningPid = find_owning_pid( map, num_entries, inode );
|
||||||
if (!(table = append_udp_row( class, heap, flags, table, &count, &row, row_size )))
|
if (!(table = append_udp_row( class, heap, flags, table, &count, &row, row_size )))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,6 +48,29 @@ typedef struct _MIB_UDPTABLE_OWNER_PID
|
||||||
MIB_UDPROW_OWNER_PID table[1];
|
MIB_UDPROW_OWNER_PID table[1];
|
||||||
} MIB_UDPTABLE_OWNER_PID, *PMIB_UDPTABLE_OWNER_PID;
|
} MIB_UDPTABLE_OWNER_PID, *PMIB_UDPTABLE_OWNER_PID;
|
||||||
|
|
||||||
|
typedef struct _MIB_UDPROW_OWNER_MODULE
|
||||||
|
{
|
||||||
|
DWORD dwLocalAddr;
|
||||||
|
DWORD dwLocalPort;
|
||||||
|
DWORD dwOwningPid;
|
||||||
|
LARGE_INTEGER liCreateTimestamp;
|
||||||
|
__C89_NAMELESS union
|
||||||
|
{
|
||||||
|
__C89_NAMELESS struct
|
||||||
|
{
|
||||||
|
int SpecificPortBind:1;
|
||||||
|
} __C89_NAMELESSSTRUCTNAME;
|
||||||
|
int dwFlags;
|
||||||
|
} __C89_NAMELESSUNIONNAME;
|
||||||
|
ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
|
||||||
|
} MIB_UDPROW_OWNER_MODULE, *PMIB_UDPROW_OWNER_MODULE;
|
||||||
|
|
||||||
|
typedef struct _MIB_UDPTABLE_OWNER_MODULE
|
||||||
|
{
|
||||||
|
DWORD dwNumEntries;
|
||||||
|
MIB_UDPROW_OWNER_MODULE table[1];
|
||||||
|
} MIB_UDPTABLE_OWNER_MODULE, *PMIB_UDPTABLE_OWNER_MODULE;
|
||||||
|
|
||||||
/* UDP statistics */
|
/* UDP statistics */
|
||||||
|
|
||||||
typedef struct _MIB_UDPSTATS
|
typedef struct _MIB_UDPSTATS
|
||||||
|
|
Loading…
Reference in New Issue