Author: jgardou Date: Tue Dec 2 18:06:57 2014 New Revision: 65547
URL: http://svn.reactos.org/svn/reactos?rev=65547&view=rev Log: [ROSTESTS] - Add tcpip_drvtest, for now only testing the IOCTL behind iphlpapi's GetInterfaceInfo
Added: trunk/rostests/drivers/CMakeLists.txt (with props) trunk/rostests/drivers/tcpip/ trunk/rostests/drivers/tcpip/CMakeLists.txt (with props) trunk/rostests/drivers/tcpip/InterfaceInfo.c (with props) trunk/rostests/drivers/tcpip/testlist.c (with props) Modified: trunk/rostests/CMakeLists.txt
Modified: trunk/rostests/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/CMakeLists.txt?rev=65547&a... ============================================================================== --- trunk/rostests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/CMakeLists.txt [iso-8859-1] Tue Dec 2 18:06:57 2014 @@ -1,7 +1,7 @@
add_subdirectory(apitests) #add_subdirectory(dibtests) -#add_subdirectory(drivers) +add_subdirectory(drivers) #add_subdirectory(dxtest) add_subdirectory(kmtests) #add_subdirectory(regtests)
Added: trunk/rostests/drivers/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/CMakeLists.txt?rev... ============================================================================== --- trunk/rostests/drivers/CMakeLists.txt (added) +++ trunk/rostests/drivers/CMakeLists.txt [iso-8859-1] Tue Dec 2 18:06:57 2014 @@ -0,0 +1,5 @@ + +#add_subdirectory(csqtest) +#add_subdirectory(memtest) +#add_subdirectory(ntoskrnl) +add_subdirectory(tcpip)
Propchange: trunk/rostests/drivers/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/drivers/tcpip/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/tcpip/CMakeLists.t... ============================================================================== --- trunk/rostests/drivers/tcpip/CMakeLists.txt (added) +++ trunk/rostests/drivers/tcpip/CMakeLists.txt [iso-8859-1] Tue Dec 2 18:06:57 2014 @@ -0,0 +1,12 @@ + +include_directories(../../apitests/include) + +list(APPEND SOURCE + InterfaceInfo.c + testlist.c) + +add_executable(tcpip_drvtest ${SOURCE}) +target_link_libraries(tcpip_drvtest wine) +set_module_type(tcpip_drvtest win32cui) +add_importlibs(tcpip_drvtest msvcrt kernel32 ntdll) +add_cd_file(TARGET tcpip_drvtest DESTINATION reactos/bin FOR all)
Propchange: trunk/rostests/drivers/tcpip/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/rostests/drivers/tcpip/InterfaceInfo.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/tcpip/InterfaceInf... ============================================================================== --- trunk/rostests/drivers/tcpip/InterfaceInfo.c (added) +++ trunk/rostests/drivers/tcpip/InterfaceInfo.c [iso-8859-1] Tue Dec 2 18:06:57 2014 @@ -0,0 +1,107 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: User mode part of the TcpIp.sys test suite + * PROGRAMMER: Jérôme Gardou jerome.gardou@reactos.org + */ + +#include <apitest.h> + +#include <ipexport.h> +#include <winioctl.h> +#include <tcpioctl.h> +#include <tcpip_undoc.h> + +START_TEST(InterfaceInfo) +{ + IP_INTERFACE_INFO* pInterfaceInfo; + IP_INTERFACE_INFO InterfaceInfo; + HANDLE FileHandle; + DWORD BufferSize; + BOOL Result; + ULONG i; + + /* Open a control channel file for TCP */ + FileHandle = CreateFileW( + L"\\.\Tcp", + FILE_READ_DATA | FILE_WRITE_DATA, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + ok(FileHandle != INVALID_HANDLE_VALUE, "CreateFile failed, GLE %lu\n", GetLastError()); + + /* Try the IOCTL */ + BufferSize = 0; + pInterfaceInfo = &InterfaceInfo; + Result = DeviceIoControl( + FileHandle, + IOCTL_IP_INTERFACE_INFO, + NULL, + 0, + pInterfaceInfo, + sizeof(InterfaceInfo), + &BufferSize, + NULL); + ok(!Result, "DeviceIoControl succeeded.\n"); + ok_long(GetLastError(), ERROR_INVALID_FUNCTION); + ok_long(BufferSize, 0); + + CloseHandle(FileHandle); + + /* This IOCTL only works with \Device\Ip */ + FileHandle = CreateFileW( + L"\\.\Ip", + FILE_READ_DATA | FILE_WRITE_DATA, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + ok(FileHandle != INVALID_HANDLE_VALUE, "CreateFile failed, GLE %lu\n", GetLastError()); + + /* Get the buffer size. */ + BufferSize = 0; + pInterfaceInfo = &InterfaceInfo; + Result = DeviceIoControl( + FileHandle, + IOCTL_IP_INTERFACE_INFO, + NULL, + 0, + pInterfaceInfo, + sizeof(InterfaceInfo), + &BufferSize, + NULL); + ok(Result, "DeviceIoControl failed.\n"); + ok(BufferSize != 0, "Buffer size is zero.\n"); + trace("Buffer size is %lu.\n", BufferSize); + + if (BufferSize > sizeof(InterfaceInfo)) + { + pInterfaceInfo = HeapAlloc(GetProcessHeap(), 0, BufferSize); + ok(pInterfaceInfo != NULL, "HeapAlloc failed.\n"); + + /* Send IOCTL to fill the buffer in. */ + Result = DeviceIoControl( + FileHandle, + IOCTL_IP_INTERFACE_INFO, + NULL, + 0, + pInterfaceInfo, + BufferSize, + &BufferSize, + NULL); + ok(Result, "DeviceIoControl failed.\n"); + } + + /* Nothing much to test. Just print out the adapters we got */ + trace("We got %ld adapters.\n", pInterfaceInfo->NumAdapters); + for (i = 0; i < pInterfaceInfo->NumAdapters; i++) + { + trace("\tIndex %lu, name %S\n", pInterfaceInfo->Adapter[i].Index, pInterfaceInfo->Adapter[i].Name); + } + + HeapFree(GetProcessHeap(), 0, pInterfaceInfo); + CloseHandle(FileHandle); +}
Propchange: trunk/rostests/drivers/tcpip/InterfaceInfo.c ------------------------------------------------------------------------------ charset = UTF-8
Propchange: trunk/rostests/drivers/tcpip/InterfaceInfo.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/rostests/drivers/tcpip/InterfaceInfo.c ------------------------------------------------------------------------------ svn:mime-type = text/plain
Added: trunk/rostests/drivers/tcpip/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/tcpip/testlist.c?r... ============================================================================== --- trunk/rostests/drivers/tcpip/testlist.c (added) +++ trunk/rostests/drivers/tcpip/testlist.c [iso-8859-1] Tue Dec 2 18:06:57 2014 @@ -0,0 +1,14 @@ +#define __ROS_LONG64__ + +#define STANDALONE +#include <apitest.h> + +extern void func_InterfaceInfo(void); + +const struct test winetest_testlist[] = +{ + { "InterfaceInfo", func_InterfaceInfo }, + + { 0, 0 } +}; +
Propchange: trunk/rostests/drivers/tcpip/testlist.c ------------------------------------------------------------------------------ charset = UTF-8
Propchange: trunk/rostests/drivers/tcpip/testlist.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/rostests/drivers/tcpip/testlist.c ------------------------------------------------------------------------------ svn:mime-type = text/plain