144 &DeviceInstanceContext);
162 if (
Name.Length >
Name.MaximumLength)
168 if (
Name.MaximumLength)
209 DPRINT(
"IopInitializeDevice(%p)\n", ControlData);
242 DPRINT1(
"IoCreateDevice() failed (Status 0x%08lx)\n",
Status);
250 DPRINT1(
"Failed to allocate a device node!\n");
260 DPRINT1(
"RtlDuplicateUnicodeString() failed (Status 0x%08lx)\n",
Status);
393 DPRINT(
"IopGetDeviceProperty() called\n");
473 DPRINT(
"Got device capabiliities\n");
500 DPRINT(
"IRP_MN_QUERY_CAPABILITIES failed (Status 0x%08lx)\n",
Status);
568#if (WINVER >= _WIN32_WINNT_WS03)
576#if (WINVER >= _WIN32_WINNT_WIN7)
631 DPRINT(
"IopGetRelatedDevice() called\n");
642 Relation = RelatedDeviceData->
Relation;
707 if (RelatedDeviceNode ==
NULL)
746 DPRINT(
"IopGetRelatedDevice() done\n");
818 ULONG DeviceStatus = 0;
819 ULONG DeviceProblem = 0;
823 DPRINT(
"IopDeviceStatus() called\n");
868 DPRINT(
"Get status data\n");
874 DPRINT1(
"Set status data is NOT SUPPORTED\n");
878 DPRINT1(
"FIXME: Clear status data!\n");
919 DPRINT(
"IopGetDeviceRelations() called\n");
942 DPRINT1(
"IopCaptureUnicodeString() failed (Status 0x%08lx)\n",
Status);
950 DPRINT1(
"IopGetDeviceObjectFromDeviceInstance() returned NULL\n");
984 DPRINT1(
"IopInitiatePnpIrp() failed (Status 0x%08lx)\n",
Status);
990 DPRINT(
"Found %d device relations\n", DeviceRelations->
Count);
998 for (
i = 0;
i < DeviceRelations->
Count;
i++)
1000 ChildDeviceObject = DeviceRelations->
Objects[
i];
1003 if (ChildDeviceNode)
1010 if (BufferLeft < ChildDeviceNode->InstancePath.Length + 2 *
sizeof(
WCHAR))
1047 if (DeviceRelations !=
NULL)
1067 DPRINT(
"IopGetDeviceDepth() called\n");
1263 DPRINT(
"NtGetPlugPlayEvent() called\n");
1268 DPRINT1(
"NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1276 DPRINT1(
"NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1281 DPRINT(
"Waiting for pnp notification event\n");
1289 DPRINT(
"KeWaitForSingleObject() failed (Status %lx)\n",
Status);
1300 if (BufferSize < Entry->
Event.TotalSize)
1302 DPRINT1(
"Buffer is too small for the pnp-event\n");
1310 Entry->Event.TotalSize,
1314 Entry->Event.TotalSize);
1322 DPRINT(
"NtGetPlugPlayEvent() done\n");
1389 DPRINT(
"NtPlugPlayControl(%d %p %lu) called\n",
1395 DPRINT1(
"NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1403 DPRINT1(
"NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1420 switch (PlugPlayControlClass)
1427 PlugPlayControlClass);
1442 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
#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 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
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 EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
#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
#define FILE_AUTOGENERATED_DEVICE_NAME
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)
_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)
#define IopInitDeviceTreeTraverseContext( _DeviceTreeTraverseContext, _DeviceNode, _Action, _Context)
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)
enum _DEVICE_ACTION DEVICE_ACTION
PDRIVER_OBJECT IopRootDriverObject
PDEVICE_NODE IopRootDeviceNode
NTSTATUS PiPerformSyncDeviceAction(_In_ PDEVICE_OBJECT DeviceObject, _In_ DEVICE_ACTION Action)
Perfom a device operation synchronously via PiQueueDeviceAction.
const LUID SeTcbPrivilege
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
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.
#define STATUS_NOT_IMPLEMENTED
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)
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)
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
static NTSTATUS IopInitializeDevice(_In_ PPLUGPLAY_CONTROL_DEVICE_CONTROL_DATA ControlData)
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 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 FILE_DEVICE_CONTROLLER
#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
PLUGPLAY_EVENT_CATEGORY EventCategory
struct _PLUGPLAY_EVENT_BLOCK::@2370::@2373 TargetDevice
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_ 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
@ 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