125 DeviceId->Buffer, DeviceId->Length);
232 &DeviceInstanceContext);
250 if (
Name.Length >
Name.MaximumLength)
256 if (
Name.MaximumLength)
298 DPRINT(
"PiControlInitializeDevice(%p)\n", ControlData);
324 DPRINT1(
"IoCreateDevice() failed (Status 0x%08lx)\n",
Status);
332 DPRINT1(
"Failed to allocate a device node!\n");
346 DPRINT1(
"RtlDuplicateUnicodeString() failed (Status 0x%08lx)\n",
Status);
359 DPRINT1(
"Failed to create the instance key! (Status %lx)\n",
Status);
502 DPRINT(
"IopGetDeviceProperty() called\n");
582 DPRINT(
"Got device capabiliities\n");
609 DPRINT(
"IRP_MN_QUERY_CAPABILITIES failed (Status 0x%08lx)\n",
Status);
677#if (WINVER >= _WIN32_WINNT_WS03)
685#if (WINVER >= _WIN32_WINNT_WIN7)
740 DPRINT(
"IopGetRelatedDevice() called\n");
751 Relation = RelatedDeviceData->
Relation;
816 if (RelatedDeviceNode ==
NULL)
855 DPRINT(
"IopGetRelatedDevice() done\n");
927 ULONG DeviceStatus = 0;
928 ULONG DeviceProblem = 0;
932 DPRINT(
"IopDeviceStatus() called\n");
977 DPRINT(
"Get status data\n");
983 DPRINT1(
"Set status data is NOT SUPPORTED\n");
987 DPRINT1(
"FIXME: Clear status data!\n");
1028 DPRINT(
"IopGetDeviceRelations() called\n");
1051 DPRINT1(
"IopCaptureUnicodeString() failed (Status 0x%08lx)\n",
Status);
1059 DPRINT1(
"IopGetDeviceObjectFromDeviceInstance() returned NULL\n");
1093 DPRINT1(
"IopInitiatePnpIrp() failed (Status 0x%08lx)\n",
Status);
1099 DPRINT(
"Found %d device relations\n", DeviceRelations->
Count);
1107 for (
i = 0;
i < DeviceRelations->
Count;
i++)
1109 ChildDeviceObject = DeviceRelations->
Objects[
i];
1112 if (ChildDeviceNode)
1119 if (BufferLeft < ChildDeviceNode->InstancePath.Length + 2 *
sizeof(
WCHAR))
1156 if (DeviceRelations !=
NULL)
1176 DPRINT(
"IopGetDeviceDepth() called\n");
1372 DPRINT(
"NtGetPlugPlayEvent() called\n");
1377 DPRINT1(
"NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1385 DPRINT1(
"NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1390 DPRINT(
"Waiting for pnp notification event\n");
1398 DPRINT(
"KeWaitForSingleObject() failed (Status %lx)\n",
Status);
1409 if (BufferSize < Entry->
Event.TotalSize)
1411 DPRINT1(
"Buffer is too small for the pnp-event\n");
1419 Entry->Event.TotalSize,
1423 Entry->Event.TotalSize);
1431 DPRINT(
"NtGetPlugPlayEvent() done\n");
1498 DPRINT(
"NtPlugPlayControl(%d %p %lu) called\n",
1504 DPRINT1(
"NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1512 DPRINT1(
"NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1529 switch (PlugPlayControlClass)
1536 PlugPlayControlClass);
1551 PlugPlayControlClass);
#define STATUS_PRIVILEGE_NOT_HELD
struct CM_Power_Data_s * PCM_POWER_DATA
#define PDCAP_WARM_EJECT_SUPPORTED
#define PDCAP_D2_SUPPORTED
struct CM_Power_Data_s CM_POWER_DATA
#define PDCAP_D0_SUPPORTED
#define PDCAP_D1_SUPPORTED
#define PDCAP_WAKE_FROM_D3_SUPPORTED
#define PDCAP_WAKE_FROM_D1_SUPPORTED
#define PDCAP_WAKE_FROM_D0_SUPPORTED
#define PDCAP_D3_SUPPORTED
#define PDCAP_WAKE_FROM_D2_SUPPORTED
static BOOL InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard)
#define DN_DRIVER_BLOCKED
#define DN_CHILD_WITH_INVALID_ID
#define DN_WILL_BE_REMOVED
#define DN_ROOT_ENUMERATED
#define DN_PRIVATE_PROBLEM
static const WCHAR ControlClass[]
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
static const WCHAR DeviceInstance[]
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
#define RemoveTailList(ListHead)
#define InitializeListHead(ListHead)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
#define ExAllocatePool(type, size)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID EventGuid
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 RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
#define EXCEPTION_EXECUTE_HANDLER
#define memcpy(s1, s2, n)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define KeGetPreviousMode()
#define PNP_PROPERTY_UI_NUMBER
#define PNP_SET_DEVICE_STATUS
#define PNP_PROPERTY_REMOVAL_POLICY
enum _PLUGPLAY_CONTROL_CLASS PLUGPLAY_CONTROL_CLASS
#define PNP_GET_SIBLING_DEVICE
#define PNP_PROPERTY_POWER_DATA
#define PNP_GET_PARENT_DEVICE
#define PNP_PROPERTY_ENUMERATOR_NAME
#define PNP_GET_CHILD_DEVICE
@ TargetDeviceChangeEvent
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME
@ PlugPlayControlEnumerateDevice
@ PlugPlayControlUserResponse
@ PlugPlayControlProperty
@ PlugPlayControlQueryDeviceRelations
@ PlugPlayControlGetRelatedDevice
@ PlugPlayControlDeviceStatus
@ PlugPlayControlQueryAndRemoveDevice
@ PlugPlayControlGetDeviceDepth
@ PlugPlayControlInitializeDevice
@ PlugPlayControlGetInterfaceDeviceList
@ PlugPlayControlStartDevice
@ PlugPlayControlResetDevice
#define PNP_POWER_RELATIONS
#define PNP_PROPERTY_INSTALL_STATE
#define PNP_BUS_RELATIONS
#define PNP_PROPERTY_LOCATION_PATHS
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT
#define PNP_PROPERTY_REMOVAL_POLICY_OVERRIDE
#define PNP_CLEAR_DEVICE_STATUS
#define PNP_PROPERTY_LEGACYBUSTYPE
#define PNP_GET_DEVICE_STATUS
#define PNP_PROPERTY_BUSTYPEGUID
#define PNP_REMOVAL_RELATIONS
#define PNP_PROPERTY_ADDRESS
#define PNP_PROPERTY_BUSNUMBER
#define PNP_EJECT_RELATIONS
#define PNP_PROPERTY_CONTAINERID
#define DNUF_WILL_BE_REMOVED
#define DNF_LEGACY_DRIVER
@ DeviceNodeRestartCompletion
@ DeviceNodeStartPostWork
@ DeviceNodeStartCompletion
@ DeviceNodeEnumerateCompletion
@ DeviceNodeEnumeratePending
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
#define DNUF_NOT_DISABLEABLE
#define DNF_HAS_PRIVATE_PROBLEM
#define DNUF_DONT_SHOW_IN_UI
#define DNF_CHILD_WITH_INVALID_ID
#define DNF_DRIVER_BLOCKED
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define REG_OPTION_NON_VOLATILE
_NullNull_terminated_ WCHAR * PZZWSTR
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)
VOID PiInsertDevNode(_In_ PDEVICE_NODE DeviceNode, _In_ PDEVICE_NODE ParentNode)
PDEVICE_NODE PipAllocateDeviceNode(IN PDEVICE_OBJECT PhysicalDeviceObject)
NTSTATUS NTAPI IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath, IN ULONG CreateOptions, OUT PHANDLE Handle)
#define IopInitDeviceTreeTraverseContext( _DeviceTreeTraverseContext, _DeviceNode, _Action, _Context)
NTSTATUS PnpRootRegisterDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS IopTraverseDeviceTree(PDEVICETREE_TRAVERSE_CONTEXT Context)
NTSTATUS IopFreeDeviceNode(IN PDEVICE_NODE DeviceNode)
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
PNP_DEVNODE_STATE PiSetDevNodeState(_In_ PDEVICE_NODE DeviceNode, _In_ PNP_DEVNODE_STATE NewState)
enum _DEVICE_ACTION DEVICE_ACTION
PDEVICE_NODE IopRootDeviceNode
NTSTATUS PiPerformSyncDeviceAction(_In_ PDEVICE_OBJECT DeviceObject, _In_ DEVICE_ACTION Action)
Perfom a device operation synchronously via PiQueueDeviceAction.
NTSTATUS PnpRootCreateDeviceObject(OUT PDEVICE_OBJECT *DeviceObject)
const LUID SeTcbPrivilege
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
struct _IOP_FIND_DEVICE_INSTANCE_TRAVERSE_CONTEXT IOP_FIND_DEVICE_INSTANCE_TRAVERSE_CONTEXT
static BOOLEAN PiIsDevNodeStarted(_In_ PDEVICE_NODE DeviceNode)
static NTSTATUS IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
NTSTATUS IopQueueTargetDeviceEvent(const GUID *Guid, PUNICODE_STRING DeviceIds)
NTSTATUS IopInitPlugPlayEvents(VOID)
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
static NTSTATUS PiControlQueryRemoveDevice(_In_ PPLUGPLAY_CONTROL_QUERY_REMOVE_DATA ControlData)
static NTSTATUS IopRemovePlugPlayEvent(_In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData)
NTSTATUS IopSetDeviceInstanceData(HANDLE InstanceKey, PDEVICE_NODE DeviceNode)
NTSTATUS IopQueueDeviceInstallEvent(_In_ const GUID *EventGuid, _In_ PUNICODE_STRING DeviceId)
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
static NTSTATUS IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
struct _PNP_EVENT_ENTRY * PPNP_EVENT_ENTRY
static ULONG IopGetDeviceNodeStatus(PDEVICE_NODE DeviceNode)
NTSTATUS IopFindDeviceInstanceTraverse(_In_ PDEVICE_NODE DeviceNode, _Inout_ PVOID Context)
static NTSTATUS IopGetInterfaceDeviceList(PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList)
static NTSTATUS IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
static LIST_ENTRY IopPnpEventQueueHead
NTSTATUS NTAPI NtGetPlugPlayEvent(IN ULONG Reserved1, IN ULONG Reserved2, OUT PPLUGPLAY_EVENT_BLOCK Buffer, IN ULONG BufferSize)
NTSTATUS IopQueueDeviceChangeEvent(_In_ const GUID *EventGuid, _In_ const GUID *InterfaceClassGuid, _In_ PUNICODE_STRING SymbolicLinkName)
static NTSTATUS PiControlSyncDeviceAction(_In_ PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA DeviceData, _In_ PLUGPLAY_CONTROL_CLASS ControlClass)
struct _IOP_FIND_DEVICE_INSTANCE_TRAVERSE_CONTEXT * PIOP_FIND_DEVICE_INSTANCE_TRAVERSE_CONTEXT
NTSTATUS NTAPI NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength)
static NTSTATUS IopGetDeviceRelations(PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA RelationsData)
static NTSTATUS IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
static NTSTATUS PiControlInitializeDevice(_In_ PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ControlData)
static KEVENT IopPnpNotifyEvent
struct _PNP_EVENT_ENTRY PNP_EVENT_ENTRY
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define STATUS_BUFFER_TOO_SMALL
SYSTEM_POWER_STATE PD_DeepestSystemWake
DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum]
DEVICE_POWER_STATE PD_MostRecentPowerState
base of all file and directory entries
PDEVICE_OBJECT PhysicalDeviceObject
UNICODE_STRING InstancePath
PDEVICE_OBJECT Objects[1]
PDEVICE_OBJECT DeviceObject
PCUNICODE_STRING InstancePath
struct _LIST_ENTRY * Blink
UNICODE_STRING DeviceInstance
UNICODE_STRING DeviceInstance
UNICODE_STRING DeviceInstance
UNICODE_STRING DeviceInstance
WCHAR SymbolicLinkName[ANYSIZE_ARRAY]
struct _PLUGPLAY_EVENT_BLOCK::@2402::@2405 TargetDevice
PLUGPLAY_EVENT_CATEGORY EventCategory
struct _PLUGPLAY_EVENT_BLOCK::@2402::@2404 DeviceClass
struct _PLUGPLAY_EVENT_BLOCK::@2402::@2406 InstallDevice
PLUGPLAY_EVENT_BLOCK Event
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
#define DeviceCapabilities
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
_In_ CONST GUID * InterfaceClassGuid
#define DO_BUS_ENUMERATED_DEVICE
@ DevicePropertyEnumeratorName
@ DevicePropertyInstallState
@ DevicePropertyBusNumber
@ DevicePropertyRemovalPolicy
@ DevicePropertyPhysicalDeviceObjectName
@ DevicePropertyLegacyBusType
@ DevicePropertyContainerID
@ DevicePropertyBusTypeGuid
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_CAPABILITIES
#define ObDereferenceObject
#define ObReferenceObject