iphlpapi/tests: Add test for AllocateAndGetTcpExTableFromStack.
Signed-off-by: André Hentschel <nerv@dawncrow.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fdf80ad7d9
commit
c77b11eba0
|
@ -50,6 +50,7 @@
|
|||
|
||||
static HMODULE hLibrary = NULL;
|
||||
|
||||
static DWORD (WINAPI *pAllocateAndGetTcpExTableFromStack)(void**,BOOL,HANDLE,DWORD,DWORD);
|
||||
static DWORD (WINAPI *pGetNumberOfInterfaces)(PDWORD);
|
||||
static DWORD (WINAPI *pGetIpAddrTable)(PMIB_IPADDRTABLE,PULONG,BOOL);
|
||||
static DWORD (WINAPI *pGetIfEntry)(PMIB_IFROW);
|
||||
|
@ -97,6 +98,7 @@ static void loadIPHlpApi(void)
|
|||
{
|
||||
hLibrary = LoadLibraryA("iphlpapi.dll");
|
||||
if (hLibrary) {
|
||||
pAllocateAndGetTcpExTableFromStack = (void *)GetProcAddress(hLibrary, "AllocateAndGetTcpExTableFromStack");
|
||||
pGetNumberOfInterfaces = (void *)GetProcAddress(hLibrary, "GetNumberOfInterfaces");
|
||||
pGetIpAddrTable = (void *)GetProcAddress(hLibrary, "GetIpAddrTable");
|
||||
pGetIfEntry = (void *)GetProcAddress(hLibrary, "GetIfEntry");
|
||||
|
@ -1562,6 +1564,52 @@ static void test_GetExtendedTcpTable(void)
|
|||
HeapFree( GetProcessHeap(), 0, table_module );
|
||||
}
|
||||
|
||||
static void test_AllocateAndGetTcpExTableFromStack(void)
|
||||
{
|
||||
DWORD ret;
|
||||
MIB_TCPTABLE_OWNER_PID *table_ex = NULL;
|
||||
|
||||
if (!pAllocateAndGetTcpExTableFromStack)
|
||||
{
|
||||
skip("AllocateAndGetTcpExTableFromStack not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on native */
|
||||
ret = pAllocateAndGetTcpExTableFromStack( NULL, FALSE, INVALID_HANDLE_VALUE, 0, 0 );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, INVALID_HANDLE_VALUE, 0, AF_INET );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
ret = pAllocateAndGetTcpExTableFromStack( (void **)NULL, FALSE, GetProcessHeap(), 0, AF_INET );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
}
|
||||
|
||||
ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, 0 );
|
||||
ok( ret == ERROR_INVALID_PARAMETER || broken(ERROR_NOT_SUPPORTED) /* win2k */, "got %u\n", ret );
|
||||
|
||||
ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, AF_INET );
|
||||
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
||||
|
||||
if (ret == NO_ERROR && winetest_debug > 1)
|
||||
{
|
||||
DWORD i;
|
||||
trace( "AllocateAndGetTcpExTableFromStack table: %u entries\n", table_ex->dwNumEntries );
|
||||
for (i = 0; i < table_ex->dwNumEntries; i++)
|
||||
{
|
||||
trace( "%u: local %s:%u remote %s:%u state %u pid %u\n", i,
|
||||
ntoa(table_ex->table[i].dwLocalAddr), ntohs(table_ex->table[i].dwLocalPort),
|
||||
ntoa( table_ex->table[i].dwRemoteAddr ), ntohs(table_ex->table[i].dwRemotePort),
|
||||
U(table_ex->table[i]).dwState, table_ex->table[i].dwOwningPid );
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, table_ex);
|
||||
|
||||
ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, AF_INET6 );
|
||||
ok( ret == ERROR_NOT_SUPPORTED, "got %u\n", ret );
|
||||
}
|
||||
|
||||
static void test_GetExtendedUdpTable(void)
|
||||
{
|
||||
DWORD ret, size;
|
||||
|
@ -1923,6 +1971,7 @@ START_TEST(iphlpapi)
|
|||
test_GetAdaptersAddresses();
|
||||
test_GetExtendedTcpTable();
|
||||
test_GetExtendedUdpTable();
|
||||
test_AllocateAndGetTcpExTableFromStack();
|
||||
test_CreateSortedAddressPairs();
|
||||
test_interface_identifier_conversion();
|
||||
test_GetIfEntry2();
|
||||
|
|
Loading…
Reference in New Issue