ReactOS 0.4.15-dev-7924-g5949c20
InterfaceInfo.c File Reference
#include <apitest.h>
#include <ipexport.h>
#include <winioctl.h>
#include <tcpioctl.h>
#include <tcpip_undoc.h>
Include dependency graph for InterfaceInfo.c:

Go to the source code of this file.

Functions

 START_TEST (InterfaceInfo)
 

Function Documentation

◆ START_TEST()

START_TEST ( InterfaceInfo  )

Definition at line 15 of file InterfaceInfo.c.

16{
17 IP_INTERFACE_INFO* pInterfaceInfo;
18 IP_INTERFACE_INFO InterfaceInfo;
23 ULONG i;
24
25 /* Open a control channel file for TCP */
27 L"\\\\.\\Tcp",
30 NULL,
33 NULL);
34 ok(FileHandle != INVALID_HANDLE_VALUE, "CreateFile failed, GLE %lu\n", GetLastError());
35
36 /* Try the IOCTL */
37 BufferSize = 0;
38 pInterfaceInfo = &InterfaceInfo;
42 NULL,
43 0,
44 pInterfaceInfo,
45 sizeof(InterfaceInfo),
47 NULL);
49 ok(!Result, "DeviceIoControl succeeded.\n");
52
54
55 /* This IOCTL only works with \Device\Ip */
57 L"\\\\.\\Ip",
60 NULL,
63 NULL);
64 ok(FileHandle != INVALID_HANDLE_VALUE, "CreateFile failed, GLE %lu\n", GetLastError());
65
66 /* Get the buffer size. */
67 BufferSize = 0;
68 pInterfaceInfo = &InterfaceInfo;
72 NULL,
73 0,
74 pInterfaceInfo,
75 sizeof(InterfaceInfo),
77 NULL);
78 ok(Result, "DeviceIoControl failed, GLE %lu.\n", GetLastError());
79 ok(BufferSize != 0, "Buffer size is zero.\n");
80 trace("Buffer size is %lu.\n", BufferSize);
81
82 if (BufferSize > sizeof(InterfaceInfo))
83 {
84 pInterfaceInfo = HeapAlloc(GetProcessHeap(), 0, BufferSize);
85 ok(pInterfaceInfo != NULL, "HeapAlloc failed.\n");
86
87 /* Send IOCTL to fill the buffer in. */
91 NULL,
92 0,
93 pInterfaceInfo,
96 NULL);
97 ok(Result, "DeviceIoControl failed, GLE %lu.\n", GetLastError());
98 }
99
101 {
102 /* Nothing much to test. Just print out the adapters we got */
103 trace("We got %ld adapters.\n", pInterfaceInfo->NumAdapters);
104 for (i = 0; i < pInterfaceInfo->NumAdapters; i++)
105 {
106 trace("\tIndex %lu, name %S\n", pInterfaceInfo->Adapter[i].Index, pInterfaceInfo->Adapter[i].Name);
107 }
108 }
109
110 if (pInterfaceInfo != &InterfaceInfo)
111 HeapFree(GetProcessHeap(), 0, pInterfaceInfo);
113}
#define ok_long(expression, result)
Definition: atltest.h:133
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
BOOL Error
Definition: chkdsk.c:66
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define BufferSize
Definition: mmc.h:75
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:672
#define L(x)
Definition: ntvdm.h:50
WCHAR Name[MAX_ADAPTER_NAME]
Definition: ipexport.h:147
IP_ADAPTER_INDEX_MAP Adapter[1]
Definition: ipexport.h:152
#define IOCTL_IP_INTERFACE_INFO
Definition: tcpip_undoc.h:5
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409