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
53d522bc
Commit
53d522bc
authored
Mar 02, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Reimplement GetTcpTable to avoid parsing the same information three times.
parent
d069e498
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
183 deletions
+145
-183
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+22
-30
ipstats.c
dlls/iphlpapi/ipstats.c
+122
-151
ipstats.h
dlls/iphlpapi/ipstats.h
+1
-2
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
53d522bc
...
...
@@ -343,7 +343,7 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable,
ppTcpTable
,
bOrder
,
heap
,
flags
);
*
ppTcpTable
=
NULL
;
ret
=
getTcpTable
(
ppTcpTable
,
0
,
heap
,
flags
);
ret
=
getTcpTable
(
ppTcpTable
,
heap
,
flags
);
if
(
!
ret
&&
bOrder
)
qsort
((
*
ppTcpTable
)
->
table
,
(
*
ppTcpTable
)
->
dwNumEntries
,
sizeof
(
MIB_TCPROW
),
TcpTableSorter
);
...
...
@@ -1603,39 +1603,31 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS pStats)
*/
DWORD
WINAPI
GetTcpTable
(
PMIB_TCPTABLE
pTcpTable
,
PDWORD
pdwSize
,
BOOL
bOrder
)
{
DWORD
ret
;
DWORD
ret
;
PMIB_TCPTABLE
table
;
TRACE
(
"pTcpTable %p, pdwSize %p, bOrder %d
\n
"
,
pTcpTable
,
pdwSize
,
(
DWORD
)
bOrder
);
if
(
!
pdwSize
)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numEntries
=
getNumTcpEntries
();
DWORD
size
=
sizeof
(
MIB_TCPTABLE
);
TRACE
(
"pTcpTable %p, pdwSize %p, bOrder %d
\n
"
,
pTcpTable
,
pdwSize
,
bOrder
);
if
(
numEntries
>
1
)
size
+=
(
numEntries
-
1
)
*
sizeof
(
MIB_TCPROW
);
if
(
!
pTcpTable
||
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
}
else
{
ret
=
getTcpTable
(
&
pTcpTable
,
numEntries
,
0
,
0
);
if
(
!
ret
)
{
size
=
sizeof
(
MIB_TCPTABLE
);
if
(
pTcpTable
->
dwNumEntries
>
1
)
size
+=
(
pTcpTable
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_TCPROW
);
*
pdwSize
=
size
;
if
(
!
pdwSize
)
return
ERROR_INVALID_PARAMETER
;
if
(
bOrder
)
qsort
(
pTcpTable
->
table
,
pTcpTable
->
dwNumEntries
,
sizeof
(
MIB_TCPROW
),
TcpTableSorter
);
ret
=
NO_ERROR
;
}
ret
=
getTcpTable
(
&
table
,
GetProcessHeap
(),
0
);
if
(
!
ret
)
{
DWORD
size
=
FIELD_OFFSET
(
MIB_TCPTABLE
,
table
[
table
->
dwNumEntries
]
);
if
(
!
pTcpTable
||
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
}
else
{
*
pdwSize
=
size
;
memcpy
(
pTcpTable
,
table
,
size
);
if
(
bOrder
)
qsort
(
pTcpTable
->
table
,
pTcpTable
->
dwNumEntries
,
sizeof
(
MIB_TCPROW
),
TcpTableSorter
);
}
HeapFree
(
GetProcessHeap
(),
0
,
table
);
}
}
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
...
...
dlls/iphlpapi/ipstats.c
View file @
53d522bc
This diff is collapsed.
Click to expand it.
dlls/iphlpapi/ipstats.h
View file @
53d522bc
...
...
@@ -83,7 +83,6 @@ DWORD getNumTcpEntries(void);
/* Allocates the TCP state table from heap and returns it to you in *ppTcpTable.
* Returns NO_ERROR on success, something else on failure.
*/
DWORD
getTcpTable
(
PMIB_TCPTABLE
*
ppTcpTable
,
DWORD
maxEntries
,
HANDLE
heap
,
DWORD
flags
);
DWORD
getTcpTable
(
PMIB_TCPTABLE
*
ppTcpTable
,
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