Remove mouse type selection in usetup.

i8042prt driver is always loaded for keyboard and auto-detects the PS/2 mouse (if any)
sermouse driver is loaded if a serial mouse is enumerated by serenum driver

svn path=/trunk/; revision=16267
This commit is contained in:
Hervé Poussineau 2005-06-25 16:01:27 +00:00
parent 95f0ca7fdb
commit 1e4c8ee564
5 changed files with 15 additions and 540 deletions

View file

@ -17,15 +17,3 @@ HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSe
; VGA miniport driver
HKLM,"SYSTEM\CurrentControlSet\Services\Vga","Start",0x00010001,0x00000001
;
; Mouse driver section
;
; PS/2 mouse port driver
HKLM,"SYSTEM\CurrentControlSet\Services\i8042Prt","Start",0x00010001,0x00000001
; Serial mouse driver
;HKLM,"SYSTEM\CurrentControlSet\Services\Sermouse","Start",0x00010001,0x00000001

View file

@ -96,23 +96,6 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
00000809 = kbduk.dll
00000807 = kbdsg.dll
[Mouse]
;<id> = <user friendly name>,<spare>,<service key name>
i8042ps2 = "PS2 Mouse",,i8042prt
;msps2 = "Microsoft PS2 Mouse",,psaux
msser = "Microsoft Serial Mouse",,sermouse
mswhs = "Microsoft Serial Wheel Mouse",,sermouse
none = "No Mouse"
[Map.Mouse]
;<id> = <pnp id string>
i8042ps2 = "MICROSOFT PS2 MOUSE"
;msps2 = "MICROSOFT PS2 MOUSE"
msser = "MICROSOFT SERIAL MOUSE"
mswhs = "MICROSOFT MOUSE WITH WHEEL"
none = "NO MOUSE"
[HiveInfs.Install]
AddReg=hivecls.inf,AddReg
AddReg=hivedef.inf,AddReg

View file

