ReactOS  0.4.15-dev-1397-g19779b3
plugplay.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for plugplay.c:

Go to the source code of this file.

Classes

struct  _PNP_EVENT_ENTRY
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _PNP_EVENT_ENTRY PNP_EVENT_ENTRY
 
typedef struct _PNP_EVENT_ENTRYPPNP_EVENT_ENTRY
 

Functions

NTSTATUS IopInitPlugPlayEvents (VOID)
 
NTSTATUS IopQueueTargetDeviceEvent (const GUID *Guid, PUNICODE_STRING DeviceIds)
 
static PDEVICE_OBJECT IopTraverseDeviceNode (PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance)
 
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance (PUNICODE_STRING DeviceInstance)
 
static NTSTATUS IopCaptureUnicodeString (PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
 
static NTSTATUS IopPnpEnumerateDevice (PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA DeviceData)
 
static NTSTATUS IopRemovePlugPlayEvent (_In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData)
 
static NTSTATUS IopGetInterfaceDeviceList (PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList)
 
static NTSTATUS IopGetDeviceProperty (PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
 
static NTSTATUS IopGetRelatedDevice (PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
 
static ULONG IopGetDeviceNodeStatus (PDEVICE_NODE DeviceNode)
 
static NTSTATUS IopDeviceStatus (PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
 
static NTSTATUS IopGetDeviceRelations (PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA RelationsData)
 
static NTSTATUS IopGetDeviceDepth (PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
 
static NTSTATUS IopResetDevice (PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData)
 
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)
 

Variables

static LIST_ENTRY IopPnpEventQueueHead
 
static KEVENT IopPnpNotifyEvent
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file plugplay.c.

Typedef Documentation

◆ PNP_EVENT_ENTRY

◆ PPNP_EVENT_ENTRY

Function Documentation

◆ IopCaptureUnicodeString()

static NTSTATUS IopCaptureUnicodeString ( PUNICODE_STRING  DstName,
PUNICODE_STRING  SrcName 
)
static

Definition at line 143 of file plugplay.c.

144 {
146  volatile UNICODE_STRING Name;
147 
148  Name.Buffer = NULL;
149  _SEH2_TRY
150  {
151  Name.Length = SrcName->Length;
152  Name.MaximumLength = SrcName->MaximumLength;
153  if (Name.Length > Name.MaximumLength)
154  {
156  _SEH2_LEAVE;
157  }
158 
159  if (Name.MaximumLength)
160  {
161  ProbeForRead(SrcName->Buffer,
162  Name.MaximumLength,
163  sizeof(WCHAR));
164  Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
165  if (Name.Buffer == NULL)
166  {
168  _SEH2_LEAVE;
169  }
170 
171  memcpy(Name.Buffer, SrcName->Buffer, Name.MaximumLength);
172  }
173 
174  *DstName = Name;
175  }
177  {
178  if (Name.Buffer)
179  {
180  ExFreePool(Name.Buffer);
181  }
183  }
184  _SEH2_END;
185 
186  return Status;
187 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4226
struct NameRec_ * Name
Definition: cdprocs.h:459
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define _SEH2_LEAVE
Definition: filesup.c:20
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by IopDeviceStatus(), IopGetDeviceDepth(), IopGetDeviceProperty(), IopGetDeviceRelations(), IopGetInterfaceDeviceList(), IopGetRelatedDevice(), IopPnpEnumerateDevice(), and IopResetDevice().

◆ IopDeviceStatus()

static NTSTATUS IopDeviceStatus ( PPLUGPLAY_CONTROL_STATUS_DATA  StatusData)
static

Definition at line 741 of file plugplay.c.

742 {
745  ULONG Operation = 0;
746  ULONG DeviceStatus = 0;
747  ULONG DeviceProblem = 0;
750 
751  DPRINT("IopDeviceStatus() called\n");
752 
754  if (!NT_SUCCESS(Status))
755  {
756  return Status;
757  }
758 
759  DPRINT("Device name: '%wZ'\n", &DeviceInstance);
760 
761  _SEH2_TRY
762  {
763  Operation = StatusData->Operation;
765  {
766  DeviceStatus = StatusData->DeviceStatus;
767  DeviceProblem = StatusData->DeviceProblem;
768  }
769  }
771  {
772  if (DeviceInstance.Buffer != NULL)
773  {
775  }
777  }
778  _SEH2_END;
779 
780  /* Get the device object */
782  if (DeviceInstance.Buffer != NULL)
783  {
785  }
786  if (DeviceObject == NULL)
787  {
788  return STATUS_NO_SUCH_DEVICE;
789  }
790 
792 
793  switch (Operation)
794  {
796  DPRINT("Get status data\n");
797  DeviceStatus = IopGetDeviceNodeStatus(DeviceNode);
798  DeviceProblem = DeviceNode->Problem;
799  break;
800 
802  DPRINT1("Set status data is NOT SUPPORTED\n");
803  break;
804 
806  DPRINT1("FIXME: Clear status data!\n");
807  break;
808  }
809 
811 
813  {
814  _SEH2_TRY
815  {
816  StatusData->DeviceStatus = DeviceStatus;
817  StatusData->DeviceProblem = DeviceProblem;
818  }
820  {
822  }
823  _SEH2_END;
824  }
825 
826  return Status;
827 }
static ULONG IopGetDeviceNodeStatus(PDEVICE_NODE DeviceNode)
Definition: plugplay.c:693
LONG NTSTATUS
Definition: precomp.h:26
#define PNP_SET_DEVICE_STATUS
Definition: cmtypes.h:60
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:513
_SEH2_TRY
Definition: create.c:4226
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PNP_GET_DEVICE_STATUS
Definition: cmtypes.h:59
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
Definition: Node.h:9
#define PNP_CLEAR_DEVICE_STATUS
Definition: cmtypes.h:61
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)

Referenced by NtPlugPlayControl().

◆ IopGetDeviceDepth()

static NTSTATUS IopGetDeviceDepth ( PPLUGPLAY_CONTROL_DEPTH_DATA  DepthData)
static

Definition at line 988 of file plugplay.c.

989 {
994 
995  DPRINT("IopGetDeviceDepth() called\n");
996  DPRINT("Device name: %wZ\n", &DepthData->DeviceInstance);
997 
999  if (!NT_SUCCESS(Status))
1000  {
1001  return Status;
1002  }
1003 
1004  /* Get the device object */
1006  if (DeviceInstance.Buffer != NULL)
1007  {
1009  }
1010  if (DeviceObject == NULL)
1011  {
1012  return STATUS_NO_SUCH_DEVICE;
1013  }
1014 
1016 
1017  _SEH2_TRY
1018  {
1019  DepthData->Depth = DeviceNode->Level;
1020  }
1022  {
1024  }
1025  _SEH2_END;
1026 
1028 
1029  return Status;
1030 }
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4226
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
Definition: Node.h:9
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
UNICODE_STRING DeviceInstance
Definition: cmtypes.h:522
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)

Referenced by NtPlugPlayControl().

◆ IopGetDeviceNodeStatus()

static ULONG IopGetDeviceNodeStatus ( PDEVICE_NODE  DeviceNode)
static

Definition at line 693 of file plugplay.c.

694 {
695  ULONG Output = 0;
696 
697  if (DeviceNode->Parent == IopRootDeviceNode)
699 
700  if (DeviceNode->Flags & DNF_ADDED)
702 
703  /* FIXME: DN_ENUM_LOADED */
704 
705  if (DeviceNode->Flags & DNF_STARTED)
706  Output |= DN_STARTED;
707 
708  /* FIXME: Manual */
709 
710  if (!(DeviceNode->Flags & DNF_PROCESSED))
712 
713  /* DN_NOT_FIRST_TIME is 9x only */
714 
715  /* FIXME: DN_HARDWARE_ENUM */
716 
717  /* DN_LIAR and DN_HAS_MARK are 9x only */
718 
719  if (DeviceNode->Problem != 0)
721 
722  /* FIXME: DN_FILTERED */
723 
724  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
726 
727  if (DeviceNode->UserFlags & DNUF_DONT_SHOW_IN_UI)
729 
730  if (!(DeviceNode->UserFlags & DNUF_NOT_DISABLEABLE))
732 
733  /* FIXME: Implement the rest */
734 
736 
737  return Output;
738 }
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
#define DNF_PROCESSED
Definition: iotypes.h:167
#define DNUF_NOT_DISABLEABLE
Definition: iotypes.h:204
#define DN_ROOT_ENUMERATED
Definition: cfg.h:118
#define DN_NEED_TO_ENUM
Definition: cfg.h:123
#define DN_DRIVER_LOADED
Definition: cfg.h:119
#define DN_DISABLEABLE
Definition: cfg.h:131
#define DNUF_DONT_SHOW_IN_UI
Definition: iotypes.h:203
#define DN_NO_SHOW_IN_DM
Definition: cfg.h:148
#define DNF_STARTED
Definition: iotypes.h:168
#define DN_HAS_PROBLEM
Definition: cfg.h:128
#define DN_NT_DRIVER
Definition: cfg.h:142
#define DN_NT_ENUMERATOR
Definition: cfg.h:141
Definition: Node.h:9
Definition: arc.h:85
#define DNF_LEGACY_DRIVER
Definition: iotypes.h:181
#define DN_LEGACY_DRIVER
Definition: cfg.h:155
#define DN_STARTED
Definition: cfg.h:121
unsigned int ULONG
Definition: retypes.h:1
#define DNF_ADDED
Definition: iotypes.h:179

Referenced by IopDeviceStatus().

◆ IopGetDeviceObjectFromDeviceInstance()

PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance ( PUNICODE_STRING  DeviceInstance)

Definition at line 122 of file plugplay.c.

123 {
124  if (IopRootDeviceNode == NULL)
125  return NULL;
126 
127  if (DeviceInstance == NULL ||
128  DeviceInstance->Length == 0)
129  {
131  {
134  }
135  else
136  return NULL;
137  }
138 
140 }
PDEVICE_OBJECT PhysicalDeviceObject
Definition: iotypes.h:839
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
static PDEVICE_OBJECT IopTraverseDeviceNode(PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:93
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
#define NULL
Definition: types.h:112
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by IopActionInterrogateDeviceStack(), IopDeviceStatus(), IopGetDeviceDepth(), IopGetDeviceProperty(), IopGetDeviceRelations(), IopGetInterfaceDeviceList(), IopGetRelatedDevice(), IopPnpEnumerateDevice(), IopResetDevice(), and IoSetDeviceInterfaceState().

◆ IopGetDeviceProperty()

static NTSTATUS IopGetDeviceProperty ( PPLUGPLAY_CONTROL_PROPERTY_DATA  PropertyData)
static

Definition at line 329 of file plugplay.c.

330 {
335  ULONG Property;
337  PVOID Buffer;
339 
340  DPRINT("IopGetDeviceProperty() called\n");
341  DPRINT("Device name: %wZ\n", &PropertyData->DeviceInstance);
342 
344  if (!NT_SUCCESS(Status))
345  {
346  return Status;
347  }
348 
349  _SEH2_TRY
350  {
351  Property = PropertyData->Property;
352  BufferSize = PropertyData->BufferSize;
353  ProbeForWrite(PropertyData->Buffer,
354  BufferSize,
355  sizeof(UCHAR));
356  }
358  {
359  if (DeviceInstance.Buffer != NULL)
360  {
362  }
364  }
365  _SEH2_END;
366 
367  /* Get the device object */
369  if (DeviceInstance.Buffer != NULL)
370  {
372  }
373  if (DeviceObject == NULL)
374  {
375  return STATUS_NO_SUCH_DEVICE;
376  }
377 
379  if (Buffer == NULL)
380  {
383  }
384 
385 
386  DeviceNode = ((PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension)->DeviceNode;
387 
389  {
390  if (BufferSize < sizeof(CM_POWER_DATA))
391  {
392  BufferSize = 0;
394  }
395  else
396  {
398  PCM_POWER_DATA PowerData;
401 
402  PowerData = (PCM_POWER_DATA)Buffer;
403  RtlZeroMemory(PowerData, sizeof(CM_POWER_DATA));
404  PowerData->PD_Size = sizeof(CM_POWER_DATA);
405 
408  DeviceCapabilities.Version = 1;
409  DeviceCapabilities.Address = -1;
410  DeviceCapabilities.UINumber = -1;
411 
412  Stack.Parameters.DeviceCapabilities.Capabilities = &DeviceCapabilities;
413 
415  &IoStatusBlock,
417  &Stack);
418  if (NT_SUCCESS(Status))
419  {
420  DPRINT("Got device capabiliities\n");
421 
422  PowerData->PD_MostRecentPowerState = PowerDeviceD0; // FIXME
423  if (DeviceCapabilities.DeviceD1)
424  PowerData->PD_Capabilities |= PDCAP_D1_SUPPORTED;
425  if (DeviceCapabilities.DeviceD2)
426  PowerData->PD_Capabilities |= PDCAP_D2_SUPPORTED;
427  if (DeviceCapabilities.WakeFromD0)
429  if (DeviceCapabilities.WakeFromD1)
431  if (DeviceCapabilities.WakeFromD2)
433  if (DeviceCapabilities.WakeFromD3)
435  if (DeviceCapabilities.WarmEjectSupported)
437  PowerData->PD_D1Latency = DeviceCapabilities.D1Latency;
438  PowerData->PD_D2Latency = DeviceCapabilities.D2Latency;
439  PowerData->PD_D3Latency = DeviceCapabilities.D3Latency;
441  &DeviceCapabilities.DeviceState,
442  sizeof(DeviceCapabilities.DeviceState));
443  PowerData->PD_DeepestSystemWake = DeviceCapabilities.SystemWake;
444  }
445  else
446  {
447  DPRINT("IRP_MN_QUERY_CAPABILITIES failed (Status 0x%08lx)\n", Status);
448 
451  }
452  }
453  }
455  {
456  }
458  {
459  if (BufferSize < sizeof(DeviceNode->HardwareRemovalPolicy))
460  {
461  BufferSize = 0;
463  }
464  else
465  {
466  BufferSize = sizeof(DeviceNode->HardwareRemovalPolicy);
468  &DeviceNode->HardwareRemovalPolicy,
469  BufferSize);
470  }
471  }
472  else
473  {
474  switch (Property)
475  {
478  break;
479 
482  break;
483 
486  break;
487 
490  break;
491 
494  break;
495 
498  break;
499 
502  break;
503 
506  break;
507 
510  break;
511 
512 #if (WINVER >= _WIN32_WINNT_WS03)
514  break;
515 #endif
516 
517 #if (WINVER >= _WIN32_WINNT_WIN7)
520  break;
521 #endif
522 
523  default:
524  BufferSize = 0;
526  break;
527  }
528 
529  if (Status == STATUS_SUCCESS)
530  {
533  BufferSize,
534  Buffer,
535  &BufferSize);
536  }
537  }
538 
540 
541  if (NT_SUCCESS(Status))
542  {
543  _SEH2_TRY
544  {
546  PropertyData->BufferSize = BufferSize;
547  }
549  {
551  }
552  _SEH2_END;
553  }
554 
556  return Status;
557 }
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1177
#define PNP_PROPERTY_POWER_DATA
Definition: cmtypes.h:39
#define PDCAP_WARM_EJECT_SUPPORTED
Definition: advprop.cpp:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PDCAP_D1_SUPPORTED
Definition: advprop.cpp:37
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
LONG NTSTATUS
Definition: precomp.h:26
DEVICE_CAPABILITIES
Definition: iotypes.h:948
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_SEH2_TRY
Definition: create.c:4226
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define PDCAP_D2_SUPPORTED
Definition: advprop.cpp:38
ULONG PD_D2Latency
Definition: advprop.cpp:52
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
#define PNP_PROPERTY_BUSTYPEGUID
Definition: cmtypes.h:36
#define DeviceCapabilities
Definition: wingdi.h:4448
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:2096
#define PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT
Definition: cmtypes.h:44
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define PDCAP_D3_SUPPORTED
Definition: advprop.cpp:39
#define PNP_PROPERTY_ADDRESS
Definition: cmtypes.h:42
ULONG PD_D3Latency
Definition: advprop.cpp:53
Status
Definition: gdiplustypes.h:24
#define PNP_PROPERTY_LOCATION_PATHS
Definition: cmtypes.h:46
#define PNP_PROPERTY_ENUMERATOR_NAME
Definition: cmtypes.h:43
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define PNP_PROPERTY_REMOVAL_POLICY
Definition: cmtypes.h:40
#define ObDereferenceObject
Definition: obfuncs.h:203
Definition: Node.h:9
#define PNP_PROPERTY_UI_NUMBER
Definition: cmtypes.h:34
#define PNP_PROPERTY_REMOVAL_POLICY_OVERRIDE
Definition: cmtypes.h:41
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME
Definition: cmtypes.h:35
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
#define PDCAP_WAKE_FROM_D1_SUPPORTED
Definition: advprop.cpp:41
_In_ DWORD Property
Definition: setupapi.h:1545
SYSTEM_POWER_STATE PD_DeepestSystemWake
Definition: advprop.cpp:55
_SEH2_END
Definition: create.c:4400
ULONG PD_D1Latency
Definition: advprop.cpp:51
struct CM_Power_Data_s CM_POWER_DATA
struct CM_Power_Data_s * PCM_POWER_DATA
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define PNP_PROPERTY_LEGACYBUSTYPE
Definition: cmtypes.h:37
#define NULL
Definition: types.h:112
DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum]
Definition: advprop.cpp:54
#define PNP_PROPERTY_INSTALL_STATE
Definition: cmtypes.h:45
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define PDCAP_WAKE_FROM_D0_SUPPORTED
Definition: advprop.cpp:40
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define PNP_PROPERTY_BUSNUMBER
Definition: cmtypes.h:38
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
DEVICE_POWER_STATE PD_MostRecentPowerState
Definition: advprop.cpp:49
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define PDCAP_WAKE_FROM_D2_SUPPORTED
Definition: advprop.cpp:42
#define PNP_PROPERTY_CONTAINERID
Definition: cmtypes.h:47
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
#define PDCAP_WAKE_FROM_D3_SUPPORTED
Definition: advprop.cpp:43
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
ULONG PD_Capabilities
Definition: advprop.cpp:50
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
#define PDCAP_D0_SUPPORTED
Definition: advprop.cpp:36
#define IRP_MN_QUERY_CAPABILITIES

Referenced by NtPlugPlayControl().

◆ IopGetDeviceRelations()

static NTSTATUS IopGetDeviceRelations ( PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA  RelationsData)
static

Definition at line 831 of file plugplay.c.

832 {
837  PDEVICE_RELATIONS DeviceRelations = NULL;
838  PDEVICE_OBJECT ChildDeviceObject;
839  PDEVICE_NODE ChildDeviceNode;
840  ULONG i;
841  ULONG Relations;
843  ULONG BufferLeft;
844  PWCHAR Buffer, Ptr;
846 
847  DPRINT("IopGetDeviceRelations() called\n");
848  DPRINT("Device name: %wZ\n", &RelationsData->DeviceInstance);
849  DPRINT("Relations: %lu\n", RelationsData->Relations);
850  DPRINT("BufferSize: %lu\n", RelationsData->BufferSize);
851  DPRINT("Buffer: %p\n", RelationsData->Buffer);
852 
853  _SEH2_TRY
854  {
855  Relations = RelationsData->Relations;
856  BufferSize = RelationsData->BufferSize;
857  Buffer = RelationsData->Buffer;
858 
859  ProbeForWrite(Buffer, BufferSize, sizeof(CHAR));
860  }
862  {
864  }
865  _SEH2_END;
866 
868  if (!NT_SUCCESS(Status))
869  {
870  DPRINT1("IopCaptureUnicodeString() failed (Status 0x%08lx)\n", Status);
871  return Status;
872  }
873 
874  /* Get the device object */
876  if (DeviceObject == NULL)
877  {
878  DPRINT1("IopGetDeviceObjectFromDeviceInstance() returned NULL\n");
880  goto done;
881  }
882 
883  switch (Relations)
884  {
885  case PNP_EJECT_RELATIONS:
886  Stack.Parameters.QueryDeviceRelations.Type = EjectionRelations;
887  break;
888 
890  Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations;
891  break;
892 
893  case PNP_POWER_RELATIONS:
894  Stack.Parameters.QueryDeviceRelations.Type = PowerRelations;
895  break;
896 
897  case PNP_BUS_RELATIONS:
898  Stack.Parameters.QueryDeviceRelations.Type = BusRelations;
899  break;
900 
901  default:
903  goto done;
904  }
905 
907  &IoStatusBlock,
909  &Stack);
910  if (!NT_SUCCESS(Status))
911  {
912  DPRINT1("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status);
913  goto done;
914  }
915 
916  DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
917 
918  DPRINT("Found %d device relations\n", DeviceRelations->Count);
919 
920  _SEH2_TRY
921  {
922  RequiredSize = 0;
923  BufferLeft = BufferSize;
924  Ptr = Buffer;
925 
926  for (i = 0; i < DeviceRelations->Count; i++)
927  {
928  ChildDeviceObject = DeviceRelations->Objects[i];
929 
930  ChildDeviceNode = IopGetDeviceNode(ChildDeviceObject);
931  if (ChildDeviceNode)
932  {
933  DPRINT("Device instance: %wZ\n", &ChildDeviceNode->InstancePath);
934  DPRINT("RequiredSize: %hu\n", ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
935 
936  if (Ptr != NULL)
937  {
938  if (BufferLeft < ChildDeviceNode->InstancePath.Length + 2 * sizeof(WCHAR))
939  {
941  break;
942  }
943 
945  ChildDeviceNode->InstancePath.Buffer,
946  ChildDeviceNode->InstancePath.Length);
947  Ptr = (PWCHAR)((ULONG_PTR)Ptr + ChildDeviceNode->InstancePath.Length);
948  *Ptr = UNICODE_NULL;
949  Ptr = (PWCHAR)((ULONG_PTR)Ptr + sizeof(WCHAR));
950 
951  BufferLeft -= (ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
952  }
953 
954  RequiredSize += (ChildDeviceNode->InstancePath.Length + sizeof(WCHAR));
955  }
956  }
957 
958  if (Ptr != NULL && BufferLeft >= sizeof(WCHAR))
959  *Ptr = UNICODE_NULL;
960 
961  if (RequiredSize > 0)
962  RequiredSize += sizeof(WCHAR);
963 
964  DPRINT("BufferSize: %lu RequiredSize: %lu\n", RelationsData->BufferSize, RequiredSize);
965 
966  RelationsData->BufferSize = RequiredSize;
967  }
969  {
971  }
972  _SEH2_END;
973 
974 done:
975  if (DeviceRelations != NULL)
976  ExFreePool(DeviceRelations);
977 
978  if (DeviceObject != NULL)
980 
981  if (DeviceInstance.Buffer != NULL)
983 
984  return Status;
985 }
#define PNP_REMOVAL_RELATIONS
Definition: cmtypes.h:67
#define PNP_POWER_RELATIONS
Definition: cmtypes.h:68
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2143
char CHAR
Definition: xmlstorage.h:175
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define PNP_BUS_RELATIONS
Definition: cmtypes.h:69
uint16_t * PWCHAR
Definition: typedefs.h:56
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define UNICODE_NULL
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
UNICODE_STRING InstancePath
Definition: iotypes.h:842
_SEH2_END
Definition: create.c:4400
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
Definition: glfuncs.h:248
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define NULL
Definition: types.h:112
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define PNP_EJECT_RELATIONS
Definition: cmtypes.h:66
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PDEVICE_NODE FASTCALL IopGetDeviceNode(IN PDEVICE_OBJECT DeviceObject)
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by NtPlugPlayControl().

◆ IopGetInterfaceDeviceList()

static NTSTATUS IopGetInterfaceDeviceList ( PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA  DeviceList)
static

Definition at line 251 of file plugplay.c.

252 {
257  GUID FilterGuid;
258  PZZWSTR SymbolicLinkList = NULL, LinkList;
260 
261  _SEH2_TRY
262  {
264 
265  ProbeForRead(StackList.FilterGuid, sizeof(GUID), sizeof(UCHAR));
266  RtlCopyMemory(&FilterGuid, StackList.FilterGuid, sizeof(GUID));
267 
268  if (StackList.Buffer != NULL && StackList.BufferSize != 0)
269  {
270  ProbeForWrite(StackList.Buffer, StackList.BufferSize, sizeof(UCHAR));
271  }
272  }
274  {
276  }
277  _SEH2_END;
278 
280  if (NT_SUCCESS(Status))
281  {
282  /* Get the device object */
284  if (DeviceInstance.Buffer != NULL)
285  {
287  }
288  }
289 
290  Status = IoGetDeviceInterfaces(&FilterGuid, DeviceObject, StackList.Flags, &SymbolicLinkList);
292 
293  if (!NT_SUCCESS(Status))
294  {
295  /* failed */
296  return Status;
297  }
298 
299  LinkList = SymbolicLinkList;
300  while (*SymbolicLinkList != UNICODE_NULL)
301  {
302  SymbolicLinkList += wcslen(SymbolicLinkList) + (sizeof(UNICODE_NULL) / sizeof(WCHAR));
303  }
304  TotalLength = ((SymbolicLinkList - LinkList + 1) * sizeof(WCHAR));
305 
306  _SEH2_TRY
307  {
308  if (StackList.Buffer != NULL &&
309  StackList.BufferSize >= TotalLength)
310  {
311  // We've already probed the buffer for writing above.
312  RtlCopyMemory(StackList.Buffer, LinkList, TotalLength);
313  }
314 
315  DeviceList->BufferSize = TotalLength;
316  }
318  {
319  ExFreePool(LinkList);
321  }
322  _SEH2_END;
323 
324  ExFreePool(LinkList);
325  return STATUS_SUCCESS;
326 }
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI IoGetDeviceInterfaces(IN CONST GUID *InterfaceClassGuid, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN ULONG Flags, OUT PWSTR *SymbolicLinkList)
Definition: deviface.c:454
PDEVICE_LIST DeviceList
Definition: utils.c:27
_NullNull_terminated_ WCHAR * PZZWSTR
Definition: ntbasedef.h:421
_In_ ULONG TotalLength
Definition: usbdlib.h:158
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4226
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define UNICODE_NULL
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
Status
Definition: gdiplustypes.h:24
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ObDereferenceObject
Definition: obfuncs.h:203
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NtPlugPlayControl().

◆ IopGetRelatedDevice()

static NTSTATUS IopGetRelatedDevice ( PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA  RelatedDeviceData)
static

Definition at line 561 of file plugplay.c.

562 {
563  UNICODE_STRING RootDeviceName;
566  PDEVICE_NODE RelatedDeviceNode;
567  UNICODE_STRING TargetDeviceInstance;
569  ULONG Relation = 0;
570  ULONG MaximumLength = 0;
571 
572  DPRINT("IopGetRelatedDevice() called\n");
573  DPRINT("Device name: %wZ\n", &RelatedDeviceData->TargetDeviceInstance);
574 
575  Status = IopCaptureUnicodeString(&TargetDeviceInstance, &RelatedDeviceData->TargetDeviceInstance);
576  if (!NT_SUCCESS(Status))
577  {
578  return Status;
579  }
580 
581  _SEH2_TRY
582  {
583  Relation = RelatedDeviceData->Relation;
584  MaximumLength = RelatedDeviceData->RelatedDeviceInstanceLength;
585  ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance,
587  sizeof(WCHAR));
588  }
590  {
591  if (TargetDeviceInstance.Buffer != NULL)
592  {
593  ExFreePool(TargetDeviceInstance.Buffer);
594  }
596  }
597  _SEH2_END;
598 
599  RtlInitUnicodeString(&RootDeviceName,
600  L"HTREE\\ROOT\\0");
601  if (RtlEqualUnicodeString(&TargetDeviceInstance,
602  &RootDeviceName,
603  TRUE))
604  {
606  if (TargetDeviceInstance.Buffer != NULL)
607  {
608  ExFreePool(TargetDeviceInstance.Buffer);
609  }
610  }
611  else
612  {
613  /* Get the device object */
614  DeviceObject = IopGetDeviceObjectFromDeviceInstance(&TargetDeviceInstance);
615  if (TargetDeviceInstance.Buffer != NULL)
616  {
617  ExFreePool(TargetDeviceInstance.Buffer);
618  }
619  if (DeviceObject == NULL)
620  return STATUS_NO_SUCH_DEVICE;
621 
622  DeviceNode = ((PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension)->DeviceNode;
623  }
624 
625  switch (Relation)
626  {
628  RelatedDeviceNode = DeviceNode->Parent;
629  break;
630 
632  RelatedDeviceNode = DeviceNode->Child;
633  break;
634 
636  RelatedDeviceNode = DeviceNode->Sibling;
637  break;
638 
639  default:
640  if (DeviceObject != NULL)
641  {
643  }
644 
646  }
647 
648  if (RelatedDeviceNode == NULL)
649  {
650  if (DeviceObject)
651  {
653  }
654 
655  return STATUS_NO_SUCH_DEVICE;
656  }
657 
658  if (RelatedDeviceNode->InstancePath.Length > MaximumLength)
659  {
660  if (DeviceObject)
661  {
663  }
664 
666  }
667 
668  /* Copy related device instance name */
669  _SEH2_TRY
670  {
671  RtlCopyMemory(RelatedDeviceData->RelatedDeviceInstance,
672  RelatedDeviceNode->InstancePath.Buffer,
673  RelatedDeviceNode->InstancePath.Length);
674  RelatedDeviceData->RelatedDeviceInstanceLength = RelatedDeviceNode->InstancePath.Length;
675  }
677  {
679  }
680  _SEH2_END;
681 
682  if (DeviceObject != NULL)
683  {
685  }
686 
687  DPRINT("IopGetRelatedDevice() done\n");
688 
689  return Status;
690 }
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define PNP_GET_SIBLING_DEVICE
Definition: cmtypes.h:54
LONG NTSTATUS
Definition: precomp.h:26
#define PNP_GET_PARENT_DEVICE
Definition: cmtypes.h:52
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_SEH2_TRY
Definition: create.c:4226
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
Definition: Node.h:9
static const WCHAR L[]
Definition: oid.c:1250
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
#define PNP_GET_CHILD_DEVICE
Definition: cmtypes.h:53
UNICODE_STRING InstancePath
Definition: iotypes.h:842
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NtPlugPlayControl().

◆ IopInitPlugPlayEvents()

NTSTATUS IopInitPlugPlayEvents ( VOID  )

Definition at line 31 of file plugplay.c.

32 {
34 
37  FALSE);
38 
39  return STATUS_SUCCESS;
40 }
static LIST_ENTRY IopPnpEventQueueHead
Definition: plugplay.c:24
#define FALSE
Definition: types.h:117
static KEVENT IopPnpNotifyEvent
Definition: plugplay.c:25
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by IopInitializePlugPlayServices().

◆ IopPnpEnumerateDevice()

static NTSTATUS IopPnpEnumerateDevice ( PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA  DeviceData)
static

Definition at line 190 of file plugplay.c.

191 {
195 
197  if (!NT_SUCCESS(Status))
198  {
199  return Status;
200  }
201 
202  DPRINT("IopPnpEnumerateDevice(%wZ)\n", &DeviceInstance);
203 
204  /* Get the device object */
206  if (DeviceInstance.Buffer != NULL)
207  {
209  }
210  if (DeviceObject == NULL)
211  {
212  return STATUS_NO_SUCH_DEVICE;
213  }
214 
216 
218 
219  return Status;
220 }
LONG NTSTATUS
Definition: precomp.h:26
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
NTSTATUS PiPerformSyncDeviceAction(_In_ PDEVICE_OBJECT DeviceObject, _In_ DEVICE_ACTION Action)
Perfom a device operation synchronously via PiQueueDeviceAction.
Definition: devaction.c:2533
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NtPlugPlayControl().

◆ IopQueueTargetDeviceEvent()

NTSTATUS IopQueueTargetDeviceEvent ( const GUID Guid,
PUNICODE_STRING  DeviceIds 
)

Definition at line 43 of file plugplay.c.

45 {
46  PPNP_EVENT_ENTRY EventEntry;
48  ULONG TotalSize;
50 
51  ASSERT(DeviceIds);
52 
53  /* Allocate a big enough buffer */
54  Copy.Length = 0;
55  Copy.MaximumLength = DeviceIds->Length + sizeof(UNICODE_NULL);
56  TotalSize =
58  Copy.MaximumLength;
59 
60  EventEntry = ExAllocatePool(NonPagedPool,
61  TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
62  if (!EventEntry)
64  RtlZeroMemory(EventEntry, TotalSize + FIELD_OFFSET(PNP_EVENT_ENTRY, Event));
65 
66  /* Fill the buffer with the event GUID */
67  RtlCopyMemory(&EventEntry->Event.EventGuid,
68  Guid,
69  sizeof(GUID));
71  EventEntry->Event.TotalSize = TotalSize;
72 
73  /* Fill the device id */
74  Copy.Buffer = EventEntry->Event.TargetDevice.DeviceIds;
76  if (!NT_SUCCESS(Status))
77  {
78  ExFreePool(EventEntry);
79  return Status;
80  }
81 
83  &EventEntry->ListEntry);
85  0,
86  FALSE);
87 
88  return STATUS_SUCCESS;
89 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:688
Definition: plugplay.c:15
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
LONG NTSTATUS
Definition: precomp.h:26
PLUGPLAY_EVENT_BLOCK Event
Definition: plugplay.c:18
static LIST_ENTRY IopPnpEventQueueHead
Definition: plugplay.c:24
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
PLUGPLAY_EVENT_CATEGORY EventCategory
Definition: cmtypes.h:406
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
static KEVENT IopPnpNotifyEvent
Definition: plugplay.c:25
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:760
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:126
LIST_ENTRY ListEntry
Definition: plugplay.c:17
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _PLUGPLAY_EVENT_BLOCK::@2354::@2357 TargetDevice
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by IoInvalidateDeviceState(), IopActionInterrogateDeviceStack(), IopHandleDeviceRemoval(), IopInitializePlugPlayServices(), IopQueryRemoveDevice(), IopRemoveDevice(), IoReportDetectedDevice(), IoRequestDeviceEject(), and PipEnumerateDevice().

◆ IopRemovePlugPlayEvent()

static NTSTATUS IopRemovePlugPlayEvent ( _In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA  ResponseData)
static

Definition at line 229 of file plugplay.c.

231 {
232  /* Remove a pnp event entry from the tail of the queue */
234  {
236  }
237 
238  /* Signal the next pnp event in the queue */
240  {
242  0,
243  FALSE);
244  }
245 
246  return STATUS_SUCCESS;
247 }
Definition: plugplay.c:15
FORCEINLINE PLIST_ENTRY RemoveTailList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:154
static LIST_ENTRY IopPnpEventQueueHead
Definition: plugplay.c:24
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define FALSE
Definition: types.h:117
static KEVENT IopPnpNotifyEvent
Definition: plugplay.c:25
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NtPlugPlayControl().

◆ IopResetDevice()

static NTSTATUS IopResetDevice ( PPLUGPLAY_CONTROL_RESET_DEVICE_DATA  ResetDeviceData)
static

Definition at line 1034 of file plugplay.c.

1035 {
1037  NTSTATUS Status;
1039 
1041  if (!NT_SUCCESS(Status))
1042  {
1043  return Status;
1044  }
1045 
1046  DPRINT("IopResetDevice(%wZ)\n", &DeviceInstance);
1047 
1048  /* Get the device object */
1050  if (DeviceInstance.Buffer != NULL)
1051  {
1053  }
1054  if (DeviceObject == NULL)
1055  {
1056  return STATUS_NO_SUCH_DEVICE;
1057  }
1058 
1060 
1062 
1063  return Status;
1064 }
LONG NTSTATUS
Definition: precomp.h:26
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
PDEVICE_OBJECT IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:122
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define ObDereferenceObject
Definition: obfuncs.h:203
static NTSTATUS IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
Definition: plugplay.c:143
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
NTSTATUS PiPerformSyncDeviceAction(_In_ PDEVICE_OBJECT DeviceObject, _In_ DEVICE_ACTION Action)
Perfom a device operation synchronously via PiQueueDeviceAction.
Definition: devaction.c:2533
#define NULL
Definition: types.h:112
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by NtPlugPlayControl().

◆ IopTraverseDeviceNode()

static PDEVICE_OBJECT IopTraverseDeviceNode ( PDEVICE_NODE  Node,
PUNICODE_STRING  DeviceInstance 
)
static

Definition at line 93 of file plugplay.c.

94 {
96  PDEVICE_NODE ChildNode;
97 
98  if (RtlEqualUnicodeString(&Node->InstancePath,
100  {
101  ObReferenceObject(Node->PhysicalDeviceObject);
102  return Node->PhysicalDeviceObject;
103  }
104 
105  /* Traversal of all children nodes */
106  for (ChildNode = Node->Child;
107  ChildNode != NULL;
108  ChildNode = ChildNode->Sibling)
109  {
111  if (DeviceObject != NULL)
112  {
113  return DeviceObject;
114  }
115  }
116 
117  return NULL;
118 }
#define TRUE
Definition: types.h:120
static PDEVICE_OBJECT IopTraverseDeviceNode(PDEVICE_NODE Node, PUNICODE_STRING DeviceInstance)
Definition: plugplay.c:93
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PNDIS_STRING DeviceInstance
Definition: ndis.h:5202
#define NULL
Definition: types.h:112
struct _DEVICE_NODE * Sibling
Definition: iotypes.h:823
#define ObReferenceObject
Definition: obfuncs.h:204
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
Definition: dlist.c:348

Referenced by IopGetDeviceObjectFromDeviceInstance().

◆ NtGetPlugPlayEvent()

NTSTATUS NTAPI NtGetPlugPlayEvent ( IN ULONG  Reserved1,
IN ULONG  Reserved2,
OUT PPLUGPLAY_EVENT_BLOCK  Buffer,
IN ULONG  BufferSize 
)

Definition at line 1129 of file plugplay.c.

1133 {
1135  NTSTATUS Status;
1136 
1137  DPRINT("NtGetPlugPlayEvent() called\n");
1138 
1139  /* Function can only be called from user-mode */
1140  if (KeGetPreviousMode() == KernelMode)
1141  {
1142  DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1143  return STATUS_ACCESS_DENIED;
1144  }
1145 
1146  /* Check for Tcb privilege */
1148  UserMode))
1149  {
1150  DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1152  }
1153 
1154  /* Wait for a PnP event */
1155  DPRINT("Waiting for pnp notification event\n");
1157  UserRequest,
1158  UserMode,
1159  FALSE,
1160  NULL);
1162  {
1163  DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status);
1165  return Status;
1166  }
1167 
1168  /* Get entry from the tail of the queue */
1171  ListEntry);
1172 
1173  /* Check the buffer size */
1174  if (BufferSize < Entry->Event.TotalSize)
1175  {
1176  DPRINT1("Buffer is too small for the pnp-event\n");
1177  return STATUS_BUFFER_TOO_SMALL;
1178  }
1179 
1180  /* Copy event data to the user buffer */
1181  _SEH2_TRY
1182  {
1184  Entry->Event.TotalSize,
1185  sizeof(UCHAR));
1187  &Entry->Event,
1188  Entry->Event.TotalSize);
1189  }
1191  {
1193  }
1194  _SEH2_END;
1195 
1196  DPRINT("NtGetPlugPlayEvent() done\n");
1197 
1198  return STATUS_SUCCESS;
1199 }
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
struct _Entry Entry
Definition: kefuncs.h:627
Definition: plugplay.c:15
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
#define KeGetPreviousMode()
Definition: ketypes.h:1107
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:520
static LIST_ENTRY IopPnpEventQueueHead
Definition: plugplay.c:24
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_SEH2_TRY
Definition: create.c:4226
#define FALSE
Definition: types.h:117
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
static KEVENT IopPnpNotifyEvent
Definition: plugplay.c:25
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Status
Definition: gdiplustypes.h:24
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
unsigned char UCHAR
Definition: xmlstorage.h:181
const LUID SeTcbPrivilege
Definition: priv.c:24
#define STATUS_USER_APC
Definition: ntstatus.h:78
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
base of all file and directory entries
Definition: entries.h:82
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by PnpEventThread().

◆ NtPlugPlayControl()

NTSTATUS NTAPI NtPlugPlayControl ( IN PLUGPLAY_CONTROL_CLASS  PlugPlayControlClass,
IN OUT PVOID  Buffer,
IN ULONG  BufferLength 
)

Definition at line 1259 of file plugplay.c.

1262 {
1263  DPRINT("NtPlugPlayControl(%d %p %lu) called\n",
1264  PlugPlayControlClass, Buffer, BufferLength);
1265 
1266  /* Function can only be called from user-mode */
1267  if (KeGetPreviousMode() == KernelMode)
1268  {
1269  DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
1270  return STATUS_ACCESS_DENIED;
1271  }
1272 
1273  /* Check for Tcb privilege */
1275  UserMode))
1276  {
1277  DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
1279  }
1280 
1281  /* Probe the buffer */
1282  _SEH2_TRY
1283  {
1285  BufferLength,
1286  sizeof(ULONG));
1287  }
1289  {
1291  }
1292  _SEH2_END;
1293 
1294  switch (PlugPlayControlClass)
1295  {
1298  return STATUS_INVALID_PARAMETER;
1300 
1301 // case PlugPlayControlRegisterNewDevice:
1302 // case PlugPlayControlDeregisterDevice:
1303 // case PlugPlayControlInitializeDevice:
1304 // case PlugPlayControlStartDevice:
1305 // case PlugPlayControlUnlockDevice:
1306 // case PlugPlayControlQueryAndRemoveDevice:
1307 
1310  return STATUS_INVALID_PARAMETER;
1312 
1313 // case PlugPlayControlGenerateLegacyDevice:
1314 
1317  return STATUS_INVALID_PARAMETER;
1319 
1322  return STATUS_INVALID_PARAMETER;
1324 
1325 // case PlugPlayControlDeviceClassAssociation:
1326 
1329  return STATUS_INVALID_PARAMETER;
1331 
1332 // case PlugPlayControlGetInterfaceDeviceAlias:
1333 
1336  return STATUS_INVALID_PARAMETER;
1338 
1341  return STATUS_INVALID_PARAMETER;
1343 
1346  return STATUS_INVALID_PARAMETER;
1348 
1349 // case PlugPlayControlTargetDeviceRelation:
1350 // case PlugPlayControlQueryConflictList:
1351 // case PlugPlayControlRetrieveDock:
1352 
1355  return STATUS_INVALID_PARAMETER;
1357 
1358 // case PlugPlayControlHaltDevice:
1359 // case PlugPlayControlGetBlockedDriverList:
1360 
1361  default:
1362  return STATUS_NOT_IMPLEMENTED;
1363  }
1364 
1365  return STATUS_NOT_IMPLEMENTED;
1366 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
static NTSTATUS IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
Definition: plugplay.c:561
static NTSTATUS IopResetDevice(PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData)
Definition: plugplay.c:1034
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define KeGetPreviousMode()
Definition: ketypes.h:1107
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:520
static NTSTATUS IopGetDeviceRelations(PPLUGPLAY_CONTROL_DEVICE_RELATIONS_DATA RelationsData)
Definition: plugplay.c:831
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
static NTSTATUS IopRemovePlugPlayEvent(_In_ PPLUGPLAY_CONTROL_USER_RESPONSE_DATA ResponseData)
Definition: plugplay.c:229
_SEH2_TRY
Definition: create.c:4226
static NTSTATUS IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
Definition: plugplay.c:329
return STATUS_NOT_IMPLEMENTED
static NTSTATUS IopPnpEnumerateDevice(PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA DeviceData)
Definition: plugplay.c:190
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
static NTSTATUS IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
Definition: plugplay.c:741
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
static NTSTATUS IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
Definition: plugplay.c:988
const LUID SeTcbPrivilege
Definition: priv.c:24
_SEH2_END
Definition: create.c:4400
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
static NTSTATUS IopGetInterfaceDeviceList(PPLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA DeviceList)
Definition: plugplay.c:251

Referenced by ClearDeviceStatus(), DisableDeviceInstance(), EnableDeviceInstance(), GetDeviceStatus(), GetRelationsInstanceList(), GetRelationsInstanceListSize(), PNP_GetDepth(), PNP_GetDeviceRegProp(), PNP_GetInterfaceDeviceList(), PNP_GetInterfaceDeviceListSize(), PNP_GetRelatedDeviceInstance(), PNP_QueryRemove(), PNP_RequestDeviceEject(), PNP_RequestEjectPC(), PnpEventThread(), ReenumerateDeviceInstance(), ResetDevice(), and SetDeviceStatus().

Variable Documentation

◆ IopPnpEventQueueHead

LIST_ENTRY IopPnpEventQueueHead
static

◆ IopPnpNotifyEvent

KEVENT IopPnpNotifyEvent
static