Added registry shutdown function CmShutdownRegistry()

Updated shutdown sequence

svn path=/trunk/; revision=1379
This commit is contained in:
Eric Kohl 2000-10-05 19:15:50 +00:00
parent beaf6eac44
commit aa5a575bd0
6 changed files with 224 additions and 48 deletions

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.39 2000/10/05 14:55:25 jean Exp $
/* $Id: registry.c,v 1.40 2000/10/05 19:13:48 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -202,6 +202,11 @@ static KSPIN_LOCK CmiKeyListLock;
/* ----------------------------------------- Forward Declarations */
static NTSTATUS RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle);
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
PVOID *NextObject,
PUNICODE_STRING FullPath,
@ -506,6 +511,12 @@ CmInitializeRegistry2(VOID)
/* FIXME : initialize standards symbolic links */
}
VOID
CmShutdownRegistry(VOID)
{
DPRINT1("CmShutdownRegistry()...\n");
}
VOID
CmImportHive(PCHAR Chunk)
{
@ -1617,7 +1628,8 @@ NtInitializeRegistry (
BOOLEAN SetUpBoot
)
{
UNIMPLEMENTED;
// UNIMPLEMENTED;
return STATUS_SUCCESS;
}
@ -1628,7 +1640,19 @@ RtlCheckRegistryKey (
IN PWSTR Path
)
{
UNIMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
FALSE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
@ -1639,7 +1663,19 @@ RtlCreateRegistryKey (
IN PWSTR Path
)
{
UNIMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
@ -1651,7 +1687,26 @@ RtlDeleteRegistryValue (
IN PWSTR ValueName
)
{
UNIMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
UNICODE_STRING Name;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
RtlInitUnicodeString(&Name,
ValueName);
NtDeleteValueKey(KeyHandle,
&Name);
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
@ -1680,11 +1735,131 @@ RtlWriteRegistryValue (
IN ULONG ValueLength
)
{
UNIMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
UNICODE_STRING Name;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
RtlInitUnicodeString(&Name,
ValueName);
NtSetValueKey(KeyHandle,
&Name,
0,
ValueType,
ValueData,
ValueLength);
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath)
{
return STATUS_UNSUCCESSFUL;
}
/* ------------------------------------------ Private Implementation */
static NTSTATUS RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle)
{
UNICODE_STRING KeyName;
WCHAR KeyBuffer[MAX_PATH];
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
if (RelativeTo & RTL_REGISTRY_HANDLE)
{
*KeyHandle = (HANDLE)Path;
return STATUS_SUCCESS;
}
if (RelativeTo & RTL_REGISTRY_OPTIONAL)
RelativeTo &= ~RTL_REGISTRY_OPTIONAL;
if (RelativeTo >= RTL_REGISTRY_MAXIMUM)
return STATUS_INVALID_PARAMETER;
KeyName.Length = 0;
KeyName.MaximumLength = MAX_PATH;
KeyName.Buffer = KeyBuffer;
KeyBuffer[0] = 0;
switch (RelativeTo)
{
case RTL_REGISTRY_SERVICES:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
break;
case RTL_REGISTRY_CONTROL:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\");
break;
case RTL_REGISTRY_WINDOWS_NT:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\");
break;
case RTL_REGISTRY_DEVICEMAP:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\Hardware\\DeviceMap\\");
break;
case RTL_REGISTRY_USER:
Status = RtlFormatCurrentUserKeyPath(&KeyName);
if (!NT_SUCCESS(Status))
return Status;
break;
}
if (Path[0] != L'\\')
RtlAppendUnicodeToString(&KeyName,
L"\\");
RtlAppendUnicodeToString(&KeyName,
Path);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
if (Create == TRUE)
{
Status = NtCreateKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
NULL,
0,
NULL);
}
else
{
Status = NtOpenKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes);
}
return Status;
}
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
PVOID *NextObject,

View file

@ -32,9 +32,11 @@ NTSTATUS STDCALL NtShutdownSystem(IN SHUTDOWN_ACTION Action)
if (Action > ShutdownPowerOff)
return STATUS_INVALID_PARAMETER;
IoShutdownRegisteredDevices();
CmShutdownRegistry();
IoShutdownRegisteredFileSystems();
PiShutdownProcessManager();
MiShutdownMemoryManager();
IoShutdownIoManager();
if (Action == ShutdownNoReboot)
{

View file

@ -1,4 +1,4 @@
/* $Id: io.h,v 1.5 2000/09/10 13:52:55 ekohl Exp $
/* $Id: io.h,v 1.6 2000/10/05 19:12:55 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -59,9 +59,10 @@ PIRP IoBuildSynchronousFsdRequestWithMdl(ULONG MajorFunction,
PLARGE_INTEGER StartingOffset,
PKEVENT Event,
PIO_STATUS_BLOCK IoStatusBlock);
VOID IoShutdownIoManager(VOID);
VOID IoInitShutdownNotification(VOID);
VOID IoShutdownRegisteredDevices(VOID);
VOID IoShutdownRegisteredFileSystems(VOID);
NTSTATUS STDCALL IoPageRead (PFILE_OBJECT FileObject,
PMDL Mdl,

View file

@ -49,6 +49,7 @@ VOID ObInit(VOID);
VOID PsInit(VOID);
VOID CmInitializeRegistry(VOID);
VOID CmInitializeRegistry2(VOID);
VOID CmShutdownRegistry(VOID);
VOID CmImportHive(PCHAR);
VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);

View file

@ -1,4 +1,4 @@
/* $Id: fs.c,v 1.13 2000/05/13 13:51:00 dwelch Exp $
/* $Id: fs.c,v 1.14 2000/10/05 19:15:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -113,6 +113,11 @@ VOID IoInitFileSystemImplementation(VOID)
KeInitializeSpinLock(&FileSystemListLock);
}
VOID IoShutdownRegisteredFileSystems(VOID)
{
DPRINT("IoShutdownRegisteredFileSystems()\n");
}
NTSTATUS IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
PDEVICE_OBJECT DeviceToMount)
{

View file

@ -1,4 +1,4 @@
/* $Id: iomgr.c,v 1.15 2000/09/10 13:54:01 ekohl Exp $
/* $Id: iomgr.c,v 1.16 2000/10/05 19:15:50 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -99,14 +99,6 @@ VOID IopDeleteFile(PVOID ObjectBody)
}
}
VOID IoShutdownIoManager(VOID)
{
/* shut down all registered devices */
IoShutdownRegisteredDevices();
}
VOID IoInit (VOID)
{