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
b406213c
Commit
b406213c
authored
Mar 02, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Moved AllocateAndGetIpNetTableFromStack implementation to ipstats.c.
parent
bc08fb99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
56 deletions
+39
-56
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+1
-49
ipstats.c
dlls/iphlpapi/ipstats.c
+37
-2
ipstats.h
dlls/iphlpapi/ipstats.h
+1
-5
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
b406213c
...
...
@@ -246,51 +246,6 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *
}
static
int
IpNetTableSorter
(
const
void
*
a
,
const
void
*
b
)
{
int
ret
;
if
(
a
&&
b
)
ret
=
((
const
MIB_IPNETROW
*
)
a
)
->
dwAddr
-
((
const
MIB_IPNETROW
*
)
b
)
->
dwAddr
;
else
ret
=
0
;
return
ret
;
}
/******************************************************************
* AllocateAndGetIpNetTableFromStack (IPHLPAPI.@)
*
* Get the IP-to-physical address mapping table.
* Like GetIpNetTable(), but allocate the returned table from heap.
*
* PARAMS
* ppIpNetTable [Out] pointer into which the MIB_IPNETTABLE is
* allocated and returned.
* bOrder [In] whether to sort the table
* heap [In] heap from which the table is allocated
* flags [In] flags to HeapAlloc
*
* RETURNS
* ERROR_INVALID_PARAMETER if ppIpNetTable is NULL, other error codes
* on failure, NO_ERROR on success.
*/
DWORD
WINAPI
AllocateAndGetIpNetTableFromStack
(
PMIB_IPNETTABLE
*
ppIpNetTable
,
BOOL
bOrder
,
HANDLE
heap
,
DWORD
flags
)
{
DWORD
ret
;
TRACE
(
"ppIpNetTable %p, bOrder %d, heap %p, flags 0x%08x
\n
"
,
ppIpNetTable
,
bOrder
,
heap
,
flags
);
ret
=
getArpTable
(
ppIpNetTable
,
heap
,
flags
);
if
(
!
ret
&&
bOrder
)
qsort
((
*
ppIpNetTable
)
->
table
,
(
*
ppIpNetTable
)
->
dwNumEntries
,
sizeof
(
MIB_IPADDRROW
),
IpNetTableSorter
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
/******************************************************************
* CreateIpForwardEntry (IPHLPAPI.@)
*
...
...
@@ -1196,7 +1151,7 @@ DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOr
if
(
!
pdwSize
)
return
ERROR_INVALID_PARAMETER
;
ret
=
getArpTable
(
&
table
,
GetProcessHeap
(),
0
);
ret
=
AllocateAndGetIpNetTableFromStack
(
&
table
,
bOrder
,
GetProcessHeap
(),
0
);
if
(
!
ret
)
{
DWORD
size
=
FIELD_OFFSET
(
MIB_IPNETTABLE
,
table
[
table
->
dwNumEntries
]
);
if
(
!
pIpNetTable
||
*
pdwSize
<
size
)
{
...
...
@@ -1206,9 +1161,6 @@ DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOr
else
{
*
pdwSize
=
size
;
memcpy
(
pIpNetTable
,
table
,
size
);
if
(
bOrder
)
qsort
(
pIpNetTable
->
table
,
pIpNetTable
->
dwNumEntries
,
sizeof
(
MIB_IPNETROW
),
IpNetTableSorter
);
}
HeapFree
(
GetProcessHeap
(),
0
,
table
);
}
...
...
dlls/iphlpapi/ipstats.c
View file @
b406213c
...
...
@@ -1296,12 +1296,41 @@ static MIB_IPNETTABLE *append_ipnet_row( HANDLE heap, DWORD flags, MIB_IPNETTABL
return
table
;
}
DWORD
getArpTable
(
PMIB_IPNETTABLE
*
ppIpNetTable
,
HANDLE
heap
,
DWORD
flags
)
static
int
compare_ipnet_rows
(
const
void
*
a
,
const
void
*
b
)
{
const
MIB_IPNETROW
*
rowA
=
a
;
const
MIB_IPNETROW
*
rowB
=
b
;
return
ntohl
(
rowA
->
dwAddr
)
-
ntohl
(
rowB
->
dwAddr
);
}
/******************************************************************
* AllocateAndGetIpNetTableFromStack (IPHLPAPI.@)
*
* Get the IP-to-physical address mapping table.
* Like GetIpNetTable(), but allocate the returned table from heap.
*
* PARAMS
* ppIpNetTable [Out] pointer into which the MIB_IPNETTABLE is
* allocated and returned.
* bOrder [In] whether to sort the table
* heap [In] heap from which the table is allocated
* flags [In] flags to HeapAlloc
*
* RETURNS
* ERROR_INVALID_PARAMETER if ppIpNetTable is NULL, other error codes
* on failure, NO_ERROR on success.
*/
DWORD
WINAPI
AllocateAndGetIpNetTableFromStack
(
PMIB_IPNETTABLE
*
ppIpNetTable
,
BOOL
bOrder
,
HANDLE
heap
,
DWORD
flags
)
{
MIB_IPNETTABLE
*
table
;
MIB_IPNETROW
row
;
DWORD
ret
=
NO_ERROR
,
count
=
16
;
TRACE
(
"table %p, bOrder %d, heap %p, flags 0x%08x
\n
"
,
ppIpNetTable
,
bOrder
,
heap
,
flags
);
if
(
!
ppIpNetTable
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
(
table
=
HeapAlloc
(
heap
,
flags
,
FIELD_OFFSET
(
MIB_IPNETTABLE
,
table
[
count
]
))))
...
...
@@ -1420,8 +1449,14 @@ done:
#endif
if
(
!
table
)
return
ERROR_OUTOFMEMORY
;
if
(
!
ret
)
*
ppIpNetTable
=
table
;
if
(
!
ret
)
{
if
(
bOrder
&&
table
->
dwNumEntries
)
qsort
(
table
->
table
,
table
->
dwNumEntries
,
sizeof
(
row
),
compare_ipnet_rows
);
*
ppIpNetTable
=
table
;
}
else
HeapFree
(
heap
,
flags
,
table
);
TRACE
(
"returning ret %u table %p
\n
"
,
ret
,
table
);
return
ret
;
}
...
...
dlls/iphlpapi/ipstats.h
View file @
b406213c
...
...
@@ -64,11 +64,6 @@ DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap,
/* Returns the number of entries in the arp table. */
DWORD
getNumArpEntries
(
void
);
/* Allocates the arp table from heap and returns it to you in *ppIpNetTable.
* Returns NO_ERROR on success, something else on failure.
*/
DWORD
getArpTable
(
PMIB_IPNETTABLE
*
ppIpNetTable
,
HANDLE
heap
,
DWORD
flags
);
/* Returns the number of entries in the UDP state table. */
DWORD
getNumUdpEntries
(
void
);
...
...
@@ -77,5 +72,6 @@ DWORD getNumTcpEntries(void);
DWORD
WINAPI
AllocateAndGetUdpTableFromStack
(
PMIB_UDPTABLE
*
ppUdpTable
,
BOOL
bOrder
,
HANDLE
heap
,
DWORD
flags
);
DWORD
WINAPI
AllocateAndGetTcpTableFromStack
(
PMIB_TCPTABLE
*
ppTcpTable
,
BOOL
bOrder
,
HANDLE
heap
,
DWORD
flags
);
DWORD
WINAPI
AllocateAndGetIpNetTableFromStack
(
PMIB_IPNETTABLE
*
ppIpNetTable
,
BOOL
bOrder
,
HANDLE
heap
,
DWORD
flags
);
#endif
/* ndef WINE_IPSTATS_H_ */
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