Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
747573f1
Commit
747573f1
authored
Jul 06, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Jul 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Reimplement get_pid_map() using the list_processes request.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8622eb32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
36 deletions
+49
-36
ipstats.c
dlls/iphlpapi/ipstats.c
+49
-36
No files found.
dlls/iphlpapi/ipstats.c
View file @
747573f1
...
...
@@ -1887,56 +1887,69 @@ struct pid_map
static
struct
pid_map
*
get_pid_map
(
unsigned
int
*
num_entries
)
{
HANDLE
snapshot
=
NULL
;
struct
pid_map
*
map
;
unsigned
int
i
=
0
,
count
=
16
,
size
=
count
*
sizeof
(
*
map
)
;
unsigned
int
i
=
0
,
map_count
=
16
,
buffer_len
=
4096
,
process_count
,
pos
=
0
;
NTSTATUS
ret
;
char
*
buffer
=
NULL
,
*
new_buffer
;
if
(
!
(
map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
NULL
;
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buffer_len
)))
return
NULL
;
SERVER_START_REQ
(
create_snapshot
)
for
(;;)
{
SERVER_START_REQ
(
list_processes
)
{
wine_server_set_reply
(
req
,
buffer
,
buffer_len
);
ret
=
wine_server_call
(
req
);
buffer_len
=
reply
->
info_size
;
process_count
=
reply
->
process_count
;
}
SERVER_END_REQ
;
if
(
ret
!=
STATUS_INFO_LENGTH_MISMATCH
)
break
;
if
(
!
(
new_buffer
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buffer
,
buffer_len
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
NULL
;
}
}
if
(
!
(
map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
map_count
*
sizeof
(
*
map
)
)))
{
req
->
flags
=
SNAP_PROCESS
;
req
->
attributes
=
0
;
if
(
!
(
ret
=
wine_server_call
(
req
)))
snapshot
=
wine_server_ptr_handle
(
reply
->
handle
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
NULL
;
}
SERVER_END_REQ
;
*
num_entries
=
0
;
while
(
ret
==
STATUS_SUCCESS
)
for
(
i
=
0
;
i
<
process_count
;
++
i
)
{
SERVER_START_REQ
(
next_process
)
const
struct
process_info
*
process
;
pos
=
(
pos
+
7
)
&
~
7
;
process
=
(
const
struct
process_info
*
)(
buffer
+
pos
);
if
(
i
>=
map_count
)
{
req
->
handle
=
wine_server_obj_handle
(
snapshot
)
;
req
->
reset
=
(
i
==
0
)
;
if
(
!
(
ret
=
wine_server_call
(
req
)))
struct
pid_map
*
new_map
;
map_count
*=
2
;
if
(
!
(
new_map
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
map
,
map_count
*
sizeof
(
*
map
)
)))
{
if
(
i
>=
count
)
{
struct
pid_map
*
new_map
;
count
*=
2
;
size
=
count
*
sizeof
(
*
new_map
);
if
(
!
(
new_map
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
map
,
size
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
map
);
map
=
NULL
;
goto
done
;
}
map
=
new_map
;
}
map
[
i
].
pid
=
reply
->
pid
;
map
[
i
].
unix_pid
=
reply
->
unix_pid
;
(
*
num_entries
)
++
;
i
++
;
HeapFree
(
GetProcessHeap
(),
0
,
map
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
NULL
;
}
map
=
new_map
;
}
SERVER_END_REQ
;
map
[
i
].
pid
=
process
->
pid
;
map
[
i
].
unix_pid
=
process
->
unix_pid
;
pos
+=
sizeof
(
struct
process_info
)
+
process
->
name_len
;
pos
=
(
pos
+
7
)
&
~
7
;
pos
+=
process
->
thread_count
*
sizeof
(
struct
thread_info
);
}
done:
NtClose
(
snapshot
)
;
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
*
num_entries
=
process_count
;
return
map
;
}
...
...
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