47 {
L"XT_83KEY",
L"*PNP0300\0" },
48 {
L"PCAT_86KEY",
L"*PNP0301\0" },
49 {
L"PCXT_84KEY",
L"*PNP0302\0" },
50 {
L"XT_84KEY",
L"*PNP0302\0" },
51 {
L"101-KEY",
L"*PNP0303\0" },
52 {
L"OLI_83KEY",
L"*PNP0304\0" },
53 {
L"ATT_301",
L"*PNP0304\0" },
54 {
L"OLI_102KEY",
L"*PNP0305\0" },
55 {
L"OLI_86KEY",
L"*PNP0306\0" },
56 {
L"OLI_A101_102KEY",
L"*PNP0309\0" },
57 {
L"ATT_302",
L"*PNP030a\0" },
58 {
L"PCAT_ENHANCED",
L"*PNP030b\0" },
59 {
L"PC98_106KEY",
L"*nEC1300\0" },
60 {
L"PC98_LaptopKEY",
L"*nEC1300\0" },
61 {
L"PC98_N106KEY",
L"*PNP0303\0" },
69 {
L"PS2 MOUSE",
L"*PNP0F0E\0" },
70 {
L"SERIAL MOUSE",
L"*PNP0F0C\0" },
71 {
L"MICROSOFT PS2 MOUSE",
L"*PNP0F03\0" },
72 {
L"LOGITECH PS2 MOUSE",
L"*PNP0F12\0" },
73 {
L"MICROSOFT INPORT MOUSE",
L"*PNP0F02\0" },
74 {
L"MICROSOFT SERIAL MOUSE",
L"*PNP0F01\0" },
75 {
L"MICROSOFT BALLPOINT SERIAL MOUSE",
L"*PNP0F09\0" },
76 {
L"LOGITECH SERIAL MOUSE",
L"*PNP0F08\0" },
77 {
L"MICROSOFT BUS MOUSE",
L"*PNP0F00\0" },
78 {
L"NEC PC-9800 BUS MOUSE",
L"*nEC1F00\0" },
86 {
L"SerialController",
L"*PNP0501\0",
NULL, 0 },
91 {
L"ParallelController",
L"*PNP0400\0",
NULL, 0 },
92 {
L"FloppyDiskPeripheral",
L"*PNP0700\0",
NULL, 0 },
169 if (!BootResources && RelativePath)
175 DPRINT(
"ZwOpenKey() failed with status 0x%08lx\n",
Status);
180 hDevicesKey = hBaseKey;
183 if (!pDeviceInformation)
185 DPRINT(
"ExAllocatePool() failed\n");
194 HANDLE hLevel1Key, hLevel2Key =
NULL, hLogConf;
204 ULONG DeviceIndex = 0;
206 Status = ZwEnumerateKey(hDevicesKey,
221 if (!pDeviceInformation)
223 DPRINT(
"ExAllocatePool() failed\n");
228 Status = ZwEnumerateKey(hDevicesKey,
238 DPRINT(
"ZwEnumerateKey() failed with status 0x%08lx\n",
Status);
257 BootResourcesLength);
266 if (!pValueInformation)
268 DPRINT(
"ExAllocatePool() failed\n");
278 DPRINT(
"ZwOpenKey() failed with status 0x%08lx\n",
Status);
283 Status = ZwQueryValueKey(hDeviceKey,
296 if (!pValueInformation)
298 DPRINT(
"ExAllocatePool() failed\n");
299 ZwDeleteKey(hLevel2Key);
304 Status = ZwQueryValueKey(hDeviceKey,
314 BootResources = ParentBootResources;
315 BootResourcesLength = ParentBootResourcesLength;
319 DPRINT(
"ZwQueryValueKey() failed with status 0x%08lx\n",
Status);
332 if (ParentBootResourcesLength == 0)
333 BootResourcesLength = pValueInformation->
DataLength;
335 BootResourcesLength = ParentBootResourcesLength
342 DPRINT(
"ExAllocatePool() failed\n");
350 else if (ParentBootResources->PartialResourceList.PartialDescriptors[ParentBootResources->PartialResourceList.Count - 1].Type ==
CmResourceTypeDeviceSpecific)
356 ParentBootResourcesLength -
Header);
357 BootResources->PartialResourceList.Count += ParentBootResources->PartialResourceList.Count;
365 ParentBootResourcesLength -
Header);
370 BootResources->PartialResourceList.Count += ParentBootResources->PartialResourceList.Count;
374 if (EnumerateSubKeys)
384 ParentBootResourcesLength);
391 Status = ZwQueryValueKey(hDeviceKey,
404 if (!pValueInformation)
406 DPRINT(
"ExAllocatePool() failed\n");
411 Status = ZwQueryValueKey(hDeviceKey,
423 DPRINT(
"ZwQueryValueKey() failed with status 0x%08lx\n",
Status);
430 DPRINT(
"Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->
Type,
REG_SZ);
446 DPRINT(
"Unknown key path '%wZ' value '%wZ'\n", RelativePath, &
ValueName);
453 HardwareIdKey.
Buffer = pHardwareId;
469 DPRINT(
"ZwCreateKey() failed with status 0x%08lx\n",
Status);
473 swprintf(Level2Name,
L"%04lu", DeviceIndex);
489 DPRINT(
"ZwCreateKey() failed with status 0x%08lx\n",
Status);
493 DPRINT(
"Found %wZ #%lu (%wZ)\n", &
ValueName, DeviceIndex, &HardwareIdKey);
498 DPRINT(
"ZwSetValueKey() failed with status 0x%08lx\n",
Status);
499 ZwDeleteKey(hLevel2Key);
517 DPRINT(
"ZwCreateKey() failed with status 0x%08lx\n",
Status);
518 ZwDeleteKey(hLevel2Key);
531 ZwDeleteKey(hLevel2Key);
544 BootResourcesLength);
547 Status = ZwSetValueKey(hLogConf,
552 BootResourcesLength +
sizeof(
ULONG));
558 DPRINT(
"ZwSetValueKey() failed with status 0x%08lx\n",
Status);
560 ZwDeleteKey(hLevel2Key);
567 if (BootResources && BootResources != ParentBootResources)
570 BootResources =
NULL;
582 if (pValueInformation)
589 if (hDevicesKey && hDevicesKey != hBaseKey)
591 if (pDeviceInformation)
615 Status = ZwQueryValueKey(hPnpKey,
628 Status = ZwQueryValueKey(hPnpKey,
636 KeyValue = (
ULONG)(*KeyInformation->
Data);
640 DPRINT1(
"ZwQueryValueKey(%wZ%wZ) failed\n", &KeyPathU, &KeyNameU);
647 DPRINT1(
"Failed to allocate memory for registry query\n");
652 DPRINT1(
"ZwQueryValueKey(%wZ%wZ) failed with status 0x%08lx\n", &KeyPathU, &KeyNameU,
Status);
659 DPRINT1(
"ZwOpenKey(%wZ) failed with status 0x%08lx\n", &KeyPathU,
Status);
662 DPRINT(
"Firmware mapper is %s\n", KeyValue != 0 ?
"disabled" :
"enabled");
683 DPRINT1(
"ZwCreateKey() failed with status 0x%08lx\n",
Status);
702 DPRINT(
"ZwOpenKey() failed with status 0x%08lx\n",
Status);
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static void cleanup(void)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define ExAllocatePool(type, size)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define CmResourceTypeDeviceSpecific
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_CREATE_SUB_KEY
#define REG_OPTION_NON_VOLATILE
#define REG_RESOURCE_LIST
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define KEY_ENUMERATE_SUB_KEYS
#define REG_OPTION_VOLATILE
#define REG_FULL_RESOURCE_DESCRIPTOR
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI IopOpenRegistryKeyEx(PHANDLE KeyHandle, HANDLE ParentKey, PUNICODE_STRING Name, ACCESS_MASK DesiredAccess)
#define STATUS_NO_MORE_ENTRIES
struct _PNP_DETECT_IDENTIFIER_MAP PNP_DETECT_IDENTIFIER_MAP
static UNICODE_STRING ConfigurationDataU
static NTSTATUS IopEnumerateDetectedDevices(_In_ HANDLE hBaseKey, _In_opt_ PUNICODE_STRING RelativePath, _In_ HANDLE hRootKey, _In_ BOOLEAN EnumerateSubKeys, _In_opt_ PCM_FULL_RESOURCE_DESCRIPTOR BootResources, _In_opt_ ULONG BootResourcesLength, _In_ PCM_FULL_RESOURCE_DESCRIPTOR ParentBootResources, _In_ ULONG ParentBootResourcesLength)
static UNICODE_STRING LogConfU
static UNICODE_STRING BootConfigU
static PNP_DETECT_IDENTIFIER_MAP PnPMap[]
static PNP_MAPPER_DEVICE_ID KeyboardMap[]
static PNP_MAPPER_DEVICE_ID PointerMap[]
static UNICODE_STRING IdentifierU
static PWSTR IopMapDetectedDeviceId(_In_ PUNICODE_STRING DetectId, _In_ PUNICODE_STRING Value, _Out_ PULONG DeviceIndex)
NTSTATUS NTAPI IopUpdateRootKey(VOID)
static BOOLEAN IopIsFirmwareMapperDisabled(VOID)
struct _PNP_MAPPER_DEVICE_ID * PPNP_MAPPER_DEVICE_ID
struct _PNP_MAPPER_DEVICE_ID PNP_MAPPER_DEVICE_ID
static PWSTR IopMapPeripheralId(_In_ PCUNICODE_STRING Value, _In_ PPNP_MAPPER_DEVICE_ID DeviceList)
static UNICODE_STRING HardwareIDU
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PPNP_MAPPER_DEVICE_ID PeripheralMap
#define RTL_CONSTANT_STRING(s)
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_OBJECT_NAME_NOT_FOUND
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value