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
08200ca3
Commit
08200ca3
authored
Jul 08, 2005
by
Felix Nawothnig
Committed by
Alexandre Julliard
Jul 08, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make GetProcessMemoryInfo fail if the passed buffer is too small.
parent
281eb29e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
psapi_main.c
dlls/psapi/psapi_main.c
+20
-16
psapi_main.c
dlls/psapi/tests/psapi_main.c
+1
-1
No files found.
dlls/psapi/psapi_main.c
View file @
08200ca3
...
...
@@ -516,33 +516,37 @@ DWORD WINAPI GetProcessImageFileNameW( HANDLE process, LPWSTR file, DWORD size )
* Retrieve memory usage information for a given process
*
*/
BOOL
WINAPI
GetProcessMemoryInfo
(
HANDLE
process
,
PPROCESS_MEMORY_COUNTERS
counters
,
DWORD
size
)
BOOL
WINAPI
GetProcessMemoryInfo
(
HANDLE
hProcess
,
PPROCESS_MEMORY_COUNTERS
pmc
,
DWORD
cb
)
{
NTSTATUS
status
;
VM_COUNTERS
vmc
;
TRACE
(
"(%p, %p, %ld)
\n
"
,
process
,
counters
,
size
);
if
(
cb
<
sizeof
(
PROCESS_MEMORY_COUNTERS
))
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
status
=
NtQueryInformationProcess
(
process
,
ProcessVmCounters
,
&
vmc
,
sizeof
(
vmc
),
NULL
);
status
=
NtQueryInformationProcess
(
hProcess
,
ProcessVmCounters
,
&
vmc
,
sizeof
(
vmc
),
NULL
);
if
(
status
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
FALSE
;
}
/* FIXME: check size */
counters
->
cb
=
sizeof
(
PROCESS_MEMORY_COUNTERS
);
counters
->
PageFaultCount
=
vmc
.
PageFaultCount
;
counters
->
PeakWorkingSetSize
=
vmc
.
PeakWorkingSetSize
;
counters
->
WorkingSetSize
=
vmc
.
WorkingSetSize
;
counters
->
QuotaPeakPagedPoolUsage
=
vmc
.
QuotaPeakPagedPoolUsage
;
counters
->
QuotaPagedPoolUsage
=
vmc
.
QuotaPagedPoolUsage
;
counters
->
QuotaPeakNonPagedPoolUsage
=
vmc
.
QuotaPeakNonPagedPoolUsage
;
counters
->
QuotaNonPagedPoolUsage
=
vmc
.
QuotaNonPagedPoolUsage
;
counters
->
PagefileUsage
=
vmc
.
PagefileUsage
;
counters
->
PeakPagefileUsage
=
vmc
.
PeakPagefileUsage
;
pmc
->
cb
=
sizeof
(
PROCESS_MEMORY_COUNTERS
);
pmc
->
PageFaultCount
=
vmc
.
PageFaultCount
;
pmc
->
PeakWorkingSetSize
=
vmc
.
PeakWorkingSetSize
;
pmc
->
WorkingSetSize
=
vmc
.
WorkingSetSize
;
pmc
->
QuotaPeakPagedPoolUsage
=
vmc
.
QuotaPeakPagedPoolUsage
;
pmc
->
QuotaPagedPoolUsage
=
vmc
.
QuotaPagedPoolUsage
;
pmc
->
QuotaPeakNonPagedPoolUsage
=
vmc
.
QuotaPeakNonPagedPoolUsage
;
pmc
->
QuotaNonPagedPoolUsage
=
vmc
.
QuotaNonPagedPoolUsage
;
pmc
->
PagefileUsage
=
vmc
.
PagefileUsage
;
pmc
->
PeakPagefileUsage
=
vmc
.
PeakPagefileUsage
;
return
TRUE
;
}
...
...
dlls/psapi/tests/psapi_main.c
View file @
08200ca3
...
...
@@ -135,7 +135,7 @@ static void test_GetProcessMemoryInfo(void)
w32_err
(
pGetProcessMemoryInfo
(
NULL
,
&
pmc
,
sizeof
(
pmc
)),
ERROR_INVALID_HANDLE
);
todo_wine
w32_err
(
pGetProcessMemoryInfo
(
hpSR
,
&
pmc
,
sizeof
(
pmc
)),
ERROR_ACCESS_DENIED
);
todo_wine
w32_err
(
pGetProcessMemoryInfo
(
hpQI
,
&
pmc
,
sizeof
(
pmc
)
-
1
),
ERROR_INSUFFICIENT_BUFFER
);
w32_err
(
pGetProcessMemoryInfo
(
hpQI
,
&
pmc
,
sizeof
(
pmc
)
-
1
),
ERROR_INSUFFICIENT_BUFFER
);
w32_suc
(
pGetProcessMemoryInfo
(
hpQI
,
&
pmc
,
sizeof
(
pmc
)));
}
...
...
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