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
5e500850
Commit
5e500850
authored
Jun 13, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
Jun 13, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed size of our SYSTEM_TIMEOFDAY_INFORMATION struct.
Fixed return codes and ReturnLength/buffer for SystemTimeOfDayInformation. Added tests for SystemTimeOfDayInformation.
parent
d27d5b0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
11 deletions
+98
-11
nt.c
dlls/ntdll/nt.c
+11
-8
info.c
dlls/ntdll/tests/info.c
+86
-2
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/ntdll/nt.c
View file @
5e500850
...
...
@@ -658,15 +658,18 @@ NTSTATUS WINAPI NtQuerySystemInformation(
break
;
case
SystemTimeOfDayInformation
:
{
SYSTEM_TIMEOFDAY_INFORMATION
*
sti
=
(
SYSTEM_TIMEOFDAY_INFORMATION
*
)
SystemInformation
;
if
(
Length
>=
sizeof
(
*
sti
))
SYSTEM_TIMEOFDAY_INFORMATION
sti
;
memset
(
&
sti
,
0
,
sizeof
(
sti
));
/* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
sti
.
liKeBootTime
.
QuadPart
=
boottime
;
if
(
Length
<=
sizeof
(
sti
))
{
sti
->
liKeBootTime
.
QuadPart
=
boottime
;
sti
->
liKeSystemTime
.
QuadPart
=
0
;
/* FIXME */
sti
->
liExpTimeZoneBias
.
QuadPart
=
0
;
/* FIXME */
sti
->
uCurrentTimeZoneId
=
0
;
/* FIXME */
sti
->
dwReserved
=
0
;
len
=
sizeof
(
*
sti
);
len
=
Length
;
if
(
!
SystemInformation
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
memcpy
(
SystemInformation
,
&
sti
,
Length
);
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
}
...
...
dlls/ntdll/tests/info.c
View file @
5e500850
...
...
@@ -80,7 +80,7 @@ static void test_query_basic()
trace
(
"Check with correct parameters
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemBasicInformation
,
&
sbi
,
sizeof
(
sbi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
sizeof
(
sbi
)
==
ReturnLength
,
"Inconsistent length (%
08x
) <-> (%ld)
\n
"
,
sizeof
(
sbi
),
ReturnLength
);
ok
(
sizeof
(
sbi
)
==
ReturnLength
,
"Inconsistent length (%
d
) <-> (%ld)
\n
"
,
sizeof
(
sbi
),
ReturnLength
);
/* Check if we have some return values */
trace
(
"Number of Processors : %d
\n
"
,
sbi
.
NumberOfProcessors
);
...
...
@@ -95,13 +95,93 @@ static void test_query_cpu()
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
);
ok
(
sizeof
(
sci
)
==
ReturnLength
,
"Inconsistent length (%
d
) <-> (%ld)
\n
"
,
sizeof
(
sci
),
ReturnLength
);
/* Check if we have some return values */
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_timeofday
()
{
DWORD
status
;
ULONG
ReturnLength
;
int
isnt
=
0
;
/* Copy of our winternl.h structure turned into a private one */
typedef
struct
_SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE
{
LARGE_INTEGER
liKeBootTime
;
LARGE_INTEGER
liKeSystemTime
;
LARGE_INTEGER
liExpTimeZoneBias
;
ULONG
uCurrentTimeZoneId
;
DWORD
dwUnknown1
[
5
];
}
SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE
,
*
PSYSTEM_TIMEOFDAY_INFORMATION_PRIVATE
;
SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE
sti
;
/* The structsize for NT (32 bytes) and Win2K/XP (48 bytes) differ.
*
* Windows 2000 and XP return STATUS_INFO_LENGTH_MISMATCH if the given buffer size is greater
* then 48 and 0 otherwise
* Windows NT returns STATUS_INFO_LENGTH_MISMATCH when the given buffer size is not correct
* and 0 otherwise
*
* Windows 2000 and XP copy the given buffer size into the provided buffer, if the return code is STATUS_SUCCESS
* NT only fills the buffer if the return code is STATUS_SUCCESS
*
*/
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
sizeof
(
sti
),
&
ReturnLength
);
isnt
=
(
status
==
STATUS_INFO_LENGTH_MISMATCH
);
if
(
isnt
)
{
trace
(
"Windows version is NT, we have to cater for differences with W2K/WinXP
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%ld)
\n
"
,
ReturnLength
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
28
,
&
ReturnLength
);
ok
(
0xdeadbeef
==
sti
.
uCurrentTimeZoneId
,
"This part of the buffer should not have been filled
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
32
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 0, it is (%ld)
\n
"
,
ReturnLength
);
}
else
{
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
0
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%ld)
\n
"
,
ReturnLength
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
24
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
24
==
ReturnLength
,
"ReturnLength should be 24, it is (%ld)
\n
"
,
ReturnLength
);
ok
(
0xdeadbeef
==
sti
.
uCurrentTimeZoneId
,
"This part of the buffer should not have been filled
\n
"
);
sti
.
uCurrentTimeZoneId
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
32
,
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
32
==
ReturnLength
,
"ReturnLength should be 32, it is (%ld)
\n
"
,
ReturnLength
);
ok
(
0xdeadbeef
!=
sti
.
uCurrentTimeZoneId
,
"Buffer should have been partially filled
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
49
,
&
ReturnLength
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
ok
(
0
==
ReturnLength
,
"ReturnLength should be 0, it is (%ld)
\n
"
,
ReturnLength
);
status
=
pNtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
sti
,
sizeof
(
sti
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
sizeof
(
sti
)
==
ReturnLength
,
"Inconsistent length (%d) <-> (%ld)
\n
"
,
sizeof
(
sti
),
ReturnLength
);
}
/* Check if we have some return values */
trace
(
"uCurrentTimeZoneId : (%ld)
\n
"
,
sti
.
uCurrentTimeZoneId
);
}
static
void
test_query_process
()
{
DWORD
status
;
...
...
@@ -250,6 +330,10 @@ START_TEST(info)
trace
(
"Starting test_query_cpu()
\n
"
);
test_query_cpu
();
/* 0x3 SystemCpuInformation */
trace
(
"Starting test_query_timeofday()
\n
"
);
test_query_timeofday
();
/* 0x5 SystemProcessInformation */
trace
(
"Starting test_query_process()
\n
"
);
test_query_process
();
...
...
include/winternl.h
View file @
5e500850
...
...
@@ -977,7 +977,7 @@ typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
LARGE_INTEGER
liKeSystemTime
;
LARGE_INTEGER
liExpTimeZoneBias
;
ULONG
uCurrentTimeZoneId
;
DWORD
dw
Reserved
;
DWORD
dw
Unknown1
[
5
]
;
#else
BYTE
Reserved1
[
48
];
#endif
...
...
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