2007-12-23 20:29:52 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 2008 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-12-23 20:29:52 +00:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS text-mode setup
|
2015-09-13 16:40:36 +00:00
|
|
|
* FILE: base/setup/usetup/mui.c
|
2007-12-23 20:29:52 +00:00
|
|
|
* PURPOSE: Text-mode setup
|
2008-02-08 04:14:09 +00:00
|
|
|
* PROGRAMMER:
|
2007-12-23 20:29:52 +00:00
|
|
|
*/
|
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
#include "usetup.h"
|
2008-05-31 13:29:45 +00:00
|
|
|
#include "muifonts.h"
|
|
|
|
#include "muilanguages.h"
|
2007-12-12 00:05:00 +00:00
|
|
|
|
2010-06-07 21:38:49 +00:00
|
|
|
#define NDEBUG
|
2008-01-07 14:51:42 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
extern
|
|
|
|
VOID
|
2008-01-09 09:40:47 +00:00
|
|
|
PopupError(IN PCCH Text,
|
|
|
|
IN PCCH Status,
|
|
|
|
IN PINPUT_RECORD Ir,
|
|
|
|
IN ULONG WaitEvent);
|
2007-12-12 00:05:00 +00:00
|
|
|
|
2011-08-25 07:03:12 +00:00
|
|
|
static
|
2008-02-12 14:52:36 +00:00
|
|
|
ULONG
|
2011-11-26 18:27:42 +00:00
|
|
|
FindLanguageIndex(VOID)
|
2008-02-12 14:52:36 +00:00
|
|
|
{
|
|
|
|
ULONG lngIndex = 0;
|
|
|
|
|
|
|
|
if (SelectedLanguageId == NULL)
|
|
|
|
{
|
2008-02-29 14:27:32 +00:00
|
|
|
/* default to english */
|
|
|
|
return 0;
|
2008-05-31 13:29:45 +00:00
|
|
|
}
|
2008-02-12 14:52:36 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (_wcsicmp(MUILanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
2008-02-12 14:52:36 +00:00
|
|
|
{
|
|
|
|
return lngIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
lngIndex++;
|
2017-12-09 22:33:02 +00:00
|
|
|
} while (MUILanguageList[lngIndex].MuiPages != NULL);
|
2008-02-12 14:52:36 +00:00
|
|
|
|
2008-02-29 14:27:32 +00:00
|
|
|
return 0;
|
2008-02-12 14:52:36 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2012-02-27 22:46:20 +00:00
|
|
|
BOOLEAN
|
2014-05-12 14:17:37 +00:00
|
|
|
IsLanguageAvailable(
|
|
|
|
PWCHAR LanguageId)
|
2012-02-27 22:46:20 +00:00
|
|
|
{
|
|
|
|
ULONG lngIndex = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (_wcsicmp(MUILanguageList[lngIndex].LanguageID , LanguageId) == 0)
|
2012-02-27 22:46:20 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
lngIndex++;
|
2017-12-09 22:33:02 +00:00
|
|
|
} while (MUILanguageList[lngIndex].MuiPages != NULL);
|
2012-02-27 22:46:20 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
static
|
2008-01-09 09:40:47 +00:00
|
|
|
const MUI_ENTRY *
|
2014-05-12 14:17:37 +00:00
|
|
|
FindMUIEntriesOfPage(
|
|
|
|
IN ULONG PageNumber)
|
2007-12-12 00:05:00 +00:00
|
|
|
{
|
2007-12-23 20:29:52 +00:00
|
|
|
ULONG muiIndex = 0;
|
2008-02-29 14:27:32 +00:00
|
|
|
ULONG lngIndex;
|
2008-01-09 09:40:47 +00:00
|
|
|
const MUI_PAGE * Pages = NULL;
|
2007-12-23 20:29:52 +00:00
|
|
|
|
2008-02-29 14:27:32 +00:00
|
|
|
lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
Pages = MUILanguageList[lngIndex].MuiPages;
|
2008-02-29 14:27:32 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
do
|
|
|
|
{
|
2008-02-29 14:27:32 +00:00
|
|
|
if (Pages[muiIndex].Number == PageNumber)
|
|
|
|
return Pages[muiIndex].MuiEntry;
|
2007-12-23 20:29:52 +00:00
|
|
|
|
2008-02-29 14:27:32 +00:00
|
|
|
muiIndex++;
|
|
|
|
}while (Pages[muiIndex].MuiEntry != NULL);
|
2007-12-23 20:29:52 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-01-02 14:34:51 +00:00
|
|
|
static
|
2008-01-09 09:40:47 +00:00
|
|
|
const MUI_ERROR *
|
|
|
|
FindMUIErrorEntries(VOID)
|
2008-01-02 14:34:51 +00:00
|
|
|
{
|
2008-02-29 14:27:32 +00:00
|
|
|
ULONG lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
return MUILanguageList[lngIndex].MuiErrors;
|
2008-01-02 14:34:51 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-02-08 04:14:09 +00:00
|
|
|
static
|
|
|
|
const MUI_STRING *
|
|
|
|
FindMUIStringEntries(VOID)
|
|
|
|
{
|
2008-02-29 14:27:32 +00:00
|
|
|
ULONG lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
return MUILanguageList[lngIndex].MuiStrings;
|
2008-02-08 04:14:09 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
LPCWSTR
|
|
|
|
MUIDefaultKeyboardLayout(VOID)
|
2008-01-06 23:36:01 +00:00
|
|
|
{
|
2008-02-29 14:27:32 +00:00
|
|
|
ULONG lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
return MUILanguageList[lngIndex].MuiLayouts[0].LayoutID;
|
2008-06-01 12:52:18 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2009-02-05 13:50:49 +00:00
|
|
|
PWCHAR
|
|
|
|
MUIGetGeoID(VOID)
|
|
|
|
{
|
|
|
|
ULONG lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
return MUILanguageList[lngIndex].GeoID;
|
2009-02-05 13:50:49 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
const MUI_LAYOUTS *
|
|
|
|
MUIGetLayoutsList(VOID)
|
|
|
|
{
|
|
|
|
ULONG lngIndex = max(FindLanguageIndex(), 0);
|
2017-12-09 22:33:02 +00:00
|
|
|
return MUILanguageList[lngIndex].MuiLayouts;
|
2008-01-06 23:36:01 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2011-11-26 18:27:42 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
MUIClearPage(
|
|
|
|
IN ULONG page)
|
2011-11-26 18:27:42 +00:00
|
|
|
{
|
|
|
|
const MUI_ENTRY * entry;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
entry = FindMUIEntriesOfPage(page);
|
|
|
|
if (!entry)
|
|
|
|
{
|
|
|
|
PopupError("Error: Failed to find translated page",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
POPUP_WAIT_NONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
index = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
CONSOLE_ClearStyledText(entry[index].X,
|
|
|
|
entry[index].Y,
|
|
|
|
entry[index].Flags,
|
|
|
|
strlen(entry[index].Buffer));
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
while (entry[index].Buffer != NULL);
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2007-12-13 16:15:43 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
MUIDisplayPage(
|
|
|
|
IN ULONG page)
|
2007-12-12 00:05:00 +00:00
|
|
|
{
|
2008-01-09 09:40:47 +00:00
|
|
|
const MUI_ENTRY * entry;
|
2007-12-12 00:05:00 +00:00
|
|
|
int index;
|
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
entry = FindMUIEntriesOfPage(page);
|
2007-12-12 00:05:00 +00:00
|
|
|
if (!entry)
|
|
|
|
{
|
|
|
|
PopupError("Error: Failed to find translated page",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
POPUP_WAIT_NONE);
|
2007-12-15 16:30:15 +00:00
|
|
|
return;
|
2007-12-12 00:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
index = 0;
|
|
|
|
do
|
|
|
|
{
|
2011-11-26 18:27:42 +00:00
|
|
|
CONSOLE_SetStyledText(entry[index].X,
|
|
|
|
entry[index].Y,
|
|
|
|
entry[index].Flags,
|
|
|
|
entry[index].Buffer);
|
2008-03-19 04:43:40 +00:00
|
|
|
|
2007-12-12 00:05:00 +00:00
|
|
|
index++;
|
2007-12-23 20:29:52 +00:00
|
|
|
}
|
|
|
|
while (entry[index].Buffer != NULL);
|
2007-12-12 00:05:00 +00:00
|
|
|
}
|
2007-12-15 14:24:02 +00:00
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2007-12-15 14:24:02 +00:00
|
|
|
VOID
|
2014-05-12 14:17:37 +00:00
|
|
|
MUIDisplayError(
|
|
|
|
IN ULONG ErrorNum,
|
|
|
|
OUT PINPUT_RECORD Ir,
|
2014-12-27 12:33:59 +00:00
|
|
|
IN ULONG WaitEvent,
|
|
|
|
...)
|
2007-12-15 14:24:02 +00:00
|
|
|
{
|
2008-01-09 09:40:47 +00:00
|
|
|
const MUI_ERROR * entry;
|
2014-12-27 12:33:59 +00:00
|
|
|
CHAR Buffer[2048];
|
|
|
|
va_list ap;
|
2008-01-02 14:34:51 +00:00
|
|
|
|
2007-12-15 14:24:02 +00:00
|
|
|
if (ErrorNum >= ERROR_LAST_ERROR_CODE)
|
|
|
|
{
|
2008-01-09 09:40:47 +00:00
|
|
|
PopupError("Invalid error number provided",
|
2008-01-02 14:34:51 +00:00
|
|
|
"Press ENTER to continue",
|
|
|
|
Ir,
|
|
|
|
POPUP_WAIT_ENTER);
|
2007-12-15 14:24:02 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2007-12-15 16:30:15 +00:00
|
|
|
|
2008-01-09 09:40:47 +00:00
|
|
|
entry = FindMUIErrorEntries();
|
2008-01-02 14:34:51 +00:00
|
|
|
if (!entry)
|
|
|
|
{
|
|
|
|
PopupError("Error: Failed to find translated error message",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
POPUP_WAIT_NONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-27 12:33:59 +00:00
|
|
|
va_start(ap, WaitEvent);
|
|
|
|
vsprintf(Buffer, entry[ErrorNum].ErrorText, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
PopupError(Buffer,
|
2008-01-02 14:34:51 +00:00
|
|
|
entry[ErrorNum].ErrorStatus,
|
2007-12-15 14:24:02 +00:00
|
|
|
Ir,
|
|
|
|
WaitEvent);
|
|
|
|
}
|
2007-12-23 20:29:52 +00:00
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-02-08 04:14:09 +00:00
|
|
|
LPSTR
|
2014-05-12 14:17:37 +00:00
|
|
|
MUIGetString(
|
|
|
|
ULONG Number)
|
2008-02-08 04:14:09 +00:00
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
const MUI_STRING * entry;
|
2016-02-02 02:23:56 +00:00
|
|
|
CHAR szErr[128];
|
2008-02-08 04:14:09 +00:00
|
|
|
|
|
|
|
entry = FindMUIStringEntries();
|
|
|
|
if (entry)
|
|
|
|
{
|
|
|
|
for (i = 0; entry[i].Number != 0; i++)
|
|
|
|
{
|
|
|
|
if (entry[i].Number == Number)
|
|
|
|
{
|
|
|
|
return entry[i].String;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-12 14:52:36 +00:00
|
|
|
sprintf(szErr, "Error: failed find string id %lu for language index %lu\n", Number, FindLanguageIndex());
|
|
|
|
|
|
|
|
PopupError(szErr,
|
2014-05-12 14:17:37 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
POPUP_WAIT_NONE);
|
2008-02-08 04:14:09 +00:00
|
|
|
|
|
|
|
return "<nostring>";
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
AddHotkeySettings(
|
|
|
|
IN LPCWSTR Hotkey,
|
|
|
|
IN LPCWSTR LangHotkey,
|
|
|
|
IN LPCWSTR LayoutHotkey)
|
2008-05-18 10:37:32 +00:00
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
UNICODE_STRING KeyName;
|
|
|
|
UNICODE_STRING ValueName;
|
|
|
|
HANDLE KeyHandle;
|
|
|
|
ULONG Disposition;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&KeyName,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
L".DEFAULT\\Keyboard Layout\\Toggle");
|
2008-05-18 10:37:32 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_USERS, NULL),
|
2008-05-18 10:37:32 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
Status = NtCreateKey(&KeyHandle,
|
2009-08-23 08:29:23 +00:00
|
|
|
KEY_SET_VALUE,
|
2008-05-18 10:37:32 +00:00
|
|
|
&ObjectAttributes,
|
|
|
|
0,
|
|
|
|
NULL,
|
2017-06-11 23:47:11 +00:00
|
|
|
REG_OPTION_NON_VOLATILE,
|
2008-05-18 10:37:32 +00:00
|
|
|
&Disposition);
|
|
|
|
|
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&ValueName,
|
|
|
|
L"Hotkey");
|
|
|
|
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)Hotkey,
|
|
|
|
(1 + 1) * sizeof(WCHAR));
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&ValueName,
|
|
|
|
L"Language Hotkey");
|
|
|
|
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)LangHotkey,
|
|
|
|
(1 + 1) * sizeof(WCHAR));
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&ValueName,
|
|
|
|
L"Layout Hotkey");
|
|
|
|
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)LayoutHotkey,
|
|
|
|
(1 + 1) * sizeof(WCHAR));
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
BOOLEAN
|
2014-05-12 14:17:37 +00:00
|
|
|
AddKbLayoutsToRegistry(
|
|
|
|
IN const MUI_LAYOUTS *MuiLayouts)
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
UNICODE_STRING KeyName;
|
|
|
|
UNICODE_STRING ValueName;
|
|
|
|
HANDLE KeyHandle;
|
2008-06-01 12:52:18 +00:00
|
|
|
HANDLE SubKeyHandle;
|
2008-04-28 14:04:22 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG Disposition;
|
2008-06-01 12:52:18 +00:00
|
|
|
ULONG uIndex = 0;
|
|
|
|
ULONG uCount = 0;
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
WCHAR szKeyName[48] = L".DEFAULT\\Keyboard Layout";
|
2008-06-01 12:52:18 +00:00
|
|
|
WCHAR szValueName[3 + 1];
|
|
|
|
WCHAR szLangID[8 + 1];
|
2008-04-28 14:04:22 +00:00
|
|
|
|
|
|
|
// Open the keyboard layout key
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
RtlInitUnicodeString(&KeyName, szKeyName);
|
2008-04-28 14:04:22 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_USERS, NULL),
|
2008-04-28 14:04:22 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
Status = NtCreateKey(&KeyHandle,
|
2009-08-23 08:29:23 +00:00
|
|
|
KEY_CREATE_SUB_KEY,
|
2008-04-28 14:04:22 +00:00
|
|
|
&ObjectAttributes,
|
|
|
|
0,
|
|
|
|
NULL,
|
2017-06-11 23:47:11 +00:00
|
|
|
REG_OPTION_NON_VOLATILE,
|
2008-04-28 14:04:22 +00:00
|
|
|
&Disposition);
|
|
|
|
|
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
KeyName.MaximumLength = sizeof(szKeyName);
|
|
|
|
Status = RtlAppendUnicodeToString(&KeyName, L"\\Preload");
|
|
|
|
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
|
|
|
DPRINT1("RtlAppend failed! (%lx)\n", Status);
|
|
|
|
DPRINT1("String is %wZ\n", &KeyName);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_USERS, NULL),
|
2008-04-28 14:04:22 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
Status = NtCreateKey(&KeyHandle,
|
2009-08-23 08:29:23 +00:00
|
|
|
KEY_SET_VALUE,
|
2008-04-28 14:04:22 +00:00
|
|
|
&ObjectAttributes,
|
|
|
|
0,
|
|
|
|
NULL,
|
2017-06-11 23:47:11 +00:00
|
|
|
REG_OPTION_NON_VOLATILE,
|
2008-04-28 14:04:22 +00:00
|
|
|
&Disposition);
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
RtlInitUnicodeString(&KeyName, L".DEFAULT\\Keyboard Layout\\Substitutes");
|
2008-06-01 12:52:18 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_USERS, NULL),
|
2008-06-01 12:52:18 +00:00
|
|
|
NULL);
|
2008-04-28 14:04:22 +00:00
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
Status = NtCreateKey(&SubKeyHandle,
|
2009-08-23 08:29:23 +00:00
|
|
|
KEY_SET_VALUE,
|
2008-06-01 12:52:18 +00:00
|
|
|
&ObjectAttributes,
|
|
|
|
0,
|
|
|
|
NULL,
|
2017-06-11 23:47:11 +00:00
|
|
|
REG_OPTION_NON_VOLATILE,
|
2008-06-01 12:52:18 +00:00
|
|
|
&Disposition);
|
|
|
|
|
|
|
|
if(!NT_SUCCESS(Status))
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
2008-06-01 12:52:18 +00:00
|
|
|
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(SubKeyHandle);
|
2008-04-28 14:04:22 +00:00
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
do
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
2008-06-01 12:52:18 +00:00
|
|
|
if (uIndex > 19) break;
|
2008-04-28 14:04:22 +00:00
|
|
|
|
2008-12-18 12:26:47 +00:00
|
|
|
swprintf(szValueName, L"%u", uIndex + 1);
|
2008-06-01 12:52:18 +00:00
|
|
|
RtlInitUnicodeString(&ValueName, szValueName);
|
|
|
|
|
|
|
|
swprintf(szLangID, L"0000%s", MuiLayouts[uIndex].LangID);
|
|
|
|
|
2008-12-18 12:26:47 +00:00
|
|
|
if (_wcsicmp(szLangID, MuiLayouts[uIndex].LayoutID) == 0)
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
2008-06-01 12:52:18 +00:00
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)MuiLayouts[uIndex].LayoutID,
|
2008-10-31 23:21:15 +00:00
|
|
|
(wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
|
2008-06-01 12:52:18 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
|
|
|
|
NtClose(SubKeyHandle);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-04-28 14:04:22 +00:00
|
|
|
}
|
2008-06-01 12:52:18 +00:00
|
|
|
else
|
|
|
|
{
|
2014-04-30 19:05:42 +00:00
|
|
|
swprintf(szLangID, L"d%03lu%s", uCount, MuiLayouts[uIndex].LangID);
|
2008-06-01 12:52:18 +00:00
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)szLangID,
|
2008-10-31 23:21:15 +00:00
|
|
|
(wcslen(szLangID)+1) * sizeof(WCHAR));
|
2008-06-01 12:52:18 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
|
|
|
|
NtClose(SubKeyHandle);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-05-18 10:37:32 +00:00
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
RtlInitUnicodeString(&ValueName, szLangID);
|
|
|
|
|
|
|
|
Status = NtSetValueKey(SubKeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)MuiLayouts[uIndex].LayoutID,
|
2008-10-31 23:21:15 +00:00
|
|
|
(wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
|
2008-06-01 12:52:18 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2008-12-18 12:26:47 +00:00
|
|
|
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
|
2008-06-01 12:52:18 +00:00
|
|
|
NtClose(SubKeyHandle);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
uIndex++;
|
2008-04-28 14:04:22 +00:00
|
|
|
}
|
2008-06-01 12:52:18 +00:00
|
|
|
while (MuiLayouts[uIndex].LangID != NULL);
|
|
|
|
|
|
|
|
if (uIndex > 1)
|
|
|
|
AddHotkeySettings(L"2", L"2", L"1");
|
|
|
|
else
|
|
|
|
AddHotkeySettings(L"3", L"3", L"3");
|
2008-04-28 14:04:22 +00:00
|
|
|
|
2008-06-01 12:52:18 +00:00
|
|
|
NtClose(SubKeyHandle);
|
2008-04-28 14:04:22 +00:00
|
|
|
NtClose(KeyHandle);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-04-28 14:04:22 +00:00
|
|
|
BOOLEAN
|
|
|
|
AddKeyboardLayouts(VOID)
|
|
|
|
{
|
|
|
|
ULONG lngIndex = 0;
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-04-28 14:04:22 +00:00
|
|
|
do
|
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (_wcsicmp(MUILanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
2008-04-28 14:04:22 +00:00
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
return AddKbLayoutsToRegistry(MUILanguageList[lngIndex].MuiLayouts);
|
2008-04-28 14:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lngIndex++;
|
|
|
|
}
|
2017-12-09 22:33:02 +00:00
|
|
|
while (MUILanguageList[lngIndex].MuiPages != NULL);
|
2008-04-28 14:04:22 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
AddCodepageToRegistry(
|
|
|
|
IN LPCWSTR ACPage,
|
|
|
|
IN LPCWSTR OEMCPage,
|
|
|
|
IN LPCWSTR MACCPage)
|
2008-01-07 14:51:42 +00:00
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
UNICODE_STRING KeyName;
|
|
|
|
UNICODE_STRING ValueName;
|
|
|
|
HANDLE KeyHandle;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
// Open the nls codepage key
|
|
|
|
RtlInitUnicodeString(&KeyName,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage");
|
2008-01-07 14:51:42 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
2008-01-09 09:40:47 +00:00
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_LOCAL_MACHINE, NULL),
|
2008-01-09 09:40:47 +00:00
|
|
|
NULL);
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
Status = NtOpenKey(&KeyHandle,
|
|
|
|
KEY_WRITE,
|
|
|
|
&ObjectAttributes);
|
2008-01-07 14:51:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set ANSI codepage
|
|
|
|
RtlInitUnicodeString(&ValueName, L"ACP");
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
2008-01-09 09:40:47 +00:00
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)ACPage,
|
2011-08-25 07:03:12 +00:00
|
|
|
(wcslen(ACPage)+1) * sizeof(WCHAR));
|
2008-01-07 14:51:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set OEM codepage
|
|
|
|
RtlInitUnicodeString(&ValueName, L"OEMCP");
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
2008-01-09 09:40:47 +00:00
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)OEMCPage,
|
2011-08-25 07:03:12 +00:00
|
|
|
(wcslen(OEMCPage)+1) * sizeof(WCHAR));
|
2008-01-07 14:51:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set MAC codepage
|
|
|
|
RtlInitUnicodeString(&ValueName, L"MACCP");
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
2008-01-09 09:40:47 +00:00
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)MACCPage,
|
2011-08-25 07:03:12 +00:00
|
|
|
(wcslen(MACCPage)+1) * sizeof(WCHAR));
|
2008-01-07 14:51:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
AddFontsSettingsToRegistry(
|
|
|
|
IN const MUI_SUBFONT * MuiSubFonts)
|
2008-05-31 13:29:45 +00:00
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
UNICODE_STRING KeyName;
|
|
|
|
UNICODE_STRING ValueName;
|
|
|
|
HANDLE KeyHandle;
|
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG uIndex = 0;
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&KeyName,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes");
|
2008-05-31 13:29:45 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&KeyName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
GetRootKeyByPredefKey(HKEY_LOCAL_MACHINE, NULL),
|
2008-05-31 13:29:45 +00:00
|
|
|
NULL);
|
[USETUP] Implement offline ReactOS registry initialization in USetup (equivalent of mkhive, but using OS functionality).
The rationale is as follows.
We now have the 1st-stage ReactOS setup running with its own registry SYSTEM hive,
similarly to regular ROS running instances (livecd, regular installation...).
The ReactOS-specific SetInstallPathValue() hack, introduced in a76689e9 (r3794)
and 5f973ce0 (r3795), is removed. This hack told the kernel that, during the setup,
it had to "switch" the used registry hives and instead use the ones of the ROS
installation being prepared.
This was really hackish because this means, mixing between registry settings used only
for the setup running instance, that could use different registry settings
than the ones that should be set for the ROS installation being actually performed.
Also, note that in the case of a 1st-stage GUI setup, consisting in running the
LiveCD + the GUI setup program, this situation would be untenable. Note also that
for people willing to use the Setup*** functions exported by setupapi.dll to parse
the registry INF files to initialize the registry of the ROS installation being
prepared, this would be impossible either.
Hence the need to have offline registry modification functionality.
svn path=/branches/setup_improvements/; revision=74766
2017-06-03 16:22:42 +00:00
|
|
|
Status = NtOpenKey(&KeyHandle,
|
|
|
|
KEY_WRITE,
|
|
|
|
&ObjectAttributes);
|
2008-05-31 13:29:45 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName);
|
|
|
|
Status = NtSetValueKey(KeyHandle,
|
|
|
|
&ValueName,
|
|
|
|
0,
|
|
|
|
REG_SZ,
|
|
|
|
(PVOID)MuiSubFonts[uIndex].SubFontName,
|
2008-06-01 12:52:18 +00:00
|
|
|
(wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR));
|
2008-05-31 13:29:45 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uIndex++;
|
|
|
|
}
|
|
|
|
while (MuiSubFonts[uIndex].FontName != NULL);
|
|
|
|
|
|
|
|
NtClose(KeyHandle);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-01-07 14:51:42 +00:00
|
|
|
BOOLEAN
|
|
|
|
AddCodePage(VOID)
|
|
|
|
{
|
|
|
|
ULONG lngIndex = 0;
|
|
|
|
do
|
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (_wcsicmp(MUILanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
2008-01-07 14:51:42 +00:00
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (AddCodepageToRegistry(MUILanguageList[lngIndex].ACPage,
|
|
|
|
MUILanguageList[lngIndex].OEMCPage,
|
|
|
|
MUILanguageList[lngIndex].MACCPage)&&
|
|
|
|
AddFontsSettingsToRegistry(MUILanguageList[lngIndex].MuiSubFonts))
|
2008-05-31 13:29:45 +00:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-01-07 14:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
lngIndex++;
|
|
|
|
}
|
2017-12-09 22:33:02 +00:00
|
|
|
while (MUILanguageList[lngIndex].MuiPages != NULL);
|
2008-01-09 09:40:47 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2008-01-07 14:51:42 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2008-01-21 13:33:52 +00:00
|
|
|
VOID
|
|
|
|
SetConsoleCodePage(VOID)
|
|
|
|
{
|
|
|
|
ULONG lngIndex = 0;
|
|
|
|
UINT wCodePage;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
if (_wcsicmp(MUILanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
|
2008-01-21 13:33:52 +00:00
|
|
|
{
|
2017-12-09 22:33:02 +00:00
|
|
|
wCodePage = (UINT) wcstoul(MUILanguageList[lngIndex].OEMCPage, NULL, 10);
|
2008-01-21 13:33:52 +00:00
|
|
|
SetConsoleOutputCP(wCodePage);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lngIndex++;
|
|
|
|
}
|
2017-12-09 22:33:02 +00:00
|
|
|
while (MUILanguageList[lngIndex].MuiPages != NULL);
|
2008-01-21 13:33:52 +00:00
|
|
|
}
|
|
|
|
|
2007-12-23 20:29:52 +00:00
|
|
|
/* EOF */
|