45 DPRINT(
"ProcessTargetDeviceEvent(%p)\n", PnpEvent);
47 if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_ARRIVAL, &RpcStatus))
51 DPRINT(
"Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds);
61 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_EJECT_VETOED, &RpcStatus))
63 DPRINT1(
"Eject vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds);
65 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_KERNEL_INITIATED_EJECT, &RpcStatus))
67 DPRINT1(
"Kernel initiated eject: %S\n", PnpEvent->TargetDevice.DeviceIds);
69 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_SAFE_REMOVAL, &RpcStatus))
73 DPRINT1(
"Safe removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
83 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_SURPRISE_REMOVAL, &RpcStatus))
87 DPRINT1(
"Surprise removal: %S\n", PnpEvent->TargetDevice.DeviceIds);
97 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_REMOVAL_VETOED, &RpcStatus))
99 DPRINT1(
"Removal vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds);
101 else if (
UuidEqual(&PnpEvent->EventGuid, (
UUID*)&GUID_DEVICE_REMOVE_PENDING, &RpcStatus))
103 DPRINT1(
"Removal pending: %S\n", PnpEvent->TargetDevice.DeviceIds);
107 DPRINT1(
"Unknown event, GUID {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
108 PnpEvent->EventGuid.Data1, PnpEvent->EventGuid.Data2, PnpEvent->EventGuid.Data3,
109 PnpEvent->EventGuid.Data4[0], PnpEvent->EventGuid.Data4[1], PnpEvent->EventGuid.Data4[2],
110 PnpEvent->EventGuid.Data4[3], PnpEvent->EventGuid.Data4[4], PnpEvent->EventGuid.Data4[5],
111 PnpEvent->EventGuid.Data4[6], PnpEvent->EventGuid.Data4[7]);
121 DPRINT(
"ProcessDeviceClassChangeEvent(%p)\n", PnpEvent);
122 DPRINT(
"SymbolicLink: %S\n", PnpEvent->DeviceClass.SymbolicLinkName);
123 DPRINT(
"ClassGuid: {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n",
124 PnpEvent->DeviceClass.ClassGuid.Data1, PnpEvent->DeviceClass.ClassGuid.Data2, PnpEvent->DeviceClass.ClassGuid.Data3,
125 PnpEvent->DeviceClass.ClassGuid.Data4[0], PnpEvent->DeviceClass.ClassGuid.Data4[1], PnpEvent->DeviceClass.ClassGuid.Data4[2],
126 PnpEvent->DeviceClass.ClassGuid.Data4[3], PnpEvent->DeviceClass.ClassGuid.Data4[4], PnpEvent->DeviceClass.ClassGuid.Data4[5],
127 PnpEvent->DeviceClass.ClassGuid.Data4[6], PnpEvent->DeviceClass.ClassGuid.Data4[7]);
138 DWORD DeviceIdLength;
141 DPRINT(
"ProcessDeviceInstallEvent(%p)\n", PnpEvent);
142 DPRINT(
"Device enumerated: %S\n", PnpEvent->InstallDevice.DeviceId);
144 DeviceIdLength =
lstrlenW(PnpEvent->InstallDevice.DeviceId);
152 wcscpy(
Params->DeviceIds, PnpEvent->InstallDevice.DeviceId);
186 PnpEventSize = 0x1000;
188 if (PnpEvent ==
NULL)
193 DPRINT(
"Calling NtGetPlugPlayEvent()\n");
201 PnpEventSize += 0x400;
203 if (NewPnpEvent ==
NULL)
208 PnpEvent = NewPnpEvent;
214 DPRINT1(
"NtGetPlugPlayEvent() failed (Status 0x%08lx)\n",
Status);
219 DPRINT(
"Received PnP Event\n");
251 sizeof(ResponseData));
254 DPRINT1(
"NtPlugPlayControl(PlugPlayControlUserResponse) failed (Status 0x%08lx)\n",
Status);
static VOID ProcessDeviceClassChangeEvent(_In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
DWORD WINAPI PnpEventThread(_In_ LPVOID lpParameter)
static VOID ProcessTargetDeviceEvent(_In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
static VOID ProcessDeviceInstallEvent(_In_ PPLUGPLAY_EVENT_BLOCK PnpEvent)
HANDLE hDeviceInstallListNotEmpty
HANDLE hDeviceInstallListMutex
LIST_ENTRY DeviceInstallListHead
#define DBT_DEVNODES_CHANGED
#define NT_SUCCESS(StatCode)
#define HeapFree(x, y, z)
#define InsertTailList(ListHead, Entry)
@ TargetDeviceChangeEvent
@ PlugPlayControlUserResponse
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI NtGetPlugPlayEvent(IN ULONG Reserved1, IN ULONG Reserved2, OUT PPLUGPLAY_EVENT_BLOCK Buffer, IN ULONG BufferSize)
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_BUFFER_TOO_SMALL
PLUGPLAY_EVENT_CATEGORY EventCategory
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define FIELD_OFFSET(t, f)
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)