@ -609,386 +609,4 @@ ProcessKeyboardLayoutFiles(PGENERIC_LIST List)
}
#endif
static BOOLEAN
GetMouseIdentifier(PWSTR ControllerType,
PWSTR Identifier,
ULONG IdentifierLength)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING KeyName;
WCHAR Buffer[32];
HANDLE BusKey;
HANDLE BusInstanceKey;
HANDLE ControllerKey;
HANDLE ControllerInstanceKey;
HANDLE PeripheralKey;
HANDLE PeripheralInstanceKey;
ULONG BusInstance;
ULONG ControllerInstance;
ULONG PeripheralInstance;
ULONG BufferLength;
ULONG ReturnedLength;
PKEY_VALUE_PARTIAL_INFORMATION ValueInfo;
NTSTATUS Status;
DPRINT("GetMouseIdentifier() called\n");
/* Open the bus key */
RtlInitUnicodeString(&KeyName,
L"\\Registry\\Machine\\HARDWARE\\Description\\System\\MultifunctionAdapter");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = NtOpenKey(&BusKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
return FALSE;
}
BusInstance = 0;
while (TRUE)
{
swprintf(Buffer, L"%lu", BusInstance);
RtlInitUnicodeString(&KeyName,
Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
BusKey,
NULL);
Status = NtOpenKey(&BusInstanceKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
NtClose(BusKey);
return FALSE;
}
/* Open the controller type key */
RtlInitUnicodeString(&KeyName,
ControllerType);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
BusInstanceKey,
NULL);
Status = NtOpenKey(&ControllerKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (NT_SUCCESS(Status))
{
ControllerInstance = 0;
while (TRUE)
{
/* Open the pointer controller instance key */
swprintf(Buffer, L"%lu", ControllerInstance);
RtlInitUnicodeString(&KeyName,
Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
ControllerKey,
NULL);
Status = NtOpenKey(&ControllerInstanceKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
NtClose(ControllerKey);
NtClose(BusInstanceKey);
NtClose(BusKey);
return FALSE;
}
/* Open the 'PointerPeripheral' key */
RtlInitUnicodeString(&KeyName,
L"PointerPeripheral");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
ControllerInstanceKey,
NULL);
Status = NtOpenKey(&PeripheralKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (NT_SUCCESS(Status))
{
PeripheralInstance = 0;
while (TRUE)
{
/* Open the pointer peripheral instance key */
swprintf(Buffer, L"%lu", PeripheralInstance);
RtlInitUnicodeString(&KeyName,
Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
PeripheralKey,
NULL);
Status = NtOpenKey(&PeripheralInstanceKey,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
NtClose(PeripheralKey);
NtClose(ControllerInstanceKey);
NtClose(ControllerKey);
NtClose(BusInstanceKey);
NtClose(BusKey);
return FALSE;
}
/* Get peripheral identifier */
RtlInitUnicodeString(&KeyName,
L"Identifier");
BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
256 * sizeof(WCHAR);
ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(),
0,
BufferLength);
if (ValueInfo == NULL)
{
DPRINT("RtlAllocateHeap() failed\n");
NtClose(PeripheralInstanceKey);
NtClose(PeripheralKey);
NtClose(ControllerInstanceKey);
NtClose(ControllerKey);
NtClose(BusInstanceKey);
NtClose(BusKey);
return FALSE;
}
Status = NtQueryValueKey(PeripheralInstanceKey,
&KeyName,
KeyValuePartialInformation,
ValueInfo,
BufferLength,
&ReturnedLength);
if (NT_SUCCESS(Status))
{
DPRINT("Identifier: %S\n", (PWSTR)ValueInfo->Data);
BufferLength = min(ValueInfo->DataLength / sizeof(WCHAR), IdentifierLength);
RtlCopyMemory (Identifier,
ValueInfo->Data,
BufferLength * sizeof(WCHAR));
Identifier[BufferLength] = 0;
RtlFreeHeap(RtlGetProcessHeap(),
0,
ValueInfo);
NtClose(PeripheralInstanceKey);
NtClose(PeripheralKey);
NtClose(ControllerInstanceKey);
NtClose(ControllerKey);
NtClose(BusInstanceKey);
NtClose(BusKey);
return TRUE;
}
RtlFreeHeap(RtlGetProcessHeap(),
0,
ValueInfo);
NtClose(PeripheralInstanceKey);
PeripheralInstance++;
}
NtClose(PeripheralKey);
}
NtClose(ControllerInstanceKey);
ControllerInstance++;
}
NtClose(ControllerKey);
}
NtClose(BusInstanceKey);
BusInstance++;
}
NtClose(BusKey);
return FALSE;
}
PGENERIC_LIST
CreateMouseDriverList(HINF InfFile)
{
CHAR Buffer[128];
PGENERIC_LIST List;
INFCONTEXT Context;
PWCHAR KeyName;
PWCHAR KeyValue;
PWCHAR UserData;
WCHAR MouseIdentifier[128];
WCHAR MouseKey[32];
/* Get the mouse identification */
if (!GetMouseIdentifier(L"SerialController", MouseIdentifier, 128))
{
if (!GetMouseIdentifier(L"PointerController", MouseIdentifier, 128))
{
wcscpy (MouseIdentifier, L"NO MOUSE");
}
}
DPRINT("Mouse identifier: '%S'\n", MouseIdentifier);
/* Search for matching device identifier */
if (!InfFindFirstLine(InfFile, L"Map.Mouse", NULL, &Context))
{
/* FIXME: error message */
return NULL;
}
do
{
if (!InfGetDataField(&Context, 1, &KeyValue))
{
/* FIXME: Handle error! */
DPRINT("InfGetDataField() failed\n");
return NULL;
}
DPRINT("KeyValue: %S\n", KeyValue);
if (wcsstr(MouseIdentifier, KeyValue))
{
if (!InfGetDataField(&Context, 0, &KeyName))
{
/* FIXME: Handle error! */
DPRINT("InfGetDataField() failed\n");
return NULL;
}
DPRINT("Mouse key: %S\n", KeyName);
wcscpy(MouseKey, KeyName);
}
}
while (InfFindNextLine(&Context, &Context));
List = CreateGenericList();
if (List == NULL)
return NULL;
if (!InfFindFirstLine(InfFile, L"Mouse", NULL, &Context))
{
DestroyGenericList(List, FALSE);
return NULL;
}
do
{
if (!InfGetDataField(&Context, 0, &KeyName))
{
DPRINT1("InfGetDataField() failed\n");
break;
}
if (!InfGetDataField(&Context, 1, &KeyValue))
{
DPRINT1("InfGetDataField() failed\n");
break;
}
UserData = RtlAllocateHeap(ProcessHeap,
0,
(wcslen(KeyName) + 1) * sizeof(WCHAR));
if (UserData == NULL)
{
DPRINT1("RtlAllocateHeap() failed\n");
DestroyGenericList(List, TRUE);
return NULL;
}
wcscpy(UserData, KeyName);
sprintf(Buffer, "%S", KeyValue);
AppendGenericListEntry(List,
Buffer,
UserData,
_wcsicmp(KeyName, MouseKey) ? FALSE : TRUE);
}
while (InfFindNextLine(&Context, &Context));
return List;
}
BOOLEAN
ProcessMouseRegistry(HINF InfFile, PGENERIC_LIST List)
{
PGENERIC_LIST_ENTRY Entry;
INFCONTEXT Context;
PWCHAR ServiceName;
ULONG StartValue;
NTSTATUS Status;
DPRINT("ProcessMouseRegistry() called\n");
Entry = GetGenericListEntry(List);
if (Entry == NULL)
{
DPRINT("GetGenericListEntry() failed\n");
return FALSE;
}
if (!InfFindFirstLine(InfFile, L"Mouse", Entry->UserData, &Context))
{
DPRINT("InfFindFirstLine() failed\n");
return FALSE;
}
if (!InfGetDataField(&Context, 3, &ServiceName))
{
DPRINT("InfGetDataField() failed\n");
return FALSE;
}
DPRINT("Service name: %S\n", ServiceName);
StartValue = 1;
Status = RtlWriteRegistryValue(RTL_REGISTRY_SERVICES,
ServiceName,
L"Start",
REG_DWORD,
&StartValue,
sizeof(ULONG));
if (!NT_SUCCESS(Status))
{
DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
return FALSE;
}
DPRINT("ProcessMouseRegistry() done\n");
return TRUE;
}
#if 0
BOOLEAN
ProcessMouseFiles(PGENERIC_LIST List)
{
return TRUE;
}
#endif
/* EOF */

View file

@ -54,12 +54,6 @@ ProcessKeyboardLayoutRegistry(PGENERIC_LIST List);
BOOLEAN
ProcessKeyboardLayoutFiles(PGENERIC_LIST List);
PGENERIC_LIST
CreateMouseDriverList(HINF InfFile);
BOOLEAN
ProcessMouseRegistry(HINF InfFile, PGENERIC_LIST List);
#endif /* __SETTINGS_H__ */
/* EOF */

View file

@ -45,7 +45,6 @@ typedef enum _PAGE_NUMBER
DISPLAY_SETTINGS_PAGE,
KEYBOARD_SETTINGS_PAGE,
LAYOUT_SETTINGS_PAGE,
POINTER_SETTINGS_PAGE,
SELECT_PARTITION_PAGE,
CREATE_PARTITION_PAGE,
@ -117,7 +116,6 @@ static PGENERIC_LIST ComputerList = NULL;
static PGENERIC_LIST DisplayList = NULL;
static PGENERIC_LIST KeyboardList = NULL;
static PGENERIC_LIST LayoutList = NULL;
static PGENERIC_LIST PointerList = NULL;
/* FUNCTIONS ****************************************************************/
@ -938,7 +936,7 @@ ScsiControllerPage(PINPUT_RECORD Ir)
static PAGE_NUMBER
DeviceSettingsPage(PINPUT_RECORD Ir)
{
static ULONG Line = 17;
static ULONG Line = 16;
/* Initialize the computer settings list */
if (ComputerList == NULL)
@ -992,42 +990,30 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
}
}
/* Initialize the pointer settings list */
if (PointerList == NULL)
{
PointerList = CreateMouseDriverList(SetupInf);
if (PointerList == NULL)
{
/* FIXME: report error */
}
}
SetTextXY(6, 8, "The list below shows the current device settings.");
SetTextXY(8, 11, " Computer:");
SetTextXY(8, 12, " Display:");
SetTextXY(8, 13, " Keyboard:");
SetTextXY(8, 14, "Keyboard layout:");
SetTextXY(8, 15, " Pointer device:");
SetTextXY(8, 17, " Accept:");
SetTextXY(8, 16, " Accept:");
SetTextXY(25, 11, GetGenericListEntry(ComputerList)->Text);
SetTextXY(25, 12, GetGenericListEntry(DisplayList)->Text);
SetTextXY(25, 13, GetGenericListEntry(KeyboardList)->Text);
SetTextXY(25, 14, GetGenericListEntry(LayoutList)->Text);
SetTextXY(25, 15, GetGenericListEntry(PointerList)->Text);
SetTextXY(25, 17, "Accept these device settings");
SetTextXY(25, 16, "Accept these device settings");
InvertTextXY (24, Line, 48, 1);
SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
SetTextXY(6, 22, "settings.");
SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys");
SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative");
SetTextXY(6, 21, "settings.");
SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
SetTextXY(6, 25, "and press ENTER.");
SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\"");
SetTextXY(6, 24, "and press ENTER.");
SetStatusText(" ENTER = Continue F3 = Quit");
@ -1039,9 +1025,9 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
NormalTextXY (24, Line, 48, 1);
if (Line == 15)
Line = 17;
else if (Line == 17)
if (Line == 14)
Line = 16;
else if (Line == 16)
Line = 11;
else
Line++;
@ -1052,9 +1038,9 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
{
NormalTextXY (24, Line, 48, 1);
if (Line == 11)
Line = 17;
else if (Line == 17)
Line = 15;
Line = 16;
else if (Line == 16)
Line = 14;
else
Line--;
InvertTextXY (24, Line, 48, 1);
@ -1076,9 +1062,7 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
return KEYBOARD_SETTINGS_PAGE;
else if (Line == 14)
return LAYOUT_SETTINGS_PAGE;
else if (Line == 15)
return POINTER_SETTINGS_PAGE;
else if (Line == 17)
else if (Line == 16)
return SELECT_PARTITION_PAGE;
}
}
@ -1341,69 +1325,6 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
}
static PAGE_NUMBER
PointerSettingsPage(PINPUT_RECORD Ir)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "You want to change the pointing device to be installed.");
SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
SetTextXY(8, 11, " device. Then press ENTER.");
SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
SetTextXY(8, 14, " the pointing device.");
GetScreenSize(&xScreen, &yScreen);
DrawGenericList(PointerList,
2,
18,
xScreen - 3,
yScreen - 3);
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
SaveGenericListState(PointerList);
while(TRUE)
{
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownGenericList(PointerList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpGenericList(PointerList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{
if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE;
break;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
{
RestoreGenericListState(PointerList);
return DEVICE_SETTINGS_PAGE;
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return DEVICE_SETTINGS_PAGE;
}
}
return DISPLAY_SETTINGS_PAGE;
}
static PAGE_NUMBER
SelectPartitionPage(PINPUT_RECORD Ir)
{
@ -3320,24 +3241,6 @@ RegistryPage(PINPUT_RECORD Ir)
}
}
/* Update mouse registry settings */
SetStatusText(" Updating mouse registry settings...");
if (!ProcessMouseRegistry(SetupInf, PointerList))
{
PopupError("Setup failed to update mouse registry settings.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
}
SetStatusText(" Done...");
return BOOT_LOADER_PAGE;
@ -3636,13 +3539,6 @@ QuitPage(PINPUT_RECORD Ir)
LayoutList = NULL;
}
/* Destroy pointer device list */
if (PointerList != NULL)
{
DestroyGenericList(PointerList, TRUE);
PointerList = NULL;
}
SetStatusText(" ENTER = Reboot computer");
while(TRUE)
@ -3838,10 +3734,6 @@ NtProcessStartup(PPEB Peb)
Page = LayoutSettingsPage(&Ir);
break;
case POINTER_SETTINGS_PAGE:
Page = PointerSettingsPage(&Ir);
break;
case SELECT_PARTITION_PAGE:
Page = SelectPartitionPage(&Ir);
break;