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
bb175832
Commit
bb175832
authored
Mar 25, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Fix GlobalMemoryStatusEx counters.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cabfefb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
heap.c
dlls/kernel32/tests/heap.c
+0
-4
memory.c
dlls/kernelbase/memory.c
+8
-5
system.c
dlls/ntdll/unix/system.c
+4
-0
No files found.
dlls/kernel32/tests/heap.c
View file @
bb175832
...
...
@@ -1266,17 +1266,13 @@ static void test_GlobalMemoryStatus(void)
expect
.
ullAvailExtendedVirtual
=
0
;
ok
(
memex
.
dwMemoryLoad
==
expect
.
dwMemoryLoad
,
"got dwMemoryLoad %lu
\n
"
,
memex
.
dwMemoryLoad
);
todo_wine
ok
(
memex
.
ullTotalPhys
==
expect
.
ullTotalPhys
,
"got ullTotalPhys %#I64x
\n
"
,
memex
.
ullTotalPhys
);
ok
(
memex
.
ullAvailPhys
==
expect
.
ullAvailPhys
,
"got ullAvailPhys %#I64x
\n
"
,
memex
.
ullAvailPhys
);
todo_wine
ok
(
memex
.
ullTotalPageFile
==
expect
.
ullTotalPageFile
,
"got ullTotalPageFile %#I64x
\n
"
,
memex
.
ullTotalPageFile
);
/* allow some variability, page file is not always in sync on Windows */
ok
(
memex
.
ullAvailPageFile
-
expect
.
ullAvailPageFile
+
32
*
basic_info
.
PageSize
<=
64
*
basic_info
.
PageSize
,
"got ullAvailPageFile %#I64x
\n
"
,
memex
.
ullAvailPageFile
);
todo_wine
ok
(
memex
.
ullTotalVirtual
==
expect
.
ullTotalVirtual
,
"got ullTotalVirtual %#I64x
\n
"
,
memex
.
ullTotalVirtual
);
todo_wine
ok
(
memex
.
ullAvailVirtual
<=
expect
.
ullAvailVirtual
,
"got ullAvailVirtual %#I64x
\n
"
,
memex
.
ullAvailVirtual
);
ok
(
memex
.
ullAvailExtendedVirtual
==
0
,
"got ullAvailExtendedVirtual %#I64x
\n
"
,
memex
.
ullAvailExtendedVirtual
);
...
...
dlls/kernelbase/memory.c
View file @
bb175832
...
...
@@ -1043,6 +1043,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GlobalMemoryStatusEx( MEMORYSTATUSEX *status )
static
DWORD
last_check
;
SYSTEM_BASIC_INFORMATION
basic_info
;
SYSTEM_PERFORMANCE_INFORMATION
perf_info
;
VM_COUNTERS_EX
vmc
;
if
(
status
->
dwLength
!=
sizeof
(
*
status
))
{
...
...
@@ -1059,16 +1060,18 @@ BOOL WINAPI DECLSPEC_HOTPATCH GlobalMemoryStatusEx( MEMORYSTATUSEX *status )
if
(
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemBasicInformation
,
&
basic_info
,
sizeof
(
basic_info
),
NULL
))
||
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemPerformanceInformation
,
&
perf_info
,
sizeof
(
perf_info
),
NULL
)))
&
perf_info
,
sizeof
(
perf_info
),
NULL
))
||
!
set_ntstatus
(
NtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessVmCounters
,
&
vmc
,
sizeof
(
vmc
),
NULL
)))
return
FALSE
;
status
->
dwMemoryLoad
=
0
;
status
->
ullTotalPhys
=
perf_info
.
TotalCommitLimit
;
status
->
ullTotalPhys
=
basic_info
.
MmNumberOfPhysicalPages
;
status
->
ullAvailPhys
=
perf_info
.
AvailablePages
;
status
->
ullTotalPageFile
=
perf_info
.
TotalCommitLimit
+
1
;
/* Titan Quest refuses to run if TotalPageFile <= TotalPhys */
status
->
ullTotalPageFile
=
perf_info
.
TotalCommitLimit
;
status
->
ullAvailPageFile
=
status
->
ullTotalPageFile
-
perf_info
.
TotalCommittedPages
;
status
->
ullTotalVirtual
=
(
ULONG_PTR
)
basic_info
.
HighestUserAddress
-
(
ULONG_PTR
)
basic_info
.
LowestUserAddress
;
status
->
ullAvailVirtual
=
status
->
ullTotalVirtual
-
64
*
1024
;
/* FIXME */
status
->
ullTotalVirtual
=
(
ULONG_PTR
)
basic_info
.
HighestUserAddress
-
(
ULONG_PTR
)
basic_info
.
LowestUserAddress
+
1
;
status
->
ullAvailVirtual
=
status
->
ullTotalVirtual
-
(
ULONGLONG
)
vmc
.
WorkingSetSize
/* approximate */
;
status
->
ullAvailExtendedVirtual
=
0
;
status
->
ullTotalPhys
*=
basic_info
.
PageSize
;
...
...
dlls/ntdll/unix/system.c
View file @
bb175832
...
...
@@ -2008,6 +2008,10 @@ static void get_performance_info( SYSTEM_PERFORMANCE_INFORMATION *info )
#endif
}
#endif
/* Titan Quest refuses to run if TotalPageFile <= TotalPhys */
if
(
!
totalswap
)
totalswap
=
page_size
;
info
->
AvailablePages
=
freeram
/
page_size
;
info
->
TotalCommittedPages
=
(
totalram
+
totalswap
-
freeram
-
freeswap
)
/
page_size
;
info
->
TotalCommitLimit
=
(
totalram
+
totalswap
)
/
page_size
;
...
...
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