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
ccd96404
Commit
ccd96404
authored
Mar 22, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use RtlGetNativeSystemInformation() to implement GetNativeSystemInfo().
parent
687068e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
71 deletions
+77
-71
process.c
dlls/kernel32/tests/process.c
+12
-6
memory.c
dlls/kernelbase/memory.c
+65
-65
No files found.
dlls/kernel32/tests/process.c
View file @
ccd96404
...
...
@@ -2202,12 +2202,12 @@ static void test_IsWow64Process2(void)
#if defined(__i386__) || defined(__x86_64__)
ok
(
machine
==
IMAGE_FILE_MACHINE_I386
,
"got %#x
\n
"
,
machine
);
expect_native
=
IMAGE_FILE_MACHINE_AMD64
;
ok
(
native_machine
==
IMAGE_FILE_MACHINE_AMD64
||
native_machine
==
IMAGE_FILE_MACHINE_ARM64
,
"got %#x
\n
"
,
native_machine
);
expect_native
=
native_machine
;
#else
skip
(
"not supported architecture
\n
"
);
#endif
ok
(
native_machine
==
expect_native
,
"got %#x
\n
"
,
native_machine
);
ret
=
TerminateProcess
(
pi
.
hProcess
,
0
);
ok
(
ret
,
"TerminateProcess error
\n
"
);
...
...
@@ -2279,6 +2279,7 @@ static void test_SystemInfo(void)
{
SYSTEM_INFO
si
,
nsi
;
BOOL
is_wow64
;
USHORT
machine
,
native_machine
;
if
(
!
pGetNativeSystemInfo
)
{
...
...
@@ -2297,9 +2298,14 @@ static void test_SystemInfo(void)
ok
(
S
(
U
(
nsi
)).
wProcessorArchitecture
==
PROCESSOR_ARCHITECTURE_AMD64
,
"Expected PROCESSOR_ARCHITECTURE_AMD64, got %d
\n
"
,
S
(
U
(
nsi
)).
wProcessorArchitecture
);
ok
(
nsi
.
dwProcessorType
==
PROCESSOR_AMD_X8664
,
"Expected PROCESSOR_AMD_X8664, got %ld
\n
"
,
nsi
.
dwProcessorType
);
if
(
pIsWow64Process2
&&
pIsWow64Process2
(
GetCurrentProcess
(),
&
machine
,
&
native_machine
)
&&
native_machine
==
IMAGE_FILE_MACHINE_ARM64
)
{
ok
(
nsi
.
dwProcessorType
==
PROCESSOR_INTEL_PENTIUM
,
"got %ld
\n
"
,
nsi
.
dwProcessorType
);
ok
(
nsi
.
wProcessorLevel
==
15
,
"got %d
\n
"
,
nsi
.
wProcessorLevel
);
ok
(
nsi
.
wProcessorRevision
==
0x40a
,
"got %d
\n
"
,
nsi
.
wProcessorRevision
);
}
else
ok
(
nsi
.
dwProcessorType
==
PROCESSOR_AMD_X8664
,
"got %ld
\n
"
,
nsi
.
dwProcessorType
);
}
}
else
...
...
dlls/kernelbase/memory.c
View file @
ccd96404
...
...
@@ -83,61 +83,24 @@ SIZE_T WINAPI GetLargePageMinimum(void)
}
/***********************************************************************
* GetNativeSystemInfo (kernelbase.@)
*/
void
WINAPI
DECLSPEC_HOTPATCH
GetNativeSystemInfo
(
SYSTEM_INFO
*
si
)
{
USHORT
current_machine
,
native_machine
;
GetSystemInfo
(
si
);
RtlWow64GetProcessMachines
(
GetCurrentProcess
(),
&
current_machine
,
&
native_machine
);
if
(
!
current_machine
)
return
;
switch
(
native_machine
)
{
case
IMAGE_FILE_MACHINE_AMD64
:
si
->
u
.
s
.
wProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_AMD64
;
si
->
dwProcessorType
=
PROCESSOR_AMD_X8664
;
break
;
case
IMAGE_FILE_MACHINE_ARM64
:
si
->
u
.
s
.
wProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_ARM64
;
si
->
dwProcessorType
=
0
;
break
;
default:
FIXME
(
"Add the proper information for %x in wow64 mode
\n
"
,
native_machine
);
}
}
/***********************************************************************
* GetSystemInfo (kernelbase.@)
*/
void
WINAPI
DECLSPEC_HOTPATCH
GetSystemInfo
(
SYSTEM_INFO
*
si
)
static
void
fill_system_info
(
SYSTEM_INFO
*
si
,
const
SYSTEM_BASIC_INFORMATION
*
basic_info
,
const
SYSTEM_CPU_INFORMATION
*
cpu_info
)
{
SYSTEM_BASIC_INFORMATION
basic_info
;
SYSTEM_CPU_INFORMATION
cpu_info
;
if
(
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemBasicInformation
,
&
basic_info
,
sizeof
(
basic_info
),
NULL
))
||
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
)))
return
;
si
->
u
.
s
.
wProcessorArchitecture
=
cpu_info
.
ProcessorArchitecture
;
si
->
u
.
s
.
wProcessorArchitecture
=
cpu_info
->
ProcessorArchitecture
;
si
->
u
.
s
.
wReserved
=
0
;
si
->
dwPageSize
=
basic_info
.
PageSize
;
si
->
lpMinimumApplicationAddress
=
basic_info
.
LowestUserAddress
;
si
->
lpMaximumApplicationAddress
=
basic_info
.
HighestUserAddress
;
si
->
dwActiveProcessorMask
=
basic_info
.
ActiveProcessorsAffinityMask
;
si
->
dwNumberOfProcessors
=
basic_info
.
NumberOfProcessors
;
si
->
dwAllocationGranularity
=
basic_info
.
AllocationGranularity
;
si
->
wProcessorLevel
=
cpu_info
.
ProcessorLevel
;
si
->
wProcessorRevision
=
cpu_info
.
ProcessorRevision
;
switch
(
cpu_info
.
ProcessorArchitecture
)
si
->
dwPageSize
=
basic_info
->
PageSize
;
si
->
lpMinimumApplicationAddress
=
basic_info
->
LowestUserAddress
;
si
->
lpMaximumApplicationAddress
=
basic_info
->
HighestUserAddress
;
si
->
dwActiveProcessorMask
=
basic_info
->
ActiveProcessorsAffinityMask
;
si
->
dwNumberOfProcessors
=
basic_info
->
NumberOfProcessors
;
si
->
dwAllocationGranularity
=
basic_info
->
AllocationGranularity
;
si
->
wProcessorLevel
=
cpu_info
->
ProcessorLevel
;
si
->
wProcessorRevision
=
cpu_info
->
ProcessorRevision
;
switch
(
cpu_info
->
ProcessorArchitecture
)
{
case
PROCESSOR_ARCHITECTURE_INTEL
:
switch
(
cpu_info
.
ProcessorLevel
)
switch
(
cpu_info
->
ProcessorLevel
)
{
case
3
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_386
;
break
;
case
4
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_486
;
break
;
...
...
@@ -146,23 +109,11 @@ void WINAPI DECLSPEC_HOTPATCH GetSystemInfo( SYSTEM_INFO *si )
default:
si
->
dwProcessorType
=
PROCESSOR_INTEL_PENTIUM
;
break
;
}
break
;
case
PROCESSOR_ARCHITECTURE_PPC
:
switch
(
cpu_info
.
ProcessorLevel
)
{
case
1
:
si
->
dwProcessorType
=
PROCESSOR_PPC_601
;
break
;
case
3
:
case
6
:
si
->
dwProcessorType
=
PROCESSOR_PPC_603
;
break
;
case
4
:
si
->
dwProcessorType
=
PROCESSOR_PPC_604
;
break
;
case
9
:
si
->
dwProcessorType
=
PROCESSOR_PPC_604
;
break
;
case
20
:
si
->
dwProcessorType
=
PROCESSOR_PPC_620
;
break
;
default:
si
->
dwProcessorType
=
0
;
}
break
;
case
PROCESSOR_ARCHITECTURE_AMD64
:
si
->
dwProcessorType
=
PROCESSOR_AMD_X8664
;
break
;
case
PROCESSOR_ARCHITECTURE_ARM
:
switch
(
cpu_info
.
ProcessorLevel
)
switch
(
cpu_info
->
ProcessorLevel
)
{
case
4
:
si
->
dwProcessorType
=
PROCESSOR_ARM_7TDMI
;
break
;
default:
si
->
dwProcessorType
=
PROCESSOR_ARM920
;
...
...
@@ -172,7 +123,7 @@ void WINAPI DECLSPEC_HOTPATCH GetSystemInfo( SYSTEM_INFO *si )
si
->
dwProcessorType
=
0
;
break
;
default:
FIXME
(
"Unknown processor architecture %x
\n
"
,
cpu_info
.
ProcessorArchitecture
);
FIXME
(
"Unknown processor architecture %x
\n
"
,
cpu_info
->
ProcessorArchitecture
);
si
->
dwProcessorType
=
0
;
break
;
}
...
...
@@ -180,6 +131,55 @@ void WINAPI DECLSPEC_HOTPATCH GetSystemInfo( SYSTEM_INFO *si )
/***********************************************************************
* GetNativeSystemInfo (kernelbase.@)
*/
void
WINAPI
DECLSPEC_HOTPATCH
GetNativeSystemInfo
(
SYSTEM_INFO
*
si
)
{
SYSTEM_BASIC_INFORMATION
basic_info
;
SYSTEM_CPU_INFORMATION
cpu_info
;
if
(
is_wow64
)
{
USHORT
current_machine
,
native_machine
;
RtlWow64GetProcessMachines
(
0
,
&
current_machine
,
&
native_machine
);
if
(
native_machine
!=
IMAGE_FILE_MACHINE_AMD64
)
{
GetSystemInfo
(
si
);
si
->
u
.
s
.
wProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_AMD64
;
return
;
}
}
if
(
!
set_ntstatus
(
RtlGetNativeSystemInformation
(
SystemBasicInformation
,
&
basic_info
,
sizeof
(
basic_info
),
NULL
))
||
!
set_ntstatus
(
RtlGetNativeSystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
)))
return
;
fill_system_info
(
si
,
&
basic_info
,
&
cpu_info
);
}
/***********************************************************************
* GetSystemInfo (kernelbase.@)
*/
void
WINAPI
DECLSPEC_HOTPATCH
GetSystemInfo
(
SYSTEM_INFO
*
si
)
{
SYSTEM_BASIC_INFORMATION
basic_info
;
SYSTEM_CPU_INFORMATION
cpu_info
;
if
(
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemBasicInformation
,
&
basic_info
,
sizeof
(
basic_info
),
NULL
))
||
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
)))
return
;
fill_system_info
(
si
,
&
basic_info
,
&
cpu_info
);
}
/***********************************************************************
* GetSystemFileCacheSize (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetSystemFileCacheSize
(
SIZE_T
*
mincache
,
SIZE_T
*
maxcache
,
DWORD
*
flags
)
...
...
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