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
50d1e4f0
Commit
50d1e4f0
authored
Jun 10, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
Jun 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed ReturnLength of SystemCpuInformation.
Added first test for SystemCpuInformation.
parent
90830863
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
37 deletions
+60
-37
nt.c
dlls/ntdll/nt.c
+13
-9
info.c
dlls/ntdll/tests/info.c
+47
-28
No files found.
dlls/ntdll/nt.c
View file @
50d1e4f0
...
...
@@ -627,16 +627,20 @@ NTSTATUS WINAPI NtQuerySystemInformation(
break
;
case
SystemCpuInformation
:
{
SYSTEM_CPU_INFORMATION
*
sci
;
sci
=
(
SYSTEM_CPU_INFORMATION
*
)
SystemInformation
;
if
(
Length
>=
sizeof
(
*
sci
))
SYSTEM_CPU_INFORMATION
sci
;
/* FIXME: move some code from kernel/cpu.c to process this */
sci
.
Architecture
=
PROCESSOR_ARCHITECTURE_INTEL
;
sci
.
Level
=
6
;
/* 686, aka Pentium II+ */
sci
.
Revision
=
0
;
sci
.
Reserved
=
0
;
sci
.
FeatureSet
=
0x1fff
;
len
=
sizeof
(
sci
);
if
(
Length
>=
len
)
{
/* FIXME: move some code from kernel/cpu.c to process this */
sci
->
Architecture
=
PROCESSOR_ARCHITECTURE_INTEL
;
sci
->
Level
=
6
;
/* 686, aka Pentium II+ */
sci
->
Revision
=
0
;
sci
->
Reserved
=
0
;
sci
->
FeatureSet
=
0x1fff
;
if
(
!
SystemInformation
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
memcpy
(
SystemInformation
,
&
sci
,
len
);
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
}
...
...
dlls/ntdll/tests/info.c
View file @
50d1e4f0
...
...
@@ -87,37 +87,19 @@ static void test_query_basic()
ok
(
sbi
.
NumberOfProcessors
>
0
,
"Expected more than 0 processors, got %d
\n
"
,
sbi
.
NumberOfProcessors
);
}
static
void
test_query_
handle
()
static
void
test_query_
cpu
()
{
DWORD
status
;
ULONG
ReturnLength
;
ULONG
SystemInformationLength
=
sizeof
(
SYSTEM_HANDLE_INFORMATION
);
SYSTEM_HANDLE_INFORMATION
*
shi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SystemInformationLength
);
/* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
SYSTEM_CPU_INFORMATION
sci
;
/* The following check assumes more than one handle on any given system */
todo_wine
{
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
}
ok
(
ReturnLength
>
0
,
"Expected ReturnLength to be > 0, it was %ld
\n
"
,
ReturnLength
);
SystemInformationLength
=
ReturnLength
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemCpuInformation
,
&
sci
,
sizeof
(
sci
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length (%08x) <-> (%ld)
\n
"
,
sizeof
(
sci
),
ReturnLength
);
/* Check if we have some return values */
trace
(
"Number of Handles : %ld
\n
"
,
shi
->
Count
);
todo_wine
{
/* our implementation is a stub for now */
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handles, got (%ld)
\n
"
,
shi
->
Count
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shi
);
trace
(
"Processor FeatureSet : %08lx
\n
"
,
sci
.
FeatureSet
);
ok
(
sci
.
FeatureSet
!=
0
,
"Expected some features for this processor, got %08lx
\n
"
,
sci
.
FeatureSet
);
}
static
void
test_query_process
()
...
...
@@ -172,7 +154,7 @@ static void test_query_process()
* dwOffset for a process is 136 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION)
* Wine (with every windows version):
* dwOffset for a process is 0 if just this test is running
* dwOffset for a process is 184 + (no. of threads
+ 1
) * sizeof(SYSTEM_THREAD_INFORMATION) +
* dwOffset for a process is 184 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION) +
* ProcessName.MaximumLength
* if more wine processes are running
*
...
...
@@ -222,16 +204,53 @@ static void test_query_process()
HeapFree
(
GetProcessHeap
(),
0
,
spi
);
}
static
void
test_query_handle
()
{
DWORD
status
;
ULONG
ReturnLength
;
ULONG
SystemInformationLength
=
sizeof
(
SYSTEM_HANDLE_INFORMATION
);
SYSTEM_HANDLE_INFORMATION
*
shi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SystemInformationLength
);
/* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
/* The following check assumes more than one handle on any given system */
todo_wine
{
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
}
ok
(
ReturnLength
>
0
,
"Expected ReturnLength to be > 0, it was %ld
\n
"
,
ReturnLength
);
SystemInformationLength
=
ReturnLength
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
/* Check if we have some return values */
trace
(
"Number of Handles : %ld
\n
"
,
shi
->
Count
);
todo_wine
{
/* our implementation is a stub for now */
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handles, got (%ld)
\n
"
,
shi
->
Count
);
}
HeapFree
(
GetProcessHeap
(),
0
,
shi
);
}
START_TEST
(
info
)
{
if
(
!
InitFunctionPtrs
())
return
;
/* 0 SystemBasicInformation */
/* 0
x0
SystemBasicInformation */
trace
(
"Starting test_query_basic()
\n
"
);
test_query_basic
();
/* 5 SystemProcessInformation */
/* 0x1 SystemCpuInformation */
trace
(
"Starting test_query_cpu()
\n
"
);
test_query_cpu
();
/* 0x5 SystemProcessInformation */
trace
(
"Starting test_query_process()
\n
"
);
test_query_process
();
...
...
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