mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Read device settings from txtsetup.sif.
svn path=/trunk/; revision=9562
This commit is contained in:
parent
e4bd8fff85
commit
9c2056bb25
6 changed files with 440 additions and 23 deletions
|
@ -1,4 +1,30 @@
|
|||
/* genlist.c */
|
||||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2004 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.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: genlist.c,v 1.2 2004/05/30 14:54:02 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/genlist.c
|
||||
* PURPOSE: Generic list functions
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
|
@ -12,7 +38,6 @@
|
|||
#include <debug.h>
|
||||
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
PGENERIC_LIST
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: genlist.h,v 1.1 2004/05/28 12:14:00 ekohl Exp $
|
||||
/* $Id: genlist.h,v 1.2 2004/05/30 14:54:02 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/genlist.h
|
||||
|
@ -24,6 +24,8 @@
|
|||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
#ifndef __GENLIST_H__
|
||||
#define __GENLIST_H__
|
||||
|
||||
typedef struct _GENERIC_LIST_ENTRY
|
||||
{
|
||||
|
@ -83,4 +85,6 @@ SaveGenericListState(PGENERIC_LIST List);
|
|||
VOID
|
||||
RestoreGenericListState(PGENERIC_LIST List);
|
||||
|
||||
#endif /* __GENLIST_H__ */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.16 2004/05/28 12:14:00 ekohl Exp $
|
||||
# $Id: makefile,v 1.17 2004/05/30 14:54:02 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -20,7 +20,8 @@ TARGET_CFLAGS = -D__NTAPP__ -I$(PATH_TO_TOP)/lib/zlib -Wall -Werror -Wno-format
|
|||
|
||||
TARGET_OBJECTS = bootsup.o cabinet.o console.o drivesup.o filequeue.o \
|
||||
filesup.o format.o fslist.o genlist.o infcache.o \
|
||||
inicache.o partlist.o progress.o registry.o usetup.o
|
||||
inicache.o partlist.o progress.o registry.o settings.o \
|
||||
usetup.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
|
311
reactos/subsys/system/usetup/settings.c
Normal file
311
reactos/subsys/system/usetup/settings.c
Normal file
|
@ -0,0 +1,311 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2004 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.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: settings.c,v 1.1 2004/05/30 14:54:02 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/settings.c
|
||||
* PURPOSE: Device settings support functions
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
|
||||
#include "usetup.h"
|
||||
#include "infcache.h"
|
||||
#include "genlist.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateComputerTypeList(HINF InfFile)
|
||||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!InfFindFirstLine (InfFile, L"Computer", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
UserData = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR));
|
||||
if (UserData == NULL)
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
}
|
||||
|
||||
wcscpy(UserData, KeyName);
|
||||
|
||||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List, Buffer, UserData, FALSE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateDisplayDriverList(HINF InfFile)
|
||||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!InfFindFirstLine (InfFile, L"Display", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
UserData = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR));
|
||||
if (UserData == NULL)
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
}
|
||||
|
||||
wcscpy(UserData, KeyName);
|
||||
|
||||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List, Buffer, UserData, FALSE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
|
||||
AppendGenericListEntry(List, "Automatic detection", NULL, TRUE);
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateKeyboardDriverList(HINF InfFile)
|
||||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!InfFindFirstLine (InfFile, L"Keyboard", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
UserData = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR));
|
||||
if (UserData == NULL)
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
}
|
||||
|
||||
wcscpy(UserData, KeyName);
|
||||
|
||||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List, Buffer, UserData, FALSE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateKeyboardLayoutList(HINF InfFile)
|
||||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
WCHAR DefaultLayout[20];
|
||||
|
||||
/* Get default layout id */
|
||||
if (!InfFindFirstLine (InfFile, L"NLS", L"DefaultLayout", &Context))
|
||||
return NULL;
|
||||
|
||||
if (!InfGetData (&Context, NULL, &KeyValue))
|
||||
return NULL;
|
||||
|
||||
wcscpy(DefaultLayout, KeyValue);
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!InfFindFirstLine (InfFile, L"KeyboardLayout", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
UserData = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR));
|
||||
if (UserData == NULL)
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
}
|
||||
|
||||
wcscpy(UserData, KeyName);
|
||||
|
||||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List,
|
||||
Buffer,
|
||||
UserData,
|
||||
_wcsicmp(KeyName, DefaultLayout) ? FALSE : TRUE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
ProcessKeyboardLayoutRegistry(PGENERIC_LIST List)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
ProcessKeyboardLayoutFiles(PGENERIC_LIST List)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateMouseDriverList(HINF InfFile)
|
||||
{
|
||||
CHAR Buffer[128];
|
||||
PGENERIC_LIST List;
|
||||
INFCONTEXT Context;
|
||||
PWCHAR KeyName;
|
||||
PWCHAR KeyValue;
|
||||
PWCHAR UserData;
|
||||
|
||||
List = CreateGenericList();
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!InfFindFirstLine (InfFile, L"Mouse", NULL, &Context))
|
||||
{
|
||||
DestroyGenericList(List, FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!InfGetData (&Context, &KeyName, &KeyValue))
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
DPRINT("InfGetData() failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
UserData = RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR));
|
||||
if (UserData == NULL)
|
||||
{
|
||||
/* FIXME: Handle error! */
|
||||
}
|
||||
|
||||
wcscpy(UserData, KeyName);
|
||||
|
||||
sprintf(Buffer, "%S", KeyValue);
|
||||
AppendGenericListEntry(List, Buffer, UserData, FALSE);
|
||||
}
|
||||
while (InfFindNextLine(&Context, &Context));
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
/* EOF */
|
53
reactos/subsys/system/usetup/settings.h
Normal file
53
reactos/subsys/system/usetup/settings.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2004 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.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: settings.h,v 1.1 2004/05/30 14:54:02 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/settings.h
|
||||
* PURPOSE: Device settings support functions
|
||||
* PROGRAMMER: Eric Kohl
|
||||
*/
|
||||
|
||||
#ifndef __SETTINGS_H__
|
||||
#define __SETTINGS_H__
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateComputerTypeList(HINF InfFile);
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateDisplayDriverList(HINF InfFile);
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateKeyboardDriverList(HINF InfFile);
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateKeyboardLayoutList(HINF InfFile);
|
||||
|
||||
BOOLEAN
|
||||
ProcessKeyboardLayoutRegistry(PGENERIC_LIST List);
|
||||
|
||||
BOOLEAN
|
||||
ProcessKeyboardLayoutFiles(PGENERIC_LIST List);
|
||||
|
||||
PGENERIC_LIST
|
||||
CreateMouseDriverList(HINF InfFile);
|
||||
|
||||
#endif /* __SETTINGS_H__ */
|
||||
|
||||
/* EOF */
|
|
@ -46,6 +46,7 @@
|
|||
#include "filesup.h"
|
||||
#include "drivesup.h"
|
||||
#include "genlist.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -866,41 +867,63 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
|
|||
/* Initialize the computer settings list */
|
||||
if (ComputerList == NULL)
|
||||
{
|
||||
ComputerList = CreateGenericList();
|
||||
AppendGenericListEntry(ComputerList, "Standard-PC", NULL, TRUE);
|
||||
ComputerList = CreateComputerTypeList(SetupInf);
|
||||
if (ComputerList == NULL)
|
||||
{
|
||||
/* FIXME: report error */
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the display settings list */
|
||||
if (DisplayList == NULL)
|
||||
{
|
||||
DisplayList = CreateGenericList();
|
||||
AppendGenericListEntry(DisplayList, "VGA display", NULL, FALSE);
|
||||
AppendGenericListEntry(DisplayList, "VESA display", NULL, FALSE);
|
||||
AppendGenericListEntry(DisplayList, "Automatic detection", NULL, TRUE);
|
||||
DisplayList = CreateDisplayDriverList(SetupInf);
|
||||
if (DisplayList == NULL)
|
||||
{
|
||||
/* FIXME: report error */
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the keyboard settings list */
|
||||
if (KeyboardList == NULL)
|
||||
{
|
||||
KeyboardList = CreateGenericList();
|
||||
AppendGenericListEntry(KeyboardList, "XT-, AT- or extended keyboard (83-105 keys)", NULL, TRUE);
|
||||
KeyboardList = CreateKeyboardDriverList(SetupInf);
|
||||
if (KeyboardList == NULL)
|
||||
{
|
||||
/* FIXME: report error */
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the keyboard settings list */
|
||||
/* Initialize the keyboard layout list */
|
||||
if (LayoutList == NULL)
|
||||
{
|
||||
LayoutList = CreateGenericList();
|
||||
AppendGenericListEntry(LayoutList, "English (USA)", NULL, TRUE);
|
||||
AppendGenericListEntry(LayoutList, "French (France)", NULL, FALSE);
|
||||
AppendGenericListEntry(LayoutList, "German (Germany)", NULL, FALSE);
|
||||
LayoutList = CreateKeyboardLayoutList(SetupInf);
|
||||
if (LayoutList == NULL)
|
||||
{
|
||||
/* FIXME: report error */
|
||||
PopupError("Setup failed to load the keyboard layout list.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the keyboard settings list */
|
||||
/* Initialize the pointer settings list */
|
||||
if (PointerList == NULL)
|
||||
{
|
||||
PointerList = CreateGenericList();
|
||||
AppendGenericListEntry(PointerList, "PS/2 (Mouse port) mouse", NULL, TRUE);
|
||||
AppendGenericListEntry(PointerList, "Serial mouse", NULL, FALSE);
|
||||
PointerList = CreateMouseDriverList(SetupInf);
|
||||
if (PointerList == NULL)
|
||||
{
|
||||
/* FIXME: report error */
|
||||
}
|
||||
}
|
||||
|
||||
SetTextXY(6, 8, "The list below shows the current device settings.");
|
||||
|
@ -2614,7 +2637,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return (InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry));
|
||||
return (InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry));
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue