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
242dc898
Commit
242dc898
authored
Jul 14, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use malloc() to allocate the system processor information.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fe7b8d70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
system.c
dlls/ntdll/unix/system.c
+14
-17
No files found.
dlls/ntdll/unix/system.c
View file @
242dc898
...
...
@@ -2182,6 +2182,11 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
}
if
(
!
(
sppi
=
calloc
(
out_cpus
,
sizeof
(
*
sppi
)
)))
{
ret
=
STATUS_NO_MEMORY
;
break
;
}
else
#ifdef __APPLE__
{
...
...
@@ -2196,8 +2201,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
{
int
i
;
cpus
=
min
(
cpus
,
out_cpus
);
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
*
cpus
;
sppi
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
for
(
i
=
0
;
i
<
cpus
;
i
++
)
{
sppi
[
i
].
IdleTime
.
QuadPart
=
pinfo
[
i
].
cpu_ticks
[
CPU_STATE_IDLE
];
...
...
@@ -2214,7 +2217,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
{
unsigned
long
clk_tck
=
sysconf
(
_SC_CLK_TCK
);
unsigned
long
usr
,
nice
,
sys
,
idle
,
remainder
[
8
];
int
i
,
count
;
int
i
,
count
,
id
;
char
name
[
32
];
char
line
[
255
];
...
...
@@ -2230,17 +2233,12 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
for
(
i
=
0
;
i
+
5
<
count
;
++
i
)
sys
+=
remainder
[
i
];
sys
+=
idle
;
usr
+=
nice
;
cpus
=
atoi
(
name
+
3
)
+
1
;
if
(
cpus
>
out_cpus
)
break
;
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
*
cpus
;
if
(
sppi
)
sppi
=
RtlReAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sppi
,
len
);
else
sppi
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
sppi
[
cpus
-
1
].
IdleTime
.
QuadPart
=
(
ULONGLONG
)
idle
*
10000000
/
clk_tck
;
sppi
[
cpus
-
1
].
KernelTime
.
QuadPart
=
(
ULONGLONG
)
sys
*
10000000
/
clk_tck
;
sppi
[
cpus
-
1
].
UserTime
.
QuadPart
=
(
ULONGLONG
)
usr
*
10000000
/
clk_tck
;
id
=
atoi
(
name
+
3
)
+
1
;
if
(
id
>
out_cpus
)
break
;
if
(
id
>
cpus
)
cpus
=
id
;
sppi
[
id
-
1
].
IdleTime
.
QuadPart
=
(
ULONGLONG
)
idle
*
10000000
/
clk_tck
;
sppi
[
id
-
1
].
KernelTime
.
QuadPart
=
(
ULONGLONG
)
sys
*
10000000
/
clk_tck
;
sppi
[
id
-
1
].
UserTime
.
QuadPart
=
(
ULONGLONG
)
usr
*
10000000
/
clk_tck
;
}
fclose
(
cpuinfo
);
}
...
...
@@ -2251,8 +2249,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
static
int
i
=
1
;
unsigned
int
n
;
cpus
=
min
(
NtCurrentTeb
()
->
Peb
->
NumberOfProcessors
,
out_cpus
);
len
=
sizeof
(
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
)
*
cpus
;
sppi
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
FIXME
(
"stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
\n
"
);
/* many programs expect these values to change so fake change */
for
(
n
=
0
;
n
<
cpus
;
n
++
)
...
...
@@ -2264,6 +2260,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
i
++
;
}
len
=
sizeof
(
*
sppi
)
*
cpus
;
if
(
size
>=
len
)
{
if
(
!
info
)
ret
=
STATUS_ACCESS_VIOLATION
;
...
...
@@ -2271,7 +2268,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
sppi
);
free
(
sppi
);
break
;
}
...
...
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