Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

mapper.c File Reference

#include "iop.h"

Go to the source code of this file.

Classes

struct  _FIRMWARE_CONFIGURATION
struct  _DEVICE_EXTENSION
struct  _FIRMWARE_IDENT_TO_PNP_ID
struct  _MAPPER_SEED
struct  _KEY_SEED

Defines

#define OPTIONS_NONE   0x00000000
#define OPTIONS_INSERT_PNP_ID   0x00000001
#define OPTIONS_INSERT_DEVICEDESC   0x00000002
#define OPTIONS_INSERT_COMPATIBLE_IDS   0x00000004
#define OPTIONS_INSERT_PHANTOM_MARKER   0x00000008
#define KEY_SEED_REQUIRED   0x00000000
#define KEY_SEED_DEVICE_PARAMETERS   0x00000001
#define PS2_KEYBOARD_COMPATIBLE_ID   L"PS2_KEYBOARD"
#define PS2_MOUSE_COMPATIBLE_ID   L"PS2_MOUSE"
#define DebugPrint(X)
#define CONTROLLER_TYPES_COUNT   (sizeof(controllerTypes) / sizeof(controllerTypes[0]))
#define SEED_BUFFER_SIZE   (512 * sizeof(WCHAR))
#define ENUM_KEY_BUFFER_SIZE   (1024 * sizeof(WCHAR))
#define INSTANCE_BUFFER_SIZE   (256 * sizeof(WCHAR))
#define COMPORT_DB_MERGE_SIZE   32

Typedefs

typedef _FIRMWARE_CONFIGURATION FIRMWARE_CONFIGURATION
typedef _FIRMWARE_CONFIGURATIONPFIRMWARE_CONFIGURATION
typedef _DEVICE_EXTENSION DEVICE_EXTENSION
typedef _DEVICE_EXTENSIONPDEVICE_EXTENSION
typedef _FIRMWARE_IDENT_TO_PNP_ID FIRMWARE_IDENT_TO_PNP_ID
typedef _FIRMWARE_IDENT_TO_PNP_IDPFIRMWARE_IDENT_TO_PNP_ID
typedef _MAPPER_SEED MAPPER_SEED
typedef _MAPPER_SEEDPMAPPER_SEED
typedef _KEY_SEED KEY_SEED
typedef _KEY_SEEDPKEY_SEED

Functions

PFIRMWARE_IDENT_TO_PNP_ID MapperFindIdentMatch (PFIRMWARE_IDENT_TO_PNP_ID IdentTable, PWCHAR String)
PWSTR MapperTranslatePnPId (CONFIGURATION_TYPE PeripheralType, PKEY_VALUE_FULL_INFORMATION Identifier)
NTSTATUS MapperPeripheralCallback (IN PVOID Context, IN PUNICODE_STRING PathName, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN PKEY_VALUE_FULL_INFORMATION *BusInformation, IN CONFIGURATION_TYPE ControllerType, IN ULONG ControllerNumber, IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation, IN CONFIGURATION_TYPE PeripheralType, IN ULONG PeripheralNumber, IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
NTSTATUS MapperCallback (IN PVOID Context, IN PUNICODE_STRING PathName, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN PKEY_VALUE_FULL_INFORMATION *BusInformation, IN CONFIGURATION_TYPE ControllerType, IN ULONG ControllerNumber, IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation, IN CONFIGURATION_TYPE PeripheralType, IN ULONG PeripheralNumber, IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation)
VOID MapperMarkKey (IN HANDLE Handle, IN PUNICODE_STRING PathName, IN PFIRMWARE_CONFIGURATION FirmwareEntry)
VOID MapperSeedKey (IN HANDLE Handle, IN PUNICODE_STRING PathName, IN PFIRMWARE_CONFIGURATION FirmwareEntry, IN BOOLEAN DeviceIsPhantom)
PCM_RESOURCE_LIST MapperAdjustResourceList (IN PCM_RESOURCE_LIST ResourceList, IN PWCHAR PnPId, IN OUT PULONG Size)
NTSTATUS ComPortDBAdd (IN HANDLE DeviceParamKey, IN PWSTR PortName)
VOID MapperProcessFirmwareTree (IN BOOLEAN OnlyProcessSerialPorts)
VOID MapperFreeList (VOID)
VOID MapperConstructRootEnumTree (IN BOOLEAN CreatePhantomDevices)
VOID MapperPhantomizeDetectedComPorts (VOID)

Variables

DEVICE_EXTENSION MapperDeviceExtension
FIRMWARE_IDENT_TO_PNP_ID KeyboardMap []
FIRMWARE_IDENT_TO_PNP_ID PointerMap []
MAPPER_SEED MapperValueSeed []
KEY_SEED MapperKeySeed []
PWSTR SerialId = L"*PNP0501"
PWSTR SerialIdNEC []
PWSTR ParallelId = L"*PNP0400"
PWSTR ParallelIdNEC = L"*nEC1401"
PWSTR FloppyId = L"*PNP0700"
PWSTR ATAId = L"*PNP0600"


Define Documentation

#define COMPORT_DB_MERGE_SIZE   32
 

Referenced by ComPortDBAdd().

#define CONTROLLER_TYPES_COUNT   (sizeof(controllerTypes) / sizeof(controllerTypes[0]))
 

Referenced by MapperProcessFirmwareTree().

#define DebugPrint  ) 
 

Definition at line 272 of file mapper.c.

#define ENUM_KEY_BUFFER_SIZE   (1024 * sizeof(WCHAR))
 

Referenced by MapperConstructRootEnumTree(), and MapperPhantomizeDetectedComPorts().

#define INSTANCE_BUFFER_SIZE   (256 * sizeof(WCHAR))
 

Referenced by MapperConstructRootEnumTree(), and MapperPhantomizeDetectedComPorts().

#define KEY_SEED_DEVICE_PARAMETERS   0x00000001
 

Definition at line 106 of file mapper.c.

Referenced by MapperSeedKey().

#define KEY_SEED_REQUIRED   0x00000000
 

Definition at line 105 of file mapper.c.

#define OPTIONS_INSERT_COMPATIBLE_IDS   0x00000004
 

Definition at line 91 of file mapper.c.

Referenced by MapperSeedKey().

#define OPTIONS_INSERT_DEVICEDESC   0x00000002
 

Definition at line 90 of file mapper.c.

Referenced by MapperSeedKey().

#define OPTIONS_INSERT_PHANTOM_MARKER   0x00000008
 

Definition at line 92 of file mapper.c.

Referenced by MapperSeedKey().

#define OPTIONS_INSERT_PNP_ID   0x00000001
 

Definition at line 89 of file mapper.c.

Referenced by MapperSeedKey().

#define OPTIONS_NONE   0x00000000
 

Definition at line 88 of file mapper.c.

#define PS2_KEYBOARD_COMPATIBLE_ID   L"PS2_KEYBOARD"
 

Definition at line 148 of file mapper.c.

Referenced by MapperSeedKey().

#define PS2_MOUSE_COMPATIBLE_ID   L"PS2_MOUSE"
 

Definition at line 149 of file mapper.c.

Referenced by MapperSeedKey().

#define SEED_BUFFER_SIZE   (512 * sizeof(WCHAR))
 

Referenced by MapperSeedKey().


Typedef Documentation

typedef struct _DEVICE_EXTENSION DEVICE_EXTENSION
 

typedef struct _FIRMWARE_CONFIGURATION FIRMWARE_CONFIGURATION
 

Referenced by MapperCallback().

typedef struct _FIRMWARE_IDENT_TO_PNP_ID FIRMWARE_IDENT_TO_PNP_ID
 

typedef struct _KEY_SEED KEY_SEED
 

typedef struct _MAPPER_SEED MAPPER_SEED
 

typedef struct _DEVICE_EXTENSION * PDEVICE_EXTENSION
 

typedef struct _FIRMWARE_CONFIGURATION * PFIRMWARE_CONFIGURATION
 

Referenced by MapperCallback(), MapperConstructRootEnumTree(), MapperFreeList(), MapperPeripheralCallback(), and MapperPhantomizeDetectedComPorts().

typedef struct _FIRMWARE_IDENT_TO_PNP_ID * PFIRMWARE_IDENT_TO_PNP_ID
 

Referenced by MapperFindIdentMatch(), and MapperTranslatePnPId().

typedef struct _KEY_SEED * PKEY_SEED
 

Referenced by MapperSeedKey().

typedef struct _MAPPER_SEED * PMAPPER_SEED
 

Referenced by MapperSeedKey().


Function Documentation

NTSTATUS ComPortDBAdd IN HANDLE  DeviceParamKey,
IN PWSTR  PortName
 

Definition at line 1955 of file mapper.c.

References ASSERT, COMPORT_DB_MERGE_SIZE, ExAllocatePool, ExFreePool(), IopCreateRegistryKeyEx(), L, NT_SUCCESS, NTSTATUS(), NULL, PagedPool, PortName, RtlCompareUnicodeString(), RtlInitUnicodeString(), and TRUE.

01959 { 01960 UNICODE_STRING portNameString; 01961 UNICODE_STRING portPrefixString; 01962 UNICODE_STRING comDBName; 01963 UNICODE_STRING valueName; 01964 PKEY_VALUE_PARTIAL_INFORMATION valueInfo; 01965 ULONG valueInfoLength; 01966 ULONG returnedLength; 01967 HANDLE comDBKey; 01968 ULONG portNo; 01969 NTSTATUS status; 01970 01971 RtlInitUnicodeString(&portNameString, PortName); 01972 01973 if (portNameString.Length > 3 * sizeof(WCHAR)) { 01974 portNameString.Length = 3 * sizeof(WCHAR); 01975 } 01976 01977 RtlInitUnicodeString(&portPrefixString, L"COM"); 01978 01979 if (RtlCompareUnicodeString(&portNameString, &portPrefixString, TRUE) == 0) { 01980 portNo = _wtol(&PortName[3]); 01981 01982 if (portNo > 0 && portNo <= 256) { 01983 01984 #if UMODETEST 01985 RtlInitUnicodeString(&comDBName, L"\\Registry\\Machine\\System\\TestControlSet\\Control\\COM Name Arbiter"); 01986 #else 01987 RtlInitUnicodeString(&comDBName, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\COM Name Arbiter"); 01988 #endif 01989 01990 status = IopCreateRegistryKeyEx( &comDBKey, 01991 NULL, 01992 &comDBName, 01993 KEY_ALL_ACCESS, 01994 REG_OPTION_NON_VOLATILE, 01995 NULL 01996 ); 01997 01998 if (NT_SUCCESS(status)) { 01999 02000 RtlInitUnicodeString(&valueName, L"ComDB Merge"); 02001 02002 #define COMPORT_DB_MERGE_SIZE 32 // 256 / 8 02003 02004 valueInfoLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + COMPORT_DB_MERGE_SIZE; 02005 valueInfo = ExAllocatePool(PagedPool, valueInfoLength); 02006 02007 if (valueInfo != NULL) { 02008 02009 status = ZwQueryValueKey( comDBKey, 02010 &valueName, 02011 KeyValuePartialInformation, 02012 valueInfo, 02013 valueInfoLength, 02014 &returnedLength); 02015 02016 if (status == STATUS_OBJECT_NAME_NOT_FOUND) { 02017 02018 valueInfo->Type = REG_BINARY; 02019 valueInfo->DataLength = COMPORT_DB_MERGE_SIZE; 02020 RtlZeroMemory(valueInfo->Data, valueInfo->DataLength); 02021 status = STATUS_SUCCESS; 02022 } 02023 02024 if (NT_SUCCESS(status)) { 02025 portNo--; 02026 valueInfo->Data[ portNo / 8 ] |= 1 << (portNo % 8); 02027 02028 status = ZwSetValueKey( comDBKey, 02029 &valueName, 02030 0, 02031 valueInfo->Type, 02032 valueInfo->Data, 02033 valueInfo->DataLength ); 02034 02035 ASSERT(NT_SUCCESS(status)); 02036 } 02037 02038 ExFreePool(valueInfo); 02039 } 02040 02041 ZwClose(comDBKey); 02042 } 02043 } 02044 } 02045 02046 RtlInitUnicodeString( &valueName, L"PortName" ); 02047 02048 status = ZwSetValueKey( DeviceParamKey, 02049 &valueName, 02050 0, 02051 REG_SZ, 02052 PortName, 02053 (wcslen(PortName) + 1) * sizeof(WCHAR) ); 02054 02055 return status; 02056 }

PCM_RESOURCE_LIST MapperAdjustResourceList IN PCM_RESOURCE_LIST  ResourceList,
IN PWCHAR  PnPId,
IN OUT PULONG  Size
 

Definition at line 1803 of file mapper.c.

References ExAllocatePool, ExFreePool(), FloppyId, KeI386MachineType, NonPagedPool, NULL, and Size.

Referenced by MapperMarkKey().

01808 { 01809 PCM_PARTIAL_RESOURCE_LIST partialResourceList; 01810 PCM_PARTIAL_RESOURCE_DESCRIPTOR problemPartialDescriptors; 01811 PCM_PARTIAL_RESOURCE_DESCRIPTOR partialDescriptors; 01812 PCM_RESOURCE_LIST newResourceList; 01813 ULONG i; 01814 01815 newResourceList = ResourceList; 01816 01817 #if _X86_ 01818 if (KeI386MachineType == MACHINE_TYPE_EISA) { 01819 01820 PCM_FULL_RESOURCE_DESCRIPTOR fullDescriptor; 01821 PCM_PARTIAL_RESOURCE_DESCRIPTOR partialDescriptor; 01822 PUCHAR nextDescriptor; 01823 ULONG j; 01824 ULONG lastResourceIndex; 01825 01826 fullDescriptor = &ResourceList->List[0]; 01827 01828 for (i = 0; i < ResourceList->Count; i++) { 01829 01830 partialResourceList = &fullDescriptor->PartialResourceList; 01831 01832 for (j = 0; j < partialResourceList->Count; j++) { 01833 partialDescriptor = &partialResourceList->PartialDescriptors[j]; 01834 01835 if (partialDescriptor->Type == CmResourceTypePort) { 01836 if (partialDescriptor->u.Port.Start.HighPart == 0 && 01837 (partialDescriptor->u.Port.Start.LowPart & 0x00000300) == 0) { 01838 partialDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE; 01839 } 01840 } 01841 } 01842 01843 nextDescriptor = (PUCHAR)fullDescriptor + sizeof(CM_FULL_RESOURCE_DESCRIPTOR); 01844 01845 // 01846 // account for any resource descriptors in addition to the single 01847 // imbedded one I've already accounted for (if there aren't any, 01848 // then I'll end up subtracting off the extra imbedded descriptor 01849 // from the previous step) 01850 // 01851 // 01852 // finally, account for any extra device specific data at the end of 01853 // the last partial resource descriptor (if any) 01854 // 01855 if (partialResourceList->Count > 0) { 01856 01857 nextDescriptor += (partialResourceList->Count - 1) * 01858 sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); 01859 01860 lastResourceIndex = partialResourceList->Count - 1; 01861 01862 if (partialResourceList->PartialDescriptors[lastResourceIndex].Type == 01863 CmResourceTypeDeviceSpecific) { 01864 01865 nextDescriptor += partialResourceList->PartialDescriptors[lastResourceIndex]. 01866 u.DeviceSpecificData.DataSize; 01867 } 01868 } 01869 01870 fullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)nextDescriptor; 01871 } 01872 } 01873 #endif 01874 01875 if (wcscmp(PnPId, FloppyId) == 0) { 01876 01877 if (ResourceList->Count == 1) { 01878 01879 partialResourceList = &ResourceList->List->PartialResourceList; 01880 01881 partialDescriptors = partialResourceList->PartialDescriptors; 01882 01883 // 01884 // Look for the one and only one 8 byte port resource 01885 // 01886 problemPartialDescriptors = NULL; 01887 for (i=0; i<partialResourceList->Count; i++) { 01888 01889 if ((partialDescriptors[i].Type == CmResourceTypePort) && 01890 (partialDescriptors[i].u.Port.Length == 8)) { 01891 01892 if (problemPartialDescriptors == NULL) { 01893 01894 problemPartialDescriptors = partialDescriptors + i; 01895 } else { 01896 01897 problemPartialDescriptors = NULL; 01898 break; 01899 } 01900 } 01901 } 01902 01903 if (problemPartialDescriptors) { 01904 01905 problemPartialDescriptors->u.Port.Length = 6; 01906 01907 newResourceList = ExAllocatePool ( 01908 NonPagedPool, 01909 *Size + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) 01910 ); 01911 if (newResourceList) { 01912 01913 RtlMoveMemory ( 01914 newResourceList, 01915 ResourceList, 01916 *Size 01917 ); 01918 01919 // 01920 // pick out the new partial resource descriptor 01921 // 01922 partialDescriptors = newResourceList->List-> 01923 PartialResourceList.PartialDescriptors; 01924 partialDescriptors += newResourceList->List->PartialResourceList.Count; 01925 01926 RtlMoveMemory ( 01927 partialDescriptors, 01928 problemPartialDescriptors, 01929 sizeof(*partialDescriptors) 01930 ); 01931 01932 partialDescriptors->u.Port.Start.QuadPart += 7; 01933 partialDescriptors->u.Port.Length = 1; 01934 01935 // 01936 // we got one more now 01937 // 01938 newResourceList->List->PartialResourceList.Count++; 01939 *Size += sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); 01940 01941 ExFreePool (ResourceList); 01942 01943 } else { 01944 01945 newResourceList = ResourceList; 01946 } 01947 } 01948 } 01949 } 01950 01951 return newResourceList; 01952 }

NTSTATUS MapperCallback IN PVOID  Context,
IN PUNICODE_STRING  PathName,
IN INTERFACE_TYPE  BusType,
IN ULONG  BusNumber,
IN PKEY_VALUE_FULL_INFORMATION *  BusInformation,
IN CONFIGURATION_TYPE  ControllerType,
IN ULONG  ControllerNumber,
IN PKEY_VALUE_FULL_INFORMATION *  ControllerInformation,
IN CONFIGURATION_TYPE  PeripheralType,
IN ULONG  PeripheralNumber,
IN PKEY_VALUE_FULL_INFORMATION *  PeripheralInformation
 

Definition at line 658 of file mapper.c.

References BusNumber, _FIRMWARE_CONFIGURATION::BusNumber, _FIRMWARE_CONFIGURATION::BusType, CONFIGURATION_TYPE, _FIRMWARE_CONFIGURATION::ControllerNumber, ControllerType, _FIRMWARE_CONFIGURATION::ControllerType, DebugPrint, DiskController, ExAllocatePool, ExFreePool(), FIRMWARE_CONFIGURATION, _DEVICE_EXTENSION::FirmwareList, FloppyDiskPeripheral, _FIRMWARE_CONFIGURATION::Identifier, _FIRMWARE_CONFIGURATION::IdentifierLength, _FIRMWARE_CONFIGURATION::IdentifierType, IoQueryDeviceConfigurationData, IoQueryDeviceDescription(), IoQueryDeviceIdentifier, KeyboardController, KeyboardPeripheral, L, MapperPeripheralCallback(), MapperTranslatePnPId(), _FIRMWARE_CONFIGURATION::Next, NonPagedPool, NULL, ParallelController, ParallelIdNEC, PDEVICE_EXTENSION, _FIRMWARE_CONFIGURATION::PeripheralNumber, _FIRMWARE_CONFIGURATION::PeripheralType, PFIRMWARE_CONFIGURATION, _FIRMWARE_CONFIGURATION::PnPId, PointerController, PointerPeripheral, _FIRMWARE_CONFIGURATION::ResourceDescriptor, _FIRMWARE_CONFIGURATION::ResourceDescriptorSize, SerialController, SerialIdNEC, and USHORT.

Referenced by MapperProcessFirmwareTree().

00674 : 00675 00676 This routine is used to acquire firmware tree information about 00677 pointer devices in the system. 00678 00679 Arguments: 00680 00681 Context - Pointer to the device extension. 00682 PathName - unicode registry path. 00683 BusType - Internal, Isa, ... 00684 BusNumber - Which bus if we are on a multibus system. 00685 BusInformation - Configuration information about the bus. Not Used. 00686 ControllerType - serial or ata disk. 00687 ControllerNumber - Which controller if there is more than one 00688 controller in the system. 00689 ControllerInformation - Array of pointers to the three pieces of 00690 registry information. 00691 PeripheralType - Undefined for this call. 00692 PeripheralNumber - Undefined for this call. 00693 PeripheralInformation - Undefined for this call. 00694 00695 Return Value: 00696 00697 STATUS_SUCCESS if everything went ok, or STATUS_INSUFFICIENT_RESOURCES 00698 if it couldn't map the base csr or acquire the device object, or 00699 all of the resource information couldn't be acquired. 00700 00701 --*/ 00702 00703 { 00704 PDEVICE_EXTENSION deviceExtension = Context; 00705 PCM_FULL_RESOURCE_DESCRIPTOR controllerData; 00706 PKEY_VALUE_FULL_INFORMATION information; 00707 PFIRMWARE_CONFIGURATION firmwareEntry; 00708 CONFIGURATION_TYPE peripheralType; 00709 PUCHAR buffer; 00710 PUCHAR identifier; 00711 ULONG dataLength; 00712 00713 // 00714 // If entry is found, but there is no information just return 00715 // 00716 00717 if (!(information = ControllerInformation[IoQueryDeviceConfigurationData])) { 00718 00719 return STATUS_SUCCESS; 00720 } 00721 00722 if (!(dataLength = information->DataLength)) { 00723 00724 return STATUS_SUCCESS; 00725 } 00726 00727 // 00728 // Setup to capture the information from the firmware tree 00729 // 00730 00731 firmwareEntry = ExAllocatePool(NonPagedPool, sizeof(FIRMWARE_CONFIGURATION)); 00732 if (!firmwareEntry) { 00733 00734 return STATUS_INSUFFICIENT_RESOURCES; 00735 } 00736 RtlZeroMemory(firmwareEntry, sizeof(FIRMWARE_CONFIGURATION)); 00737 00738 // 00739 // Save information concerning the controller 00740 // 00741 00742 firmwareEntry->ControllerType = ControllerType; 00743 firmwareEntry->ControllerNumber = ControllerNumber; 00744 firmwareEntry->BusNumber = BusNumber; 00745 firmwareEntry->BusType = BusType; 00746 00747 // 00748 // Save the resource descriptor 00749 // 00750 00751 buffer = firmwareEntry->ResourceDescriptor = ExAllocatePool(NonPagedPool, 00752 dataLength); 00753 00754 if (!buffer) { 00755 ExFreePool(firmwareEntry); 00756 return STATUS_INSUFFICIENT_RESOURCES; 00757 } 00758 00759 // 00760 // Save the configuration information on this controller. 00761 // 00762 00763 controllerData = (PCM_FULL_RESOURCE_DESCRIPTOR) 00764 ((PUCHAR)information + information->DataOffset); 00765 RtlMoveMemory(buffer, controllerData, dataLength); 00766 firmwareEntry->ResourceDescriptorSize = dataLength; 00767 00768 // 00769 // If there is a device identifier save it. 00770 // 00771 00772 if (information = ControllerInformation[IoQueryDeviceIdentifier]) { 00773 PWCHAR ptr; 00774 00775 if (dataLength = information->DataLength) { 00776 00777 ptr = (PWCHAR) ((PUCHAR)information + information->DataOffset); 00778 if (ControllerType == ParallelController) { 00779 PWCHAR tmpChar; 00780 00781 // 00782 // Some extra mapping is performed here to 00783 // translate the firmware names to LPT names. 00784 // 00785 00786 *ptr++ = (WCHAR) 'L'; 00787 *ptr++ = (WCHAR) 'P'; 00788 *ptr++ = (WCHAR) 'T'; 00789 00790 // 00791 // Find the number. 00792 // 00793 00794 tmpChar = ptr; 00795 while (*tmpChar) { 00796 if ((*tmpChar >= (WCHAR) '0') && 00797 (*tmpChar <= (WCHAR) '9')) { 00798 break; 00799 } 00800 tmpChar++; 00801 } 00802 00803 if (*tmpChar) { 00804 while (*tmpChar) { 00805 *ptr++ = *tmpChar++; 00806 } 00807 *ptr = (WCHAR) 0; 00808 00809 // 00810 // Update the datalength to be 4 wchars and eos and 00811 // restore the pointer. 00812 // 00813 00814 ptr = (PWCHAR) ((PUCHAR)information + information->DataOffset); 00815 dataLength = 10; 00816 } else { 00817 dataLength = 0; 00818 DebugPrint((MAPPER_ERROR, 00819 "Mapper: no parallel port number!\n")); 00820 } 00821 } 00822 00823 if (dataLength) { 00824 firmwareEntry->Identifier = ExAllocatePool(NonPagedPool, 00825 dataLength); 00826 if (firmwareEntry->Identifier) { 00827 00828 // 00829 // Move the data 00830 // 00831 00832 firmwareEntry->IdentifierType = information->Type; 00833 firmwareEntry->IdentifierLength = dataLength; 00834 RtlMoveMemory(firmwareEntry->Identifier, ptr, dataLength); 00835 } 00836 } 00837 } 00838 } 00839 00840 // 00841 // For some controllers, search the peripheral information 00842 // 00843 00844 switch (ControllerType) { 00845 case SerialController: 00846 case ParallelController: 00847 // 00848 // Don't look for a peripheral. 00849 // 00850 peripheralType = (CONFIGURATION_TYPE) 0; 00851 break; 00852 case DiskController: 00853 peripheralType = FloppyDiskPeripheral; 00854 break; 00855 case KeyboardController: 00856 peripheralType = KeyboardPeripheral; 00857 break; 00858 case PointerController: 00859 peripheralType = PointerPeripheral; 00860 break; 00861 default: 00862 peripheralType = (CONFIGURATION_TYPE) 0; 00863 break; 00864 } 00865 00866 DebugPrint((MAPPER_REGISTRY, 00867 "Mapper: registry location is\n %ws\n", 00868 PathName->Buffer)); 00869 00870 DebugPrint((MAPPER_INFORMATION, 00871 "Mapper: ControllerInformation[] -\n\tIdent: %x -\n\tData: %x -\n\tInformation: %x\n", 00872 ControllerInformation[0], 00873 ControllerInformation[1], 00874 ControllerInformation[2])); 00875 00876 if (peripheralType) { 00877 DebugPrint((MAPPER_PNP_ID, 00878 "Mapper: searching for peripheral type %d\n", 00879 peripheralType)); 00880 00881 IoQueryDeviceDescription(&BusType, 00882 &BusNumber, 00883 &ControllerType, 00884 &ControllerNumber, 00885 &peripheralType, 00886 NULL, 00887 MapperPeripheralCallback, 00888 firmwareEntry); 00889 } 00890 00891 // 00892 // firmwareEntry->PnPId will be NULL if there are no peripherals of this 00893 // type in the tree or if the peripheral's description doesn't match one of 00894 // those in our table. 00895 // 00896 // firmwareEntry->PeripheralType will be equal to peripheralType if we found 00897 // one of the proper type regardless of whether or not it is in the table. 00898 // 00899 // So this test just ensures that we fallback to the controller IDs in the 00900 // case were there is no peripheral entry. If there is a peripheral entry 00901 // that we don't understand we will suppress the entire node. 00902 // 00903 // This prevents creating devices with hw ids of bogus as we were seeing on 00904 // the SGI x86 ARC machines. 00905 // 00906 00907 if (!firmwareEntry->PnPId && firmwareEntry->PeripheralType == 0) { 00908 00909 // 00910 // Attempt to get PnPId from the controller type. 00911 // 00912 00913 firmwareEntry->PnPId = MapperTranslatePnPId(ControllerType, NULL); 00914 00915 if (!firmwareEntry->PnPId) { 00916 DebugPrint((MAPPER_PNP_ID, 00917 "Mapper: NO PnP Id for\n ==> %ws\n", 00918 PathName->Buffer)); 00919 } 00920 } 00921 00922 // NEC98 needs DeviceId which differs with the other H/W. 00923 if (IsNEC_98){ 00924 00925 switch (ControllerType) { 00926 case SerialController:{ 00927 ULONG i,j; 00928 PWSTR serialFirmwareName; 00929 serialFirmwareName = ExAllocatePool(NonPagedPool, sizeof(USHORT)*10); 00930 if (!serialFirmwareName) { 00931 if (buffer) 00932 ExFreePool(buffer); 00933 if (firmwareEntry) { 00934 if (firmwareEntry->Identifier) 00935 ExFreePool(firmwareEntry->Identifier); 00936 ExFreePool(firmwareEntry); 00937 } 00938 return STATUS_INSUFFICIENT_RESOURCES; 00939 } 00940 for ( 00941 i = 0; 00942 i < controllerData->PartialResourceList.Count; 00943 i++ 00944 ) { 00945 PCM_PARTIAL_RESOURCE_DESCRIPTOR partial = 00946 &controllerData->PartialResourceList.PartialDescriptors[i]; 00947 00948 if (partial->Type == CmResourceTypeDeviceSpecific) { 00949 PCM_SERIAL_DEVICE_DATA sDeviceData; 00950 00951 sDeviceData = (PCM_SERIAL_DEVICE_DATA)(partial + 1); 00952 00953 swprintf(serialFirmwareName, L"*nEC%04X\0", sDeviceData->Revision); 00954 j = 0; 00955 while (SerialIdNEC[j]) { 00956 if (!wcscmp(serialFirmwareName, SerialIdNEC[j])) { 00957 firmwareEntry->PnPId = SerialIdNEC[j]; 00958 } 00959 j++; 00960 } 00961 } 00962 00963 } 00964 ExFreePool(serialFirmwareName); 00965 break; 00966 } 00967 case ParallelController: 00968 firmwareEntry->PnPId = ParallelIdNEC; 00969 break; 00970 default: 00971 break; 00972 } 00973 } 00974 00975 DebugPrint((MAPPER_PNP_ID, 00976 "Mapper: constructed name %d_%d_%d_%d_%d_%d\n", 00977 firmwareEntry->BusType, 00978 firmwareEntry->BusNumber, 00979 firmwareEntry->ControllerType, 00980 firmwareEntry->ControllerNumber, 00981 firmwareEntry->PeripheralType, 00982 firmwareEntry->PeripheralNumber)); 00983 00984 if (firmwareEntry->PnPId) { 00985 00986 // 00987 // Link into chain of entries. 00988 // 00989 00990 firmwareEntry->Next = deviceExtension->FirmwareList; 00991 deviceExtension->FirmwareList = firmwareEntry; 00992 } else { 00993 00994 // 00995 // No map found - don't remember this entry. 00996 // 00997 00998 ExFreePool(buffer); 00999 if(firmwareEntry->Identifier) { 01000 ExFreePool(firmwareEntry->Identifier); 01001 } 01002 ExFreePool(firmwareEntry); 01003 } 01004 return STATUS_SUCCESS; 01005 }

VOID MapperConstructRootEnumTree IN BOOLEAN  CreatePhantomDevices  ) 
 

Definition at line 1600 of file mapper.c.

References _FIRMWARE_CONFIGURATION::BusNumber, _FIRMWARE_CONFIGURATION::BusType, _FIRMWARE_CONFIGURATION::ControllerNumber, _FIRMWARE_CONFIGURATION::ControllerType, DebugPrint, ENUM_KEY_BUFFER_SIZE, ExAllocatePool, ExFreePool(), FALSE, _DEVICE_EXTENSION::FirmwareList, _FIRMWARE_CONFIGURATION::Identifier, INSTANCE_BUFFER_SIZE, L, MapperDeviceExtension, MapperFreeList(), MapperMarkKey(), MapperSeedKey(), _FIRMWARE_CONFIGURATION::NewlyCreated, _FIRMWARE_CONFIGURATION::Next, NonPagedPool, NT_SUCCESS, NTSTATUS(), NULL, PDEVICE_EXTENSION, _FIRMWARE_CONFIGURATION::PeripheralNumber, _FIRMWARE_CONFIGURATION::PeripheralType, PFIRMWARE_CONFIGURATION, _FIRMWARE_CONFIGURATION::PnPId, _FIRMWARE_CONFIGURATION::ResourceDescriptor, RtlAppendUnicodeToString(), RtlInitUnicodeString(), and TRUE.

Referenced by IopInitializePlugPlayServices().

01606 : 01607 01608 This routine walks through the list of firmware entries 01609 in the device extension and migrates the information into 01610 the root enumerator's tree in the registry. 01611 01612 Arguments: 01613 01614 CreatePhantomDevices - If non-zero, then the device instances are created 01615 as "phantoms" (i.e., they are marked with the "Phantom" value entry so 01616 that the root enumerator will ignore them). The only time these device 01617 instance registry keys will ever turn into real live devnodes is if the 01618 class installer (in response to DIF_FIRSTTIMESETUP or DIF_DETECT) 01619 decides that these devices aren't duplicates of any PnP-enumerated 01620 devnodes, and subsequently registers and installs them. 01621 01622 Return Value: 01623 01624 None 01625 01626 --*/ 01627 01628 { 01629 #define ENUM_KEY_BUFFER_SIZE (1024 * sizeof(WCHAR)) 01630 #define INSTANCE_BUFFER_SIZE (256 * sizeof(WCHAR)) 01631 UNICODE_STRING enumKey; 01632 PFIRMWARE_CONFIGURATION firmwareEntry; 01633 OBJECT_ATTRIBUTES objectAttributes; 01634 NTSTATUS status; 01635 BOOLEAN keyPresent; 01636 PWCHAR registryBase; 01637 PWCHAR instanceBuffer; 01638 HANDLE handle; 01639 ULONG disposition; 01640 PVOID buffer; 01641 PDEVICE_EXTENSION DeviceExtension = &MapperDeviceExtension; 01642 01643 // 01644 // allocate space needed for the registry path into the root 01645 // enumerator tree. Note, limited size on path length. 01646 // 01647 01648 buffer = ExAllocatePool(NonPagedPool, ENUM_KEY_BUFFER_SIZE); 01649 01650 if (!buffer) { 01651 MapperFreeList(); 01652 DebugPrint((MAPPER_ERROR, 01653 "Mapper: could not allocate memory for registry update\n")); 01654 return; 01655 } 01656 01657 instanceBuffer = ExAllocatePool(NonPagedPool, INSTANCE_BUFFER_SIZE); 01658 if (!instanceBuffer) { 01659 MapperFreeList(); 01660 ExFreePool(buffer); 01661 DebugPrint((MAPPER_ERROR, 01662 "Mapper: could not allocate memory for instance buffer\n")); 01663 return; 01664 } 01665 01666 InitializeObjectAttributes(&objectAttributes, 01667 &enumKey, 01668 OBJ_CASE_INSENSITIVE, 01669 NULL, 01670 NULL); 01671 01672 #if UMODETEST 01673 registryBase = L"\\Registry\\Machine\\System\\TestControlSet\\Enum\\Root\\"; 01674 #else 01675 registryBase = L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\Root\\"; 01676 #endif 01677 01678 firmwareEntry = DeviceExtension->FirmwareList; 01679 while (firmwareEntry) { 01680 01681 // 01682 // Construct the base for the path for this entry. 01683 // 01684 01685 01686 RtlInitUnicodeString(&enumKey, NULL); 01687 enumKey.MaximumLength = ENUM_KEY_BUFFER_SIZE; 01688 enumKey.Buffer = buffer; 01689 RtlZeroMemory(buffer, ENUM_KEY_BUFFER_SIZE); 01690 RtlAppendUnicodeToString(&enumKey, registryBase); 01691 RtlAppendUnicodeToString(&enumKey, firmwareEntry->PnPId); 01692 01693 // 01694 // Build the pnp Key. 01695 // 01696 01697 status = ZwCreateKey(&handle, 01698 KEY_READ | KEY_WRITE, 01699 &objectAttributes, 01700 0, 01701 NULL, 01702 REG_OPTION_NON_VOLATILE, 01703 &disposition); 01704 01705 if (NT_SUCCESS(status)) { 01706 01707 // 01708 // Do not need the handle, so close it 01709 // Remember if the key was present prior to call 01710 // 01711 01712 ZwClose(handle); 01713 keyPresent = (disposition == REG_OPENED_EXISTING_KEY) ? TRUE : FALSE; 01714 DebugPrint((MAPPER_INFORMATION, 01715 "Mapper: Key was %s\n", 01716 keyPresent ? "Present" : "Created")); 01717 01718 // 01719 // Construct the instance name. 01720 // 01721 01722 RtlZeroMemory(instanceBuffer, INSTANCE_BUFFER_SIZE); 01723 swprintf(instanceBuffer, 01724 L"\\%d_%d_%d_%d_%d_%d", 01725 firmwareEntry->BusType, 01726 firmwareEntry->BusNumber, 01727 firmwareEntry->ControllerType, 01728 firmwareEntry->ControllerNumber, 01729 firmwareEntry->PeripheralType, 01730 firmwareEntry->PeripheralNumber); 01731 RtlAppendUnicodeToString(&enumKey, instanceBuffer); 01732 01733 status = ZwCreateKey(&handle, 01734 KEY_READ | KEY_WRITE, 01735 &objectAttributes, 01736 0, 01737 NULL, 01738 REG_OPTION_NON_VOLATILE, 01739 &disposition); 01740 01741 if (NT_SUCCESS(status)) { 01742 01743 if (firmwareEntry->ResourceDescriptor) { 01744 DebugPrint((MAPPER_INFORMATION, 01745 "Mapper: firmware entry has resources %x\n", 01746 firmwareEntry->ResourceDescriptor)); 01747 } 01748 01749 if (firmwareEntry->Identifier) { 01750 DebugPrint((MAPPER_INFORMATION, 01751 "Mapper: firmware entry has identifier %x\n", 01752 firmwareEntry->Identifier)); 01753 } 01754 01755 // 01756 // Only if this is a new entry do we see the key. 01757 // 01758 01759 if (disposition == REG_CREATED_NEW_KEY) { 01760 01761 // 01762 // Remember the fact that the key was newly-created for the 01763 // PnP BIOS case where we need to come along and "phantomize" 01764 // all newly-created ntdetect COM ports. 01765 // 01766 01767 firmwareEntry->NewlyCreated = TRUE; 01768 01769 // 01770 // Create enough information to get pnp to 01771 // install drivers 01772 // 01773 01774 MapperSeedKey(handle, 01775 &enumKey, 01776 firmwareEntry, 01777 CreatePhantomDevices 01778 ); 01779 } 01780 MapperMarkKey(handle, 01781 &enumKey, 01782 firmwareEntry); 01783 ZwClose(handle); 01784 01785 } else { 01786 DebugPrint((MAPPER_ERROR, 01787 "Mapper: create of instance key failed %x\n", 01788 status)); 01789 } 01790 01791 } else { 01792 DebugPrint((MAPPER_ERROR, 01793 "Mapper: create pnp key failed %x\n", 01794 status)); 01795 } 01796 01797 firmwareEntry = firmwareEntry->Next; 01798 } 01799 ExFreePool(instanceBuffer); 01800 }

PFIRMWARE_IDENT_TO_PNP_ID MapperFindIdentMatch PFIRMWARE_IDENT_TO_PNP_ID  IdentTable,
PWCHAR  String
 

Definition at line 367 of file mapper.c.

References _FIRMWARE_IDENT_TO_PNP_ID::FirmwareName, NULL, PFIRMWARE_IDENT_TO_PNP_ID, and String.

Referenced by MapperTranslatePnPId().

00374 : 00375 00376 Given a table of strings to match, find the match for 00377 the identifier given. 00378 00379 Arguments: 00380 00381 Return Value: 00382 00383 A pointer to the ident table entry for the match if found 00384 NULL if not found. 00385 00386 --*/ 00387 00388 { 00389 PFIRMWARE_IDENT_TO_PNP_ID entry; 00390 00391 entry = IdentTable; 00392 while (entry->FirmwareName) { 00393 if (!wcscmp(String, entry->FirmwareName)) { 00394 return entry; 00395 } 00396 entry++; 00397 } 00398 return NULL; 00399 }

VOID MapperFreeList VOID   ) 
 

Definition at line 1549 of file mapper.c.

References ExFreePool(), _DEVICE_EXTENSION::FirmwareList, _FIRMWARE_CONFIGURATION::Identifier, MapperDeviceExtension, _FIRMWARE_CONFIGURATION::Next, PDEVICE_EXTENSION, PFIRMWARE_CONFIGURATION, and _FIRMWARE_CONFIGURATION::ResourceDescriptor.

Referenced by IopInitializePlugPlayServices(), and MapperConstructRootEnumTree().

01555 : 01556 01557 This routine walks through the list of firmware entries 01558 and frees all allocated memory. 01559 01560 Arguments: 01561 01562 None 01563 01564 Return Value: 01565 01566 None 01567 01568 --*/ 01569 01570 { 01571 PDEVICE_EXTENSION deviceExtension = &MapperDeviceExtension; 01572 PFIRMWARE_CONFIGURATION tempEntry; 01573 PFIRMWARE_CONFIGURATION firmwareEntry; 01574 01575 firmwareEntry = deviceExtension->FirmwareList; 01576 while (firmwareEntry) { 01577 01578 // 01579 // free allocated structures associated with the firmware entry 01580 // 01581 01582 if (firmwareEntry->ResourceDescriptor) { 01583 ExFreePool(firmwareEntry->ResourceDescriptor); 01584 } 01585 if (firmwareEntry->Identifier) { 01586 ExFreePool(firmwareEntry->Identifier); 01587 } 01588 01589 // 01590 // free this entry and move to the next 01591 // 01592 01593 tempEntry = firmwareEntry->Next; 01594 ExFreePool(firmwareEntry); 01595 firmwareEntry = tempEntry; 01596 } 01597 }

VOID MapperMarkKey IN HANDLE  Handle,
IN PUNICODE_STRING  PathName,
IN PFIRMWARE_CONFIGURATION  FirmwareEntry
 

Definition at line 1091 of file mapper.c.

References DebugPrint, ExAllocatePool, ExFreePool(), Handle, IopCmResourcesToIoResources(), L, MapperAdjustResourceList(), NonPagedPool, NT_SUCCESS, NTSTATUS(), NULL, RtlAppendUnicodeToString(), RtlInitUnicodeString(), and USHORT.

Referenced by MapperConstructRootEnumTree().

01099 : 01100 01101 Record in the root enum key that the firmware mapper found this entry. 01102 Migrate configuration information entries. 01103 01104 Arguments: 01105 01106 Handle - handle to the key 01107 PathName - base path name to this key 01108 FirmwareEntry - information from the firmware tree. 01109 01110 Return Value: 01111 01112 None 01113 01114 --*/ 01115 01116 { 01117 OBJECT_ATTRIBUTES objectAttributes; 01118 PCM_RESOURCE_LIST resourceList; 01119 UNICODE_STRING unicodeName; 01120 NTSTATUS status; 01121 HANDLE subKeyHandle; 01122 PWCHAR wcptr; 01123 ULONG disposition; 01124 ULONG buffer; 01125 USHORT originalLength; 01126 01127 // 01128 // Mark that this entry was in the firmware tree. 01129 // 01130 01131 buffer = 1; 01132 RtlInitUnicodeString(&unicodeName, REGSTR_VAL_FIRMWAREIDENTIFIED); 01133 01134 ZwSetValueKey(Handle, 01135 &unicodeName, 01136 0, 01137 REG_DWORD, 01138 &buffer, 01139 sizeof(ULONG)); 01140 01141 // 01142 // Create the control subkey 01143 // 01144 01145 DebugPrint((MAPPER_INFORMATION, 01146 "Mapper: marking existing key\n")); 01147 originalLength = PathName->Length; 01148 wcptr = (PWCHAR) ((PUCHAR)PathName->Buffer + PathName->Length); 01149 wcptr++; // locate eos 01150 01151 // 01152 // Build the volatile control key 01153 // 01154 01155 InitializeObjectAttributes(&objectAttributes, 01156 PathName, 01157 OBJ_CASE_INSENSITIVE, 01158 NULL, 01159 NULL); 01160 RtlAppendUnicodeToString(PathName, L"\\Control"); 01161 status = ZwCreateKey(&subKeyHandle, 01162 KEY_READ | KEY_WRITE, 01163 &objectAttributes, 01164 0, 01165 NULL, 01166 REG_OPTION_VOLATILE, 01167 &disposition); 01168 01169 if (NT_SUCCESS(status)) { 01170 01171 // 01172 // Create the found by firmware volatile. 01173 // 01174 01175 buffer = 1; 01176 RtlInitUnicodeString(&unicodeName, REGSTR_VAL_FIRMWAREMEMBER); 01177 01178 ZwSetValueKey(subKeyHandle, 01179 &unicodeName, 01180 0, 01181 REG_DWORD, 01182 &buffer, 01183 sizeof(ULONG)); 01184 ZwClose(subKeyHandle); 01185 01186 } else { 01187 01188 // 01189 // ignore failures 01190 // 01191 01192 DebugPrint((MAPPER_ERROR, 01193 "Mapper: failed to mark control key %x\n", 01194 status)); 01195 } 01196 01197 // 01198 // if there is a resource descriptor, restore path and open LogConf key. 01199 // 01200 01201 if (FirmwareEntry->ResourceDescriptor) { 01202 PathName->Length = originalLength; 01203 *wcptr = (WCHAR) 0; 01204 01205 InitializeObjectAttributes(&objectAttributes, 01206 PathName, 01207 OBJ_CASE_INSENSITIVE, 01208 NULL, 01209 NULL); 01210 RtlAppendUnicodeToString(PathName, L"\\LogConf"); 01211 status = ZwCreateKey(&subKeyHandle, 01212 KEY_READ | KEY_WRITE, 01213 &objectAttributes, 01214 0, 01215 NULL, 01216 REG_OPTION_VOLATILE, 01217 &disposition); 01218 01219 if (NT_SUCCESS(status)) { 01220 ULONG size; 01221 01222 // 01223 // two entries need to be made: 01224 // BootConfig:REG_RESOURCE_LIST 01225 // BasicConfigVector:REG_RESOURCE_REQUIREMENTS_LIST 01226 // 01227 01228 size = sizeof(CM_RESOURCE_LIST) - 01229 sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + 01230 FirmwareEntry->ResourceDescriptorSize; 01231 01232 resourceList = ExAllocatePool(NonPagedPool, size); 01233 01234 if (resourceList) { 01235 PIO_RESOURCE_REQUIREMENTS_LIST reqList; 01236 01237 resourceList->Count = 1; 01238 RtlMoveMemory(&resourceList->List[0], 01239 FirmwareEntry->ResourceDescriptor, 01240 FirmwareEntry->ResourceDescriptorSize); 01241 01242 resourceList = MapperAdjustResourceList ( 01243 resourceList, 01244 FirmwareEntry->PnPId, 01245 &size 01246 ); 01247 01248 RtlInitUnicodeString(&unicodeName, 01249 L"BootConfig"); 01250 ZwSetValueKey(subKeyHandle, 01251 &unicodeName, 01252 0, 01253 REG_RESOURCE_LIST, 01254 resourceList, 01255 size); 01256 #if 0 01257 // 01258 // Now do the resource requirements list. 01259 // 01260 01261 reqList = IopCmResourcesToIoResources(0, resourceList); 01262 01263 if (reqList) { 01264 RtlInitUnicodeString(&unicodeName, 01265 L"BasicConfigVector"); 01266 ZwSetValueKey(subKeyHandle, 01267 &unicodeName, 01268 0, 01269 REG_RESOURCE_REQUIREMENTS_LIST, 01270 reqList, 01271 reqList->ListSize); 01272 ExFreePool(reqList); 01273 } 01274 #endif 01275 ExFreePool(resourceList); 01276 } 01277 } else { 01278 01279 // 01280 // ignore errors 01281 // 01282 01283 DebugPrint((MAPPER_ERROR, 01284 "Mapper: failed to update logconf key %x\n", 01285 status)); 01286 } 01287 } 01288 01289 // 01290 // Restore path passed in. 01291 // 01292 01293 PathName->Length = originalLength; 01294 *wcptr = (WCHAR) 0; 01295 }

NTSTATUS MapperPeripheralCallback IN PVOID  Context,
IN PUNICODE_STRING  PathName,
IN INTERFACE_TYPE  BusType,
IN ULONG  BusNumber,
IN PKEY_VALUE_FULL_INFORMATION *  BusInformation,
IN CONFIGURATION_TYPE  ControllerType,
IN ULONG  ControllerNumber,
IN PKEY_VALUE_FULL_INFORMATION *  ControllerInformation,
IN CONFIGURATION_TYPE  PeripheralType,
IN ULONG  PeripheralNumber,
IN PKEY_VALUE_FULL_INFORMATION *  PeripheralInformation
 

Definition at line 535 of file mapper.c.

References DebugPrint, ExAllocatePool, ExFreePool(), _FIRMWARE_CONFIGURATION::Identifier, _FIRMWARE_CONFIGURATION::IdentifierLength, _FIRMWARE_CONFIGURATION::IdentifierType, IoQueryDeviceIdentifier, MapperTranslatePnPId(), NonPagedPool, _FIRMWARE_CONFIGURATION::PeripheralNumber, _FIRMWARE_CONFIGURATION::PeripheralType, PeripheralType, PFIRMWARE_CONFIGURATION, and _FIRMWARE_CONFIGURATION::PnPId.

Referenced by MapperCallback().

00551 : 00552 00553 This routine is used to acquire firmware tree information about 00554 pointer devices in the system. 00555 00556 Arguments: 00557 00558 Context - Pointer to the device extension. 00559 PathName - unicode registry path. 00560 BusType - Internal, Isa, ... 00561 BusNumber - Which bus if we are on a multibus system. 00562 BusInformation - Configuration information about the bus. Not Used. 00563 ControllerType - serial or ata disk. 00564 ControllerNumber - Which controller if there is more than one 00565 controller in the system. 00566 ControllerInformation - Array of pointers to the three pieces of 00567 registry information. 00568 PeripheralType - Undefined for this call. 00569 PeripheralNumber - Undefined for this call. 00570 PeripheralInformation - Undefined for this call. 00571 00572 Return Value: 00573 00574 STATUS_SUCCESS if everything went ok, or STATUS_INSUFFICIENT_RESOURCES 00575 if it couldn't map the base csr or acquire the device object, or 00576 all of the resource information couldn't be acquired. 00577 00578 --*/ 00579 00580 { 00581 PFIRMWARE_CONFIGURATION firmwareEntry = Context; 00582 PKEY_VALUE_FULL_INFORMATION information; 00583 ULONG dataLength; 00584 PWCHAR ptr; 00585 PVOID temp; 00586 00587 DebugPrint((MAPPER_REGISTRY, 00588 "Mapper: peripheral registry location is\n %ws\n", 00589 PathName->Buffer)); 00590 00591 if (!ControllerInformation) { 00592 DebugPrint((MAPPER_VERBOSE, 00593 "Mapper: No component information\n")); 00594 } 00595 if (!PeripheralInformation) { 00596 DebugPrint((MAPPER_VERBOSE, 00597 "Mapper: No peripheral information\n")); 00598 return STATUS_SUCCESS; 00599 } 00600 00601 // 00602 // Map the PnP Id for this device. 00603 // 00604 00605 if (PeripheralInformation[IoQueryDeviceIdentifier]) { 00606 information = PeripheralInformation[IoQueryDeviceIdentifier]; 00607 firmwareEntry->PnPId = MapperTranslatePnPId(PeripheralType, information); 00608 00609 if (firmwareEntry->PnPId) { 00610 // 00611 // Remember the peripheral's identifier (if it has one, and it's a REG_SZ value) 00612 // for use as the default PnP device description. 00613 // 00614 00615 if (((dataLength = information->DataLength) > sizeof(WCHAR)) && 00616 (information->Type == REG_SZ)) { 00617 00618 ptr = (PWCHAR) ((PUCHAR)information + information->DataOffset); 00619 00620 if (*ptr) { 00621 temp = ExAllocatePool(NonPagedPool, dataLength); 00622 if (temp) { 00623 00624 // 00625 // If there's already an identifier here (from the peripheral's 00626 // controller) then wipe it out. 00627 // 00628 00629 if(firmwareEntry->Identifier) { 00630 ExFreePool(firmwareEntry->Identifier); 00631 } 00632 00633 // 00634 // Move the data 00635 // 00636 00637 firmwareEntry->Identifier = temp; 00638 firmwareEntry->IdentifierType = information->Type; 00639 firmwareEntry->IdentifierLength = dataLength; 00640 RtlMoveMemory(firmwareEntry->Identifier, ptr, dataLength); 00641 } 00642 } 00643 } 00644 } 00645 } 00646 00647 // 00648 // Save the ordinals for the peripheral type and number 00649 // 00650 00651 firmwareEntry->PeripheralType = PeripheralType; 00652 firmwareEntry->PeripheralNumber = PeripheralNumber; 00653 00654 return STATUS_SUCCESS; 00655 }

VOID MapperPhantomizeDetectedComPorts VOID   ) 
 

Definition at line 2060 of file mapper.c.

References _FIRMWARE_CONFIGURATION::BusNumber, _FIRMWARE_CONFIGURATION::BusType, _FIRMWARE_CONFIGURATION::ControllerNumber, _FIRMWARE_CONFIGURATION::ControllerType, DebugPrint, ENUM_KEY_BUFFER_SIZE, ExAllocatePool, ExFreePool(), _DEVICE_EXTENSION::FirmwareList, INSTANCE_BUFFER_SIZE, L, MapperDeviceExtension, _FIRMWARE_CONFIGURATION::NewlyCreated, _FIRMWARE_CONFIGURATION::Next, NonPagedPool, NT_SUCCESS, NTSTATUS(), NULL, PDEVICE_EXTENSION, _FIRMWARE_CONFIGURATION::PeripheralNumber, _FIRMWARE_CONFIGURATION::PeripheralType, PFIRMWARE_CONFIGURATION, _FIRMWARE_CONFIGURATION::PnPId, regValue(), RtlAppendUnicodeToString(), RtlInitUnicodeString(), and SerialController.

Referenced by IopInitializePlugPlayServices().

02065 : 02066 02067 This routine turns all newly-created firmware/ntdetect COM ports into 02068 phantoms. 02069 02070 Arguments: 02071 02072 None 02073 02074 Return Value: 02075 02076 None 02077 02078 --*/ 02079 { 02080 PFIRMWARE_CONFIGURATION firmwareEntry; 02081 NTSTATUS status; 02082 PWCHAR registryBase; 02083 PWCHAR instanceBuffer; 02084 HANDLE handle; 02085 PWCHAR buffer; 02086 PDEVICE_EXTENSION DeviceExtension = &MapperDeviceExtension; 02087 UNICODE_STRING enumKey; 02088 OBJECT_ATTRIBUTES objectAttributes; 02089 UNICODE_STRING unicodeName; 02090 ULONG regValue; 02091 02092 // 02093 // allocate space needed for the registry path into the root 02094 // enumerator tree. Note, limited size on path length. 02095 // 02096 02097 buffer = ExAllocatePool(NonPagedPool, ENUM_KEY_BUFFER_SIZE); 02098 02099 if (!buffer) { 02100 DebugPrint((MAPPER_ERROR, 02101 "Mapper: could not allocate memory for registry update\n")); 02102 return; 02103 } 02104 02105 instanceBuffer = ExAllocatePool(NonPagedPool, INSTANCE_BUFFER_SIZE); 02106 if (!instanceBuffer) { 02107 ExFreePool(buffer); 02108 DebugPrint((MAPPER_ERROR, 02109 "Mapper: could not allocate memory for instance buffer\n")); 02110 return; 02111 } 02112 02113 InitializeObjectAttributes(&objectAttributes, 02114 &enumKey, 02115 OBJ_CASE_INSENSITIVE, 02116 NULL, 02117 NULL); 02118 02119 #if UMODETEST 02120 registryBase = L"\\Registry\\Machine\\System\\TestControlSet\\Enum\\Root\\"; 02121 #else 02122 registryBase = L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\Root\\"; 02123 #endif 02124 02125 firmwareEntry = DeviceExtension->FirmwareList; 02126 while (firmwareEntry) { 02127 02128 // 02129 // Construct the base for the path for this entry. 02130 // 02131 02132 02133 if ((firmwareEntry->ControllerType == SerialController) && 02134 firmwareEntry->NewlyCreated) { 02135 02136 RtlInitUnicodeString(&enumKey, NULL); 02137 enumKey.MaximumLength = ENUM_KEY_BUFFER_SIZE; 02138 enumKey.Buffer = buffer; 02139 RtlZeroMemory(buffer, ENUM_KEY_BUFFER_SIZE); 02140 RtlAppendUnicodeToString(&enumKey, registryBase); 02141 RtlAppendUnicodeToString(&enumKey, firmwareEntry->PnPId); 02142 02143 // 02144 // Construct the instance name. 02145 // 02146 02147 RtlZeroMemory(instanceBuffer, INSTANCE_BUFFER_SIZE); 02148 swprintf(instanceBuffer, 02149 L"\\%d_%d_%d_%d_%d_%d", 02150 firmwareEntry->BusType, 02151 firmwareEntry->BusNumber, 02152 firmwareEntry->ControllerType, 02153 firmwareEntry->ControllerNumber, 02154 firmwareEntry->PeripheralType, 02155 firmwareEntry->PeripheralNumber); 02156 RtlAppendUnicodeToString(&enumKey, instanceBuffer); 02157 02158 status = ZwOpenKey(&handle, 02159 KEY_READ | KEY_WRITE, 02160 &objectAttributes 02161 ); 02162 02163 if (NT_SUCCESS(status)) { 02164 02165 RtlInitUnicodeString(&unicodeName, REGSTR_VAL_PHANTOM); 02166 regValue = 1; 02167 ZwSetValueKey(handle, 02168 &unicodeName, 02169 0, 02170 REG_DWORD, 02171 &regValue, 02172 sizeof(regValue) 02173 ); 02174 02175 ZwClose(handle); 02176 } 02177 } 02178 02179 firmwareEntry = firmwareEntry->Next; 02180 } 02181 02182 ExFreePool (buffer); 02183 ExFreePool (instanceBuffer); 02184 }

VOID MapperProcessFirmwareTree IN BOOLEAN  OnlyProcessSerialPorts  ) 
 

Definition at line 1009 of file mapper.c.

References CONFIGURATION_TYPE, CONTROLLER_TYPES_COUNT, DebugPrint, DiskController, FloppyDiskPeripheral, IoQueryDeviceDescription(), KeyboardController, MapperCallback(), MapperDeviceExtension, NULL, ParallelController, PointerController, and SerialController.

Referenced by IopInitializePlugPlayServices().

01015 : 01016 01017 Query the information in the firmware tree to know what 01018 system board devices were located. This will cause a FirmwareList 01019 to be created on the device extention passed. 01020 01021 Arguments: 01022 01023 OnlyProcessSerialPorts - if non-zero, then we'll only look at serial ports. 01024 This is done on ACPI machines where, in general, we don't want to pay 01025 attention to ntdetect/firmware information (but we have to for serial 01026 ports so that legacy add-in ISA serial ports and modems are detected 01027 automatically as in previous versions of NT as well as Win9x). 01028 01029 Return Value: 01030 01031 None 01032 01033 --*/ 01034 01035 { 01036 INTERFACE_TYPE interfaceType; 01037 ULONG index; 01038 CONFIGURATION_TYPE sc; 01039 CONFIGURATION_TYPE controllerTypes[] = { PointerController, 01040 KeyboardController, 01041 ParallelController, 01042 DiskController, 01043 FloppyDiskPeripheral, 01044 SerialController // must be last 01045 }; 01046 #define CONTROLLER_TYPES_COUNT (sizeof(controllerTypes) / sizeof(controllerTypes[0])) 01047 01048 // 01049 // Locate all firmware controller information and save its resource usage. 01050 // 01051 // BUGBUG (lonnym)--it's pretty inefficient to be going through all 01052 // interface types, when we really only care about a very small subset of 01053 // non-PnP buses (e.g., ISA, EISA, maybe Internal). 01054 // 01055 01056 for (interfaceType = 0; interfaceType < MaximumInterfaceType; interfaceType++) { 01057 01058 DebugPrint((MAPPER_VERBOSE, 01059 "Mapper: searching on interface ===> %d\n", 01060 interfaceType)); 01061 01062 if(OnlyProcessSerialPorts) { 01063 01064 // 01065 // Start out at the last element of the array, so we only process 01066 // SerialControllers. 01067 // 01068 01069 index = CONTROLLER_TYPES_COUNT - 1; 01070 } else { 01071 index = 0; 01072 } 01073 01074 for ( ; index < CONTROLLER_TYPES_COUNT; index++) { 01075 sc = controllerTypes[index]; 01076 01077 IoQueryDeviceDescription(&interfaceType, 01078 NULL, 01079 &sc, 01080 NULL, 01081 NULL, 01082 NULL, 01083 MapperCallback, 01084 &MapperDeviceExtension); 01085 } 01086 } 01087 }

VOID MapperSeedKey IN HANDLE  Handle,
IN PUNICODE_STRING  PathName,
IN PFIRMWARE_CONFIGURATION  FirmwareEntry,
IN BOOLEAN  DeviceIsPhantom
 

Definition at line 1298 of file mapper.c.

References ASSERT, _KEY_SEED::Attribute, ComPortDBAdd(), DebugPrint, _MAPPER_SEED::DwordValueContent, ExAllocatePool, ExFreePool(), FALSE, Handle, IopOpenDeviceParametersSubkey(), KEY_SEED_DEVICE_PARAMETERS, KeyboardPeripheral, _KEY_SEED::KeyName, L, MapperKeySeed, MapperValueSeed, NonPagedPool, NT_SUCCESS, NTSTATUS(), NULL, _MAPPER_SEED::Options, _KEY_SEED::Options, OPTIONS_INSERT_COMPATIBLE_IDS, OPTIONS_INSERT_DEVICEDESC, OPTIONS_INSERT_PHANTOM_MARKER, OPTIONS_INSERT_PNP_ID, ParallelController, PKEY_SEED, PMAPPER_SEED, PointerPeripheral, PS2_KEYBOARD_COMPATIBLE_ID, PS2_MOUSE_COMPATIBLE_ID, RtlAppendUnicodeToString(), RtlInitUnicodeString(), SEED_BUFFER_SIZE, SerialController, USHORT, _MAPPER_SEED::ValueName, and _MAPPER_SEED::ValueType.

Referenced by MapperConstructRootEnumTree().

01307 : 01308 01309 This routine seeds a registry key with enough information 01310 to get PnP to run the class installer on the devnode. 01311 01312 Arguments: 01313 01314 Handle - handle to the key 01315 01316 PathName - base path name to this key 01317 01318 FirmwareEntry - information from the firmware tree 01319 01320 DeviceIsPhantom - if non-zero, add "Phantom" value entry so the root 01321 enumerator will skip this device instance (i.e., not turn it into a 01322 devnode) 01323 01324 Return Value: 01325 01326 None 01327 01328 --*/ 01329 01330 { 01331 #define SEED_BUFFER_SIZE (512 * sizeof(WCHAR)) 01332 UNICODE_STRING unicodeName; 01333 UNICODE_STRING unicodeValue; 01334 OBJECT_ATTRIBUTES objectAttributes; 01335 PMAPPER_SEED valueSeed; 01336 PKEY_SEED keySeed; 01337 NTSTATUS status; 01338 HANDLE subKeyHandle; 01339 PWCHAR pnpid; 01340 PWCHAR buffer; 01341 PWCHAR wcptr; 01342 ULONG disposition; 01343 ULONG size; 01344 USHORT originalLength; 01345 01346 buffer = ExAllocatePool(NonPagedPool, SEED_BUFFER_SIZE); 01347 if (!buffer) { 01348 return; 01349 } 01350 RtlZeroMemory(buffer, SEED_BUFFER_SIZE); 01351 01352 // 01353 // Create subkeys. 01354 // 01355 01356 originalLength = PathName->Length; 01357 wcptr = (PWCHAR) ((PUCHAR)PathName->Buffer + PathName->Length); 01358 01359 for (keySeed = MapperKeySeed; keySeed->KeyName; keySeed++) { 01360 01361 // 01362 // Reset the base path for the next key to seed. 01363 // 01364 01365 *wcptr = (WCHAR) 0; 01366 PathName->Length = originalLength; 01367 RtlAppendUnicodeToString(PathName, keySeed->KeyName); 01368 01369 // 01370 // Only build a device parameters key if there is something 01371 // to put in the key (i.e., this is a serial or parallel port). 01372 // 01373 01374 if (keySeed->Options & KEY_SEED_DEVICE_PARAMETERS) { 01375 if (((FirmwareEntry->ControllerType != SerialController) && (FirmwareEntry->ControllerType != ParallelController)) || 01376 !FirmwareEntry->Identifier) { 01377 continue; 01378 } 01379 01380 status = IopOpenDeviceParametersSubkey( &subKeyHandle, 01381 NULL, 01382 PathName, 01383 KEY_READ | KEY_WRITE 01384 ); 01385 if (NT_SUCCESS(status)) { 01386 status = STATUS_SUCCESS; 01387 } else { 01388 status = STATUS_UNSUCCESSFUL; 01389 } 01390 } else { 01391 01392 // 01393 // need to construct this key. 01394 // 01395 01396 InitializeObjectAttributes(&objectAttributes, 01397 PathName, 01398 OBJ_CASE_INSENSITIVE, 01399 NULL, 01400 NULL); 01401 status = ZwCreateKey(&subKeyHandle, 01402 KEY_READ | KEY_WRITE, 01403 &objectAttributes, 01404 0, 01405 NULL, 01406 keySeed->Attribute, 01407 &disposition); 01408 } 01409 01410 if (NT_SUCCESS(status)) { 01411 01412 // 01413 // Check to see if this is the parameters key and 01414 // migrate the parameter information. 01415 // 01416 01417 if (keySeed->Options & KEY_SEED_DEVICE_PARAMETERS) { 01418 01419 if (FirmwareEntry->ControllerType == SerialController) { 01420 01421 ComPortDBAdd(subKeyHandle, (PWSTR)FirmwareEntry->Identifier); 01422 } else { 01423 // 01424 // to get here there must be identifier information 01425 // in the FirmwareEntry, so that check is not performed. 01426 // 01427 // NOTE: this will only happen once - when the key is 01428 // created -- perhaps this needs to happen on every 01429 // boot. 01430 // 01431 01432 RtlInitUnicodeString(&unicodeName, 01433 L"PortName"); 01434 ZwSetValueKey(subKeyHandle, 01435 &unicodeName, 01436 0, 01437 FirmwareEntry->IdentifierType, 01438 FirmwareEntry->Identifier, 01439 FirmwareEntry->IdentifierLength); 01440 } 01441 } 01442 ZwClose(subKeyHandle); 01443 } else { 01444 01445 // 01446 // ignore failures 01447 // 01448 01449 DebugPrint((MAPPER_ERROR, 01450 "Mapper: failed to build control key %x\n", 01451 status)); 01452 } 01453 } 01454 01455 // 01456 // Undo the mangling of the path name performed in the loop above. 01457 // 01458 01459 *wcptr = (WCHAR) 0; 01460 PathName->Length = originalLength; 01461 01462 // 01463 // Create values. 01464 // 01465 01466 pnpid = FirmwareEntry->PnPId; 01467 for (valueSeed = MapperValueSeed; valueSeed->ValueName; valueSeed++) { 01468 01469 if (valueSeed->ValueType == REG_DWORD) { 01470 01471 if ((valueSeed->Options == OPTIONS_INSERT_PHANTOM_MARKER) && 01472 !DeviceIsPhantom) { 01473 01474 // 01475 // Device isn't a phantom--we don't want to mark it as such. 01476 // 01477 01478 continue; 01479 } 01480 01481 size = sizeof(ULONG); 01482 RtlMoveMemory(buffer, &valueSeed->DwordValueContent, size); 01483 01484 } else if (valueSeed->Options == OPTIONS_INSERT_PNP_ID) { 01485 01486 size = (wcslen(pnpid) + 2) * sizeof(WCHAR); // eos multi_sz 01487 if (FirmwareEntry->BusType == Eisa) { 01488 01489 // 01490 // need a mult_sz of EISA\PNPblah *PNPblah 01491 // 01492 01493 RtlZeroMemory(buffer, SEED_BUFFER_SIZE); 01494 wcptr = pnpid; 01495 wcptr++; 01496 swprintf(buffer, L"EISA\\%s", wcptr); 01497 01498 wcptr = buffer; 01499 while (*wcptr) { 01500 wcptr++; 01501 } 01502 wcptr++; // step past eos for 1st string 01503 01504 RtlMoveMemory(wcptr, pnpid, size); 01505 01506 size += (ULONG)((PUCHAR)wcptr - (PUCHAR)buffer); 01507 } else { 01508 RtlMoveMemory(buffer, pnpid, size - sizeof(WCHAR)); 01509 buffer[size / sizeof(WCHAR) - 1] = L'\0'; 01510 } 01511 } else if (valueSeed->Options == OPTIONS_INSERT_COMPATIBLE_IDS) { 01512 if (FirmwareEntry->PeripheralType == KeyboardPeripheral) { 01513 size = sizeof(PS2_KEYBOARD_COMPATIBLE_ID); 01514 RtlMoveMemory(buffer, PS2_KEYBOARD_COMPATIBLE_ID, size); 01515 } else if (FirmwareEntry->PeripheralType == PointerPeripheral && 01516 (wcscmp(pnpid, L"*PNP0F0E") == 0 || 01517 wcscmp(pnpid, L"*PNP0F03") == 0 || 01518 wcscmp(pnpid, L"*PNP0F12") == 0)) { 01519 size = sizeof(PS2_MOUSE_COMPATIBLE_ID); 01520 RtlMoveMemory(buffer, PS2_MOUSE_COMPATIBLE_ID, size); 01521 } else { 01522 continue; 01523 } 01524 buffer[size / 2] = L'\0'; // 2nd NUL for MULTI_SZ 01525 size += sizeof(L'\0'); 01526 } else if (valueSeed->Options == OPTIONS_INSERT_DEVICEDESC) { 01527 size = FirmwareEntry->IdentifierLength; 01528 RtlMoveMemory(buffer, FirmwareEntry->Identifier, size); 01529 } else { 01530 DebugPrint((MAPPER_ERROR, "Mapper: NO VALUE TYPE!\n")); 01531 ASSERT(FALSE); 01532 continue; 01533 } 01534 01535 RtlInitUnicodeString(&unicodeName, 01536 valueSeed->ValueName); 01537 ZwSetValueKey(Handle, 01538 &unicodeName, 01539 0, 01540 valueSeed->ValueType, 01541 buffer, 01542 size); 01543 } 01544 ExFreePool(buffer); 01545 }

PWSTR MapperTranslatePnPId CONFIGURATION_TYPE  PeripheralType,
PKEY_VALUE_FULL_INFORMATION  Identifier
 

Definition at line 402 of file mapper.c.

References DebugPrint, DiskController, DiskPeripheral, FloppyDiskPeripheral, FloppyId, KeyboardController, KeyboardMap, KeyboardPeripheral, MapperFindIdentMatch(), NULL, ParallelController, ParallelId, PeripheralType, PFIRMWARE_IDENT_TO_PNP_ID, _FIRMWARE_IDENT_TO_PNP_ID::PnPId, PointerController, PointerMap, PointerPeripheral, SerialController, and SerialId.

Referenced by MapperCallback(), and MapperPeripheralCallback().

00409 : 00410 00411 Given the peripheral type and a location in the firmware tree 00412 this routine will determine the PnP Id to be used when constructing 00413 the root enumeration portion of the registry. 00414 00415 Arguments: 00416 00417 PeripheralType - the type of item being translated (keyboard, mouse, etc) 00418 PathName - the registry path name into the firmware tree for 00419 this device. 00420 00421 Return Value: 00422 00423 A pointer to the PnP Id string if a map is found. 00424 00425 --*/ 00426 00427 { 00428 PFIRMWARE_IDENT_TO_PNP_ID identMap; 00429 PWSTR identifierString; 00430 PWSTR idStr; 00431 00432 if (Identifier) { 00433 identifierString = (PWSTR)((PUCHAR)Identifier + Identifier->DataOffset); 00434 DebugPrint((MAPPER_PNP_ID, 00435 "Mapper: identifier = %ws\n\tType = ", 00436 identifierString)); 00437 } 00438 00439 idStr = NULL; 00440 switch (PeripheralType) { 00441 case DiskController: 00442 DebugPrint((MAPPER_PNP_ID, 00443 "%s (%d)\n", 00444 "DiskController", 00445 PeripheralType)); 00446 idStr = FloppyId; 00447 break; 00448 00449 case SerialController: 00450 DebugPrint((MAPPER_PNP_ID, 00451 "%s (%d)\n", 00452 "SerialController", 00453 PeripheralType)); 00454 idStr = SerialId; 00455 break; 00456 00457 case ParallelController: 00458 DebugPrint((MAPPER_PNP_ID, 00459 "%s (%d)\n", 00460 "ParallelController", 00461 PeripheralType)); 00462 idStr = ParallelId; 00463 break; 00464 00465 case PointerController: 00466 DebugPrint((MAPPER_PNP_ID, 00467 "%s (%d)\n", 00468 "PointerController", 00469 PeripheralType)); 00470 idStr = PointerMap[0].PnPId; 00471 break; 00472 00473 case KeyboardController: 00474 DebugPrint((MAPPER_PNP_ID, 00475 "%s (%d)\n", 00476 "KeyboardController", 00477 PeripheralType)); 00478 idStr = KeyboardMap[0].PnPId; 00479 break; 00480 00481 case DiskPeripheral: 00482 DebugPrint((MAPPER_PNP_ID, 00483 "%s (%d)\n", 00484 "DiskPeripheral", 00485 PeripheralType)); 00486 break; 00487 00488 case FloppyDiskPeripheral: 00489 DebugPrint((MAPPER_PNP_ID, 00490 "%s (%d)\n", 00491 "FloppyDiskPeripheral", 00492 PeripheralType)); 00493 idStr = FloppyId; 00494 break; 00495 00496 case PointerPeripheral: 00497 identMap = MapperFindIdentMatch(PointerMap, identifierString); 00498 if (identMap) { 00499 DebugPrint((MAPPER_PNP_ID, 00500 "%ws\n", 00501 identMap->PnPId)); 00502 idStr = identMap->PnPId; 00503 } else { 00504 DebugPrint((MAPPER_ERROR, 00505 "Mapper: No pointer match found\n")); 00506 } 00507 break; 00508 00509 case KeyboardPeripheral: 00510 identMap = MapperFindIdentMatch(KeyboardMap, identifierString); 00511 00512 if (identMap) { 00513 DebugPrint((MAPPER_PNP_ID, 00514 "%ws\n", 00515 identMap->PnPId)); 00516 idStr = identMap->PnPId; 00517 } else { 00518 DebugPrint((MAPPER_ERROR, 00519 "Mapper: No keyboard match found\n")); 00520 } 00521 00522 break; 00523 00524 default: 00525 DebugPrint((MAPPER_ERROR, 00526 "Mapper: Unknown device (%d)\n", 00527 PeripheralType)); 00528 break; 00529 } 00530 return idStr; 00531 }


Variable Documentation

PWSTR ATAId = L"*PNP0600"
 

Definition at line 238 of file mapper.c.

PWSTR FloppyId = L"*PNP0700"
 

Definition at line 231 of file mapper.c.

Referenced by MapperAdjustResourceList(), and MapperTranslatePnPId().

FIRMWARE_IDENT_TO_PNP_ID KeyboardMap[]
 

Initial value:

{ L"XT_83KEY", L"*PNP0300", L"PCAT_86KEY", L"*PNP0301", L"PCXT_84KEY", L"*PNP0302", L"XT_84KEY", L"*PNP0302", L"101-KEY", L"*PNP0303", L"OLI_83KEY", L"*PNP0304", L"ATT_301", L"*PNP0304", L"OLI_102KEY", L"*PNP0305", L"OLI_86KEY", L"*PNP0306", L"OLI_A101_102KEY", L"*PNP0309", L"ATT_302", L"*PNP030a", L"PCAT_ENHANCED", L"*PNP030b", L"PC98_106KEY", L"*nEC1300", L"PC98_LaptopKEY", L"*nEC1300", L"PC98_N106KEY", L"*PNP0303", NULL, NULL }

Definition at line 129 of file mapper.c.

Referenced by MapperTranslatePnPId().

DEVICE_EXTENSION MapperDeviceExtension
 

Definition at line 122 of file mapper.c.

Referenced by MapperConstructRootEnumTree(), MapperFreeList(), MapperPhantomizeDetectedComPorts(), and MapperProcessFirmwareTree().

KEY_SEED MapperKeySeed[]
 

Initial value:

{ L"\\Control", REG_OPTION_VOLATILE, KEY_SEED_REQUIRED, L"\\LogConf", REG_OPTION_NON_VOLATILE, KEY_SEED_REQUIRED, L"", REG_OPTION_NON_VOLATILE, KEY_SEED_DEVICE_PARAMETERS, NULL, 0, 0 }

Definition at line 194 of file mapper.c.

Referenced by MapperSeedKey().

MAPPER_SEED MapperValueSeed[]
 

Initial value:

{ REGSTR_VAL_HARDWAREID, REG_MULTI_SZ, 0, OPTIONS_INSERT_PNP_ID, REGSTR_VAL_COMPATIBLEIDS, REG_MULTI_SZ, 0, OPTIONS_INSERT_COMPATIBLE_IDS, REGSTR_VAL_FIRMWAREIDENTIFIED, REG_DWORD, 1, OPTIONS_NONE, REGSTR_VAL_DEVDESC, REG_SZ, 0, OPTIONS_INSERT_DEVICEDESC, REGSTR_VAL_PHANTOM, REG_DWORD, 1, OPTIONS_INSERT_PHANTOM_MARKER, NULL, 0, 0, 0 }

Definition at line 176 of file mapper.c.

Referenced by MapperSeedKey().

PWSTR ParallelId = L"*PNP0400"
 

Definition at line 223 of file mapper.c.

Referenced by MapperTranslatePnPId().

PWSTR ParallelIdNEC = L"*nEC1401"
 

Definition at line 225 of file mapper.c.

Referenced by MapperCallback().

FIRMWARE_IDENT_TO_PNP_ID PointerMap[]
 

Initial value:

{ L"PS2 MOUSE", L"*PNP0F0E", L"SERIAL MOUSE", L"*PNP0F0C", L"MICROSOFT PS2 MOUSE", L"*PNP0F03", L"LOGITECH PS2 MOUSE", L"*PNP0F12", L"MICROSOFT INPORT MOUSE", L"*PNP0F02", L"MICROSOFT SERIAL MOUSE", L"*PNP0F01", L"MICROSOFT BALLPOINT SERIAL MOUSE", L"*PNP0F09", L"LOGITECH SERIAL MOUSE", L"*PNP0F08", L"MICROSOFT BUS MOUSE", L"*PNP0F00", L"NEC PC-9800 BUS MOUSE", L"*nEC1F00", NULL, NULL }

Definition at line 156 of file mapper.c.

Referenced by MapperTranslatePnPId().

PWSTR SerialId = L"*PNP0501"
 

Definition at line 206 of file mapper.c.

Referenced by MapperTranslatePnPId(), and UdfSerial32().

PWSTR SerialIdNEC[]
 

Initial value:

{ L"*nEC1500", L"*nEC1501", L"*nEC1502", L"*nEC1503", L"*nEC8071", L"*nEC0C01", NULL }

Definition at line 208 of file mapper.c.

Referenced by MapperCallback().


Generated on Sat May 15 19:44:36 2004 for test by doxygen 1.3.7