mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[NTOS:PNP] Queue a device change event on interface enable or disable
This commit is contained in:
parent
a64a674980
commit
12a5971b7a
3 changed files with 53 additions and 1 deletions
|
@ -668,6 +668,12 @@ CODE_SEG("INIT")
|
|||
NTSTATUS
|
||||
IopInitPlugPlayEvents(VOID);
|
||||
|
||||
NTSTATUS
|
||||
IopQueueDeviceChangeEvent(
|
||||
_In_ const GUID *EventGuid,
|
||||
_In_ const GUID *InterfaceClassGuid,
|
||||
_In_ PUNICODE_STRING SymbolicLinkName);
|
||||
|
||||
NTSTATUS
|
||||
IopQueueTargetDeviceEvent(
|
||||
const GUID *Guid,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* PROGRAMMERS: Filip Navara (xnavara@volny.cz)
|
||||
* Matthew Brace (ismarc@austin.rr.com)
|
||||
* Hervé Poussineau (hpoussin@reactos.org)
|
||||
* Hervé Poussineau (hpoussin@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
@ -1465,6 +1465,7 @@ IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName,
|
|||
EventGuid = Enable ? &GUID_DEVICE_INTERFACE_ARRIVAL : &GUID_DEVICE_INTERFACE_REMOVAL;
|
||||
|
||||
PiNotifyDeviceInterfaceChange(EventGuid, &DeviceGuid, SymbolicLinkName);
|
||||
IopQueueDeviceChangeEvent(EventGuid, &DeviceGuid, SymbolicLinkName);
|
||||
|
||||
ObDereferenceObject(PhysicalDeviceObject);
|
||||
DPRINT("Status %x\n", Status);
|
||||
|
|
|
@ -48,6 +48,51 @@ IopInitPlugPlayEvents(VOID)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IopQueueDeviceChangeEvent(
|
||||
_In_ const GUID *EventGuid,
|
||||
_In_ const GUID *InterfaceClassGuid,
|
||||
_In_ PUNICODE_STRING SymbolicLinkName)
|
||||
{
|
||||
PPNP_EVENT_ENTRY EventEntry;
|
||||
UNICODE_STRING Copy;
|
||||
ULONG TotalSize;
|
||||
|
||||
/* Allocate a big enough buffer */
|
||||
Copy.Length = 0;
|
||||
Copy.MaximumLength = SymbolicLinkName->Length + sizeof(UNICODE_NULL);
|
||||
TotalSize =
|
||||
FIELD_OFFSET(PLUGPLAY_EVENT_BLOCK, DeviceClass.SymbolicLinkName) +
|
||||
Copy.MaximumLength;
|
||||
|
||||
EventEntry = ExAllocatePool(NonPagedPool,
|
||||
TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
|
||||
if (!EventEntry)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
RtlZeroMemory(EventEntry, TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
|
||||
|
||||
/* Fill the buffer with the event GUID */
|
||||
RtlCopyMemory(&EventEntry->Event.EventGuid, EventGuid, sizeof(GUID));
|
||||
EventEntry->Event.EventCategory = DeviceClassChangeEvent;
|
||||
EventEntry->Event.TotalSize = TotalSize;
|
||||
|
||||
/* Fill the interface class GUID */
|
||||
RtlCopyMemory(&EventEntry->Event.DeviceClass.ClassGuid, InterfaceClassGuid, sizeof(GUID));
|
||||
|
||||
/* Fill the symbolic link name */
|
||||
RtlCopyMemory(&EventEntry->Event.DeviceClass.SymbolicLinkName,
|
||||
SymbolicLinkName->Buffer, SymbolicLinkName->Length);
|
||||
EventEntry->Event.DeviceClass.SymbolicLinkName[SymbolicLinkName->Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
InsertHeadList(&IopPnpEventQueueHead,
|
||||
&EventEntry->ListEntry);
|
||||
KeSetEvent(&IopPnpNotifyEvent,
|
||||
0,
|
||||
FALSE);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IopQueueTargetDeviceEvent(const GUID *Guid,
|
||||
PUNICODE_STRING DeviceIds)
|
||||
|
|
Loading…
Reference in a new issue