mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Reorganize registry initialization.
Fix typos. svn path=/trunk/; revision=4347
This commit is contained in:
parent
1b066695c5
commit
65620794d3
3 changed files with 128 additions and 67 deletions
|
@ -209,6 +209,7 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
WCHAR EmptyStr = (WCHAR)0;
|
WCHAR EmptyStr = (WCHAR)0;
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (Flags & (FLG_ADDREG_DELREG_BIT | FLG_ADDREG_DELVAL)) /* deletion */
|
if (Flags & (FLG_ADDREG_DELREG_BIT | FLG_ADDREG_DELVAL)) /* deletion */
|
||||||
{
|
{
|
||||||
|
@ -331,37 +332,50 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
|
|
||||||
if (Type == REG_DWORD)
|
if (Type == REG_DWORD)
|
||||||
{
|
{
|
||||||
ULONG dw = Str ? wcstol (Str, NULL, 16) : 0;
|
ULONG dw = Str ? wcstol (Str, NULL, 0) : 0;
|
||||||
|
|
||||||
DPRINT1("setting dword %wZ to %lx\n", &ValueName, dw);
|
DPRINT1("setting dword %wZ to %lx\n", ValueName, dw);
|
||||||
|
|
||||||
NtSetValueKey (KeyHandle,
|
Status = NtSetValueKey (KeyHandle,
|
||||||
ValueName,
|
ValueName,
|
||||||
0,
|
0,
|
||||||
Type,
|
Type,
|
||||||
(PVOID)&dw,
|
(PVOID)&dw,
|
||||||
(ULONG)sizeof(dw));
|
sizeof(ULONG));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("setting value %wZ to %S\n", ValueName, Str);
|
DPRINT1("setting value %wZ to %S\n", ValueName, Str);
|
||||||
|
|
||||||
if (Str)
|
if (Str)
|
||||||
{
|
{
|
||||||
NtSetValueKey (KeyHandle,
|
Status = NtSetValueKey (KeyHandle,
|
||||||
ValueName,
|
ValueName,
|
||||||
0,
|
0,
|
||||||
Type,
|
Type,
|
||||||
(PVOID)Str,
|
(PVOID)Str,
|
||||||
Size * sizeof(WCHAR));
|
Size * sizeof(WCHAR));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NtSetValueKey (KeyHandle,
|
Status = NtSetValueKey (KeyHandle,
|
||||||
ValueName,
|
ValueName,
|
||||||
0,
|
0,
|
||||||
Type,
|
Type,
|
||||||
(PVOID)&EmptyStr,
|
(PVOID)&EmptyStr,
|
||||||
sizeof(WCHAR));
|
sizeof(WCHAR));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RtlFreeHeap (ProcessHeap, 0, Str);
|
RtlFreeHeap (ProcessHeap, 0, Str);
|
||||||
|
@ -383,16 +397,18 @@ do_reg_operation(HANDLE KeyHandle,
|
||||||
InfGetBinaryField (Context, 5, Data, Size, NULL);
|
InfGetBinaryField (Context, 5, Data, Size, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtSetValueKey (KeyHandle,
|
Status = NtSetValueKey (KeyHandle,
|
||||||
ValueName,
|
ValueName,
|
||||||
0,
|
0,
|
||||||
Type,
|
Type,
|
||||||
(PVOID)Data,
|
(PVOID)Data,
|
||||||
Size);
|
Size);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
RtlFreeHeap (ProcessHeap, 0, Data);
|
RtlFreeHeap (ProcessHeap, 0, Data);
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -651,6 +667,7 @@ ImportRegistryData(PWSTR Filename)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
SetupUpdateRegistry(VOID)
|
SetupUpdateRegistry(VOID)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING KeyName;
|
UNICODE_STRING KeyName;
|
||||||
UNICODE_STRING ValueName;
|
UNICODE_STRING ValueName;
|
||||||
|
@ -679,7 +696,6 @@ SetupUpdateRegistry(VOID)
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Create '\Registry\Machine\System\Setup' key */
|
/* Create '\Registry\Machine\System\Setup' key */
|
||||||
RtlInitUnicodeStringFromLiteral(&KeyName,
|
RtlInitUnicodeStringFromLiteral(&KeyName,
|
||||||
L"\\Registry\\Machine\\SYSTEM\\Setup");
|
L"\\Registry\\Machine\\SYSTEM\\Setup");
|
||||||
|
@ -708,6 +724,7 @@ SetupUpdateRegistry(VOID)
|
||||||
NtClose(KeyHandle);
|
NtClose(KeyHandle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SetStatusText(" Importing hivesys.inf...");
|
SetStatusText(" Importing hivesys.inf...");
|
||||||
|
|
||||||
if (!ImportRegistryData (L"hivesys.inf"))
|
if (!ImportRegistryData (L"hivesys.inf"))
|
||||||
|
@ -720,4 +737,49 @@ SetupUpdateRegistry(VOID)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
SetInstallPathValue(PUNICODE_STRING InstallPath)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING KeyName;
|
||||||
|
UNICODE_STRING ValueName;
|
||||||
|
HANDLE KeyHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Create the 'secret' InstallPath key */
|
||||||
|
RtlInitUnicodeStringFromLiteral (&KeyName,
|
||||||
|
L"\\Registry\\Machine\\HARDWARE");
|
||||||
|
InitializeObjectAttributes (&ObjectAttributes,
|
||||||
|
&KeyName,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = NtOpenKey (&KeyHandle,
|
||||||
|
KEY_ALL_ACCESS,
|
||||||
|
&ObjectAttributes);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlInitUnicodeStringFromLiteral (&ValueName,
|
||||||
|
L"InstallPath");
|
||||||
|
Status = NtSetValueKey (KeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
(PVOID)InstallPath->Buffer,
|
||||||
|
InstallPath->Length);
|
||||||
|
NtClose(KeyHandle);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: registry.h,v 1.2 2003/03/18 20:39:49 ekohl Exp $
|
/* $Id: registry.h,v 1.3 2003/03/19 20:12:44 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS text-mode setup
|
* PROJECT: ReactOS text-mode setup
|
||||||
* FILE: subsys/system/usetup/registry.h
|
* FILE: subsys/system/usetup/registry.h
|
||||||
|
@ -27,12 +27,16 @@
|
||||||
#ifndef __REGISTRY_H__
|
#ifndef __REGISTRY_H__
|
||||||
#define __REGISTRY_H__
|
#define __REGISTRY_H__
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
SetupUpdateRegistry(VOID);
|
SetupUpdateRegistry(VOID);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
ImportRegistryData(PWSTR Filename);
|
ImportRegistryData(PWSTR Filename);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
SetInstallPathValue(PUNICODE_STRING InstallPath);
|
||||||
|
|
||||||
#endif /* __REGISTRY_H__ */
|
#endif /* __REGISTRY_H__ */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1264,58 +1264,21 @@ FileCopyPage(PINPUT_RECORD Ir)
|
||||||
static ULONG
|
static ULONG
|
||||||
RegistryPage(PINPUT_RECORD Ir)
|
RegistryPage(PINPUT_RECORD Ir)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
INFCONTEXT InfContext;
|
||||||
UNICODE_STRING KeyName;
|
|
||||||
UNICODE_STRING ValueName;
|
|
||||||
HANDLE KeyHandle;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
SetTextXY(6, 8, "Setup updated the system configuration");
|
PWSTR Action;
|
||||||
|
PWSTR File;
|
||||||
|
PWSTR Section;
|
||||||
|
|
||||||
|
|
||||||
|
SetTextXY(6, 8, "Setup is updating the system configuration");
|
||||||
|
|
||||||
SetStatusText(" Creating registry hives...");
|
SetStatusText(" Creating registry hives...");
|
||||||
|
|
||||||
/* Create the 'secret' InstallPath key */
|
if (!SetInstallPathValue(&DestinationPath))
|
||||||
RtlInitUnicodeStringFromLiteral(&KeyName,
|
|
||||||
L"\\Registry\\Machine\\HARDWARE");
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&KeyName,
|
|
||||||
OBJ_CASE_INSENSITIVE,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = NtOpenKey(&KeyHandle,
|
|
||||||
KEY_ALL_ACCESS,
|
|
||||||
&ObjectAttributes);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
|
PopupError("Setup failed to set the initialize the registry.",
|
||||||
PopupError("Setup failed to open the HARDWARE registry key.",
|
|
||||||
"ENTER = Reboot computer");
|
|
||||||
|
|
||||||
while(TRUE)
|
|
||||||
{
|
|
||||||
ConInKey(Ir);
|
|
||||||
|
|
||||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
|
||||||
{
|
|
||||||
return(QUIT_PAGE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlInitUnicodeStringFromLiteral(&ValueName,
|
|
||||||
L"InstallPath");
|
|
||||||
|
|
||||||
Status = NtSetValueKey(KeyHandle,
|
|
||||||
&ValueName,
|
|
||||||
0,
|
|
||||||
REG_SZ,
|
|
||||||
(PVOID)DestinationPath.Buffer,
|
|
||||||
DestinationPath.Length);
|
|
||||||
NtClose(KeyHandle);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
||||||
PopupError("Setup failed to set the \'InstallPath\' registry value.",
|
|
||||||
"ENTER = Reboot computer");
|
"ENTER = Reboot computer");
|
||||||
|
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
|
@ -1334,7 +1297,7 @@ RegistryPage(PINPUT_RECORD Ir)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status);
|
DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status);
|
||||||
PopupError("Setup failed to initialize the registry.",
|
PopupError("Setup failed to create the registry hives.",
|
||||||
"ENTER = Reboot computer");
|
"ENTER = Reboot computer");
|
||||||
|
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
|
@ -1351,6 +1314,38 @@ RegistryPage(PINPUT_RECORD Ir)
|
||||||
/* Update registry */
|
/* Update registry */
|
||||||
SetStatusText(" Updating registry hives...");
|
SetStatusText(" Updating registry hives...");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (!InfFindFirstLine(SetupInf, L"HiveInfs.Install", NULL, &InfContext))
|
||||||
|
{
|
||||||
|
DPRINT1("InfFindFirstLine() failed\n");
|
||||||
|
PopupError("Setup failed to find the registry hive inf-files.",
|
||||||
|
"ENTER = Reboot computer");
|
||||||
|
|
||||||
|
while(TRUE)
|
||||||
|
{
|
||||||
|
ConInKey(Ir);
|
||||||
|
|
||||||
|
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||||
|
{
|
||||||
|
return(QUIT_PAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
InfGetDataField (&InfContext, 0, &Action);
|
||||||
|
InfGetDataField (&InfContext, 1, &File);
|
||||||
|
InfGetDataField (&InfContext, 2, &Section);
|
||||||
|
|
||||||
|
DPRINT1("Action: %S File: %S Section %S\n", Action, File, Section);
|
||||||
|
|
||||||
|
}
|
||||||
|
while (InfFindNextLine (&InfContext, &InfContext));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Status = SetupUpdateRegistry();
|
Status = SetupUpdateRegistry();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue