Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bdf180d2
Commit
bdf180d2
authored
Jul 02, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Fix the return value of GetPerAdapterInfo, with tests.
parent
89a3bd0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+9
-18
iphlpapi.c
dlls/iphlpapi/tests/iphlpapi.c
+23
-1
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
bdf180d2
...
...
@@ -1513,28 +1513,19 @@ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf)
DWORD
WINAPI
GetPerAdapterInfo
(
ULONG
IfIndex
,
PIP_PER_ADAPTER_INFO
pPerAdapterInfo
,
PULONG
pOutBufLen
)
{
ULONG
bytesNeeded
=
sizeof
(
IP_PER_ADAPTER_INFO
);
DWORD
ret
;
TRACE
(
"(IfIndex %d, pPerAdapterInfo %p, pOutBufLen %p)
\n
"
,
IfIndex
,
pPerAdapterInfo
,
pOutBufLen
);
if
(
!
pOutBufLen
)
ret
=
ERROR_INVALID_PARAMETER
;
else
if
(
!
pPerAdapterInfo
)
{
*
pOutBufLen
=
bytesNeeded
;
ret
=
NO_ERROR
;
}
else
if
(
*
pOutBufLen
<
bytesNeeded
)
TRACE
(
"(IfIndex %d, pPerAdapterInfo %p, pOutBufLen %p)
\n
"
,
IfIndex
,
pPerAdapterInfo
,
pOutBufLen
);
if
(
!
pOutBufLen
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
pPerAdapterInfo
||
*
pOutBufLen
<
bytesNeeded
)
{
*
pOutBufLen
=
bytesNeeded
;
ret
=
ERROR_BUFFER_OVERFLOW
;
}
else
{
memset
(
pPerAdapterInfo
,
0
,
bytesNeeded
);
ret
=
NO_ERROR
;
return
ERROR_BUFFER_OVERFLOW
;
}
return
ret
;
memset
(
pPerAdapterInfo
,
0
,
bytesNeeded
);
return
NO_ERROR
;
}
...
...
dlls/iphlpapi/tests/iphlpapi.c
View file @
bdf180d2
...
...
@@ -61,6 +61,7 @@ typedef DWORD (WINAPI *GetTcpStatisticsFunc)(PMIB_TCPSTATS);
typedef
DWORD
(
WINAPI
*
GetUdpStatisticsFunc
)(
PMIB_UDPSTATS
);
typedef
DWORD
(
WINAPI
*
GetTcpTableFunc
)(
PMIB_TCPTABLE
,
PDWORD
,
BOOL
);
typedef
DWORD
(
WINAPI
*
GetUdpTableFunc
)(
PMIB_UDPTABLE
,
PDWORD
,
BOOL
);
typedef
DWORD
(
WINAPI
*
GetPerAdapterInfoFunc
)(
ULONG
,
PIP_PER_ADAPTER_INFO
,
PULONG
);
static
GetNumberOfInterfacesFunc
gGetNumberOfInterfaces
=
NULL
;
static
GetIpAddrTableFunc
gGetIpAddrTable
=
NULL
;
...
...
@@ -78,6 +79,7 @@ static GetTcpStatisticsFunc gGetTcpStatistics = NULL;
static
GetUdpStatisticsFunc
gGetUdpStatistics
=
NULL
;
static
GetTcpTableFunc
gGetTcpTable
=
NULL
;
static
GetUdpTableFunc
gGetUdpTable
=
NULL
;
static
GetPerAdapterInfoFunc
gGetPerAdapterInfo
=
NULL
;
static
void
loadIPHlpApi
(
void
)
{
...
...
@@ -115,6 +117,7 @@ static void loadIPHlpApi(void)
hLibrary
,
"GetTcpTable"
);
gGetUdpTable
=
(
GetUdpTableFunc
)
GetProcAddress
(
hLibrary
,
"GetUdpTable"
);
gGetPerAdapterInfo
=
(
GetPerAdapterInfoFunc
)
GetProcAddress
(
hLibrary
,
"GetPerAdapterInfo"
);
}
}
...
...
@@ -584,6 +587,25 @@ static void testWin98Functions(void)
testGetNetworkParams
();
}
static
void
testGetPerAdapterInfo
(
void
)
{
DWORD
ret
,
needed
;
void
*
buffer
;
if
(
!
gGetPerAdapterInfo
)
return
;
ret
=
gGetPerAdapterInfo
(
1
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_INVALID_PARAMETER
,
"got %u instead of ERROR_INVALID_PARAMETER
\n
"
,
ret
);
needed
=
0xdeadbeef
;
ret
=
gGetPerAdapterInfo
(
1
,
NULL
,
&
needed
);
if
(
ret
==
ERROR_NO_DATA
)
return
;
/* no such adapter */
ok
(
ret
==
ERROR_BUFFER_OVERFLOW
,
"got %u instead of ERROR_BUFFER_OVERFLOW
\n
"
,
ret
);
ok
(
needed
!=
0xdeadbeef
,
"needed not set
\n
"
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
ret
=
gGetPerAdapterInfo
(
1
,
buffer
,
&
needed
);
ok
(
ret
==
NO_ERROR
,
"got %u instead of NO_ERROR
\n
"
,
ret
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
/*
still-to-be-tested 2K-onward functions:
AddIPAddress
...
...
@@ -593,7 +615,6 @@ DeleteProxyArpEntry
EnableRouter
FlushIpNetTable
GetAdapterIndex
GetPerAdapterInfo
NotifyAddrChange
NotifyRouteChange
SendARP
...
...
@@ -601,6 +622,7 @@ UnenableRouter
*/
static
void
testWin2KFunctions
(
void
)
{
testGetPerAdapterInfo
();
}
START_TEST
(
iphlpapi
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment