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
71aba33f
Commit
71aba33f
authored
Nov 18, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move system information functions to kernelbase.
parent
b73cfa72
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
161 deletions
+157
-161
cpu.c
dlls/kernel32/cpu.c
+0
-151
kernel32.spec
dlls/kernel32/kernel32.spec
+5
-5
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+5
-5
memory.c
dlls/kernelbase/memory.c
+147
-0
No files found.
dlls/kernel32/cpu.c
View file @
71aba33f
...
...
@@ -47,104 +47,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
reg
);
/***********************************************************************
* GetSystemInfo [KERNEL32.@]
*
* Get information about the system.
*
* RETURNS
* Nothing.
*/
VOID
WINAPI
GetSystemInfo
(
LPSYSTEM_INFO
si
/* [out] Destination for system information, may not be NULL */
)
{
SYSTEM_CPU_INFORMATION
sci
;
TRACE
(
"si=0x%p
\n
"
,
si
);
if
(
!
set_ntstatus
(
NtQuerySystemInformation
(
SystemCpuInformation
,
&
sci
,
sizeof
(
sci
),
NULL
)))
return
;
si
->
u
.
s
.
wProcessorArchitecture
=
sci
.
Architecture
;
si
->
u
.
s
.
wReserved
=
0
;
si
->
dwPageSize
=
system_info
.
PageSize
;
si
->
lpMinimumApplicationAddress
=
system_info
.
LowestUserAddress
;
si
->
lpMaximumApplicationAddress
=
system_info
.
HighestUserAddress
;
si
->
dwActiveProcessorMask
=
system_info
.
ActiveProcessorsAffinityMask
;
si
->
dwNumberOfProcessors
=
system_info
.
NumberOfProcessors
;
switch
(
sci
.
Architecture
)
{
case
PROCESSOR_ARCHITECTURE_INTEL
:
switch
(
sci
.
Level
)
{
case
3
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_386
;
break
;
case
4
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_486
;
break
;
case
5
:
case
6
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_PENTIUM
;
break
;
default:
si
->
dwProcessorType
=
PROCESSOR_INTEL_PENTIUM
;
break
;
}
break
;
case
PROCESSOR_ARCHITECTURE_PPC
:
switch
(
sci
.
Level
)
{
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
(
sci
.
Level
)
{
case
4
:
si
->
dwProcessorType
=
PROCESSOR_ARM_7TDMI
;
break
;
default:
si
->
dwProcessorType
=
PROCESSOR_ARM920
;
}
break
;
case
PROCESSOR_ARCHITECTURE_ARM64
:
si
->
dwProcessorType
=
0
;
break
;
default:
FIXME
(
"Unknown processor architecture %x
\n
"
,
sci
.
Architecture
);
si
->
dwProcessorType
=
0
;
}
si
->
dwAllocationGranularity
=
system_info
.
AllocationGranularity
;
si
->
wProcessorLevel
=
sci
.
Level
;
si
->
wProcessorRevision
=
sci
.
Revision
;
}
/***********************************************************************
* GetNativeSystemInfo [KERNEL32.@]
*/
VOID
WINAPI
GetNativeSystemInfo
(
LPSYSTEM_INFO
si
/* [out] Destination for system information, may not be NULL */
)
{
BOOL
is_wow64
;
GetSystemInfo
(
si
);
IsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
);
if
(
is_wow64
)
{
if
(
si
->
u
.
s
.
wProcessorArchitecture
==
PROCESSOR_ARCHITECTURE_INTEL
)
{
si
->
u
.
s
.
wProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_AMD64
;
si
->
dwProcessorType
=
PROCESSOR_AMD_X8664
;
}
else
{
FIXME
(
"Add the proper information for %d in wow64 mode
\n
"
,
si
->
u
.
s
.
wProcessorArchitecture
);
}
}
}
/***********************************************************************
* K32GetPerformanceInfo (KERNEL32.@)
*/
BOOL
WINAPI
K32GetPerformanceInfo
(
PPERFORMANCE_INFORMATION
info
,
DWORD
size
)
...
...
@@ -216,18 +118,6 @@ err:
}
/***********************************************************************
* GetLargePageMinimum (KERNEL32.@)
*/
SIZE_T
WINAPI
GetLargePageMinimum
(
void
)
{
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
return
2
*
1024
*
1024
;
#endif
FIXME
(
"Not implemented on your platform/architecture.
\n
"
);
return
0
;
}
/***********************************************************************
* GetActiveProcessorGroupCount (KERNEL32.@)
*/
WORD
WINAPI
GetActiveProcessorGroupCount
(
void
)
...
...
@@ -274,44 +164,3 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void)
FIXME
(
"
\n
"
);
return
0
;
}
/***********************************************************************
* GetSystemFirmwareTable (KERNEL32.@)
*/
UINT
WINAPI
GetSystemFirmwareTable
(
DWORD
provider
,
DWORD
id
,
void
*
buffer
,
DWORD
size
)
{
ULONG
buffer_size
=
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
)
+
size
;
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
sfti
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buffer_size
);
NTSTATUS
status
;
TRACE
(
"(0x%08x, 0x%08x, %p, %d)
\n
"
,
provider
,
id
,
buffer
,
size
);
if
(
!
sfti
)
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
0
;
}
sfti
->
ProviderSignature
=
provider
;
sfti
->
Action
=
SystemFirmwareTable_Get
;
sfti
->
TableID
=
id
;
status
=
NtQuerySystemInformation
(
SystemFirmwareTableInformation
,
sfti
,
buffer_size
,
&
buffer_size
);
buffer_size
-=
FIELD_OFFSET
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
buffer_size
<=
size
)
memcpy
(
buffer
,
sfti
->
TableBuffer
,
buffer_size
);
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
));
HeapFree
(
GetProcessHeap
(),
0
,
sfti
);
return
buffer_size
;
}
/***********************************************************************
* EnumSystemFirmwareTables (KERNEL32.@)
*/
UINT
WINAPI
EnumSystemFirmwareTables
(
DWORD
provider
,
void
*
buffer
,
DWORD
size
)
{
FIXME
(
"(0x%08x, %p, %d)
\n
"
,
provider
,
buffer
,
size
);
return
0
;
}
dlls/kernel32/kernel32.spec
View file @
71aba33f
...
...
@@ -418,7 +418,7 @@
@ stdcall EnumResourceTypesW(long ptr long)
@ stdcall EnumSystemCodePagesA(ptr long)
@ stdcall -import EnumSystemCodePagesW(ptr long)
@ stdcall EnumSystemFirmwareTables(long ptr long)
@ stdcall
-import
EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr)
@ stdcall EnumSystemLanguageGroupsA(ptr long ptr)
@ stdcall -import EnumSystemLanguageGroupsW(ptr long ptr)
...
...
@@ -698,7 +698,7 @@
@ stdcall -import GetHandleInformation(long ptr)
@ stub -i386 GetLSCallbackTarget
@ stub -i386 GetLSCallbackTemplate
@ stdcall GetLargePageMinimum()
@ stdcall
-import
GetLargePageMinimum()
@ stdcall -import GetLargestConsoleWindowSize(long)
@ stdcall -import GetLastError()
@ stub GetLinguistLangSize
...
...
@@ -734,7 +734,7 @@
@ stdcall -import GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNamedPipeServerProcessId(long ptr)
@ stdcall GetNamedPipeServerSessionId(long ptr)
@ stdcall GetNativeSystemInfo(ptr)
@ stdcall
-import
GetNativeSystemInfo(ptr)
@ stdcall -arch=x86_64 GetNextUmsListItem(ptr)
@ stub GetNextVDMCommand
@ stub GetNlsSectionName
...
...
@@ -825,8 +825,8 @@
@ stdcall GetSystemDEPPolicy()
@ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long)
@ stdcall GetSystemFirmwareTable(long long ptr long)
@ stdcall GetSystemInfo(ptr)
@ stdcall
-import
GetSystemFirmwareTable(long long ptr long)
@ stdcall
-import
GetSystemInfo(ptr)
@ stdcall GetSystemPowerStatus(ptr)
@ stdcall GetSystemPreferredUILanguages(long ptr ptr ptr)
@ stdcall GetSystemRegistryQuota(ptr ptr)
...
...
dlls/kernelbase/kernelbase.spec
View file @
71aba33f
...
...
@@ -312,7 +312,7 @@
@ stdcall EnumResourceTypesExA(long ptr long long long)
@ stdcall EnumResourceTypesExW(long ptr long long long)
@ stdcall EnumSystemCodePagesW(ptr long)
@ stdcall EnumSystemFirmwareTables(long ptr long)
kernel32.EnumSystemFirmwareTables
@ stdcall EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr) kernel32.EnumSystemGeoID
@ stdcall EnumSystemLanguageGroupsW(ptr long ptr)
@ stdcall EnumSystemLocalesA(ptr long)
...
...
@@ -536,7 +536,7 @@
# @ stub GetIntegratedDisplaySize
# @ stub GetIsEdpEnabled
@ stdcall GetKernelObjectSecurity(long long ptr long ptr)
@ stdcall GetLargePageMinimum()
kernel32.GetLargePageMinimum
@ stdcall GetLargePageMinimum()
@ stdcall GetLargestConsoleWindowSize(long)
@ stdcall GetLastError() kernelbase_GetLastError
@ stdcall GetLengthSid(ptr)
...
...
@@ -572,7 +572,7 @@
@ stub GetNamedPipeClientComputerNameW
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) kernel32.GetNamedPipeHandleStateW
@ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNativeSystemInfo(ptr)
kernel32.GetNativeSystemInfo
@ stdcall GetNativeSystemInfo(ptr)
# @ stub GetNextFgPolicyRefreshInfoInternal
@ stdcall GetNumaHighestNodeNumber(ptr)
@ stdcall GetNumaNodeProcessorMaskEx(long ptr)
...
...
@@ -687,8 +687,8 @@
@ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long)
@ stdcall GetSystemFileCacheSize(ptr ptr ptr)
@ stdcall GetSystemFirmwareTable(long long ptr long)
kernel32.GetSystemFirmwareTable
@ stdcall GetSystemInfo(ptr)
kernel32.GetSystemInfo
@ stdcall GetSystemFirmwareTable(long long ptr long)
@ stdcall GetSystemInfo(ptr)
# @ stub GetSystemMetadataPath
# @ stub GetSystemMetadataPathForPackage
# @ stub GetSystemMetadataPathForPackageFamily
...
...
dlls/kernelbase/memory.c
View file @
71aba33f
...
...
@@ -27,6 +27,7 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
...
...
@@ -59,6 +60,104 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlushViewOfFile( const void *base, SIZE_T size )
/***********************************************************************
* GetLargePageMinimum (kernelbase.@)
*/
SIZE_T
WINAPI
GetLargePageMinimum
(
void
)
{
return
2
*
1024
*
1024
;
}
/***********************************************************************
* GetNativeSystemInfo (kernelbase.@)
*/
void
WINAPI
DECLSPEC_HOTPATCH
GetNativeSystemInfo
(
SYSTEM_INFO
*
si
)
{
GetSystemInfo
(
si
);
if
(
!
is_wow64
)
return
;
switch
(
si
->
u
.
s
.
wProcessorArchitecture
)
{
case
PROCESSOR_ARCHITECTURE_INTEL
:
si
->
u
.
s
.
wProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_AMD64
;
si
->
dwProcessorType
=
PROCESSOR_AMD_X8664
;
break
;
default:
FIXME
(
"Add the proper information for %d in wow64 mode
\n
"
,
si
->
u
.
s
.
wProcessorArchitecture
);
}
}
/***********************************************************************
* 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
;
si
->
u
.
s
.
wProcessorArchitecture
=
cpu_info
.
Architecture
;
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
.
Level
;
si
->
wProcessorRevision
=
cpu_info
.
Revision
;
switch
(
cpu_info
.
Architecture
)
{
case
PROCESSOR_ARCHITECTURE_INTEL
:
switch
(
cpu_info
.
Level
)
{
case
3
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_386
;
break
;
case
4
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_486
;
break
;
case
5
:
case
6
:
si
->
dwProcessorType
=
PROCESSOR_INTEL_PENTIUM
;
break
;
default:
si
->
dwProcessorType
=
PROCESSOR_INTEL_PENTIUM
;
break
;
}
break
;
case
PROCESSOR_ARCHITECTURE_PPC
:
switch
(
cpu_info
.
Level
)
{
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
.
Level
)
{
case
4
:
si
->
dwProcessorType
=
PROCESSOR_ARM_7TDMI
;
break
;
default:
si
->
dwProcessorType
=
PROCESSOR_ARM920
;
}
break
;
case
PROCESSOR_ARCHITECTURE_ARM64
:
si
->
dwProcessorType
=
0
;
break
;
default:
FIXME
(
"Unknown processor architecture %x
\n
"
,
cpu_info
.
Architecture
);
si
->
dwProcessorType
=
0
;
break
;
}
}
/***********************************************************************
* GetSystemFileCacheSize (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetSystemFileCacheSize
(
SIZE_T
*
mincache
,
SIZE_T
*
maxcache
,
DWORD
*
flags
)
...
...
@@ -1025,3 +1124,51 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAllocExNuma( HANDLE process, void *addr,
if
(
node
)
FIXME
(
"Ignoring preferred node %u
\n
"
,
node
);
return
VirtualAllocEx
(
process
,
addr
,
size
,
type
,
protect
);
}
/***********************************************************************
* Firmware functions
***********************************************************************/
/***********************************************************************
* EnumSystemFirmwareTable (kernelbase.@)
*/
UINT
WINAPI
EnumSystemFirmwareTables
(
DWORD
provider
,
void
*
buffer
,
DWORD
size
)
{
FIXME
(
"(0x%08x, %p, %d)
\n
"
,
provider
,
buffer
,
size
);
return
0
;
}
/***********************************************************************
* GetSystemFirmwareTable (kernelbase.@)
*/
UINT
WINAPI
GetSystemFirmwareTable
(
DWORD
provider
,
DWORD
id
,
void
*
buffer
,
DWORD
size
)
{
SYSTEM_FIRMWARE_TABLE_INFORMATION
*
info
;
ULONG
buffer_size
=
offsetof
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
)
+
size
;
TRACE
(
"(0x%08x, 0x%08x, %p, %d)
\n
"
,
provider
,
id
,
buffer
,
size
);
if
(
!
(
info
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
buffer_size
)))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
0
;
}
info
->
ProviderSignature
=
provider
;
info
->
Action
=
SystemFirmwareTable_Get
;
info
->
TableID
=
id
;
if
(
set_ntstatus
(
NtQuerySystemInformation
(
SystemFirmwareTableInformation
,
info
,
buffer_size
,
&
buffer_size
)))
{
buffer_size
-=
offsetof
(
SYSTEM_FIRMWARE_TABLE_INFORMATION
,
TableBuffer
);
if
(
buffer_size
<=
size
)
memcpy
(
buffer
,
info
->
TableBuffer
,
buffer_size
);
}
else
buffer_size
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
info
);
return
buffer_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