mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Partial Implementation of NtQuerySystemInformation and NtSetSystemInformation
svn path=/trunk/; revision=613
This commit is contained in:
parent
6cb529270a
commit
2a466eda80
8 changed files with 310 additions and 47 deletions
|
@ -112,7 +112,7 @@ struct _LPC_MESSAGE
|
|||
#define ObjectNameInformation 1
|
||||
#define ObjectTypeInformation 2
|
||||
#define ObjectAllInformation 3
|
||||
#define ObjectDataInformation 4
|
||||
#define ObjectDataInformation 4
|
||||
|
||||
// semaphore information
|
||||
|
||||
|
@ -125,9 +125,12 @@ struct _LPC_MESSAGE
|
|||
// system information
|
||||
|
||||
#define SystemPerformanceInformation 5
|
||||
#define SystemDriverInformation 11
|
||||
#define SystemCacheInformation 21
|
||||
#define SystemTimeAdjustmentInformation 28
|
||||
|
||||
#define SystemTimeZoneInformation 44
|
||||
|
||||
// shutdown action
|
||||
|
||||
typedef enum SHUTDOWN_ACTION_TAG {
|
||||
|
@ -286,9 +289,26 @@ typedef struct _OBJECT_TYPE_INFORMATION
|
|||
|
||||
// system information
|
||||
|
||||
typedef struct _SYSTEM_DRIVER_INFO
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
DWORD Unknown1;
|
||||
DWORD Unknown2;
|
||||
DWORD EntryIndex;
|
||||
DWORD Unknown4;
|
||||
CHAR DriverName[MAX_PATH+1];
|
||||
} SYSTEM_DRIVER_INFO, *PSYSTEM_DRIVER_INFO;
|
||||
|
||||
typedef struct _SYSTEM_DRIVERS_INFO
|
||||
{
|
||||
DWORD DriverCount;
|
||||
SYSTEM_DRIVER_INFO DriverInfo[1];
|
||||
} SYSTEM_DRIVERS_INFO, *PSYSTEM_DRIVERS_INFO;
|
||||
|
||||
|
||||
typedef struct _SYSTEM_TIME_ADJUSTMENT
|
||||
{
|
||||
ULONG TimeAdjustment;
|
||||
ULONG TimeAdjustment;
|
||||
BOOL TimeAdjustmentDisabled;
|
||||
} SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
|
||||
|
||||
|
@ -321,6 +341,8 @@ typedef struct _SYSTEM_CACHE_INFORMATION {
|
|||
ULONG Unused[4];
|
||||
} SYSTEM_CACHE_INFORMATION;
|
||||
|
||||
// file information
|
||||
|
||||
typedef struct _FILE_BASIC_INFORMATION
|
||||
{
|
||||
TIME CreationTime;
|
||||
|
|
|
@ -1,2 +1,31 @@
|
|||
/*
|
||||
* internal executive prototypes
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_INTERNAL_EXECUTIVE_H
|
||||
#define _INCLUDE_INTERNAL_EXECUTIVE_H
|
||||
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/* GLOBAL VARIABLES *********************************************************/
|
||||
|
||||
TIME_ZONE_INFORMATION SystemTimeZoneInfo;
|
||||
|
||||
|
||||
/* INTERNAL EXECUTIVE FUNCTIONS *********************************************/
|
||||
|
||||
VOID ExUnmapPage(PVOID Addr);
|
||||
PVOID ExAllocatePage(VOID);
|
||||
|
||||
|
||||
/* INITIALIZATION FUNCTIONS *************************************************/
|
||||
|
||||
VOID ExInit (VOID);
|
||||
VOID ExInitTimeZoneInfo (VOID);
|
||||
|
||||
|
||||
#endif /* _INCLUDE_INTERNAL_EXECUTIVE_H */
|
||||
|
||||
/*EOF */
|
||||
|
||||
|
|
|
@ -363,6 +363,27 @@ typedef struct _DISK_GEOMETRY {
|
|||
DWORD BytesPerSector;
|
||||
} DISK_GEOMETRY ;
|
||||
|
||||
typedef struct _SYSTEMTIME {
|
||||
WORD wYear;
|
||||
WORD wMonth;
|
||||
WORD wDayOfWeek;
|
||||
WORD wDay;
|
||||
WORD wHour;
|
||||
WORD wMinute;
|
||||
WORD wSecond;
|
||||
WORD wMilliseconds;
|
||||
} SYSTEMTIME, *LPSYSTEMTIME;
|
||||
|
||||
typedef struct _TIME_ZONE_INFORMATION {
|
||||
LONG Bias;
|
||||
WCHAR StandardName[ 32 ];
|
||||
SYSTEMTIME StandardDate;
|
||||
LONG StandardBias;
|
||||
WCHAR DaylightName[ 32 ];
|
||||
SYSTEMTIME DaylightDate;
|
||||
LONG DaylightBias;
|
||||
} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
|
||||
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
@ -2503,17 +2524,6 @@ typedef struct _INPUT_RECORD {
|
|||
} Event;
|
||||
} INPUT_RECORD, *PINPUT_RECORD;
|
||||
|
||||
typedef struct _SYSTEMTIME {
|
||||
WORD wYear;
|
||||
WORD wMonth;
|
||||
WORD wDayOfWeek;
|
||||
WORD wDay;
|
||||
WORD wHour;
|
||||
WORD wMinute;
|
||||
WORD wSecond;
|
||||
WORD wMilliseconds;
|
||||
} SYSTEMTIME, *LPSYSTEMTIME;
|
||||
|
||||
typedef struct _JOB_INFO_1 {
|
||||
DWORD JobId;
|
||||
LPTSTR pPrinterName;
|
||||
|
@ -4172,16 +4182,6 @@ typedef struct _textrange {
|
|||
LPSTR lpstrText;
|
||||
} TEXTRANGE;
|
||||
|
||||
typedef struct _TIME_ZONE_INFORMATION {
|
||||
LONG Bias;
|
||||
WCHAR StandardName[ 32 ];
|
||||
SYSTEMTIME StandardDate;
|
||||
LONG StandardBias;
|
||||
WCHAR DaylightName[ 32 ];
|
||||
SYSTEMTIME DaylightDate;
|
||||
LONG DaylightBias;
|
||||
} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
|
||||
|
||||
typedef struct tagTOGGLEKEYS {
|
||||
DWORD cbSize;
|
||||
DWORD dwFlags;
|
||||
|
|
23
reactos/ntoskrnl/ex/init.c
Normal file
23
reactos/ntoskrnl/ex/init.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: kernel/ex/init.c
|
||||
* PURPOSE: executive initalization
|
||||
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
* UPDATE HISTORY:
|
||||
* Created 11/09/99
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ex.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
VOID
|
||||
ExInit (VOID)
|
||||
{
|
||||
ExInitTimeZoneInfo ();
|
||||
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
/* $Id: sysinfo.c,v 1.3 1999/08/11 23:27:58 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/bug.c
|
||||
* PURPOSE: Graceful system shutdown if a bug is detected
|
||||
* FILE: ntoskrnl/ex/sysinfo.c
|
||||
* PURPOSE: System information functions
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* Created 22/05/98
|
||||
|
@ -11,6 +12,9 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/zwtypes.h>
|
||||
#include <string.h>
|
||||
#include <internal/ex.h>
|
||||
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
@ -21,21 +25,8 @@ STDCALL
|
|||
NtQuerySystemEnvironmentValue (
|
||||
IN PUNICODE_STRING Name,
|
||||
OUT PVOID Value,
|
||||
ULONG Length,
|
||||
PULONG ReturnLength
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQuerySystemInformation (
|
||||
IN CINT SystemInformationClass,
|
||||
OUT PVOID SystemInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
IN ULONG Length,
|
||||
IN OUT PULONG ReturnLength
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
@ -53,6 +44,142 @@ NtSetSystemEnvironmentValue (
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQuerySystemInformation (
|
||||
IN CINT SystemInformationClass,
|
||||
OUT PVOID SystemInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
)
|
||||
{
|
||||
/*
|
||||
* If called from user mode, check
|
||||
* possible unsafe arguments.
|
||||
*/
|
||||
#if 0
|
||||
if (KernelMode != KeGetPreviousMode())
|
||||
{
|
||||
// Check arguments
|
||||
//ProbeForWrite(
|
||||
// SystemInformation,
|
||||
// Length
|
||||
// );
|
||||
//ProbeForWrite(
|
||||
// ResultLength,
|
||||
// sizeof (ULONG)
|
||||
// );
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Clear the user buffer.
|
||||
*/
|
||||
memset(
|
||||
SystemInformation,
|
||||
0,
|
||||
Length
|
||||
);
|
||||
/*
|
||||
* Check the request is valid.
|
||||
*/
|
||||
switch (SystemInformationClass)
|
||||
{
|
||||
#if 0
|
||||
/*---*/
|
||||
case SystemPerformanceInformation:
|
||||
/*
|
||||
* Check user buffer's size
|
||||
*/
|
||||
if (Length < sizeof())
|
||||
{
|
||||
*ResultLength =
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
/* FIXME */
|
||||
return STATUS_SUCCESS;
|
||||
/*---*/
|
||||
case SystemDriverInformation:
|
||||
/* Check user buffer's size */
|
||||
if (Length < sizeof (SYSTEM_DRIVER_INFO))
|
||||
{
|
||||
*ResultLength = sizeof (SYSTEM_DRIVER_INFO);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
/* FIXME: */
|
||||
return STATUS_SUCCESS;
|
||||
/*---*/
|
||||
case SystemCacheInformation:
|
||||
/* Check user buffer's size */
|
||||
if (Length < sizeof (SYSTEM_CACHE_INFORMATION))
|
||||
{
|
||||
*ResultLength = sizeof (SYSTEM_CACHE_INFORMATION);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
/*---*/
|
||||
case SystemTimeAdjustmentInformation:
|
||||
/*
|
||||
* Check user buffer's size
|
||||
*/
|
||||
if (Length < sizeof (SYSTEM_TIME_ADJUSTMENT))
|
||||
{
|
||||
*ResultLength = sizeof (SYSTEM_TIME_ADJUSTMENT);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
/* FIXME: */
|
||||
return STATUS_SUCCESS;
|
||||
/*---*/
|
||||
case SystemConfigurationInformation:
|
||||
{
|
||||
PSYSTEM_CONFIGURATION_INFO Sci
|
||||
= (PSYSTEM_CONFIGURATION_INFO) SystemInformation;
|
||||
|
||||
*ResultLength = sizeof (SYSTEM_CONFIGUTATION_INFO);
|
||||
/*
|
||||
* Check user buffer's size
|
||||
*/
|
||||
if (Length < sizeof (SYSTEM_CONFIGURATION_INFO))
|
||||
{
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
/*
|
||||
* Fill the object with config data.
|
||||
* FIXME: some data should come from the
|
||||
* registry.
|
||||
*/
|
||||
Sci->tag2.tag1.ProcessorAchitecture
|
||||
= 80586;
|
||||
Sci->tag2.tag1.Reserved
|
||||
= 0x00000000;
|
||||
Sci->PageSize
|
||||
= 4096;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
case SystemTimeZoneInformation: /* 44 */
|
||||
*ResultLength = sizeof (TIME_ZONE_INFORMATION);
|
||||
|
||||
/*
|
||||
* Check user buffer's size
|
||||
*/
|
||||
if (Length < sizeof (TIME_ZONE_INFORMATION))
|
||||
{
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
/* Copy the time zone information struct */
|
||||
memcpy (SystemInformation,
|
||||
&SystemTimeZoneInfo,
|
||||
sizeof (TIME_ZONE_INFORMATION));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
return STATUS_INVALID_INFO_CLASS;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetSystemInformation (
|
||||
|
@ -61,7 +188,50 @@ NtSetSystemInformation (
|
|||
IN ULONG SystemInformationLength
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
/*
|
||||
* If called from user mode, check
|
||||
* possible unsafe arguments.
|
||||
*/
|
||||
#if 0
|
||||
if (KernelMode != KeGetPreviousMode())
|
||||
{
|
||||
// Check arguments
|
||||
//ProbeForWrite(
|
||||
// SystemInformation,
|
||||
// Length
|
||||
// );
|
||||
//ProbeForWrite(
|
||||
// ResultLength,
|
||||
// sizeof (ULONG)
|
||||
// );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check the request is valid.
|
||||
*/
|
||||
switch (SystemInformationClass)
|
||||
{
|
||||
|
||||
|
||||
case SystemTimeZoneInformation: /* 44 */
|
||||
/*
|
||||
* Check user buffer's size
|
||||
*/
|
||||
if (SystemInformationLength < sizeof (TIME_ZONE_INFORMATION))
|
||||
{
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
/* Copy the time zone information struct */
|
||||
memcpy (&SystemTimeZoneInfo,
|
||||
&SystemInformation,
|
||||
sizeof (TIME_ZONE_INFORMATION));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return STATUS_INVALID_INFO_CLASS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ex.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
@ -19,10 +21,21 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
static LONG lTimeZoneBias = 0; /* bias[minutes] = UTC - local time */
|
||||
/* Note: Bias[minutes] = UTC - local time */
|
||||
TIME_ZONE_INFORMATION SystemTimeZoneInfo;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
VOID
|
||||
ExInitTimeZoneInfo (VOID)
|
||||
{
|
||||
/* Initialize system time zone information */
|
||||
memset (&SystemTimeZoneInfo, 0, sizeof(TIME_ZONE_INFORMATION));
|
||||
|
||||
/* FIXME: Read time zone information from the registry */
|
||||
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetSystemTime (
|
||||
|
@ -46,22 +59,26 @@ NtQuerySystemTime (
|
|||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ExLocalTimeToSystemTime (
|
||||
PLARGE_INTEGER LocalTime,
|
||||
PLARGE_INTEGER SystemTime
|
||||
)
|
||||
{
|
||||
SystemTime->QuadPart = LocalTime->QuadPart +
|
||||
lTimeZoneBias * TICKSPERMINUTE;
|
||||
SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ExSystemTimeToLocalTime (
|
||||
PLARGE_INTEGER SystemTime,
|
||||
PLARGE_INTEGER LocalTime
|
||||
)
|
||||
{
|
||||
LocalTime->QuadPart = SystemTime->QuadPart -
|
||||
lTimeZoneBias * TICKSPERMINUTE;
|
||||
SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <internal/symbol.h>
|
||||
#include <internal/module.h>
|
||||
#include <internal/ldr.h>
|
||||
#include <internal/ex.h>
|
||||
|
||||
#include <internal/mmhal.h>
|
||||
#include <internal/i386/segment.h>
|
||||
|
@ -158,6 +159,7 @@ asmlinkage void _main(boot_param* _bp)
|
|||
HalInit(&bp);
|
||||
MmInitialize(&bp, last_kernel_address);
|
||||
KeInit();
|
||||
ExInit();
|
||||
ObInit();
|
||||
PsInit();
|
||||
IoInit();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile_rex,v 1.29 1999/07/29 21:25:04 ekohl Exp $
|
||||
# $Id: makefile_rex,v 1.30 1999/08/11 23:23:48 ekohl Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -47,7 +47,7 @@ PS_OBJECTS = ps/psmgr.o ps/thread.o ps/process.o ps/idle.o ps/kill.o \
|
|||
|
||||
EX_OBJECTS = ex/work.o ex/fmutex.o ex/resource.o ex/time.o ex/interlck.o \
|
||||
ex/callback.o ex/napi.o ex/power.o ex/sysinfo.o ex/locale.o \
|
||||
ex/stamp.o
|
||||
ex/stamp.o ex/init.o
|
||||
|
||||
SE_OBJECTS = se/semgr.o
|
||||
|
||||
|
|
Loading…
Reference in a new issue