mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
[NTOSKRNL]
- Fix a horrible casting bug - EventCategoryData1 is a pointer to a GUID not a pointer to a UNICODE_STRING - Convert the GUID into a UNICODE_STRING properly by using RtlStringFromGUID and pass that string to RtlCompareUnicodeString - Fix another bug which results in us sending EventCategoryHardwareProfileChange and EventCategoryTargetDeviceChange events to everyone registered for PnP notifications - Fixes sending EventCategoryDeviceInterfaceChange notifications that happen after calling IoRegisterPlugPlayNotification svn path=/trunk/; revision=47064
This commit is contained in:
parent
04c6b45023
commit
174a4670ea
1 changed files with 18 additions and 2 deletions
|
@ -42,6 +42,8 @@ IopNotifyPlugPlayNotification(
|
|||
PLIST_ENTRY ListEntry;
|
||||
PVOID NotificationStructure;
|
||||
BOOLEAN CallCurrentEntry;
|
||||
UNICODE_STRING GuidString;
|
||||
NTSTATUS Status;
|
||||
|
||||
ASSERT(DeviceObject);
|
||||
|
||||
|
@ -71,6 +73,13 @@ IopNotifyPlugPlayNotification(
|
|||
RtlCopyMemory(&NotificationInfos->Event, Event, sizeof(GUID));
|
||||
RtlCopyMemory(&NotificationInfos->InterfaceClassGuid, EventCategoryData1, sizeof(GUID));
|
||||
NotificationInfos->SymbolicLinkName = (PUNICODE_STRING)EventCategoryData2;
|
||||
Status = RtlStringFromGUID(&NotificationInfos->InterfaceClassGuid, &GuidString);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
KeReleaseGuardedMutex(&PnpNotifyListLock);
|
||||
ExFreePool(NotificationStructure);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EventCategoryHardwareProfileChange:
|
||||
|
@ -125,12 +134,17 @@ IopNotifyPlugPlayNotification(
|
|||
ChangeEntry = CONTAINING_RECORD(ListEntry, PNP_NOTIFY_ENTRY, PnpNotifyList);
|
||||
CallCurrentEntry = FALSE;
|
||||
|
||||
if (ChangeEntry->EventCategory != EventCategory)
|
||||
{
|
||||
ListEntry = ListEntry->Flink;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (EventCategory)
|
||||
{
|
||||
case EventCategoryDeviceInterfaceChange:
|
||||
{
|
||||
if (ChangeEntry->EventCategory == EventCategory
|
||||
&& RtlCompareUnicodeString(&ChangeEntry->Guid, (PUNICODE_STRING)EventCategoryData1, FALSE) == 0)
|
||||
if (RtlCompareUnicodeString(&ChangeEntry->Guid, &GuidString, FALSE) == 0)
|
||||
{
|
||||
CallCurrentEntry = TRUE;
|
||||
}
|
||||
|
@ -174,6 +188,8 @@ IopNotifyPlugPlayNotification(
|
|||
}
|
||||
KeReleaseGuardedMutex(&PnpNotifyListLock);
|
||||
ExFreePoolWithTag(NotificationStructure, TAG_PNP_NOTIFY);
|
||||
if (EventCategory == EventCategoryDeviceInterfaceChange)
|
||||
RtlFreeUnicodeString(&GuidString);
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS **********************************************************/
|
||||
|
|
Loading…
Reference in a new issue