Commit 8dde502f authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

iphlpapi/tests: Add SetTcpEntry tests.

parent ae6fb751
...@@ -67,6 +67,7 @@ typedef DWORD (WINAPI *GetAdaptersAddressesFunc)(ULONG,ULONG,PVOID,PIP_ADAPTER_A ...@@ -67,6 +67,7 @@ typedef DWORD (WINAPI *GetAdaptersAddressesFunc)(ULONG,ULONG,PVOID,PIP_ADAPTER_A
typedef DWORD (WINAPI *NotifyAddrChangeFunc)(PHANDLE,LPOVERLAPPED); typedef DWORD (WINAPI *NotifyAddrChangeFunc)(PHANDLE,LPOVERLAPPED);
typedef BOOL (WINAPI *CancelIPChangeNotifyFunc)(LPOVERLAPPED); typedef BOOL (WINAPI *CancelIPChangeNotifyFunc)(LPOVERLAPPED);
typedef DWORD (WINAPI *GetExtendedTcpTableFunc)(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG); typedef DWORD (WINAPI *GetExtendedTcpTableFunc)(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);
typedef DWORD (WINAPI *SetTcpEntryFunc)(PMIB_TCPROW);
static GetNumberOfInterfacesFunc gGetNumberOfInterfaces = NULL; static GetNumberOfInterfacesFunc gGetNumberOfInterfaces = NULL;
static GetIpAddrTableFunc gGetIpAddrTable = NULL; static GetIpAddrTableFunc gGetIpAddrTable = NULL;
...@@ -89,6 +90,7 @@ static GetAdaptersAddressesFunc gGetAdaptersAddresses = NULL; ...@@ -89,6 +90,7 @@ static GetAdaptersAddressesFunc gGetAdaptersAddresses = NULL;
static NotifyAddrChangeFunc gNotifyAddrChange = NULL; static NotifyAddrChangeFunc gNotifyAddrChange = NULL;
static CancelIPChangeNotifyFunc gCancelIPChangeNotify = NULL; static CancelIPChangeNotifyFunc gCancelIPChangeNotify = NULL;
static GetExtendedTcpTableFunc gGetExtendedTcpTable = NULL; static GetExtendedTcpTableFunc gGetExtendedTcpTable = NULL;
static SetTcpEntryFunc gSetTcpEntry = NULL;
static void loadIPHlpApi(void) static void loadIPHlpApi(void)
{ {
...@@ -134,6 +136,8 @@ static void loadIPHlpApi(void) ...@@ -134,6 +136,8 @@ static void loadIPHlpApi(void)
hLibrary, "CancelIPChangeNotify"); hLibrary, "CancelIPChangeNotify");
gGetExtendedTcpTable = (GetExtendedTcpTableFunc)GetProcAddress( gGetExtendedTcpTable = (GetExtendedTcpTableFunc)GetProcAddress(
hLibrary, "GetExtendedTcpTable"); hLibrary, "GetExtendedTcpTable");
gSetTcpEntry = (SetTcpEntryFunc)GetProcAddress(
hLibrary, "SetTcpEntry");
} }
} }
...@@ -159,6 +163,7 @@ static void freeIPHlpApi(void) ...@@ -159,6 +163,7 @@ static void freeIPHlpApi(void)
gNotifyAddrChange = NULL; gNotifyAddrChange = NULL;
gCancelIPChangeNotify = NULL; gCancelIPChangeNotify = NULL;
gGetExtendedTcpTable = NULL; gGetExtendedTcpTable = NULL;
gSetTcpEntry = NULL;
FreeLibrary(hLibrary); FreeLibrary(hLibrary);
hLibrary = NULL; hLibrary = NULL;
} }
...@@ -651,6 +656,27 @@ static void testGetUdpTable(void) ...@@ -651,6 +656,27 @@ static void testGetUdpTable(void)
} }
} }
static void testSetTcpEntry(void)
{
DWORD ret;
MIB_TCPROW row;
memset(&row, 0, sizeof(row));
if(0) /* This test crashes in OS >= VISTA */
{
ret = gSetTcpEntry(NULL);
ok( ret == ERROR_INVALID_PARAMETER, "got %u, expected %u\n", ret, ERROR_INVALID_PARAMETER);
}
ret = gSetTcpEntry(&row);
todo_wine ok( ret == ERROR_INVALID_PARAMETER, "got %u, expected %u\n", ret, ERROR_INVALID_PARAMETER);
row.dwState = MIB_TCP_STATE_DELETE_TCB;
ret = gSetTcpEntry(&row);
todo_wine ok( ret == ERROR_MR_MID_NOT_FOUND || broken(ret == ERROR_INVALID_PARAMETER),
"got %u, expected %u\n", ret, ERROR_MR_MID_NOT_FOUND);
}
/* /*
still-to-be-tested NT4-onward functions: still-to-be-tested NT4-onward functions:
CreateIpForwardEntry CreateIpForwardEntry
...@@ -664,7 +690,6 @@ SetIpForwardEntry ...@@ -664,7 +690,6 @@ SetIpForwardEntry
SetIpNetEntry SetIpNetEntry
SetIpStatistics SetIpStatistics
SetIpTTL SetIpTTL
SetTcpEntry
*/ */
static void testWinNT4Functions(void) static void testWinNT4Functions(void)
{ {
...@@ -679,6 +704,7 @@ static void testWinNT4Functions(void) ...@@ -679,6 +704,7 @@ static void testWinNT4Functions(void)
testGetUdpStatistics(); testGetUdpStatistics();
testGetTcpTable(); testGetTcpTable();
testGetUdpTable(); testGetUdpTable();
testSetTcpEntry();
} }
static void testGetInterfaceInfo(void) static void testGetInterfaceInfo(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment