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
b73cfa72
Commit
b73cfa72
authored
Nov 18, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move physical memory status functions to kernelbase.
parent
dad14ab8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
276 deletions
+83
-276
heap.c
dlls/kernel32/heap.c
+2
-272
kernel32.spec
dlls/kernel32/kernel32.spec
+2
-2
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+2
-2
memory.c
dlls/kernelbase/memory.c
+77
-0
No files found.
dlls/kernel32/heap.c
View file @
b73cfa72
This diff is collapsed.
Click to expand it.
dlls/kernel32/kernel32.spec
View file @
b73cfa72
...
@@ -762,7 +762,7 @@
...
@@ -762,7 +762,7 @@
@ stdcall -import GetOverlappedResult(long ptr ptr long)
@ stdcall -import GetOverlappedResult(long ptr ptr long)
@ stdcall GetUserPreferredUILanguages(long ptr ptr ptr)
@ stdcall GetUserPreferredUILanguages(long ptr ptr ptr)
@ stdcall GetPackageFullName(long ptr ptr)
@ stdcall GetPackageFullName(long ptr ptr)
@ stdcall GetPhysicallyInstalledSystemMemory(ptr)
@ stdcall
-import
GetPhysicallyInstalledSystemMemory(ptr)
@ stdcall -import GetPriorityClass(long)
@ stdcall -import GetPriorityClass(long)
@ stdcall GetPrivateProfileIntA(str str long str)
@ stdcall GetPrivateProfileIntA(str str long str)
@ stdcall GetPrivateProfileIntW(wstr wstr long wstr)
@ stdcall GetPrivateProfileIntW(wstr wstr long wstr)
...
@@ -906,7 +906,7 @@
...
@@ -906,7 +906,7 @@
@ stdcall GlobalHandle(ptr)
@ stdcall GlobalHandle(ptr)
@ stdcall GlobalLock(long)
@ stdcall GlobalLock(long)
@ stdcall GlobalMemoryStatus(ptr)
@ stdcall GlobalMemoryStatus(ptr)
@ stdcall GlobalMemoryStatusEx(ptr)
@ stdcall
-import
GlobalMemoryStatusEx(ptr)
@ stdcall GlobalReAlloc(long long long)
@ stdcall GlobalReAlloc(long long long)
@ stdcall GlobalSize(long)
@ stdcall GlobalSize(long)
@ stdcall GlobalUnWire(long)
@ stdcall GlobalUnWire(long)
...
...
dlls/kernelbase/kernelbase.spec
View file @
b73cfa72
...
@@ -614,7 +614,7 @@
...
@@ -614,7 +614,7 @@
# @ stub GetPackageVolumeSisPath
# @ stub GetPackageVolumeSisPath
# @ stub GetPackagesByPackageFamily
# @ stub GetPackagesByPackageFamily
# @ stub GetPerformanceInfo
# @ stub GetPerformanceInfo
@ stdcall GetPhysicallyInstalledSystemMemory(ptr)
kernel32.GetPhysicallyInstalledSystemMemory
@ stdcall GetPhysicallyInstalledSystemMemory(ptr)
# @ stub GetPreviousFgPolicyRefreshInfoInternal
# @ stub GetPreviousFgPolicyRefreshInfoInternal
@ stdcall GetPriorityClass(long)
@ stdcall GetPriorityClass(long)
@ stdcall GetPrivateObjectSecurity(ptr long ptr long ptr)
@ stdcall GetPrivateObjectSecurity(ptr long ptr long ptr)
...
@@ -767,7 +767,7 @@
...
@@ -767,7 +767,7 @@
# @ stub GetXStateFeaturesMask
# @ stub GetXStateFeaturesMask
@ stdcall GlobalAlloc(long long)
@ stdcall GlobalAlloc(long long)
@ stdcall GlobalFree(long)
@ stdcall GlobalFree(long)
@ stdcall GlobalMemoryStatusEx(ptr)
kernel32.GlobalMemoryStatusEx
@ stdcall GlobalMemoryStatusEx(ptr)
# @ stub GuardCheckLongJumpTarget
# @ stub GuardCheckLongJumpTarget
# @ stub HasPolicyForegroundProcessingCompletedInternal
# @ stub HasPolicyForegroundProcessingCompletedInternal
@ stdcall HashData(ptr long ptr long)
@ stdcall HashData(ptr long ptr long)
...
...
dlls/kernelbase/memory.c
View file @
b73cfa72
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "wine/debug.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
heap
);
WINE_DEFAULT_DEBUG_CHANNEL
(
heap
);
WINE_DECLARE_DEBUG_CHANNEL
(
virtual
);
/***********************************************************************
/***********************************************************************
...
@@ -817,6 +818,82 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeUserPhysicalPages( HANDLE process, ULONG_PTR *
...
@@ -817,6 +818,82 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeUserPhysicalPages( HANDLE process, ULONG_PTR *
/***********************************************************************
/***********************************************************************
* GetPhysicallyInstalledSystemMemory (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetPhysicallyInstalledSystemMemory
(
ULONGLONG
*
memory
)
{
MEMORYSTATUSEX
status
;
if
(
!
memory
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
status
.
dwLength
=
sizeof
(
status
);
GlobalMemoryStatusEx
(
&
status
);
*
memory
=
status
.
ullTotalPhys
/
1024
;
return
TRUE
;
}
/***********************************************************************
* GlobalMemoryStatusEx (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GlobalMemoryStatusEx
(
MEMORYSTATUSEX
*
status
)
{
static
MEMORYSTATUSEX
cached_status
;
static
DWORD
last_check
;
SYSTEM_BASIC_INFORMATION
basic_info
;
SYSTEM_PERFORMANCE_INFORMATION
perf_info
;
if
(
status
->
dwLength
!=
sizeof
(
*
status
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
((
NtGetTickCount
()
-
last_check
)
<
1000
)
{
*
status
=
cached_status
;
return
TRUE
;
}
last_check
=
NtGetTickCount
();
if
(
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemBasicInformation
,
&
basic_info
,
sizeof
(
basic_info
),
NULL
))
||
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemPerformanceInformation
,
&
perf_info
,
sizeof
(
perf_info
),
NULL
)))
return
FALSE
;
status
->
dwMemoryLoad
=
0
;
status
->
ullTotalPhys
=
perf_info
.
TotalCommitLimit
;
status
->
ullAvailPhys
=
perf_info
.
AvailablePages
;
status
->
ullTotalPageFile
=
perf_info
.
TotalCommitLimit
+
1
;
/* Titan Quest refuses to run if TotalPageFile <= TotalPhys */
status
->
ullAvailPageFile
=
status
->
ullTotalPageFile
-
perf_info
.
TotalCommittedPages
-
perf_info
.
AvailablePages
;
status
->
ullTotalVirtual
=
(
ULONG_PTR
)
basic_info
.
HighestUserAddress
-
(
ULONG_PTR
)
basic_info
.
LowestUserAddress
;
status
->
ullAvailVirtual
=
status
->
ullTotalVirtual
-
64
*
1024
;
/* FIXME */
status
->
ullAvailExtendedVirtual
=
0
;
status
->
ullTotalPhys
*=
basic_info
.
PageSize
;
status
->
ullAvailPhys
*=
basic_info
.
PageSize
;
status
->
ullTotalPageFile
*=
basic_info
.
PageSize
;
status
->
ullAvailPageFile
*=
basic_info
.
PageSize
;
if
(
status
->
ullTotalPhys
)
status
->
dwMemoryLoad
=
(
status
->
ullTotalPhys
-
status
->
ullAvailPhys
)
/
(
status
->
ullTotalPhys
/
100
);
TRACE_
(
virtual
)(
"MemoryLoad %d, TotalPhys %s, AvailPhys %s, TotalPageFile %s,"
"AvailPageFile %s, TotalVirtual %s, AvailVirtual %s
\n
"
,
status
->
dwMemoryLoad
,
wine_dbgstr_longlong
(
status
->
ullTotalPhys
),
wine_dbgstr_longlong
(
status
->
ullAvailPhys
),
wine_dbgstr_longlong
(
status
->
ullTotalPageFile
),
wine_dbgstr_longlong
(
status
->
ullAvailPageFile
),
wine_dbgstr_longlong
(
status
->
ullTotalVirtual
),
wine_dbgstr_longlong
(
status
->
ullAvailVirtual
)
);
cached_status
=
*
status
;
return
TRUE
;
}
/***********************************************************************
* MapUserPhysicalPages (kernelbase.@)
* MapUserPhysicalPages (kernelbase.@)
*/
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
MapUserPhysicalPages
(
void
*
addr
,
ULONG_PTR
page_count
,
ULONG_PTR
*
pages
)
BOOL
WINAPI
DECLSPEC_HOTPATCH
MapUserPhysicalPages
(
void
*
addr
,
ULONG_PTR
page_count
,
ULONG_PTR
*
pages
)
...
...
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