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
d418460f
Commit
d418460f
authored
Jun 15, 2005
by
Felix Nawothnig
Committed by
Alexandre Julliard
Jun 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Replaced server requests in EnumProcesses by native APIs
- Fixed third parameter (should return the amount of used and not needed memory).
parent
8dd4ee76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
43 deletions
+31
-43
psapi_main.c
dlls/psapi/psapi_main.c
+31
-43
No files found.
dlls/psapi/psapi_main.c
View file @
d418460f
...
...
@@ -75,61 +75,49 @@ BOOL WINAPI EnumPageFilesW( PENUM_PAGE_FILE_CALLBACKW callback, LPVOID context )
/***********************************************************************
* EnumProcesses (PSAPI.@)
*/
BOOL
WINAPI
EnumProcesses
(
DWORD
*
lp
idProcess
,
DWORD
cb
,
DWORD
*
lpcbNeed
ed
)
BOOL
WINAPI
EnumProcesses
(
DWORD
*
lp
dwProcessIDs
,
DWORD
cb
,
DWORD
*
lpcbUs
ed
)
{
HANDLE
hSnapshot
;
DWORD
count
;
DWORD
countMax
;
DWORD
pid
;
int
ret
;
SYSTEM_PROCESS_INFORMATION
*
spi
;
NTSTATUS
status
;
PVOID
pBuf
=
NULL
;
ULONG
nAlloc
=
0x8000
;
TRACE
(
"(%p, %ld, %p)
\n
"
,
lpidProcess
,
cb
,
lpcbNeeded
);
do
{
if
(
pBuf
!=
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pBuf
);
nAlloc
*=
2
;
}
if
(
lpidProcess
==
NULL
)
cb
=
0
;
if
(
lpcbNeeded
!=
NULL
)
*
lpcbNeeded
=
0
;
pBuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nAlloc
);
if
(
pBuf
==
NULL
)
return
FALSE
;
SERVER_START_REQ
(
create_snapshot
)
{
req
->
flags
=
SNAP_PROCESS
;
req
->
inherit
=
FALSE
;
req
->
pid
=
0
;
wine_server_call_err
(
req
);
hSnapshot
=
reply
->
handle
;
}
SERVER_END_REQ
;
status
=
NtQuerySystemInformation
(
SystemProcessInformation
,
pBuf
,
nAlloc
,
NULL
);
}
while
(
status
==
STATUS_INFO_LENGTH_MISMATCH
);
if
(
hSnapshot
==
0
)
if
(
status
!=
STATUS_SUCCESS
)
{
FIXME
(
"cannot create snapshot
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
pBuf
);
SetLastError
(
RtlNtStatusToDosError
(
status
));
return
FALSE
;
}
count
=
0
;
countMax
=
cb
/
sizeof
(
DWORD
);
for
(;;)
spi
=
pBuf
;
for
(
*
lpcbUsed
=
0
;
cb
>=
sizeof
(
DWORD
);
cb
-=
sizeof
(
DWORD
))
{
SERVER_START_REQ
(
next_process
)
{
req
->
handle
=
hSnapshot
;
req
->
reset
=
(
count
==
0
);
if
((
ret
=
!
wine_server_call_err
(
req
)))
pid
=
reply
->
pid
;
}
SERVER_END_REQ
;
if
(
!
ret
)
break
;
TRACE
(
"process 0x%08lx
\n
"
,
pid
);
if
(
count
<
countMax
)
lpidProcess
[
count
]
=
pid
;
count
++
;
}
CloseHandle
(
hSnapshot
);
*
lpdwProcessIDs
++
=
spi
->
dwProcessID
;
*
lpcbUsed
+=
sizeof
(
DWORD
);
if
(
lpcbNeeded
!=
NULL
)
*
lpcbNeeded
=
sizeof
(
DWORD
)
*
count
;
if
(
spi
->
dwOffset
==
0
)
break
;
TRACE
(
"return %lu processes
\n
"
,
count
);
spi
=
(
SYSTEM_PROCESS_INFORMATION
*
)(((
PCHAR
)
spi
)
+
spi
->
dwOffset
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pBuf
);
return
TRUE
;
}
...
...
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