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
62f22dd4
Commit
62f22dd4
authored
Jan 08, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Retrieve the system info from ntdll on startup.
parent
58176bba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
22 deletions
+18
-22
cpu.c
dlls/kernel32/cpu.c
+9
-10
kernel_private.h
dlls/kernel32/kernel_private.h
+1
-0
process.c
dlls/kernel32/process.c
+2
-0
virtual.c
dlls/kernel32/virtual.c
+6
-12
No files found.
dlls/kernel32/cpu.c
View file @
62f22dd4
...
...
@@ -39,9 +39,10 @@
#include "winnt.h"
#include "winternl.h"
#include "psapi.h"
#include "ddk/wdm.h"
#include "wine/unicode.h"
#include "kernel_private.h"
#include "wine/debug.h"
#include "ddk/wdm.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
reg
);
...
...
@@ -104,13 +105,11 @@ VOID WINAPI GetSystemInfo(
LPSYSTEM_INFO
si
/* [out] Destination for system information, may not be NULL */
)
{
NTSTATUS
nts
;
SYSTEM_BASIC_INFORMATION
sbi
;
SYSTEM_CPU_INFORMATION
sci
;
TRACE
(
"si=0x%p
\n
"
,
si
);
if
((
nts
=
NtQuerySystemInformation
(
SystemBasicInformation
,
&
sbi
,
sizeof
(
sbi
),
NULL
))
!=
STATUS_SUCCESS
||
(
nts
=
NtQuerySystemInformation
(
SystemCpuInformation
,
&
sci
,
sizeof
(
sci
),
NULL
))
!=
STATUS_SUCCESS
)
if
((
nts
=
NtQuerySystemInformation
(
SystemCpuInformation
,
&
sci
,
sizeof
(
sci
),
NULL
))
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
nts
));
return
;
...
...
@@ -118,11 +117,11 @@ VOID WINAPI GetSystemInfo(
si
->
u
.
s
.
wProcessorArchitecture
=
sci
.
Architecture
;
si
->
u
.
s
.
wReserved
=
0
;
si
->
dwPageSize
=
s
bi
.
PageSize
;
si
->
lpMinimumApplicationAddress
=
s
bi
.
LowestUserAddress
;
si
->
lpMaximumApplicationAddress
=
s
bi
.
HighestUserAddress
;
si
->
dwActiveProcessorMask
=
s
bi
.
ActiveProcessorsAffinityMask
;
si
->
dwNumberOfProcessors
=
s
bi
.
NumberOfProcessors
;
si
->
dwPageSize
=
s
ystem_info
.
PageSize
;
si
->
lpMinimumApplicationAddress
=
s
ystem_info
.
LowestUserAddress
;
si
->
lpMaximumApplicationAddress
=
s
ystem_info
.
HighestUserAddress
;
si
->
dwActiveProcessorMask
=
s
ystem_info
.
ActiveProcessorsAffinityMask
;
si
->
dwNumberOfProcessors
=
s
ystem_info
.
NumberOfProcessors
;
switch
(
sci
.
Architecture
)
{
...
...
@@ -162,7 +161,7 @@ VOID WINAPI GetSystemInfo(
FIXME
(
"Unknown processor architecture %x
\n
"
,
sci
.
Architecture
);
si
->
dwProcessorType
=
0
;
}
si
->
dwAllocationGranularity
=
s
bi
.
AllocationGranularity
;
si
->
dwAllocationGranularity
=
s
ystem_info
.
AllocationGranularity
;
si
->
wProcessorLevel
=
sci
.
Level
;
si
->
wProcessorRevision
=
sci
.
Revision
;
}
...
...
dlls/kernel32/kernel_private.h
View file @
62f22dd4
...
...
@@ -53,6 +53,7 @@ static inline obj_handle_t console_handle_unmap(HANDLE h)
#define KERNEL32_CONSOLE_SHELL ((HANDLE)2)
extern
HMODULE
kernel32_handle
DECLSPEC_HIDDEN
;
extern
SYSTEM_BASIC_INFORMATION
system_info
DECLSPEC_HIDDEN
;
extern
const
WCHAR
*
DIR_Windows
DECLSPEC_HIDDEN
;
extern
const
WCHAR
*
DIR_System
DECLSPEC_HIDDEN
;
...
...
dlls/kernel32/process.c
View file @
62f22dd4
...
...
@@ -87,6 +87,7 @@ static BOOL is_wow64;
static
const
int
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
HMODULE
kernel32_handle
=
0
;
SYSTEM_BASIC_INFORMATION
system_info
=
{
0
};
const
WCHAR
*
DIR_Windows
=
NULL
;
const
WCHAR
*
DIR_System
=
NULL
;
...
...
@@ -1146,6 +1147,7 @@ void CDECL __wine_kernel_init(void)
setbuf
(
stderr
,
NULL
);
kernel32_handle
=
GetModuleHandleW
(
kernel32W
);
IsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
);
NtQuerySystemInformation
(
SystemBasicInformation
,
&
system_info
,
sizeof
(
system_info
),
NULL
);
LOCALE_Init
();
...
...
dlls/kernel32/virtual.c
View file @
62f22dd4
...
...
@@ -48,8 +48,6 @@
WINE_DECLARE_DEBUG_CHANNEL
(
seh
);
WINE_DECLARE_DEBUG_CHANNEL
(
file
);
static
unsigned
int
page_size
;
/***********************************************************************
* VirtualAlloc (KERNEL32.@)
...
...
@@ -648,19 +646,17 @@ BOOL WINAPI IsBadReadPtr( LPCVOID ptr, UINT size )
{
if
(
!
size
)
return
FALSE
;
/* handle 0 size case w/o reference */
if
(
!
ptr
)
return
TRUE
;
if
(
!
page_size
)
page_size
=
getpagesize
();
__TRY
{
volatile
const
char
*
p
=
ptr
;
char
dummy
__attribute__
((
unused
));
UINT
count
=
size
;
while
(
count
>
page_s
ize
)
while
(
count
>
system_info
.
PageS
ize
)
{
dummy
=
*
p
;
p
+=
page_s
ize
;
count
-=
page_s
ize
;
p
+=
system_info
.
PageS
ize
;
count
-=
system_info
.
PageS
ize
;
}
dummy
=
p
[
0
];
dummy
=
p
[
count
-
1
];
...
...
@@ -692,18 +688,16 @@ BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT size )
{
if
(
!
size
)
return
FALSE
;
/* handle 0 size case w/o reference */
if
(
!
ptr
)
return
TRUE
;
if
(
!
page_size
)
page_size
=
getpagesize
();
__TRY
{
volatile
char
*
p
=
ptr
;
UINT
count
=
size
;
while
(
count
>
page_s
ize
)
while
(
count
>
system_info
.
PageS
ize
)
{
*
p
|=
0
;
p
+=
page_s
ize
;
count
-=
page_s
ize
;
p
+=
system_info
.
PageS
ize
;
count
-=
system_info
.
PageS
ize
;
}
p
[
0
]
|=
0
;
p
[
count
-
1
]
|=
0
;
...
...
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