From 8dde502f0ec7da338ec2b492d1451d8ea25b2a1b Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Wed, 25 Apr 2012 01:50:21 -0300 Subject: [PATCH] iphlpapi/tests: Add SetTcpEntry tests. --- dlls/iphlpapi/tests/iphlpapi.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index ec388a36937..e9e4021205c 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -67,6 +67,7 @@ typedef DWORD (WINAPI *GetAdaptersAddressesFunc)(ULONG,ULONG,PVOID,PIP_ADAPTER_A typedef DWORD (WINAPI *NotifyAddrChangeFunc)(PHANDLE,LPOVERLAPPED); typedef BOOL (WINAPI *CancelIPChangeNotifyFunc)(LPOVERLAPPED); typedef DWORD (WINAPI *GetExtendedTcpTableFunc)(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG); +typedef DWORD (WINAPI *SetTcpEntryFunc)(PMIB_TCPROW); static GetNumberOfInterfacesFunc gGetNumberOfInterfaces = NULL; static GetIpAddrTableFunc gGetIpAddrTable = NULL; @@ -89,6 +90,7 @@ static GetAdaptersAddressesFunc gGetAdaptersAddresses = NULL; static NotifyAddrChangeFunc gNotifyAddrChange = NULL; static CancelIPChangeNotifyFunc gCancelIPChangeNotify = NULL; static GetExtendedTcpTableFunc gGetExtendedTcpTable = NULL; +static SetTcpEntryFunc gSetTcpEntry = NULL; static void loadIPHlpApi(void) { @@ -134,6 +136,8 @@ static void loadIPHlpApi(void) hLibrary, "CancelIPChangeNotify"); gGetExtendedTcpTable = (GetExtendedTcpTableFunc)GetProcAddress( hLibrary, "GetExtendedTcpTable"); + gSetTcpEntry = (SetTcpEntryFunc)GetProcAddress( + hLibrary, "SetTcpEntry"); } } @@ -159,6 +163,7 @@ static void freeIPHlpApi(void) gNotifyAddrChange = NULL; gCancelIPChangeNotify = NULL; gGetExtendedTcpTable = NULL; + gSetTcpEntry = NULL; FreeLibrary(hLibrary); hLibrary = NULL; } @@ -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: CreateIpForwardEntry @@ -664,7 +690,6 @@ SetIpForwardEntry SetIpNetEntry SetIpStatistics SetIpTTL -SetTcpEntry */ static void testWinNT4Functions(void) { @@ -679,6 +704,7 @@ static void testWinNT4Functions(void) testGetUdpStatistics(); testGetTcpTable(); testGetUdpTable(); + testSetTcpEntry(); } static void testGetInterfaceInfo(void) -- 2.11.4.GIT