Author: fireball
Date: Sun Jan 4 09:11:47 2009
New Revision: 38565
URL:
http://svn.reactos.org/svn/reactos?rev=38565&view=rev
Log:
- Rewrite SystemTimeOfDay QuerySystemInformation case. ReqSize is the amount of data
copied to the user so use it accordingly. Also, fill up the buffer as much as the caller
requested. Fixes 1 "ntdll_winetest.exe info".
- Use a newer (5.0 and higher) version of SYSTEM_TIMEOFDAY_INFORMATION structure
(consisting of two additional 64 bits fields: boot time bias and sleep time bias).
Modified:
trunk/reactos/include/ndk/extypes.h
trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/include/ndk/extypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/extypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/extypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/extypes.h [iso-8859-1] Sun Jan 4 09:11:47 2009
@@ -817,6 +817,10 @@
LARGE_INTEGER TimeZoneBias;
ULONG TimeZoneId;
ULONG Reserved;
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+ ULONGLONG BootTimeBias;
+ ULONGLONG SleepTimeBias;
+#endif
} SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;
// Class 4
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Sun Jan 4 09:11:47 2009
@@ -663,25 +663,36 @@
/* Class 3 - Time Of Day Information */
QSI_DEF(SystemTimeOfDayInformation)
{
- PSYSTEM_TIMEOFDAY_INFORMATION Sti;
+ SYSTEM_TIMEOFDAY_INFORMATION Sti;
LARGE_INTEGER CurrentTime;
- Sti = (PSYSTEM_TIMEOFDAY_INFORMATION)Buffer;
- *ReqSize = sizeof (SYSTEM_TIMEOFDAY_INFORMATION);
+ /* Set amount of written information to 0 */
+ *ReqSize = 0;
/* Check user buffer's size */
- if (Size != sizeof (SYSTEM_TIMEOFDAY_INFORMATION))
- {
- return STATUS_INFO_LENGTH_MISMATCH;
- }
-
+ if (Size > sizeof(SYSTEM_TIMEOFDAY_INFORMATION))
+ {
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+
+ /* Get current time */
KeQuerySystemTime(&CurrentTime);
- Sti->BootTime= KeBootTime;
- Sti->CurrentTime = CurrentTime;
- Sti->TimeZoneBias.QuadPart = ExpTimeZoneBias.QuadPart;
- Sti->TimeZoneId = ExpTimeZoneId;
- Sti->Reserved = 0;
+ /* Zero local buffer */
+ RtlZeroMemory(&Sti, sizeof(SYSTEM_TIMEOFDAY_INFORMATION));
+
+ /* Fill local time structure */
+ Sti.BootTime= KeBootTime;
+ Sti.CurrentTime = CurrentTime;
+ Sti.TimeZoneBias.QuadPart = ExpTimeZoneBias.QuadPart;
+ Sti.TimeZoneId = ExpTimeZoneId;
+ Sti.Reserved = 0;
+
+ /* Copy as much as requested by caller */
+ RtlCopyMemory(Buffer, &Sti, Size);
+
+ /* Set amount of information we copied */
+ *ReqSize = Size;
return STATUS_SUCCESS;
}