ReactOS  0.4.15-dev-2991-g632fa1c
fxdevice.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxDevice.hpp
8 
9 Abstract:
10 
11  This is the definition of the FxDevice object.
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Both kernel and user mode
20 
21 Revision History:
22 
23 --*/
24 
25 #ifndef _FXDEVICE_H_
26 #define _FXDEVICE_H_
27 
28 #include "fxcxdeviceinit.hpp"
29 #include "fxdeviceinit.hpp"
30 #include "fxtelemetry.hpp"
31 
33 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
34  WUDF_IO_REMOVE_LOCK IoRemoveLock;
35 #else
37 #endif
39 };
40 
41 //
42 // The following enum is used in serializing packet based DMA transactions.
43 // According to the DDK docs:
44 // Only one DMA request can be queued for a device object at any
45 // one time. Therefore, the driver should not call AllocateAdapterChannel
46 // again for another DMA operation on the same device object until the
47 // AdapterControl routine has completed execution. In addition,
48 // a driver must not call AllocateAdapterChannel from within its
49 // AdapterControl routine.
50 //
51 // This is because when AllocateAdapterChannel blocks waiting for
52 // map registers, it obtains its wait context block from the device object.
53 // If AllocateAdapterChannel is then called through a different adapter
54 // object attached to the same device the wait block will be reused and the
55 // map register wait list will be corrupted.
56 //
57 // For this reason, we need to make sure that for a device used in creating
58 // DMA enablers, there can be only one packet base DMA transaction
59 // queued at any one time.
60 //
61 // In WDM, one can workaround this limitation by creating dummy deviceobject.
62 // We can also workaround this limitation by creating a control-device on the
63 // side for additional enabler objects. Since packet based multi-channel
64 // devices are rarity these days, IMO, we will defer this feature until there
65 // is a big demand for it.
66 //
70 };
71 
72 //
73 // The following enum is used in determining whether the RemLock for a device
74 // object needs to be held while processing an IRP. For processing certain
75 // IRPs, it might not be necessary to hold the RemLock, but it might be
76 // necessary to just test whether the RemLock can be acquired and released.
77 //
83 };
84 
88 };
89 
90 //
91 // This mask is used to validate the WdfDeviceWdmDispatchIrp's Flags.
92 //
93 #define FX_DISPATCH_IRP_TO_IO_QUEUE_FLAGS_MASK \
94  (WDF_DISPATCH_IRP_TO_IO_QUEUE_INVOKE_INCALLERCTX_CALLBACK |\
95  WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP)
96 
97 //
98 // The following inline functions are used for extracting the normalized file
99 // object class value and checking the file object class's flags.
100 //
102 __inline
104  __in WDF_FILEOBJECT_CLASS FileObjectClass
105  )
106 {
107  return (WDF_FILEOBJECT_CLASS)(FileObjectClass & ~WdfFileObjectCanBeOptional);
108 }
109 
110 BOOLEAN
111 __inline
113  __in WDF_FILEOBJECT_CLASS FileObjectClass
114  )
115 {
116  return (FileObjectClass & WdfFileObjectCanBeOptional) ? TRUE : FALSE;
117 }
118 
119 //
120 // Base class for all devices.
121 //
123 
124 protected:
125  FxDeviceBase(
126  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
128  __in WDFTYPE Type,
130  );
131 
133  VOID
134  );
135 
136  VOID
137  Init(
139  __in MdDeviceObject AttachedDevice,
141  );
142 
143 public:
144  NTSTATUS
147  );
148 
149  // begin IFxHasCallbacks overrides
150  VOID
152  __out_opt WDF_EXECUTION_LEVEL* ExecutionLevel,
153  __out_opt WDF_SYNCHRONIZATION_SCOPE* SynchronizationScope
154  ) ;
155 
159  );
160  // end IFxHasCallbacks overrides
161 
162  __inline
163  FxDriver*
165  VOID
166  )
167  {
168  return m_Driver;
169  }
170 
171 
173  __inline
175  VOID
176  )
177  {
178  return m_DeviceObject.GetObject();
179  }
180 
181  __inline
184  VOID
185  )
186  {
187  return &m_DeviceObject;
188  }
189 
190  ULONG
191  __inline
193  VOID
194  )
195  {
196  return m_DeviceObject.GetFlags();
197  }
198 
199  VOID
200  __inline
203  )
204  {
206  }
207 
209  __inline
211  VOID
212  )
213  {
214  return m_AttachedDevice.GetObject();
215  }
216 
217  ULONG
218  __inline
220  VOID
221  )
222  {
223  return m_AttachedDevice.GetFlags();
224  }
225 
227  __inline
229  VOID
230  )
231  {
232  return m_PhysicalDevice.GetObject();
233  }
234 
235  WDFDEVICE
236  __inline
238  VOID
239  )
240  {
241  return (WDFDEVICE) GetObjectHandle();
242  }
243 
244  virtual
246  NTSTATUS
249  )
250  {
252 
253  //
254  // Intentionally does nothing
255  //
256  return STATUS_SUCCESS;
257  }
258 
259  virtual
260  VOID
263  )
264  {
265  //
266  // Intentionally does nothing
267  //
269  }
270 
271  virtual
273  NTSTATUS
275  VOID
276  )
277  {
278  return STATUS_SUCCESS;
279  }
280 
281  virtual
282  VOID
285  )
286  {
287  //
288  // Intentionally does nothing
289  //
291  }
292 
293  virtual
294  VOID
297  )
298  {
299  //
300  // Intentionally does nothing
301  //
303  }
304 
305  virtual
307  NTSTATUS
309  VOID
310  )
311  {
312  return STATUS_SUCCESS;
313  }
314 
315  virtual
316  VOID
318  __inout FxDmaEnabler* Enabler
319  )
320  {
321  //
322  // Intentionally does nothing
323  //
324  UNREFERENCED_PARAMETER(Enabler);
325  }
326 
327  virtual
328  VOID
330  __inout FxDmaEnabler* Enabler
331  )
332  {
333  //
334  // Intentionally does nothing
335  //
336  UNREFERENCED_PARAMETER(Enabler);
337  }
338 
339  virtual
340  VOID
343  )
344  {
345  //
346  // Intentionally does nothing
347  //
349  }
350 
351  __inline
353  NTSTATUS
355  VOID
356  )
357  {
358  //
359  // Set the status to Pending only if the previous transaction is Completed.
360  //
365  return STATUS_SUCCESS;
366  } else {
367  return STATUS_WDF_BUSY;
368  }
369  }
370 
371  __inline
372  VOID
374  VOID
375  )
376  {
377  LONG val;
378 
381 
382  ASSERT(val == FxDmaPacketTransactionPending); // To catch double release
384  }
385 
386  VOID
389  )
390  {
392  }
393 
394  // begin FxObject overrides
396  NTSTATUS
399  );
400  // end FxObject overrides
401 
402  static
403  FxDeviceBase*
407  );
408 
409  static
410  FxDeviceBase*
412  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
414  );
415 
417  NTSTATUS
419  __in const GUID* InterfaceType,
421  __in USHORT Size,
425  );
426 
427  __inline
430  VOID
431  )
432  {
434  }
435 
436  virtual
437  FxIoTarget*
439  VOID
440  )
441  {
442  return NULL;
443  }
444 
446  NTSTATUS
449  _In_ BOOLEAN SelfTarget
450  );
451 
452  //
453  // Note: these fields are carefully aligned to minimize space. If you add
454  // additional fields make sure to insert them correctly. Always
455  // double check your assumptions by loading the amd64 image and
456  // comparing the size of this type before and after. For example the
457  // m_RequestLookasideList is aligned on SYSTEM_CACHE_ALIGNMENT_SIZE (64/128),
458  // a simple change can increase the size by 64/128 bytes.
459  //
460 
461 public:
462  //
463  // This is used to defer items that must be cleaned up at passive
464  // level, and FxDevice waits on this list to empty in DeviceRemove.
465  //
467 
468 protected:
470 
474 
477 
480 
481  //
482  // Used to serialize packet dma transactions on this device.
483  //
485 };
486 
487 class FxDevice : public FxDeviceBase {
488  friend VOID GetTriageInfo(VOID);
489  friend class FxDriver;
490  friend class FxIrp;
491  friend class FxFileObject;
492  friend class FxPkgPnp;
493 
494  //
495  // Note: these fields are carefully aligned to minimize space. If you add
496  // additional fileds make sure to insert them correctly. Always
497  // double check your assumptions by loading the amd64 image and
498  // comparing the size of this type before and after. For example the
499  // m_RequestLookasideList is aligned on SYSTEM_CACHE_ALIGNMENT_SIZE (64/128),
500  // a simple change can increase the size by 64/128 bytes.
501  //
502 
503 private:
504  //
505  // Maintain the current device states.
506  //
510 
511  //
512  // Store the IO type for read/write
513  //
515 
516  //
517  // Bit-flags, see FxDeviceCallbackFlags for definitions.
518  //
520 
521  // TRUE if a Filter
523 
524  //
525  // If TRUE, DO_POWER_PAGABLE can be set on m_DeviceObject->Flags if we are
526  // not in a special usage path.
527  //
528  // ***Ignored for filters***
529  //
531 
532  //
533  // TRUE if the parent is removed while the child is still around
534  //
536 
537  //
538  // TRUE if the device only allows one create to succeed at any given time
539  //
541 
542  //
543  // More deterministic the m_PkgPnp == NULL since m_PkgPnp can be == NULL
544  // if there is an allocation failure and during deletion due to insufficient
545  // resources we need to know if the device is legacy or not.
546  //
548 
549  //
550  // If TRUE, m_DeviceObject was deleted in FxDevice::DeleteObject and should
551  // not be deleted again later in the destroy path.
552  //
554 
555  //
556  // This boost will be used in IoCompleteRequest
557  // for read, write and ioctl requests if the client driver
558  // completes the request without specifying the boost.
559  //
560  //
562 
563  static const CHAR m_PriorityBoosts[];
564 
565 public:
566  //
567  // Track the parent if applicable
568  //
570 
571  //
572  // Properties used during Device Creation
573  //
574 
575  //
576  // Store the device name that is used during device creation.
577  //
579 
581 
582  //
583  // Store the name of the resource that is used to store the MOF data
584  //
586 
587  //
588  // When reporting a PDO via query device relations, there is a period of
589  // time where it is an "official" PDO as recognized by the pnp subsystem.
590  // In that period of time, we cannot use the soon to be PDO in any export
591  // which expects a PDO as an input parameter. Once this is set to TRUE,
592  // the PDO can be used for such exports.
593  //
594  // No need to use a lock when comparing against this field. Once set, it
595  // will never revert back to FALSE.
596  //
597  // This field is always TRUE for FDOs (in relation to the PDO for its stack).
598  //
600 
601  //
602  // If TRUE, then create/cleanup/close are forwarded down the stack
603  // If FALSE, then create/cleanup/close are completed at this device
604  //
606 
607  //
608  // If TRUE, an Io Target to the client itself is created to support
609  // Self Io Targets.
610  //
612 
613 private:
614  //
615  // bit-map of device info for Telemetry
616  //
618 
619 public:
620 
622 
624 
625  //
626  // We'll maintain the prepreocess table "per device" so that it is possible
627  // to have different callbacks for each device.
628  // Note that each device may be associted with multiple class extension in the future.
629  //
631 
632  //
633  // Optional, list of additional class extension settings.
634  //
636 
637 protected:
638 
639  //
640  // This is used by the FxFileObject class to manage
641  // the list of FxFileObject's for this FxDevice
642  //
644 
645  //
646  // Lookaside list to allocate FxRequests from
647  //
649 
650  //
651  // Total size of an FxRequest + driver context LookasideList element.
652  //
654 
655  //
656  // Object attributes to apply to each FxRequest* returned by
657  // m_RequestLookasideList
658  //
660 
661 public:
662 
663  //
664  // This is the set of packages used by this device. I am simply using
665  // FxPackage pointers rather than using the actual types because I want
666  // to allow fredom for FDOs, PDOs, and control objects to use
667  // differnet packages.
668  //
674 
675  //
676  // Note on approaches to having mode-agnoctic code that works for KM and UM
677  // and avoids code with lots of #ifdef which becomes a maintenance nightmare.
678  // To avoid #ifdef such as below, one approach would have been to have a
679  // base class with common data members and virtual funtions , and have
680  // derived classes for km and um,each having data members specific to their
681  // mode, implementing virtual funcions in mode specific manner. This
682  // approach was not taken for following reasons:
683  //
684  // 1. Avoid confusion between logical hierarchy and organizational hierarchy
685  // of objects. E.g. fdo and pdo package is derived from pnp package (logical
686  // hierarchy). However, both pdo and fdo package can also be organized into
687  // fdokm/fdoum deriving from fdo, and pdokm/pdoum deriving from pdo for km
688  // and um flavors, and that would be organizational hierarchy. Mixing these
689  // two approaches may create more confusion. If we were to extend the
690  // classes in future (for whatever reason), this may become more complex.
691  //
692  // 2. Even with organizational hierarchy, we need to have #ifdef at the
693  // point of creation.
694  //
695  // Luckily, we don't have many objects that need to be have mode specific
696  // data members (currently only FxDevice and interrupt to some extent).
697  // Note that member functions are already implemented in mode specific
698  // manner, for example, FxDevice::CreateDevice is implemented for UM and KM
699  // in FxDeviceUm.cpp and FxDeviceKm.cpp. So #ifdef usage is not a whole lot
700  // but we can definitely improve on it.
701  //
702  // With the current approach, we can do better by avoiding #ifdef as much as
703  // possible. We can achieve that with better abstraction, but also having
704  // host provide more interfaces so as to mimic closely those interfaces
705  // that kernel provides would also help (this way framework has to maintain
706  // less info, because it can always get it from host the way kernel
707  // framework would).
708  //
709 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
710 public:
711  //
712  // On failed create during AddDevice, KMDF sends a simulated remove event
713  // to pnp state machine and thereafter detaches from stack so that windows
714  // I/O manager can't send a remove irp. UMDF imitates windows I/O manager
715  // in that when AddDevice sent by host is failed by driver, host sends a
716  // simulated remove irp to Fx so that it can cleanup.
717  //
718  // This causes a conflict in merged code because for UMDF, Fx doesn't
719  // detach from stack as part of remove event (since lifetime of umdf stack
720 
721  // is controlled by host including detach and deletiton), so unless we
722  // prevent, Fx will end up processing remove event twice, once by Pnp sm's
723  // simulated event and another by host simulated remove irp.
724  //
725  // The solution is to allow one remove event to be processed and that would
726  // be Fx's remove event (to minimize disparity between KM and UM Fx). The
727  // field below tracks the fact that create failed and allows the Fx remove
728  // event to be processed and then also allows the device object to detach
729  // before returning from failure so that host is not able to send simulated
730  // remove to the device.
731  //
733 
734  //
735  // This object implements the IFxMessageDispatch that contains entry points
736  // to driver, and is used by host to dispatch irp and other messages.
737  //
739 
740  //
741  //Weak reference to host side device stack
742  //
743  IWudfDeviceStack* m_DevStack;
744 
745  //
746  // PnP devinode hw key handle
747  //
749 
750  //
751  // Device key registry path
752  //
754 
755  //
756  // Kernel redirector's side object name.
757  //
759 
760  //
761  // PDO Instance ID
762  //
764 
765  //
766  // The retrieval mode and i/o type preferences requested
767  // by this device. Note that ReadWriteIoType is common to both KMDF and UMDF
768  // so no new UM-specific field is required.
769  //
773 
774  //
775  // Tells whether hardware access is allowed.
776  //
777  WDF_DIRECT_HARDWARE_ACCESS_TYPE m_DirectHardwareAccess;
778 
779  //
780  // Tells whether hardware register read/write is done using user-mode
781  // mapped virtual addresses
782  //
783  WDF_REGISTER_ACCESS_MODE_TYPE m_RegisterAccessMode;
784 
785  //
786  // File object policy set through INF directive
787  //
788  WDF_FILE_OBJECT_POLICY_TYPE m_FileObjectPolicy;
789 
790  //
791  // Fs context use policy set through INF directive
792  //
793  WDF_FS_CONTEXT_USE_POLICY_TYPE m_FsContextUsePolicy;
794 
795  //
796  // Thread pool for interrupt servicing
797  //
799 
800 #endif // (FX_CORE_MODE == FX_CORE_USER_MODE)
801 
802 private:
803  //
804  // A method called by the constructor(s) to initialize the device state.
805  //
806  VOID
808  VOID
809  );
810 
812  NTSTATUS
814  __in MdIrp Irp
815  );
816 
818  NTSTATUS
820  __in NTSTATUS FailedStatus,
821  __in BOOLEAN UseStateMachine
822  );
823 
824  VOID
826  VOID
827  );
828 
829  static
832 
833  static
835  NTSTATUS
838  __in MdIrp Irp
839  );
840 
841  VOID
843  VOID
844  );
845 
846  NTSTATUS
848  VOID
849  );
850 
851  VOID
853  VOID
854  );
855 
856  VOID
858  VOID
859  );
860 
861 public:
862 
863  FxDevice(
864  __in FxDriver *ArgDriver
865  );
866 
867  ~FxDevice(
868  VOID
869  );
870 
871  static
873  NTSTATUS
874  _Create(
875  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
879  );
880 
882  NTSTATUS
884  __in NTSTATUS FailedStatus,
885  __in BOOLEAN UseStateMachine
886  );
887 
888  __inline
889  FxPackage*
892  )
893  {
894  switch (MajorFunction) {
895  case IRP_MJ_CREATE:
896  case IRP_MJ_CLOSE:
897  case IRP_MJ_CLEANUP:
898  case IRP_MJ_SHUTDOWN:
899  return (FxPackage*) m_PkgGeneral;
900 
901  case IRP_MJ_READ:
902  case IRP_MJ_WRITE:
905  return (FxPackage*) m_PkgIo;
906 
908  return (FxPackage*) m_PkgWmi;
909 
910  case IRP_MJ_PNP:
911  case IRP_MJ_POWER:
912  if (m_PkgPnp != NULL) {
913  return (FxPackage*) m_PkgPnp;
914  }
915  else {
916  return (FxPackage*) m_PkgDefault;
917  }
918  break;
919 
920  default:
921  return (FxPackage*) m_PkgDefault;
922  }
923  }
924 
927  VOID
928  );
929 
930  static
932  __inline
934  __in UCHAR MajorCode,
935  __in UCHAR MinorCode
936  )
937  {
938  switch (MajorCode) {
939  //
940  // We require remove locks for power irps because they can show
941  // up after the device has been removed if the Power subysystem has
942  // taken a reference on the device object that raced with the
943  // remove irp (or if we are attached above the power policy owner
944  // and the power policy owner requests a power irp during remove
945  // processing.
946  //
947  // What it boils down to is that we do it for power because
948  // that is the only valid irp which can be sent with an outstanding
949  // reference w/out coordination to the device's pnp state. We
950  // assume that for all other irps, the sender has synchronized with
951  // the pnp state of the device.
952  //
953  // We also acquire the remove lock for WMI IRPs because they can
954  // come into the stack while we are processing a remove. For
955  // instance, a WMI irp can come into the stack to the attached
956  // device before it has a change to process the remove device and
957  // unregister with WMI.
958  //
959  // PNP irps can come in at any time as well. For instance, query
960  // device relations for removal or ejection relations can be sent
961  // at any time (and there are pnp stress tests which send them
962  // during remove).
963  //
964  case IRP_MJ_PNP:
965  //
966  // We special case remove device and only acquire the remove lock
967  // in the minor code handler itself. If handled remove device in
968  // the normal way and there was a preprocess routine for it, then
969  // we could deadlock if the irp was dispatched back to KMDF in the
970  // preprocess routine with an extra outstandling remlock acquire
971  // (which won't be released until the preprocess routine returns,
972  // which will be too late).
973  //
974  if (MinorCode == IRP_MN_REMOVE_DEVICE) {
976  }
977  case IRP_MJ_POWER:
980 
981  default:
982 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
983  return FxDeviceRemLockOptIn;
984 #else
985  //
986  // There is no forseeable scenario where a UMDF driver would need to
987  // need to support remove lock for IO IRPs. While this ifdef can be safely
988  // removed and UMDF can also return FxDeviceRemLockOptIn, that is
989  // being avoided here so that the caller does not need to test the
990  // remove lock flags for IO which would never be set.
991  //
993 #endif
994  }
995  }
996 
997  static
998  FxDevice*
999  GetFxDevice(
1001  );
1002 
1004  __inline
1006  VOID
1007  )
1008  {
1009  //
1010  // Makes sure that the PDO we think we have is
1011  // 1) reported to pnp (m_PdoKnown check)
1012  // 2) actually there (m_PhysicalDevice != NULL check)
1013  //
1014  if (m_PdoKnown && m_PhysicalDevice.GetObject() != NULL) {
1015  return m_PhysicalDevice.GetObject();
1016  }
1017  else {
1018  return NULL;
1019  }
1020  }
1021 
1022  static
1024  NTSTATUS
1025  STDCALL
1026  Dispatch(
1029  );
1030 
1031 #if (FX_CORE_MODE==FX_CORE_USER_MODE)
1032  static
1033  VOID
1034  DispatchUm(
1036  _In_ MdIrp Irp,
1038  );
1039 
1040  static
1041  VOID
1044  _In_ MdIrp Irp,
1046  );
1047 
1048  VOID
1051  )
1052  {
1054  }
1055 
1058  VOID
1059  )
1060  {
1061  return m_InteruptThreadpool;
1062  }
1063 
1064 #endif // (FX_CORE_MODE == FX_CORE_USER_MODE)
1065 
1066  static
1068  NTSTATUS
1069  STDCALL
1073  );
1074 
1076  NTSTATUS
1078  __in MdIrp Irp,
1080  );
1081 
1082  __inline
1085  VOID
1086  )
1087  {
1088  return m_ReadWriteIoType;
1089  }
1090 
1091  __inline
1094  VOID
1095  )
1096  {
1097 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1098  return m_ReadWriteIoType;
1099 #else
1100  //
1101  // For UM, both buffer-copy and direct-access i/o buffer access types
1102  // follow the same storage and retrieval model in internal structures
1103  // as in buffered I/O so always return WdfDeviceIoBuffered.
1104  //
1105  return WdfDeviceIoBuffered;
1106 #endif
1107  }
1108 
1109  __inline
1110  CHAR
1112  VOID
1113  )
1114  {
1115  return m_DefaultPriorityBoost;
1116  }
1117 
1118  //
1119  // Return FileObjectClass
1120  //
1121  __inline
1124  VOID
1125  )
1126  {
1127  return m_FileObjectClass;
1128  }
1129 
1130  //
1131  // Configuration time fileobject support setting
1132  //
1133  __inline
1134  VOID
1136  __in WDF_FILEOBJECT_CLASS FileObjectClass
1137  )
1138  {
1139  m_FileObjectClass = FileObjectClass;
1140  }
1141 
1142  VOID
1144  __inout FxPackage *Package
1145  );
1146 
1147  __inline
1150  )
1151  {
1152  return m_CurrentPnpState;
1153  }
1154 
1155  __inline
1158  )
1159  {
1160  return m_CurrentPowerState;
1161  }
1162 
1163  __inline
1166  )
1167  {
1169  }
1170 
1171  __inline
1172  VOID
1175  )
1176  {
1178  }
1179 
1180  __inline
1181  VOID
1184  )
1185  {
1187  }
1188 
1189  __inline
1190  VOID
1193  )
1194  {
1196  }
1197 
1198  __inline
1199  BOOLEAN
1201  VOID
1202  )
1203  {
1204  return m_PkgPnp != NULL ? TRUE : FALSE;
1205  }
1206 
1207  __inline
1208  BOOLEAN
1210  VOID
1211  )
1212  {
1213  return m_Legacy;
1214  }
1215 
1216  __inline
1217  BOOLEAN
1219  VOID
1220  )
1221  {
1222  return m_Exclusive;
1223  }
1224 
1225  __inline
1226  BOOLEAN
1228  VOID
1229  )
1230  {
1231  return m_PkgPnp->GetType() == FX_TYPE_PACKAGE_FDO;
1232  }
1233 
1234  __inline
1235  FxPkgFdo*
1237  VOID
1238  )
1239  {
1240  return (FxPkgFdo*) m_PkgPnp;
1241  }
1242 
1243  __inline
1244  BOOLEAN
1246  VOID
1247  )
1248  {
1249  return (IsPnp() && m_PkgPnp->GetType() == FX_TYPE_PACKAGE_PDO);
1250  }
1251 
1252  __inline
1253  FxPkgPdo*
1255  VOID
1256  )
1257  {
1258  return (FxPkgPdo*) m_PkgPnp;
1259  }
1260 
1262  NTSTATUS
1263  CreateDevice(
1265  );
1266 
1267  __inline
1268  VOID
1270  VOID
1271  )
1272  {
1274  }
1275 
1276  //
1277 
1278  // There are really three steps in device creation.
1279  //
1280  // - Creating the device
1281  // - Creating the device object that goes with the device (Initialize)
1282  // - Finilizing the initialization after packages are installed, attached,
1283  // etc.
1284 
1285 
1286 
1287 
1288 
1289  VOID
1291  VOID
1292  );
1293 
1294  VOID
1295  Destroy(
1296  VOID
1297  );
1298 
1299  // <begin> FxObject overrides
1300  virtual
1301  VOID
1302  DeleteObject(
1303  VOID
1304  );
1305 
1306  virtual
1307  BOOLEAN
1308  Dispose(
1309  VOID
1310  );
1311  // <end> FxObject overrides
1312 
1313  __inline
1316  VOID
1317  )
1318  {
1319  return &m_RequestAttributes;
1320  }
1321 
1322  PVOID
1325  );
1326 
1327  VOID
1330  );
1331 
1332  // begin FxDeviceBase overrides
1333  virtual
1335  NTSTATUS
1336  AddIoTarget(
1338  );
1339 
1340  virtual
1341  VOID
1344  );
1345 
1346  virtual
1348  NTSTATUS
1350  VOID
1351  );
1352 
1353  virtual
1354  VOID
1355  AddChildList(
1357  );
1358 
1359  virtual
1360  VOID
1363  );
1364 
1365  virtual
1367  NTSTATUS
1369  VOID
1370  );
1371 
1372  virtual
1373  VOID
1374  AddDmaEnabler(
1375  __inout FxDmaEnabler* Enabler
1376  );
1377 
1378  virtual
1379  VOID
1381  __inout FxDmaEnabler* Enabler
1382  );
1383 
1384  virtual
1385  FxIoTarget*
1387  VOID
1388  );
1389 
1392  VOID
1393  );
1394 
1395  virtual
1397  NTSTATUS
1400  );
1401  // end FxDeviceBase overrides
1402 
1403  //
1404  // Filter Driver Support
1405  //
1406  __inline
1407  BOOLEAN
1409  {
1410  return m_Filter;
1411  }
1412 
1414  NTSTATUS
1415  SetFilter(
1417  );
1418 
1419  __inline
1420  BOOLEAN
1422  VOID
1423  )
1424  {
1425  return m_PowerPageableCapable;
1426  }
1427 
1429  NTSTATUS
1430  Initialize(
1433  );
1434 
1435  VOID
1438  );
1439 
1441  NTSTATUS
1443  VOID
1444  );
1445 
1447  NTSTATUS
1448  PdoInitialize(
1450  );
1451 
1453  NTSTATUS
1454  FdoInitialize(
1456  );
1457 
1459  NTSTATUS
1462  );
1463 
1464  VOID
1466  VOID
1467  )
1468  {
1469  //
1470  // FxDevice::DeleteObject() has already run, so we must call the super
1471  // class's version of DeleteObject();
1472  //
1474 
1475  FxDeviceBase::DeleteObject(); // __super call
1476  }
1477 
1479  NTSTATUS
1481  __out HANDLE* Key,
1483  );
1484 
1485  VOID
1487  VOID
1488  );
1489 
1490  __inline
1491  BYTE
1493  VOID
1494  )
1495  {
1496  return m_CallbackFlags;
1497  }
1498 
1499  __inline
1500  BYTE
1502  VOID
1503  )
1504  {
1505  BYTE flags;
1506  KIRQL irql;
1507 
1508  Lock(&irql);
1510  Unlock(irql);
1511 
1512  return flags;
1513  }
1514 
1515  __inline
1516  VOID
1518  __in BYTE Flags
1519  )
1520  {
1522  }
1523 
1524  __inline
1525  VOID
1527  __in BYTE Flags
1528  )
1529  {
1530  KIRQL irql;
1531 
1532  Lock(&irql);
1534  Unlock(irql);
1535  }
1536 
1537  __inline
1538  VOID
1540  __in BYTE Flags
1541  )
1542  {
1543  m_CallbackFlags &= ~Flags;
1544  }
1545 
1546  __inline
1547  VOID
1549  __in BYTE Flags
1550  )
1551  {
1552  KIRQL irql;
1553 
1554  Lock(&irql);
1556  Unlock(irql);
1557  }
1558 
1561  __in FxDriver* CxDriver
1562  )
1563  {
1564  FxCxDeviceInfo* cxDeviceInfo;
1565  PLIST_ENTRY next;
1566 
1567  //
1568  // Check if we are using I/O class extensions.
1569  //
1572  next = next->Flink) {
1573 
1574  cxDeviceInfo = CONTAINING_RECORD(next, FxCxDeviceInfo, ListEntry);
1575  if (cxDeviceInfo->Driver == CxDriver) {
1576  return cxDeviceInfo;
1577  }
1578  }
1579 
1580  return NULL;
1581  }
1582 
1583  __inline
1584  BOOLEAN
1586  __in FxDriver* CxDriver
1587  )
1588  {
1589  return (GetCxDeviceInfo(CxDriver) != NULL) ? TRUE : FALSE;
1590  }
1591 
1592  __inline
1593  BOOLEAN
1595  VOID
1596  )
1597  {
1599  }
1600 
1601 #if DBG
1602  __inline
1604  GetFirstCxDeviceInfo(
1605  VOID
1606  )
1607  {
1609  return NULL;
1610  }
1611  else {
1614  ListEntry);
1615  }
1616  }
1617 
1618  __inline
1620  GetNextCxDeviceInfo(
1621  __in FxCxDeviceInfo* CxDeviceInfo
1622  )
1623  {
1624  ASSERT(CxDeviceInfo != NULL);
1625  if (CxDeviceInfo->ListEntry.Flink == &m_CxDeviceInfoListHead) {
1626  return NULL;
1627  }
1628  else {
1629  return CONTAINING_RECORD(CxDeviceInfo->ListEntry.Flink,
1631  ListEntry);
1632  }
1633  }
1634 
1635 #endif
1636 
1637  __inline
1638  static
1639  CCHAR
1641  __in FxCxDeviceInfo* CxDeviceInfo
1642  )
1643  {
1644  if (CxDeviceInfo != NULL) {
1645  return CxDeviceInfo->Index;
1646  }
1647  else {
1648  return 0;
1649  }
1650  }
1651 
1652  __inline
1653  FxDriver*
1655  __in FxCxDeviceInfo* CxDeviceInfo
1656  )
1657  {
1658  if (CxDeviceInfo != NULL) {
1659  return CxDeviceInfo->Driver;
1660  }
1661  else {
1662  return GetDriver();
1663  }
1664  }
1665 
1666 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
1667 
1668  static
1669  __inline
1670  NTSTATUS
1676  );
1677 
1678  __inline
1679  static
1680  NTSTATUS
1687  );
1688 
1689 #elif (FX_CORE_MODE == FX_CORE_USER_MODE)
1690 
1691  static
1692  NTSTATUS
1694  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
1695  _In_ IWudfDeviceStack* DeviceStack,
1696  _In_ PWSTR DriverName,
1700  );
1701 
1702  static
1703  NTSTATUS
1705  _In_ PVOID DeviceStack,
1710  );
1711 
1712 #endif
1713 
1714  static
1716  NTSTATUS
1718  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
1721  );
1722 
1723  static
1725  NTSTATUS
1726  _OpenKey(
1727  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
1733  _Out_ WDFKEY* Key
1734  );
1735 
1736  static
1738  NTSTATUS
1743  _In_opt_ MdDeviceObject RemotePdo,
1747  _Out_ WDFMEMORY* PropertyMemory
1748  );
1749 
1750  static
1752  NTSTATUS
1754  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
1757  _In_opt_ MdDeviceObject RemotePdo,
1762  );
1763 
1764  static
1765  VOID
1766  STDCALL
1769  )
1770  {
1771  // NoOp reference stub for query interface
1773  }
1774 
1775  static
1776  VOID
1777  STDCALL
1780  )
1781  {
1782  // NoOp dereference stub for query interface
1784  }
1785 
1786  static
1790  );
1791 
1792  BOOLEAN
1794  VOID
1795  );
1796 
1797  VOID
1799  VOID
1800  )
1801  {
1802  // LogDeviceStartTelemetryEvent(GetDriverGlobals(), this); __REACTOS__ : no-op
1803  }
1804 
1805  virtual
1806  VOID
1809  )
1810  {
1812  }
1813 
1814  USHORT
1816  VOID
1817  )
1818  {
1820  }
1821 
1822  __inline
1823  CHAR
1825  VOID
1826  )
1827  {
1828  return m_DeviceObject.GetStackSize();
1829  }
1830 
1831  __inline
1832  VOID
1834  _In_ CHAR Size
1835  )
1836  {
1838  }
1839 
1840  NTSTATUS
1842  VOID
1843  )
1844  {
1845 
1846 
1847 
1848 
1849 
1850  return STATUS_SUCCESS;
1851  }
1852 
1853  FxCmResList*
1855  )
1856  {
1858  }
1859 
1860  VOID
1861  DetachDevice(
1862  VOID
1863  );
1864 
1865  VOID
1867  VOID
1868  );
1869 
1870  NTSTATUS
1872  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
1874  );
1875 
1876  VOID
1878  BOOLEAN Value
1879  )
1880  {
1881 #if (FX_CORE_MODE == FX_CORE_USER_MODE)
1883 #else
1885 #endif
1886  }
1887 
1888  BOOLEAN
1890  _In_ const GUID* InterfaceClassGUID,
1892  );
1893 
1894  static
1896  NTSTATUS
1905  _Out_ WDFMEMORY* PropertyMemory,
1907  );
1908 
1909  static
1911  NTSTATUS
1922  );
1923 
1925  NTSTATUS
1930  _In_ FxRegKey* pKey
1931  );
1932 
1934  NTSTATUS
1935  AssignProperty (
1941  );
1942 
1943 #if (FX_CORE_MODE==FX_CORE_USER_MODE)
1944 
1946  NTSTATUS
1948  _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
1949  );
1950 
1951  VOID
1955  );
1956 
1957  __inline
1960  VOID
1961  )
1962  {
1963  return m_RetrievalMode;
1964  }
1965 
1966  __inline
1969  VOID
1970  )
1971  {
1972  return m_ReadWriteIoType;
1973  }
1974 
1975  __inline
1978  VOID
1979  )
1980  {
1981  return m_IoctlIoType;
1982  }
1983 
1984  __inline
1985  ULONG
1987  VOID
1988  )
1989  {
1991  }
1992 
1993  static
1994  VOID
1998  _Out_ WDF_DEVICE_IO_TYPE *RWPreference,
1999  _Out_ WDF_DEVICE_IO_TYPE *IoctlPreference
2000  );
2001 
2002  NTSTATUS
2004  _In_ RdWmiPowerAction Action,
2005  _Out_ BOOLEAN * QueryResult
2006  );
2007 
2008  static
2011  _In_ IWudfDevice * DeviceObject,
2012  _In_ LPCGUID DeviceInterfaceGuid,
2014  );
2015 
2016  static
2017  void
2019  _In_ IWudfDevice * DeviceObject,
2020  _In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID
2021  );
2022 
2023  static
2024  void
2027  );
2028 
2029  static
2030  void
2033  );
2034 
2035  static
2036  BOOL
2038  _In_ IWudfDevice * DeviceObject,
2039  _In_ DWORD Id,
2040  _In_ PVOID DataBuffer,
2041  _In_ SIZE_T cbDataBufferSize
2042  );
2043 
2044  static
2045  NTSTATUS
2046  NtStatusFromHr (
2047  _In_ IWudfDeviceStack * DevStack,
2048  _In_ HRESULT Hr
2049  );
2050 
2051  NTSTATUS
2052  NtStatusFromHr (
2053  _In_ HRESULT Hr
2054  );
2055 
2056  IWudfDeviceStack*
2058  VOID
2059  );
2060 
2061  IWudfDeviceStack2 *
2063  VOID
2064  );
2065 
2066  VOID
2068  VOID
2069  );
2070 
2071  BOOLEAN
2073  )
2074  {
2075  return (m_DirectHardwareAccess == WdfAllowDirectHardwareAccess);
2076  }
2077 
2078  BOOLEAN
2080  VOID
2081  )
2082  {
2083  //
2084  // Allow access to interrupts if the device has any connection resources,
2085  // regardless of the UmdfDirectHardwareAccess INF directive.
2086  //
2087  return IsDirectHardwareAccessAllowed() ||
2089  }
2090 
2091  BOOLEAN
2093  VOID
2094  )
2095  {
2096  return (m_RegisterAccessMode == WdfRegisterAccessUsingUserModeMapping);
2097  }
2098 
2099  PVOID
2101  __in PVOID SystemAddress
2102  )
2103  {
2104  return SystemAddress;
2105  }
2106 
2107  PVOID
2109  __in PVOID PseudoAddress
2110  )
2111  {
2112  return PseudoAddress;
2113  }
2114 
2115  static
2116  ULONG
2117  __inline
2119  __in WDF_DEVICE_HWACCESS_TARGET_SIZE Size
2120  )
2121  {
2122  ULONG length = 0;
2123 
2124  switch(Size) {
2125  case WdfDeviceHwAccessTargetSizeUchar:
2126  length = sizeof(UCHAR);
2127  break;
2128  case WdfDeviceHwAccessTargetSizeUshort:
2129  length = sizeof(USHORT);
2130  break;
2131  case WdfDeviceHwAccessTargetSizeUlong:
2132  length = sizeof(ULONG);
2133  break;
2134  case WdfDeviceHwAccessTargetSizeUlong64:
2135  length = sizeof(ULONG64);
2136  break;
2137  default:
2138  ASSERT(FALSE);
2139  }
2140 
2141  return length;
2142  }
2143 
2144  BOOL
2146  __in WDF_DEVICE_HWACCESS_TARGET_TYPE Type
2147  )
2148  {
2149  if (Type == WdfDeviceHwAccessTargetTypeRegister ||
2150  Type == WdfDeviceHwAccessTargetTypeRegisterBuffer) {
2151  return TRUE;
2152  }
2153 
2154  return FALSE;
2155  }
2156 
2157  BOOL
2159  __in WDF_DEVICE_HWACCESS_TARGET_TYPE Type
2160  )
2161  {
2162  if (Type == WdfDeviceHwAccessTargetTypePort ||
2163  Type == WdfDeviceHwAccessTargetTypePortBuffer) {
2164  return TRUE;
2165  }
2166 
2167  return FALSE;
2168  }
2169 
2170  BOOL
2172  __in WDF_DEVICE_HWACCESS_TARGET_TYPE Type
2173  )
2174  {
2175  if (Type == WdfDeviceHwAccessTargetTypeRegisterBuffer ||
2176  Type == WdfDeviceHwAccessTargetTypePortBuffer) {
2177  return TRUE;
2178  }
2179 
2180  return FALSE;
2181  }
2182 
2183  SIZE_T
2184  ReadRegister(
2185  __in WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
2186  __in PVOID Register
2187  );
2188 
2189  VOID
2191  __in WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
2192  __in PVOID Register,
2194  __in ULONG Count
2195  );
2196 
2197  VOID
2198  WriteRegister(
2199  __in WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
2200  __in PVOID Register,
2201  __in SIZE_T Value
2202  );
2203 
2204  VOID
2206  __in WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
2207  __in PVOID Register,
2209  __in ULONG Count
2210  );
2211 
2212  VOID
2214  _Out_ PCWSTR* GroupId,
2215  _Out_ PUMDF_DRIVER_REGSITRY_INFO DeviceRegInfo
2216  );
2217 
2218 #endif // (FX_CORE_MODE == FX_CORE_USER_MODE)
2219 
2220 };
2221 
2222 class FxMpDevice : public FxDeviceBase {
2223 public:
2225  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
2226  __in FxDriver* Driver,
2228  __in MdDeviceObject AttachedDevice,
2229  __in MdDeviceObject PDO
2230  ) :
2231  FxDeviceBase(FxDriverGlobals, Driver, FX_TYPE_MP_DEVICE, sizeof(*this))
2232  {
2233  Init(DeviceObject, AttachedDevice, PDO);
2235 
2237 
2239  }
2240 
2241  // begin FxObject overrides
2242  BOOLEAN
2244  VOID
2245  )
2246  {
2247  //
2248  // Important that the cleanup routine be called while the MdDeviceObject
2249  // is valid!
2250  //
2251  CallCleanup();
2252 
2253  //
2254  // Manually destroy the children now so that by the time we wait on the
2255  // dispose empty out, all of the children will have been added to it.
2256  //
2257  DestroyChildren();
2258 
2259  if (m_DisposeList != NULL) {
2261  }
2262 
2263  //
2264  // No device object to delete since the caller's own the
2265  // WDM device. Simulate what FxDevice::Destroy does by NULL'ing out the
2266  // device objects.
2267  //
2269  m_DeviceObject = NULL;
2271 
2272  return FALSE;
2273  }
2274  // end FxObject overrides
2275 
2276  // begin FxDeviceBase overrides
2277  virtual
2278  FxIoTarget*
2280  VOID
2281  )
2282  {
2283  return m_DefaultTarget;
2284  }
2285  // end FxDeviceBase overrides
2286 
2287 public:
2288  //
2289  // Default I/O target for this miniport device
2290  //
2292 };
2293 
2294 #if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
2295 #include "fxdevicekm.hpp"
2296 #else
2297 #include "fxdeviceum.hpp"
2298 #endif
2299 
2300 
2301 #endif // _FXDEVICE_H_
USHORT m_DeviceTelemetryInfoFlags
Definition: fxdevice.hpp:617
NTSTATUS ConfigureConstraints(__in_opt PWDF_OBJECT_ATTRIBUTES ObjectAttributes)
VOID SetInitialState(VOID)
Definition: fxdevice.cpp:153
enum _WDF_DEVICE_PNP_STATE WDF_DEVICE_PNP_STATE
VOID DestructorInternal(VOID)
Definition: fxdevicekm.cpp:390
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
Definition: fxobject.hpp:1474
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
static VOID DispatchUm(_In_ MdDeviceObject DeviceObject, _In_ MdIrp Irp, _In_opt_ IUnknown *Context)
Definition: fxdeviceum.cpp:32
#define STATUS_WDF_BUSY
Definition: wdfstatus.h:126
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
VOID RetrieveDeviceInfoRegistrySettings(_Out_ PCWSTR *GroupId, _Out_ PUMDF_DRIVER_REGSITRY_INFO DeviceRegInfo)
virtual VOID DeleteObject(VOID)
#define __out_ecount_full(size)
Definition: ms_sal.h:2684
NPAGED_LOOKASIDE_LIST m_RequestLookasideList
Definition: fxdevice.hpp:648
const uint16_t * PCWSTR
Definition: typedefs.h:57
VOID InvalidateDeviceState(VOID)
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
MxDeviceObject m_AttachedDevice
Definition: fxdevice.hpp:472
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:461
UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL m_RetrievalMode
Definition: fxdevice.hpp:770
CfxDevice * m_ParentDevice
Definition: fxdevice.hpp:569
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2654
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1697
virtual VOID RemoveDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevice.hpp:329
static _Must_inspect_result_ NTSTATUS _ValidateOpenKeyParams(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device)
Definition: fxdevice.cpp:2151
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes)
Definition: fxdevice.cpp:663
#define IRP_MN_REMOVE_DEVICE
__inline WDF_DEVICE_IO_TYPE GetPreferredRWTransferMode(VOID)
Definition: fxdevice.hpp:1968
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
MdRemoveLock GetRemoveLock(VOID)
Definition: fxdevicekm.hpp:47
#define _In_opt_
Definition: ms_sal.h:309
WDF_FILEOBJECT_CLASS m_FileObjectClass
Definition: fxdevice.hpp:621
CCHAR GetStackSize(VOID)
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
VOID SetFlags(ULONG Flags)
BOOL IsRegister(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
Definition: fxdevice.hpp:2145
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
WUDF_IO_COMPLETION_ROUTINE MdCompletionRoutineType
Definition: mxum.h:142
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
_Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
BOOLEAN m_Legacy
Definition: fxdevice.hpp:547
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:690
#define _Out_
Definition: ms_sal.h:345
__inline MxDeviceObject * GetMxDeviceObject(VOID)
Definition: fxdevice.hpp:183
virtual _Must_inspect_result_ NTSTATUS AllocateEnumInfo(VOID)
Definition: fxdevice.hpp:274
#define IRP_MJ_SHUTDOWN
_Must_inspect_result_ NTSTATUS ControlDeviceInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:399
__inline WDF_DEVICE_IO_TYPE GetIoType(VOID)
Definition: fxdevice.hpp:1084
_Must_inspect_result_ NTSTATUS QueryForInterface(__in const GUID *InterfaceType, __out PINTERFACE Interface, __in USHORT Size, __in USHORT Version, __in PVOID InterfaceSpecificData, __in_opt MdDeviceObject TargetDevice=NULL)
#define __in_opt
Definition: dbghelp.h:38
#define TRUE
Definition: types.h:120
virtual VOID AddDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevice.hpp:317
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
static const CHAR m_PriorityBoosts[]
Definition: fxdevice.hpp:563
uint16_t * PWSTR
Definition: typedefs.h:56
FxIoTarget * m_DefaultTarget
Definition: fxdevice.hpp:2291
static __inline NTSTATUS _OpenDeviceRegistryKey(_In_ MdDeviceObject DeviceObject, _In_ ULONG DevInstKeyType, _In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE DevInstRegKey)
_In_ ULONG DevInstKeyType
Definition: iofuncs.h:1125
virtual VOID RemoveChildList(__inout FxChildList *List)
Definition: fxdevice.hpp:295
WDF_DEVICE_POWER_POLICY_STATE m_CurrentPowerPolicyState
Definition: fxdevice.hpp:509
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3767
__in WDFDEVICE __in CONST GUID __in_opt PCUNICODE_STRING RefString
char CHAR
Definition: xmlstorage.h:175
NTSTATUS UpdateInterruptThreadpoolLimits(VOID)
Definition: fxdevice.hpp:1841
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
static MdCompletionRoutineType _CompletionRoutineForRemlockMaintenance
Definition: fxdevice.hpp:831
static _Must_inspect_result_ NTSTATUS _AllocAndQueryProperty(_In_ PFX_DRIVER_GLOBALS Globals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory)
Definition: fxdevice.cpp:1988
LONG NTSTATUS
Definition: precomp.h:26
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
VOID Init(__in MdDeviceObject DeviceObject, __in MdDeviceObject AttachedDevice, __in MdDeviceObject PhysicalDevice)
__inline BOOLEAN IsPnp(VOID)
Definition: fxdevice.hpp:1200
VOID InstallPackage(__inout FxPackage *Package)
Definition: fxdevice.cpp:1611
static FxDevice * GetFxDevice(__in MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:60
_Must_inspect_result_ NTSTATUS AllocateTarget(_Out_ FxIoTarget **Target, _In_ BOOLEAN SelfTarget)
static void PoFxDevicePowerNotRequired(_In_ MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:817
Definition: fxirp.hpp:28
#define InterlockedCompareExchange
Definition: interlocked.h:104
virtual _Must_inspect_result_ NTSTATUS AllocateEnumInfo(VOID)
Definition: fxdevice.cpp:1805
IWudfDeviceStack * m_DevStack
Definition: fxdevice.hpp:743
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
Definition: wdfdevice.h:3810
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
WDF_DEVICE_POWER_STATE m_CurrentPowerState
Definition: fxdevice.hpp:508
VOID WriteRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in SIZE_T Value)
Definition: fxdeviceum.hpp:279
BOOLEAN IsDirectHardwareAccessAllowed()
Definition: fxdevice.hpp:2072
WDF_DEVICE_IO_TYPE m_IoctlIoType
Definition: fxdevice.hpp:771
KIRQL irql
Definition: wave.h:1
UNICODE_STRING m_SymbolicLinkName
Definition: fxdevice.hpp:580
FxDeviceBase(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxDriver *Driver, __in WDFTYPE Type, __in USHORT Size)
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
Definition: fxdevice.hpp:1807
static VOID DispatchWithLockUm(_In_ MdDeviceObject DeviceObject, _In_ MdIrp Irp, _In_opt_ IUnknown *Context)
Definition: fxdeviceum.cpp:48
DriverGlobals
virtual FxIoTarget * GetDefaultIoTarget(VOID)
Definition: fxdevice.hpp:438
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
__inline BOOLEAN IsLegacy(VOID)
Definition: fxdevice.hpp:1209
friend VOID GetTriageInfo(VOID)
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
BOOLEAN m_Exclusive
Definition: fxdevice.hpp:540
VOID WmiPkgDeregister(VOID)
Definition: fxdevicekm.cpp:497
FxDeviceRemLockAction
Definition: fxdevice.hpp:78
PVOID GetSystemAddressFromPseudoAddress(__in PVOID PseudoAddress)
Definition: fxdevice.hpp:2108
VOID __inline SetDeviceObjectFlags(_In_ ULONG Flags)
Definition: fxdevice.hpp:201
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
WDFTYPE GetType(VOID)
Definition: fxobject.hpp:742
virtual VOID RemoveIoTarget(__inout FxIoTarget *IoTarget)
Definition: fxdevice.hpp:261
__inline VOID SetCallbackFlagsLocked(__in BYTE Flags)
Definition: fxdevice.hpp:1517
static _Must_inspect_result_ NTSTATUS STDCALL DispatchWithLock(__in MdDeviceObject DeviceObject, __in MdIrp OriginalIrp)
Definition: fxdevice.cpp:1336
__inline MdDeviceObject GetAttachedDeviceReference(VOID)
Definition: fxdevice.hpp:429
FxCmResList * GetTranslatedResourceList(VOID)
Definition: fxpkgpnp.hpp:3796
DWORD Id
BOOLEAN m_CleanupFromFailedCreate
Definition: fxdevice.hpp:732
_Must_inspect_result_ NTSTATUS FxValidateInterfacePropertyData(_In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData)
VOID FreeRequestMemory(__in FxRequest *Request)
Definition: fxdevice.cpp:1728
VOID GetDeviceStackIoType(_Out_ WDF_DEVICE_IO_TYPE *ReadWriteIoType, _Out_ WDF_DEVICE_IO_TYPE *IoControlIoType)
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
FxDriver * Driver
UCHAR KIRQL
Definition: env_spec_w32.h:591
__inline ULONG GetDirectTransferThreshold(VOID)
Definition: fxdevice.hpp:1986
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
PWSTR m_DeviceInstanceId
Definition: fxdevice.hpp:763
VOID SetInterruptThreadpool(_In_ FxInterruptThreadpool *Pool)
Definition: fxdevice.hpp:1049
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
static _Must_inspect_result_ NTSTATUS _QueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ ULONG BufferLength, _Out_ PVOID PropertyBuffer, _Out_ PULONG ResultLength, _Out_ PDEVPROPTYPE PropertyType)
Definition: fxdevicekm.cpp:859
__inline WDF_DEVICE_POWER_STATE GetDevicePowerState()
Definition: fxdevice.hpp:1157
VOID DetachDevice(VOID)
_In_ WDFDEVICE _Out_ PWDF_DEVICE_STATE DeviceState
Definition: wdfdevice.h:1996
BOOLEAN AreRegistersMappedToUsermode(VOID)
Definition: fxdevice.hpp:2092
virtual VOID RemoveDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevicekm.cpp:475
#define __out_opt
Definition: dbghelp.h:65
FxDefaultIrpHandler * m_PkgDefault
Definition: fxdevice.hpp:673
~FxDevice(VOID)
Definition: fxdevice.cpp:239
FxWmiIrpHandler * m_PkgWmi
Definition: fxdevice.hpp:672
BOOL IsBufferType(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
Definition: fxdevice.hpp:2171
VOID WmiPkgCleanup(VOID)
Definition: fxdevicekm.cpp:505
#define FALSE
Definition: types.h:117
FxCmResList * GetTranslatedResources()
Definition: fxdevice.hpp:1854
_In_ PIRP Irp
Definition: csq.h:116
_Must_inspect_result_ _Inout_ PWDFDEVICE_INIT _In_opt_ PWDF_OBJECT_ATTRIBUTES DeviceAttributes
Definition: wdfdevice.h:3561
__inline FxPackage * GetDispatchPackage(__in UCHAR MajorFunction)
Definition: fxdevice.hpp:890
static __inline MdDeviceObject MxGetAttachedDeviceReference(__in MdDeviceObject DriverObject)
Definition: mxgeneralkm.h:415
__inline BOOLEAN IsFdo(VOID)
Definition: fxdevice.hpp:1227
UNICODE_STRING m_MofResourceName
Definition: fxdevice.hpp:585
BOOL IsPort(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
Definition: fxdevice.hpp:2158
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
IWudfDeviceStack2 * GetDeviceStack2(VOID)
Definition: fxdeviceum.hpp:444
NTSTATUS WmiPkgRegister(VOID)
Definition: fxdevicekm.cpp:488
static __inline CCHAR GetCxDriverIndex(__in FxCxDeviceInfo *CxDeviceInfo)
Definition: fxdevice.hpp:1640
static VOID STDCALL _InterfaceReferenceNoOp(__in_opt PVOID Context)
Definition: fxdevice.hpp:1767
HKEY m_PdoDevKey
Definition: fxdevice.hpp:748
virtual _Must_inspect_result_ NTSTATUS AddIoTarget(__inout FxIoTarget *IoTarget)
Definition: fxdevice.hpp:247
__inline VOID SetCallbackFlags(__in BYTE Flags)
Definition: fxdevice.hpp:1526
WDF_DEVICE_IO_TYPE m_ReadWriteIoType
Definition: fxdevice.hpp:514
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
enum _WDF_FILEOBJECT_CLASS WDF_FILEOBJECT_CLASS
static __inline VOID MxReferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:238
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
_Must_inspect_result_ NTSTATUS CreateDevice(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevice.cpp:964
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
size_t m_RequestLookasideListElementSize
Definition: fxdevice.hpp:653
__inline WDF_FILEOBJECT_CLASS GetFileObjectClass(VOID)
Definition: fxdevice.hpp:1123
#define __out
Definition: dbghelp.h:62
BOOLEAN m_Filter
Definition: fxdevice.hpp:522
unsigned char BOOLEAN
VOID ControlDeviceDelete(VOID)
Definition: fxdevice.hpp:1465
static WUDF_INTERFACE_CONTEXT RemoteInterfaceArrival(_In_ IWudfDevice *DeviceObject, _In_ LPCGUID DeviceInterfaceGuid, _In_ PCWSTR SymbolicLink)
Definition: fxdeviceum.cpp:762
FxCallbackLock * m_CallbackLockPtr
Definition: fxdevice.hpp:475
VOID ConfigureAutoForwardCleanupClose(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevice.cpp:864
UNICODE_STRING m_DeviceName
Definition: fxdevice.hpp:578
static NTSTATUS NtStatusFromHr(_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
Definition: fxdeviceum.cpp:826
MdDeviceObject __inline GetAttachedDevice(VOID)
Definition: fxdevice.hpp:210
virtual VOID RemoveIoTarget(__inout FxIoTarget *IoTarget)
Definition: fxdevice.cpp:1790
#define _In_
Definition: ms_sal.h:308
_Must_inspect_result_ NTSTATUS OpenDevicemapKeyWorker(_In_ PFX_DRIVER_GLOBALS pFxDriverGlobals, _In_ PCUNICODE_STRING KeyName, _In_ ACCESS_MASK DesiredAccess, _In_ FxRegKey *pKey)
Definition: fxdevicekm.cpp:995
IWudfIrp * MdIrp
Definition: mxum.h:103
_Must_inspect_result_ NTSTATUS PdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:221
Definition: bufpool.h:45
LIST_ENTRY m_CxDeviceInfoListHead
Definition: fxdevice.hpp:635
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes
Definition: wdfdevice.h:2654
VOID AddToDisposeList(__inout FxObject *Object)
Definition: fxdevice.hpp:387
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
BOOLEAN m_PdoKnown
Definition: fxdevice.hpp:599
FxMpDevice(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxDriver *Driver, __in MdDeviceObject DeviceObject, __in MdDeviceObject AttachedDevice, __in MdDeviceObject PDO)
Definition: fxdevice.hpp:2224
VOID Destroy(VOID)
Definition: fxdevicekm.cpp:329
GLuint GLfloat * val
Definition: glext.h:7180
__inline VOID SetDevicePowerPolicyState(__in WDF_DEVICE_POWER_POLICY_STATE DeviceState)
Definition: fxdevice.hpp:1191
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreateNoDelete(__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
Definition: fxdevice.cpp:559
WDF_FILE_OBJECT_POLICY_TYPE m_FileObjectPolicy
Definition: fxdevice.hpp:788
BOOLEAN Dispose(VOID)
Definition: fxdevice.hpp:2243
enum _WDF_SYNCHRONIZATION_SCOPE WDF_SYNCHRONIZATION_SCOPE
FxDisposeList * m_DisposeList
Definition: fxdevice.hpp:466
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDFDEVICE_INIT *DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes, __out FxDevice **Device)
Definition: fxdevice.cpp:366
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY m_FileObjectListHead
Definition: fxdevice.hpp:643
static _Must_inspect_result_ NTSTATUS _AcquireOptinRemoveLock(__in MdDeviceObject DeviceObject, __in MdIrp Irp)
Definition: fxdevice.cpp:1296
int Count
Definition: noreturn.cpp:7
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE PropertyType
IWudfDeviceStack * GetDeviceStack(VOID)
Definition: fxdeviceum.hpp:435
__inline BYTE GetCallbackFlagsLocked(VOID)
Definition: fxdevice.hpp:1492
FxPropertyType
Definition: fxdevice.hpp:85
__inline FxDriver * GetCxDriver(__in FxCxDeviceInfo *CxDeviceInfo)
Definition: fxdevice.hpp:1654
PFX_DRIVER_GLOBALS pFxDriverGlobals
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BOOLEAN __inline FxIsFileObjectOptional(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:112
static void RemoteInterfaceRemoval(_In_ IWudfDevice *DeviceObject, _In_ WUDF_INTERFACE_CONTEXT RemoteInterfaceID)
Definition: fxdeviceum.cpp:778
WUDF_IO_REMOVE_LOCK IoRemoveLock
Definition: fxdevice.hpp:34
BOOLEAN IsRemoveLockEnabledForIo(VOID)
Definition: fxdevicekm.hpp:57
MdDeviceObject __inline GetPhysicalDevice(VOID)
Definition: fxdevice.hpp:228
__inline VOID SetDevicePowerState(__in WDF_DEVICE_POWER_STATE DeviceState)
Definition: fxdevice.hpp:1182
#define STDCALL
Definition: wdf.h:45
#define ASSERT(a)
Definition: mode.c:44
const struct winhelp_callbacks Callbacks
Definition: callback.c:161
BOOLEAN IsInterfaceRegistered(_In_ const GUID *InterfaceClassGUID, _In_opt_ PCUNICODE_STRING RefString)
Definition: fxdevice.cpp:1926
LONG HRESULT
Definition: typedefs.h:79
char CCHAR
Definition: typedefs.h:51
INT POOL_TYPE
Definition: typedefs.h:78
__inline VOID SetFileObjectClass(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:1135
__inline BOOLEAN IsFilter()
Definition: fxdevice.hpp:1408
__inline BYTE GetCallbackFlags(VOID)
Definition: fxdevice.hpp:1501
enum _WDF_DEVICE_IO_BUFFER_RETRIEVAL WDF_DEVICE_IO_BUFFER_RETRIEVAL
Definition: mxum.h:117
FxDevice(__in FxDriver *ArgDriver)
Definition: fxdevice.cpp:143
WDF_FILEOBJECT_CLASS __inline FxFileObjectClassNormalize(__in WDF_FILEOBJECT_CLASS FileObjectClass)
Definition: fxdevice.hpp:103
LIST_ENTRY m_PreprocessInfoListHead
Definition: fxdevice.hpp:630
__inline CHAR GetStackSize(VOID)
Definition: fxdevice.hpp:1824
__inline UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL GetRetrievalMode(VOID)
Definition: fxdevice.hpp:1959
BOOLEAN m_AutoForwardCleanupClose
Definition: fxdevice.hpp:605
PVOID AllocateRequestMemory(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: fxdevice.cpp:1630
Definition: xml2sdb.h:79
__inline VOID ClearCallbackFlagsLocked(__in BYTE Flags)
Definition: fxdevice.hpp:1539
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG DeviceInstanceKeyType
Definition: wdfdevice.h:2654
FxSpinLockTransactionedList m_IoTargetsList
Definition: fxdevice.hpp:623
VOID Add(FxObject *object)
static BOOL TransportQueryId(_In_ IWudfDevice *DeviceObject, _In_ DWORD Id, _In_ PVOID DataBuffer, _In_ SIZE_T cbDataBufferSize)
Definition: fxdeviceum.cpp:790
VOID WriteRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in_ecount(Count) PVOID Buffer, __in ULONG Count)
Definition: fxdeviceum.hpp:323
ULONG __inline GetDeviceObjectFlags(VOID)
Definition: fxdevice.hpp:192
Definition: bufpool.h:50
Type
Definition: Type.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
Definition: fxdevice.hpp:341
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
__inline FxPkgFdo * GetFdoPkg(VOID)
Definition: fxdevice.hpp:1236
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
static _Must_inspect_result_ NTSTATUS _AllocAndQueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory, _Out_ PDEVPROPTYPE PropertyType)
Definition: fxdevice.cpp:2063
__inline FxPkgPdo * GetPdoPkg(VOID)
Definition: fxdevice.hpp:1254
_Must_inspect_result_ NTSTATUS FdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:33
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE _Out_ WDF_DEVICE_IO_TYPE * IoControlIoType
PWSTR m_KernelDeviceName
Definition: fxdevice.hpp:758
GLbitfield flags
Definition: glext.h:7161
__inline WDF_DEVICE_IO_TYPE GetPreferredIoctlTransferMode(VOID)
Definition: fxdevice.hpp:1977
__inline BOOLEAN IsPowerPageableCapable(VOID)
Definition: fxdevice.hpp:1421
__inline FxDriver * GetDriver(VOID)
Definition: fxdevice.hpp:164
unsigned __int64 ULONG64
Definition: imports.h:198
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID SetCleanupFromFailedCreate(BOOLEAN Value)
Definition: fxdevice.hpp:1877
#define IRP_MJ_POWER
FxIoTargetSelf * GetSelfIoTarget(VOID)
Definition: fxdevice.cpp:1831
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
WDF_EXECUTION_LEVEL m_ExecutionLevel
Definition: fxdevice.hpp:478
MxDeviceObject m_PhysicalDevice
Definition: fxdevice.hpp:473
__inline WDF_DEVICE_PNP_STATE GetDevicePnpState()
Definition: fxdevice.hpp:1149
_Must_inspect_result_ NTSTATUS AssignProperty(_In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ DEVPROPTYPE Type, _In_ ULONG BufferLength, _In_opt_ PVOID PropertyBuffer)
Definition: fxdevicekm.cpp:668
NTSTATUS CreateSymbolicLink(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING SymbolicLinkName)
Definition: fxdevicekm.cpp:513
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:454
FxPkgIo * m_PkgIo
Definition: fxdevice.hpp:669
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_Must_inspect_result_ NTSTATUS OpenSettingsKey(__out HANDLE *Key, __in ACCESS_MASK DesiredAccess=STANDARD_RIGHTS_ALL)
Definition: fxdevicekm.cpp:818
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4431
BOOLEAN m_SelfIoTargetNeeded
Definition: fxdevice.hpp:611
#define __inout
Definition: dbghelp.h:50
Definition: typedefs.h:119
CHAR m_DefaultPriorityBoost
Definition: fxdevice.hpp:561
VOID FxLogDeviceStartTelemetryEvent(VOID)
Definition: fxdevice.hpp:1798
_In_ PTRANSFER_PACKET _In_ ULONG _In_ PIRP OriginalIrp
Definition: classp.h:1757
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
unsigned char BYTE
Definition: xxhash.c:193
#define IRP_MJ_SYSTEM_CONTROL
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
Definition: wdfdevice.h:3810
FxPkgGeneral * m_PkgGeneral
Definition: fxdevice.hpp:671
_In_ ULONG _In_ ACCESS_MASK _Out_ PHANDLE DevInstRegKey
Definition: iofuncs.h:1125
#define InterlockedExchange
Definition: armddk.h:54
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
virtual _Must_inspect_result_ NTSTATUS AddIoTarget(__inout FxIoTarget *IoTarget)
Definition: fxdevice.cpp:1772
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
MdDeviceObject __inline GetSafePhysicalDevice(VOID)
Definition: fxdevice.hpp:1005
WDF_OBJECT_ATTRIBUTES m_RequestAttributes
Definition: fxdevice.hpp:659
VOID __inline DestroyChildren(VOID)
Definition: fxobject.hpp:464
static VOID GetPreferredTransferMode(_In_ MdDeviceObject DeviceObject, _Out_ UMINT::WDF_DEVICE_IO_BUFFER_RETRIEVAL *RetrievalMode, _Out_ WDF_DEVICE_IO_TYPE *RWPreference, _Out_ WDF_DEVICE_IO_TYPE *IoctlPreference)
Definition: fxdeviceum.cpp:593
_Must_inspect_result_ NTSTATUS PreprocessIrp(__in MdIrp Irp)
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in ULONG __in ULONG __in_ecount(ValueLength) PVOID Value)
FxRegKey * pKey
_Must_inspect_result_ NTSTATUS SetFilter(__in BOOLEAN Value)
Definition: fxdevice.cpp:1851
static FxWdmDeviceExtension * _GetFxWdmExtension(__in MdDeviceObject DeviceObject)
Definition: fxdevicekm.hpp:30
ULONG_PTR SIZE_T
Definition: typedefs.h:80
__inline MdDeviceObject GetObject(VOID)
WDF_SYNCHRONIZATION_SCOPE m_SynchronizationScope
Definition: fxdevice.hpp:479
__inline BOOLEAN IsCxInIoPath(VOID)
Definition: fxdevice.hpp:1594
VOID DeleteSymbolicLink(VOID)
static unsigned __int64 next
Definition: rand_nt.c:6
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
ioTypeConfig ReadWriteIoType
__inline CHAR GetDefaultPriorityBoost(VOID)
Definition: fxdevice.hpp:1111
BOOLEAN m_PowerPageableCapable
Definition: fxdevice.hpp:530
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
unsigned short USHORT
Definition: pedump.c:61
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
PWSTR m_DeviceKeyPath
Definition: fxdevice.hpp:753
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
static void PoFxDevicePowerRequired(_In_ MdDeviceObject DeviceObject)
Definition: fxdeviceum.cpp:808
FxCxDeviceInfo * GetCxDeviceInfo(__in FxDriver *CxDriver)
Definition: fxdevice.hpp:1560
__inline VOID CallCleanup(VOID)
Definition: fxobject.hpp:815
FxCallbackLock * GetCallbackLockPtr(__out_opt FxObject **LockObject)
FxObject * m_CallbackLockObjectPtr
Definition: fxdevice.hpp:476
WDF_DEVICE_PNP_STATE m_CurrentPnpState
Definition: fxdevice.hpp:507
__inline WDF_DEVICE_IO_TYPE GetIoTypeForReadWriteBufferAccess(VOID)
Definition: fxdevice.hpp:1093
FxDeviceInfoFlags
Definition: fxtelemetry.hpp:98
USHORT WDFTYPE
Definition: fxtypes.h:29
__inline _Must_inspect_result_ NTSTATUS AcquireDmaPacketTransaction(VOID)
Definition: fxdevice.hpp:354
FxDmaPacketTransactionStatus
Definition: fxdevice.hpp:67
VOID WaitForEmpty(VOID)
__inline VOID SetStackSize(_In_ CHAR Size)
Definition: fxdevice.hpp:1833
WDF_REGISTER_ACCESS_MODE_TYPE m_RegisterAccessMode
Definition: fxdevice.hpp:783
static FxDeviceRemLockAction __inline _RequiresRemLock(__in UCHAR MajorCode, __in UCHAR MinorCode)
Definition: fxdevice.hpp:933
__inline VOID ClearCallbackFlags(__in BYTE Flags)
Definition: fxdevice.hpp:1548
#define _Out_opt_
Definition: ms_sal.h:346
ULONG RemoveLockOptionFlags
Definition: fxdevice.hpp:38
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
virtual VOID AddDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevicekm.cpp:465
static VOID STDCALL _InterfaceDereferenceNoOp(__in_opt PVOID Context)
Definition: fxdevice.hpp:1778
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
FxInterruptThreadpool * GetInterruptThreadpool(VOID)
Definition: fxdevice.hpp:1057
_Must_inspect_result_ NTSTATUS DispatchPreprocessedIrp(__in MdIrp Irp, __in PVOID DispatchContext)
Definition: fxdevice.cpp:1564
BYTE m_CallbackFlags
Definition: fxdevice.hpp:519
__inline WDF_DEVICE_POWER_POLICY_STATE GetDevicePowerPolicyState()
Definition: fxdevice.hpp:1165
#define IRP_MJ_READ
Definition: rdpdr.c:46
enum _WDF_DEVICE_POWER_POLICY_STATE WDF_DEVICE_POWER_POLICY_STATE
virtual VOID RemoveChildList(__inout FxChildList *List)
Definition: fxdevicekm.cpp:441
virtual VOID AddChildList(__inout FxChildList *List)
Definition: fxdevicekm.cpp:431
static _Must_inspect_result_ NTSTATUS _QueryProperty(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_opt_ PULONG ResultLength)
Definition: fxdevicekm.cpp:939
FxInterruptThreadpool * m_InteruptThreadpool
Definition: fxdevice.hpp:798
BOOLEAN m_ParentWaitingOnChild
Definition: fxdevice.hpp:535
static _Must_inspect_result_ NTSTATUS _OpenKey(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ ULONG DeviceInstanceKeyType, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes, _Out_ WDFKEY *Key)
Definition: fxdevicekm.cpp:731
BOOLEAN IsInterruptAccessAllowed(VOID)
Definition: fxdevice.hpp:2079
#define IRP_MJ_CLEANUP
__inline VOID SetParentWaitingOnRemoval(VOID)
Definition: fxdevice.hpp:1269
VOID FinishInitializing(VOID)
Definition: fxdevice.cpp:1109
static __inline NTSTATUS _GetDeviceProperty(_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)
WDF_FS_CONTEXT_USE_POLICY_TYPE m_FsContextUsePolicy
Definition: fxdevice.hpp:793
VOID GetConstraints(__out_opt WDF_EXECUTION_LEVEL *ExecutionLevel, __out_opt WDF_SYNCHRONIZATION_SCOPE *SynchronizationScope)
__inline VOID SetDevicePnpState(__in WDF_DEVICE_PNP_STATE DeviceState)
Definition: fxdevice.hpp:1173
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
__inline PWDF_OBJECT_ATTRIBUTES GetRequestAttributes(VOID)
Definition: fxdevice.hpp:1315
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIOTARGET * IoTarget
Definition: wdfiotarget.h:363
_Must_inspect_result_ NTSTATUS PostInitialize(VOID)
Definition: fxdevice.cpp:940
WDF_EXTERN_C_START enum _WDF_EXECUTION_LEVEL WDF_EXECUTION_LEVEL
virtual _Must_inspect_result_ NTSTATUS AllocateDmaEnablerList(VOID)
Definition: fxdevice.hpp:308
ULONG m_DirectTransferThreshold
Definition: fxdevice.hpp:772
FxDriver * m_Driver
Definition: fxdevice.hpp:469
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
__inline BOOLEAN IsCxDriverInIoPath(__in FxDriver *CxDriver)
Definition: fxdevice.hpp:1585
__inline BOOLEAN IsPdo(VOID)
Definition: fxdevice.hpp:1245
enum _WDF_DEVICE_POWER_STATE WDF_DEVICE_POWER_STATE
_Must_inspect_result_ NTSTATUS DeleteDeviceFromFailedCreate(__in NTSTATUS FailedStatus, __in BOOLEAN UseStateMachine)
Definition: fxdevice.cpp:644
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG GetFlags(VOID)
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID * InterfaceClassGUID
Definition: wdfdevice.h:3625
VOID ReadRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __out_ecount_full(Count) PVOID Buffer, __in ULONG Count)
Definition: fxdeviceum.hpp:233
LONG m_DmaPacketTransactionStatus
Definition: fxdevice.hpp:484
virtual FxIoTarget * GetDefaultIoTarget(VOID)
Definition: fxdevice.hpp:2279
__inline BOOLEAN IsExclusive(VOID)
Definition: fxdevice.hpp:1218
virtual VOID AddChildList(__inout FxChildList *List)
Definition: fxdevice.hpp:283
BOOLEAN HasConnectionResources(VOID)
Definition: fxresource.hpp:615
virtual BOOLEAN Dispose(VOID)
Definition: fxdevice.cpp:1242
WDF_DIRECT_HARDWARE_ACCESS_TYPE m_DirectHardwareAccess
Definition: fxdevice.hpp:777
VOID RetrieveDeviceRegistrySettings(VOID)
Definition: fxdeviceum.cpp:851
static _Must_inspect_result_ NTSTATUS STDCALL Dispatch(__in MdDeviceObject DeviceObject, __in MdIrp OriginalIrp)
Definition: fxdevice.cpp:1551
static ULONG __inline GetLength(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size)
Definition: fxdevice.hpp:2118
USHORT GetDeviceTelemetryInfoFlags(VOID)
Definition: fxdevice.hpp:1815
__inline VOID ReleaseDmaPacketTransaction(VOID)
Definition: fxdevice.hpp:373
static __inline VOID MxDereferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:247
#define __in
Definition: dbghelp.h:35
PVOID GetPseudoAddressFromSystemAddress(__in PVOID SystemAddress)
Definition: fxdevice.hpp:2100
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
virtual FxIoTarget * GetDefaultIoTarget(VOID)
Definition: fxdevice.cpp:1818
SIZE_T ReadRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register)
Definition: fxdeviceum.hpp:186
UINT64 WUDF_INTERFACE_CONTEXT
Definition: mxum.h:111
virtual _Must_inspect_result_ NTSTATUS AllocateDmaEnablerList(VOID)
Definition: fxdevicekm.cpp:452
FxMessageDispatch * m_Dispatcher
Definition: fxdevice.hpp:738
NTSTATUS ProcessWmiPowerQueryOrSetData(_In_ RdWmiPowerAction Action, _Out_ BOOLEAN *QueryResult)
Definition: fxdeviceum.cpp:699
ULONG ACCESS_MASK
Definition: nt_native.h:40
ULONG __inline GetAttachedDeviceObjectFlags(VOID)
Definition: fxdevice.hpp:219
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:461
MxDeviceObject m_DeviceObject
Definition: fxdevice.hpp:471
static const WCHAR SymbolicLink[]
Definition: interface.c:31
~FxDeviceBase(VOID)
VOID SetFilterIoType(VOID)
Definition: fxdevice.cpp:1873
BOOLEAN m_DeviceObjectDeleted
Definition: fxdevice.hpp:553
VOID SetStackSize(_In_ CCHAR Size)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3736
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
_Must_inspect_result_ _In_ WDFDEVICE _In_ PDEVICE_OBJECT PhysicalDevice
Definition: wdfdevice.h:2320
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
virtual VOID DeleteObject(VOID)
Definition: fxdevice.cpp:1135
#define LockObject(Object)
Definition: titypes.h:34
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
Definition: fxdevice.cpp:1754