mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[TCPIP_DRVTEST]
- Handle errors to avoid uninitialized variable usage svn path=/trunk/; revision=68870
This commit is contained in:
parent
6528e0b9d8
commit
fec1f08cd5
1 changed files with 12 additions and 7 deletions
|
@ -19,6 +19,7 @@ START_TEST(InterfaceInfo)
|
||||||
HANDLE FileHandle;
|
HANDLE FileHandle;
|
||||||
DWORD BufferSize;
|
DWORD BufferSize;
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
|
DWORD Error;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
/* Open a control channel file for TCP */
|
/* Open a control channel file for TCP */
|
||||||
|
@ -44,8 +45,9 @@ START_TEST(InterfaceInfo)
|
||||||
sizeof(InterfaceInfo),
|
sizeof(InterfaceInfo),
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
NULL);
|
NULL);
|
||||||
|
Error = GetLastError();
|
||||||
ok(!Result, "DeviceIoControl succeeded.\n");
|
ok(!Result, "DeviceIoControl succeeded.\n");
|
||||||
ok_long(GetLastError(), ERROR_INVALID_FUNCTION);
|
ok_long(Error, ERROR_INVALID_FUNCTION);
|
||||||
ok_long(BufferSize, 0);
|
ok_long(BufferSize, 0);
|
||||||
|
|
||||||
CloseHandle(FileHandle);
|
CloseHandle(FileHandle);
|
||||||
|
@ -73,7 +75,7 @@ START_TEST(InterfaceInfo)
|
||||||
sizeof(InterfaceInfo),
|
sizeof(InterfaceInfo),
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
NULL);
|
NULL);
|
||||||
ok(Result, "DeviceIoControl failed.\n");
|
ok(Result, "DeviceIoControl failed, GLE %lu.\n", GetLastError());
|
||||||
ok(BufferSize != 0, "Buffer size is zero.\n");
|
ok(BufferSize != 0, "Buffer size is zero.\n");
|
||||||
trace("Buffer size is %lu.\n", BufferSize);
|
trace("Buffer size is %lu.\n", BufferSize);
|
||||||
|
|
||||||
|
@ -92,15 +94,18 @@ START_TEST(InterfaceInfo)
|
||||||
BufferSize,
|
BufferSize,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
NULL);
|
NULL);
|
||||||
ok(Result, "DeviceIoControl failed.\n");
|
ok(Result, "DeviceIoControl failed, GLE %lu.\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Result && BufferSize >= RTL_SIZEOF_THROUGH_FIELD(IP_INTERFACE_INFO, NumAdapters))
|
||||||
|
{
|
||||||
/* Nothing much to test. Just print out the adapters we got */
|
/* Nothing much to test. Just print out the adapters we got */
|
||||||
trace("We got %ld adapters.\n", pInterfaceInfo->NumAdapters);
|
trace("We got %ld adapters.\n", pInterfaceInfo->NumAdapters);
|
||||||
for (i = 0; i < pInterfaceInfo->NumAdapters; i++)
|
for (i = 0; i < pInterfaceInfo->NumAdapters; i++)
|
||||||
{
|
{
|
||||||
trace("\tIndex %lu, name %S\n", pInterfaceInfo->Adapter[i].Index, pInterfaceInfo->Adapter[i].Name);
|
trace("\tIndex %lu, name %S\n", pInterfaceInfo->Adapter[i].Index, pInterfaceInfo->Adapter[i].Name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pInterfaceInfo != &InterfaceInfo)
|
if (pInterfaceInfo != &InterfaceInfo)
|
||||||
HeapFree(GetProcessHeap(), 0, pInterfaceInfo);
|
HeapFree(GetProcessHeap(), 0, pInterfaceInfo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue