ReactOS  0.4.15-dev-3187-ge372f2b
fxdeviceapium.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxDeviceApiUm.cpp
8 
9 Abstract:
10 
11  This module exposes the "C" interface to the FxDevice object.
12 
13 Author:
14 
15 
16 Environment:
17 
18  user mode only
19 
20 Revision History:
21 
22 --*/
23 
24 #include "coreprivshared.hpp"
25 #include "fxiotarget.hpp"
26 #include <intsafe.h>
27 
28 extern "C" {
29 #include "FxDeviceApiUm.tmh"
30 }
31 
32 //
33 // extern "C" the entire file
34 //
35 extern "C" {
36 
37 //
38 // Verifier Functions
39 //
40 // Do not specify argument names
42 NTSTATUS,
44  _In_ FxDevice*,
45  _In_ MdIrp,
46  _In_ FxIoQueue*,
47  _In_ ULONG
48  );
49 
53 WDFEXPORT(WdfDevicePostEvent)(
55  _In_ WDFDEVICE Device,
60  )
61 /*++
62 
63 Routine Description:
64 
65  This method asynchronously notifies applications that are waiting for the
66  specified event from a driver.
67 
68 Arguments:
69  Device - WDF Device handle.
70 
71  EventGuid: The GUID for the event. The GUID is determined by the application
72  and the driver and is opaque to the framework.
73 
74  EventType: A WDF_EVENT_TYPE-typed value that identifies the type of
75  event. In the current version of UMDF, the driver must set EventType
76  to WdfEventBroadcast (1). WdfEventBroadcast indicates that the event
77  is broadcast. Applications can subscribe to WdfEventBroadcast-type
78  events. To receive broadcast events, the application must register
79  for notification through the Microsoft Win32
80  RegisterDeviceNotification function. WdfEventBroadcast-type events
81  are exposed as DBT_CUSTOMEVENT-type events to applications.
82 
83  Data: A pointer to a buffer that contains data that is associated with the
84  event. NULL is a valid value.
85 
86  DataSizeCb : The size, in bytes, of data that Data points to. Zero is a
87  valid size value if Data is set to NULL.
88 
89 Return Value:
90  An NTSTATUS value that denotes success or failure of the DDI
91 
92 --*/
93 {
94  DDI_ENTRY();
95 
100 
101  //
102  // Validate the Device object handle and get its FxDevice. Also get the
103  // driver globals pointer.
104  //
106  Device,
108  (PVOID *) &pDevice,
110 
111  if (DataSizeCb > 0) {
113  }
114 
115  //
116  // Currently only broadcast events are supported.
117  //
118  if (WdfEventType != WdfEventBroadcast) {
122  "WDFDEVICE 0x%p WdfEventType %d not expected %!STATUS!",
125  return status;
126  }
127 
128  //
129  // post the event
130  //
131  hr = pDevice->GetDeviceStack()->PostEvent(EventGuid,
132  WdfEventType,
133  Data,
134  DataSizeCb);
135 
136  if (FAILED(hr)) {
140  "WDFDEVICE 0x%p Failed to post event %!STATUS!",
141  Device, status);
142  }
143  else {
145  }
146 
147  return status;
148 }
149 
152 WDFAPI
153 NTSTATUS
154 WDFEXPORT(WdfDeviceMapIoSpace)(
155  _In_
157  _In_
158  WDFDEVICE Device,
159  _In_
161  _In_
163  _In_
165  _Out_
167  )
168 /*++
169 
170 Routine Description:
171 
172  This routine maps given physical address of a device register into
173  system address space and optionally into user-mode address space.
174 
175 Arguments:
176 
177  DriverGlobals - DriverGlobals pointer
178 
179  Device - WDF Device handle.
180 
181  PhysicalAddress - Address of MMIO register to be mapped
182 
183  NumberOfBytes - Length of resource to be mapped in bytes.
184 
185  CacheType - supplies type of caching desired
186 
187  PseudoBaseAddress - Pseudo base address (opaque base address) of the
188  mapped resource.
189 
190 Return Value:
191 
192  HRESULT
193 
194 --*/
195 {
196  DDI_ENTRY();
197 
201  FxDevice *pDevice;
202  HRESULT hr;
203 
204  //
205  // Validate the Device object handle and get its FxDevice. Also get the
206  // driver globals pointer.
207  //
209  Device,
211  (PVOID *) &pDevice,
213 
214  //
215  // Is direct hardware access allowed?
216  //
217  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
220  DriverGlobals->DriverName);
221 
222  //
223  // Validate input parameters.
224  //
225  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(PhysicalAddress.QuadPart),
226  DriverGlobals->DriverName);
227  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("NumberOfBytes should be > 0",
228  (NumberOfBytes > 0)), DriverGlobals->DriverName);
229  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("CacheType incorrect",
230  (CacheType >= MmNonCached &&
232  DriverGlobals->DriverName);
233  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(PseudoBaseAddress),
234  DriverGlobals->DriverName);
235 
240  CacheType,
242  if (FAILED(hr)) {
244  }
245  else {
247  }
248 
249  return status;
250 }
251 
253 WDFAPI
254 VOID
255 WDFEXPORT(WdfDeviceUnmapIoSpace)(
256  _In_
258  _In_
259  WDFDEVICE Device,
260  _In_
262  _In_
264  )
265 /*++
266 
267 Routine Description:
268 
269  This routine unmaps a previously mapped register resource.
270 
271 Arguments:
272  DriverGlobals - DriverGlobals pointer
273 
274  Device - WDF Device handle.
275 
276  PseudoBaseAddress - Address to be unmapped
277 
278  NumberOfBytes - Length of resource to be mapped in bytes.
279 
280 Return Value:
281 
282  VOID
283 
284 --*/
285 {
286  DDI_ENTRY();
287 
288  IWudfDeviceStack *deviceStack;
289  HRESULT hr;
293  FxDevice *pDevice;
294 
295  //
296  // Validate the Device object handle and get its FxDevice. Also get the
297  // driver globals pointer.
298  //
300  Device,
302  (PVOID *) &pDevice,
304 
305  //
306  // Is direct hardware access allowed?
307  //
308  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
311  DriverGlobals->DriverName);
312 
313  //
314  // Validate input parameters.
315  //
316  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(PseudoBaseAddress),
317  DriverGlobals->DriverName);
318  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("NumberOfBytes should be > 0",
319  (NumberOfBytes > 0)), DriverGlobals->DriverName);
320  //
321  // Get system address.
322  //
324 
325  //
326  // Validate that caller has given correct base address and length, and if
327  // so clear the mapping from resource table
328  //
331  NumberOfBytes);
332 
333  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Driver attempted to unmap "
334  "incorrect register address, or provided incorrect size",
335  SUCCEEDED(hr)), DriverGlobals->DriverName);
336 
337  //
338  // call host
339  //
340  if SUCCEEDED(hr) {
342 
344  }
345 
346  return;
347 }
348 
350 WDFAPI
351 PVOID
352 WDFEXPORT(WdfDeviceGetHardwareRegisterMappedAddress)(
353  _In_
355  _In_
356  WDFDEVICE Device,
357  _In_
359  )
360 /*++
361 
362 Routine Description:
363 
364  This routine returns user-mode base address where registers corresponing
365  to supplied pseudo base address have been mapped..
366 
367 Arguments:
368  DriverGlobals - DriverGlobals pointer
369 
370  Device - WDF Device handle.
371 
372  PseudoBaseAddress - Pseudo base address for which the caller needs to get
373  user-mode mapped address.
374 
375 Return Value:
376 
377  User-mode mapped base address.
378 
379 --*/
380 {
381  DDI_ENTRY();
382 
383  HRESULT hr;
388  FxDevice *pDevice;
389 
390  //
391  // Validate the Device object handle and get its FxDevice. Also get the
392  // driver globals pointer.
393  //
395  Device,
397  (PVOID *) &pDevice,
399 
400  //
401  // Is direct hardware access allowed?
402  //
403  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
406  DriverGlobals->DriverName);
407 
408  //
409  // Is user-mode mapping of registers enabled
410  //
411  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Incorrect register access mode."
412  " Register mapping to user-mode is not enabled. Set the INF directive"
413  " UmdfRegisterAccessMode to RegisterAccessUsingUserModeMapping"
414  " in driver's INF file to enable Register mapping to user-mode",
416 
417  //
418  // Validate input parameters.
419  //
420  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(PseudoBaseAddress),
421  DriverGlobals->DriverName);
422 
423  //
424  // check if this base address is valid.
425  //
429 
432 
433  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Driver provided incorrect base "
434  "address", SUCCEEDED(hr)), DriverGlobals->DriverName);
435 
436  return usermodeBaseAddress;
437 }
438 
440 SIZE_T
441 WDFAPI
442 WDFEXPORT(WdfDeviceReadFromHardware)(
443  _In_
445  _In_
446  WDFDEVICE Device,
447  _In_
448  WDF_DEVICE_HWACCESS_TARGET_TYPE Type,
449  _In_
450  WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
451  _In_
454  PVOID Buffer,
455  _In_opt_
456  ULONG Count
457  )
458 /*++
459 
460 Routine Description:
461 
462  This routine does read from a device port or register.
463 
464 Arguments:
465  DriverGlobals - DriverGlobals pointer
466 
467  Device - WDF Device handle.
468 
469  Type - Specified whether it is port or register
470 
471  Size - Supplies size of read in bytes.
472 
473  TargetAddress - Supplies address of port or register to read from
474 
475  Buffer - Supplies optionally a buffer to receive the read data
476 
477  Count - Size of buffer in bytes
478 
479 Return Value:
480 
481  Returns the read value if it is non-buffered port or register.
482  Otherwise zero.
483 
484 --*/
485 {
486  DDI_ENTRY();
487 
490  HRESULT hr = S_OK;
494  FxDevice *pDevice;
495 
496  //
497  // ETW event for perf measurement
498  //
500 
501  //
502  // Validate the Device object handle and get its FxDevice. Also get the
503  // driver globals pointer.
504  //
506  Device,
508  (PVOID *) &pDevice,
510 
511  //
512  // See if direct hwaccess is allowed
513  //
514  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
517  DriverGlobals->DriverName);
518 
519  //
520  // validate parameters
521  //
522  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
523  CHECK("Incorrect Type parameter",
524  (Type > WdfDeviceHwAccessTargetTypeInvalid &&
525  Type < WdfDeviceHwAccessTargetTypeMaximum)),
526  DriverGlobals->DriverName);
527 
528  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
529  CHECK("Incorrect Size parameter",
530  (Size > WdfDeviceHwAccessTargetSizeInvalid &&
531  Size < WdfDeviceHwAccessTargetSizeMaximum)),
532  DriverGlobals->DriverName);
533 
534  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(TargetAddress),
535  DriverGlobals->DriverName);
536 
538  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(Buffer), DriverGlobals->DriverName);
539  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Count should be > 0", (Count > 0)),
540  DriverGlobals->DriverName);
541  }
542  else {
543  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NULL(Buffer), DriverGlobals->DriverName);
544  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Count should be 0", (Count == 0)),
545  DriverGlobals->DriverName);
546  }
547 
548 #if !defined(_WIN64)
549  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("ULONG64 write is allowed only"
550  "on 64-bit platform", (Size != WdfDeviceHwAccessTargetSizeUlong64)),
551  DriverGlobals->DriverName);
552 #endif
553 
554  //
555  // get system address from pseudo address for registers
556  //
557  if (pDevice->IsRegister(Type)){
559  }
560 
562 
563  //
564  // For buffer access for registers, compute the length of buffer using Count.
565  // Count is the element count in the buffer (of UCHAR/USHORT/ULONG/ULONG64).
566  // Note that Port is accessed differently than registers - the buffer is
567  // written into the port address of specified size (UCHAR/USHORT/ULONG).
568  //
570  size_t tmp;
571 
572  hr = SizeTMult(Count, length, &tmp);
573  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Integer overflow occurred "
574  "when computing length of read access", (SUCCEEDED(hr))),
575  DriverGlobals->DriverName);
576 
577  length = tmp;
578  }
579 
581 
582  //
583  // Port access is always handled through system call.
584  // Register access can be handled in usermode if driver enabled
585  // mapping registers to usermode.
586  //
588  PVOID umAddress = NULL;
589 
590  //
591  // Acquire the resource validation table lock for read/write as well
592  // since a driver's thread accessing hardware register/port and
593  // race with Map/Unmap operations.
594  //
596 
598  length,
599  &umAddress);
600 
601  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
602  CHECK("Driver attempted to read from invalid register address or "
603  "address range", (SUCCEEDED(hr))),
604  DriverGlobals->DriverName);
605 
606  if (pDevice->IsBufferType(Type)) {
607  pDevice->ReadRegisterBuffer(Size, umAddress, Buffer, Count);
608  }
609  else {
610  value = pDevice->ReadRegister(Size, umAddress);
611  }
612 
614  }
615  else {
616  //
617  // Registers are not mapped to user-mode address space so send
618  // message to reflector to use system HAL routines to access register.
619  // Acquire validation table lock here as well since some read/write
620  // thread might race with PrepareHardware/ReleaseHardware that may be
621  // building/deleting the table.
622  //
623  IWudfDeviceStack *deviceStack;
624 
626 
627  if (pDevice->IsRegister(Type)) {
629  length,
630  NULL);
631  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
632  CHECK("Driver attempted to read from invalid register address "
633  "or address range", (SUCCEEDED(hr))),
634  DriverGlobals->DriverName);
635  }
636  else {
638  length);
639  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
640  CHECK("Driver attempted to read from invalid port address or "
641  "address range", (SUCCEEDED(hr))),
642  DriverGlobals->DriverName);
643  }
644 
646 
648  deviceStack->ReadFromHardware((UMINT::WDF_DEVICE_HWACCESS_TARGET_TYPE)Type,
649  (UMINT::WDF_DEVICE_HWACCESS_TARGET_SIZE)Size,
651  &value,
652  Buffer,
653  Count);
654  }
655 
656  //
657  // ETW event for perf measurement
658  //
660 
661  return value;
662 }
663 
665 VOID
666 WDFAPI
667 WDFEXPORT(WdfDeviceWriteToHardware)(
668  _In_
670  _In_
671  WDFDEVICE Device,
672  _In_
673  WDF_DEVICE_HWACCESS_TARGET_TYPE Type,
674  _In_
675  WDF_DEVICE_HWACCESS_TARGET_SIZE Size,
676  _In_
678  _In_
679  SIZE_T Value,
681  PVOID Buffer,
682  _In_opt_
683  ULONG Count
684  )
685 /*++
686 
687 Routine Description:
688 
689  This routine does writes to a device port or register.
690 
691 Arguments:
692  DriverGlobals - DriverGlobals pointer
693 
694  Device - WDF Device handle.
695 
696  Type - Specified whether it is port or register
697 
698  Size - Supplies size of read in bytes.
699 
700  TargetAddress - Supplies address of port or register to read from
701 
702  Value - value to write
703 
704  Buffer - Supplies optionally a buffer that has data that needs to be
705  written.
706 
707  Count - Size of buffer in bytes
708 
709 Return Value:
710 
711  void
712 
713 --*/
714 {
715  DDI_ENTRY();
716 
719  HRESULT hr = S_OK;
720  SIZE_T length = 0;
722  FxDevice *pDevice;
723 
724  //
725  // ETW event for perf measurement
726  //
728 
729  //
730  // Validate the Device object handle and get its FxDevice. Also get the
731  // driver globals pointer.
732  //
734  Device,
736  (PVOID *) &pDevice,
738 
739  //
740  // See if direct hwaccess is allowed
741  //
742  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
745  DriverGlobals->DriverName);
746 
747  //
748  // validate parameters
749  //
750  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
751  CHECK("Incorrect Type parameter",
752  (Type > WdfDeviceHwAccessTargetTypeInvalid &&
753  Type < WdfDeviceHwAccessTargetTypeMaximum)),
754  DriverGlobals->DriverName);
755 
756  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
757  CHECK("Incorrect Size parameter",
758  (Size > WdfDeviceHwAccessTargetSizeInvalid &&
759  Size < WdfDeviceHwAccessTargetSizeMaximum)),
760  DriverGlobals->DriverName);
761 
762  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(TargetAddress),
763  DriverGlobals->DriverName);
764 
765  if (pDevice->IsBufferType(Type)) {
766  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NOT_NULL(Buffer),
767  DriverGlobals->DriverName);
768  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Count should be > 0", (Count > 0)),
769  DriverGlobals->DriverName);
770  }
771  else {
772  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK_NULL(Buffer), DriverGlobals->DriverName);
773  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Count should be 0", (Count == 0)),
774  DriverGlobals->DriverName);
775  }
776 
777 #if !defined(_WIN64)
778  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("ULONG64 write is allowed only"
779  "on 64-bit platform", (Size != WdfDeviceHwAccessTargetSizeUlong64)),
780  DriverGlobals->DriverName);
781 #endif
782 
783  //
784  // get system address from pseudo address for registers
785  //
786  if (pDevice->IsRegister(Type)){
788  }
789 
791 
792  //
793  // For buffer access for registers, compute the length of buffer using Count.
794  // Count is the element count in the buffer (of UCHAR/USHORT/ULONG/ULONG64).
795  // Note that Port is accessed differently than registers - the buffer is
796  // written into the port address of specified size (UCHAR/USHORT/ULONG).
797  //
799  size_t tmp;
800 
801  hr = SizeTMult(Count, length, &tmp);
802  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Integer overflow occurred "
803  "when computing length of write access", (SUCCEEDED(hr))),
804  DriverGlobals->DriverName);
805 
806  length = tmp;
807  }
808 
810 
811  //
812  // Port access is always handled through system call.
813  // Register access can be handled in usermode if driver enabled
814  // mapping registers to usermode.
815  //
817  PVOID umAddress = NULL;
818 
819  //
820  // Acquire the resource validation table lock for read/write as well
821  // since a driver's thread accessing hardware register/port and
822  // race with Map/Unmap operations.
823  //
825 
826 
828  length,
829  &umAddress);
830 
831  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
832  CHECK("Driver attempted to write to invalid register address or "
833  "address range", (SUCCEEDED(hr))),
834  DriverGlobals->DriverName);
835 
836  if (pDevice->IsBufferType(Type)) {
838  }
839  else {
840  pDevice->WriteRegister(Size, umAddress, Value);
841  }
842 
844  }
845  else {
846  //
847  // Registers are not mapped to user-mode address space so send
848  // message to reflector to use system HAL routines to access register.
849  // Acquire validation table lock here as well since some read/write
850  // thread might race with PrepareHardware/ReleaseHardware that may be
851  // building/deleting the table.
852  //
853  IWudfDeviceStack *deviceStack;
854 
856 
857  if (pDevice->IsRegister(Type)) {
859  length,
860  NULL);
861  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
862  CHECK("Driver attempted to write to invalid register address "
863  "or address range", (SUCCEEDED(hr))),
864  DriverGlobals->DriverName);
865 
866  }
867  else {
869  length);
870  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
871  CHECK("Driver attempted to write to invalid port address or "
872  "address range", (SUCCEEDED(hr))),
873  DriverGlobals->DriverName);
874  }
875 
877 
879  deviceStack->WriteToHardware((UMINT::WDF_DEVICE_HWACCESS_TARGET_TYPE)Type,
880  (UMINT::WDF_DEVICE_HWACCESS_TARGET_SIZE)Size,
882  Value,
883  Buffer,
884  Count);
885  }
886 
887  //
888  // ETW event for perf measurement
889  //
891 
892  return;
893 }
894 
896 WDFAPI
897 NTSTATUS
898 WDFEXPORT(WdfDeviceAssignInterfaceProperty) (
899  _In_
901  _In_
902  WDFDEVICE Device,
903  _In_
904  PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData,
905  _In_
907  _In_
909  _In_opt_
911  )
912 /*++
913 
914 Routine Description:
915 
916  This routine assigns interface property.
917 
918 Arguments:
919 
920  DriverGlobals - DriverGlobals pointer
921 
922  Device - WDF Device handle.
923 
924  PropertyData - A pointer to WDF_DEVICE_INTERFACE_PROPERTY_ DATA structure.
925 
926  Type - Set this parameter to the DEVPROPTYPE value that specifies the type
927  of the data that is supplied in the Data buffer.
928 
929  BufferLength - Specifies the length, in bytes, of the buffer that
930  PropertyBuffer points to.
931 
932  PropertyBuffer - optional, A pointer to the device interface property data.
933  Set this parameter to NULL to delete the specified property.
934 
935 Return Value:
936 
937  Mthod returns an NTSTATUS value. This routine might return one of the
938  following values. It might return other NTSTATUS-codes as well.
939 
940  STATUS_SUCCESS - The operation succeeded.
941  STATUS_INVALID_PARAMETER - One of the parameters is incorrect.
942 
943 --*/
944 {
945  DDI_ENTRY();
946 
948  FxDevice *pDevice;
950 
951  //
952  // Validate the Device object handle and get its FxDevice. Also get the
953  // driver globals pointer.
954  //
956  Device,
958  (PVOID *) &pDevice,
960 
961  //
962  // Validate PropertyData
963  //
966  return status;
967  }
968 
969  if (BufferLength == 0 && PropertyBuffer != NULL) {
972  "Property buffer size is zero, while the buffer is non-NULL"
973  ", %!STATUS!", status);
974  return status;
975  }
976 
979  Type,
980  BufferLength,
982  );
983  return status;
984 }
985 
987 WDFAPI
988 NTSTATUS
989 WDFEXPORT(WdfDeviceAllocAndQueryInterfaceProperty) (
990  _In_
992  _In_
993  WDFDEVICE Device,
994  _In_
995  PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData,
996  _In_
998  _In_opt_
1000  _Out_
1001  WDFMEMORY* PropertyMemory,
1002  _Out_
1004  )
1005 /*++
1006 
1007 Routine Description:
1008 
1009  This routine queries interface property.
1010 
1011 Arguments:
1012 
1013  DriverGlobals - DriverGlobals pointer
1014 
1015  Device - WDF Device handle.
1016 
1017  PropertyData - A pointer to WDF_DEVICE_INTERFACE_PROPERTY_ DATA structure.
1018 
1019  PoolType - A POOL_TYPE-typed enumerator that specifies the type of memory
1020  to be allocated.
1021 
1022  PropertyMemoryAttributes - optional, A pointer to a caller-allocated
1023  WDF_OBJECT_ATTRIBUTES structure that describes object attributes
1024  for the memory object that the function will allocate. This
1025  parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.
1026 
1027  PropertyMemory - A pointer to a WDFMEMORY-typed location that receives a
1028  handle to a framework memory object.
1029 
1030  Type - A pointer to a DEVPROPTYPE variable. If method successfully retrieves
1031  the property data, the routine writes the property type value to
1032  this variable. This value indicates the type of property data
1033  that is in the Data buffer.
1034 
1035 
1036 Return Value:
1037 
1038  Method returns an NTSTATUS value. This routine might return one of the
1039  following values. It might return other NTSTATUS-codes as well.
1040 
1041  STATUS_SUCCESS The operation succeeded.
1042  STATUS_INVALID_PARAMETER One of the parameters is incorrect.
1043 
1044 --*/
1045 {
1046  DDI_ENTRY();
1047 
1049  FxDevice* pDevice;
1050  NTSTATUS status;
1051 
1053  Device,
1055  (PVOID *) &pDevice,
1056  &pFxDriverGlobals);
1057 
1058  //
1059  // Validate PropertyData
1060  //
1062  if (!NT_SUCCESS(status)) {
1063  return status;
1064  }
1065 
1068 
1069  *PropertyMemory = NULL;
1070 
1072  if (!NT_SUCCESS(status)) {
1073  return status;
1074  }
1075 
1077  if (!NT_SUCCESS(status)) {
1078  return status;
1079  }
1080 
1082  NULL,
1083  pDevice,
1084  PropertyData,
1086  PoolType,
1089  Type);
1090  return status;
1091 }
1092 
1093 
1095 WDFAPI
1096 NTSTATUS
1097 WDFEXPORT(WdfDeviceQueryInterfaceProperty) (
1098  _In_
1100  _In_
1101  WDFDEVICE Device,
1102  _In_
1103  PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData,
1104  _In_
1106  _Out_
1108  _Out_
1110  _Out_
1112  )
1113 /*++
1114 
1115 Routine Description:
1116 
1117  This routine queries interface property.
1118 
1119 Arguments:
1120 
1121  DriverGlobals - DriverGlobals pointer
1122 
1123  Device - WDF Device handle.
1124 
1125  PropertyData - A pointer to WDF_DEVICE_INTERFACE_PROPERTY_ DATA structure.
1126 
1127  BufferLength - The size, in bytes, of the buffer that is pointed to by
1128  PropertyBuffer.
1129 
1130  PropertyBuffer - A caller-supplied pointer to a caller-allocated buffer that
1131  receives the requested information. The pointer can be NULL
1132  if the BufferLength parameter is zero.
1133 
1134  ResultLength - A caller-supplied location that, on return, contains the
1135  size, in bytes, of the information that the method stored in
1136  PropertyBuffer. If the function's return value is
1137  STATUS_BUFFER_TOO_SMALL, this location receives the required
1138  buffer size.
1139 
1140  Type - A pointer to a DEVPROPTYPE variable. If method successfully retrieves
1141  the property data, the routine writes the property type value
1142  to this variable. This value indicates the type of property
1143  data that is in the Data buffer.
1144 
1145 Return Value:
1146 
1147  Method returns an NTSTATUS value. This routine might return one of the
1148  following values.
1149 
1150  STATUS_BUFFER_TOO_SMALL - The supplied buffer is too small to receive the
1151  information. The ResultLength member receives the
1152  size of buffer required.
1153  STATUS_SUCCESS - The operation succeeded.
1154  STATUS_INVALID_PARAMETER - One of the parameters is incorrect.
1155 
1156  The method might return other NTSTATUS values.
1157 
1158 --*/
1160  DDI_ENTRY();
1161 
1163  FxDevice* pDevice;
1164  NTSTATUS status;
1165 
1167  Device,
1169  (PVOID *) &pDevice,
1170  &pFxDriverGlobals);
1171 
1172  //
1173  // Validate PropertyData
1174  //
1176  if (!NT_SUCCESS(status)) {
1177  return status;
1178  }
1179 
1182 
1186  "Property buffer size is non-zero, while the buffer is NULL"
1187  ", %!STATUS!", status);
1188  return status;
1189  }
1190 
1191  if (BufferLength == 0 && PropertyBuffer != NULL) {
1194  "Property buffer size is zero, while the buffer is non-NULL"
1195  ", %!STATUS!", status);
1196  return status;
1197  }
1198 
1200  NULL,
1201  pDevice,
1202  PropertyData,
1204  BufferLength,
1206  ResultLength,
1207  PropertyType);
1208  return status;
1209 }
1210 
1212 WDFAPI
1213 VOID
1214 WDFEXPORT(WdfDeviceGetDeviceStackIoType) (
1215  _In_
1217  _In_
1218  WDFDEVICE Device,
1219  _Out_
1221  _Out_
1223  )
1225  DDI_ENTRY();
1226 
1228  FxDevice* pDevice;
1229 
1231  Device,
1233  (PVOID *) &pDevice,
1234  &pFxDriverGlobals);
1235 
1238 
1242  );
1243 }
1244 
1247 NTSTATUS
1248 WDFEXPORT(WdfDeviceHidNotifyPresence)(
1249  _In_
1251  _In_
1252  WDFDEVICE Device,
1253  _In_
1255  )
1257  DDI_ENTRY();
1258 
1259  NTSTATUS status;
1260  HRESULT hr;
1261  FxDevice* pDevice;
1262  IWudfDeviceStack* pDevStack;
1264 
1266  Device,
1268  (PVOID *)&pDevice,
1269  &pFxDriverGlobals);
1270 
1272 
1273  hr = pDevStack->HidNotifyPresence(IsPresent);
1275  if (!NT_SUCCESS(status)) {
1277  "HidNotifyPresence(%s) failed, %!STATUS! - Make sure to call "
1278  "WdfDeviceInitEnableHidInterface in EvtDriverDeviceAdd "
1279  "before calling WdfDeviceHidNotifyPresence.",
1280  IsPresent ? "TRUE" : "FALSE", status);
1281  }
1282 
1283  return status;
1284 }
1285 
1287 WDFFILEOBJECT
1288 WDFEXPORT(WdfDeviceGetFileObject)(
1289  __in
1291  __in
1292  WDFDEVICE Device,
1293  __in
1295  )
1296 /*++
1297 
1298 Routine Description:
1299 
1300  This functions returns the WDFFILEOBJECT corresponding to the WDM fileobject.
1301 
1302 Arguments:
1303 
1304  Device - Handle to the device to which the WDM fileobject is related to.
1305 
1306  FileObject - WDM FILE_OBJECT structure.
1307 
1308 Return Value:
1309 
1310 --*/
1311 
1315 
1316  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
1317  TRAPMSG("The DDI WdfDeviceGetFileObject is not supported for UMDF"),
1318  DriverGlobals->DriverName);
1319 
1320  return NULL;
1321 }
1322 
1325 NTSTATUS
1326 WDFEXPORT(WdfDeviceWdmDispatchIrpToIoQueue)(
1327  __in
1329  __in
1330  WDFDEVICE Device,
1331  __in
1332  MdIrp Irp,
1333  __in
1334  WDFQUEUE Queue,
1335  __in
1336  ULONG Flags
1337  )
1340  NTSTATUS status;
1341  FxDevice* pDevice;
1343 
1345  Device,
1347  (PVOID *) &pDevice,
1348  &pFxDriverGlobals);
1349 
1351  Queue,
1352  FX_TYPE_QUEUE,
1353  (PVOID*)&pQueue);
1354 
1356 
1357  FxIrp fxIrp(Irp);
1358 
1359  //
1360  // Unlike in KMDF, It's not possible for UMDF to forward to a parent queue.
1361  //
1363 
1365  pDevice,
1366  Irp,
1367  pQueue,
1368  Flags);
1369  if (!NT_SUCCESS(status)) {
1370 
1374 
1375  return status;
1376  }
1377 
1378  //
1379  // DispatchStep2 will convert the IRP to a WDFRequest and queue it, dispatching
1380  // the request to the driver if possible.
1381  //
1382  return pDevice->m_PkgIo->DispatchStep2(reinterpret_cast<MdIrp>(Irp),
1383  NULL,
1384  pQueue);
1385 }
1386 
1387 
1390 NTSTATUS
1391 WDFEXPORT(WdfDeviceWdmDispatchIrp)(
1392  _In_
1394  _In_
1395  WDFDEVICE Device,
1396  _In_
1397  PIRP pIrp,
1398  _In_
1400  )
1401 
1402 /*++
1403 
1404 Routine Description:
1405 
1406  This DDI returns control of the IRP to the framework.
1407  This must only be called from the dispatch callback passed to
1408  WdfDeviceConfigureWdmIrpDispatchCallback
1409 
1410 
1411 Arguments:
1412 
1413  Device - Handle to the I/O device.
1414 
1415  pIrp - Opaque handle to a _WUDF_IRP_WITH_VALIDATION structure.
1416 
1417  DispatchContext - Framework dispatch context passed as a parameter to the
1418  dispatch callback.
1419 
1420 Returns:
1421 
1422  IRP's status.
1423 
1424 --*/
1426  DDI_ENTRY();
1427 
1429  FxDevice* pDevice;
1430 
1432  Device,
1434  (PVOID *) &pDevice,
1435  &pFxDriverGlobals);
1436 
1437  //
1438  // Validate parameters and dispatch state. DispatchContext has already been
1439  // validated in DispatchStep1.
1440  //
1443 
1444  FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
1445  CHECK("This function must be called from within a "
1446  "EVT_WDFDEVICE_WDM_IRP_DISPATCH callback",
1448  DriverGlobals->DriverName);
1449 
1450  //
1451  // Adjust this context
1452  //
1454 
1455  //
1456  // Cast this pIrp back to its composite parts and dispatch it again
1457  //
1458  return pDevice->m_PkgIo->DispatchStep1(reinterpret_cast<MdIrp>(pIrp),
1459  DispatchContext);
1460 }
1461 
1462 } // extern "C"
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN IsPresent
CfxDevice * m_ParentDevice
Definition: fxdevice.hpp:569
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1697
Definition: pdh_main.c:93
FxIoQueue * pQueue
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG ResultLength
PVOID systemBaseAddress
#define _In_opt_
Definition: ms_sal.h:309
_Must_inspect_result_ __in WDFDEVICE __in MdIrp __in WDFQUEUE __in ULONG Flags
BOOL IsRegister(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
Definition: fxdevice.hpp:2145
GLint x0
Definition: linetemp.h:95
VOID SetStatus(__in NTSTATUS Status)
Definition: fxirpum.cpp:457
HRESULT ValidateRegisterSystemBaseAddress(__in PVOID Address, __out PVOID *UsermodeBaseAddress)
Definition: scsiwmi.h:51
UNREFERENCED_PARAMETER(FileObject)
FX_DECLARE_VF_FUNCTION_P4(NTSTATUS, VerifyWdfDeviceWdmDispatchIrpToIoQueue, _In_ FxDevice *, _In_ MdIrp, _In_ FxIoQueue *, _In_ ULONG)
NTSTATUS status
#define _Out_
Definition: ms_sal.h:345
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2221
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
FxPointerNotNull(pFxDriverGlobals, PropertyMemory)
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _In_ SIZE_T _In_reads_opt_(Count) PVOID Buffer
_Must_inspect_result_ _IRQL_requires_max_(PASSIVE_LEVEL) WDFAPI NTSTATUS WDFEXPORT(WdfDeviceMapIoSpace)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
Queries information details about a security descriptor.
Definition: Messaging.c:64
LONG NTSTATUS
Definition: precomp.h:26
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE Type
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
EventWriteEVENT_UMDF_FX_DDI_READ_FROM_HARDWARE_START(Type, Size, Count)
Definition: fxirp.hpp:28
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
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
IWudfDeviceStack * deviceStack
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID TargetAddress
DriverGlobals
EventWriteEVENT_UMDF_FX_DDI_READ_FROM_HARDWARE_END(Type, Size, Count)
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
PFILE_OBJECT MdFileObject
Definition: mxgeneralkm.h:32
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
#define CHECK(type, val, base, expected)
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _In_opt_ ULONG Count
HRESULT ValidateAndClearMapping(__in PVOID Address, __in SIZE_T Length)
PVOID GetSystemAddressFromPseudoAddress(__in PVOID PseudoAddress)
Definition: fxdevice.hpp:2108
HRESULT ValidateRegisterSystemAddressRange(__in PVOID SystemAddress, __in SIZE_T Length, __out_opt PVOID *UsermodeAddress)
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID PropertyBuffer
_Must_inspect_result_ NTSTATUS __fastcall DispatchStep2(__inout MdIrp Irp, __in_opt FxIoInCallerContext *IoInCallerCtx, __in_opt FxIoQueue *Queue)
Definition: fxpkgio.cpp:342
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
_Must_inspect_result_ NTSTATUS FxValidateInterfacePropertyData(_In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData)
FxObjectHandleGetPtr(pFxDriverGlobals, Queue, FX_TYPE_QUEUE,(PVOID *)&pQueue)
HRESULT hr
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID GetDeviceStackIoType(_Out_ WDF_DEVICE_IO_TYPE *ReadWriteIoType, _Out_ WDF_DEVICE_IO_TYPE *IoControlIoType)
__inline void UnlockResourceTable()
Definition: fxresource.hpp:500
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
BOOLEAN AreRegistersMappedToUsermode(VOID)
Definition: fxdevice.hpp:2092
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE _Out_ PVOID * PseudoBaseAddress
BOOL IsBufferType(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
Definition: fxdevice.hpp:2171
#define TODO
Definition: SAX2.c:49
FxCmResList * GetTranslatedResources()
Definition: fxdevice.hpp:1854
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP pIrp
PVOID usermodeBaseAddress
_In_ PIRP Irp
Definition: csq.h:116
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define WDFAPI
Definition: wdftypes.h:53
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _In_ SIZE_T Value
HRESULT ValidatePortAddressRange(__in PVOID Address, __in SIZE_T Length)
if SUCCEEDED(hr)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define ERROR_STRING_HW_ACCESS_NOT_ALLOWED
Definition: device_common.h:40
unsigned char BOOLEAN
static NTSTATUS NtStatusFromHr(_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
Definition: fxdeviceum.cpp:826
#define _In_
Definition: ms_sal.h:308
IWudfIrp * MdIrp
Definition: mxum.h:103
SIZE_T value
FxCmResList * transResources
Definition: bufpool.h:45
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE * ReadWriteIoType
Windows helper functions for integer overflow prevention.
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE PropertyType
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
IWudfDeviceStack * pDevStack
IWudfDeviceStack * GetDeviceStack(VOID)
Definition: fxdeviceum.hpp:435
#define TRACINGDEVICE
Definition: dbgtrace.h:58
PVOID WDFCONTEXT
Definition: wdftypes.h:94
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__inline void LockResourceTable()
Definition: fxresource.hpp:487
enum _WDF_EVENT_TYPE WDF_EVENT_TYPE
Definition: mxum.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG HRESULT
Definition: typedefs.h:79
INT POOL_TYPE
Definition: typedefs.h:78
VOID CompleteRequest(__in_opt CCHAR PriorityBoost=IO_NO_INCREMENT)
Definition: fxirpum.cpp:24
VOID WriteRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in_ecount(Count) PVOID Buffer, __in ULONG Count)
Definition: fxdeviceum.hpp:323
Type
Definition: Type.h:6
VOID SetInformation(__in ULONG_PTR Information)
Definition: fxirpum.cpp:504
_Must_inspect_result_ __in WDFDEVICE __in MdIrp __in WDFQUEUE Queue
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
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE _Out_ WDF_DEVICE_IO_TYPE * IoControlIoType
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE PoolType
_Must_inspect_result_ NTSTATUS __fastcall DispatchStep1(__inout MdIrp Irp, __in WDFCONTEXT DispatchContext)
Definition: fxpkgio.cpp:165
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_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
FxPkgIo * m_PkgIo
Definition: fxdevice.hpp:669
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4431
__in WDFDEVICE __in MdFileObject FileObject
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID _In_ WDF_EVENT_TYPE _In_reads_bytes_(DataSizeCb) BYTE *Data
unsigned char BYTE
Definition: xxhash.c:193
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _Out_writes_all_opt_(Count) PVOID Buffer
_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
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define S_OK
Definition: intsafe.h:52
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID _In_ WDF_EVENT_TYPE _In_ ULONG DataSizeCb
return NULL
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID _In_ WDF_EVENT_TYPE WdfEventType
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxIrp fxIrp(Irp)
unsigned int * PULONG
Definition: retypes.h:1
HRESULT MapIoSpaceWorker(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T NumberOfBytes, __in MEMORY_CACHING_TYPE CacheType, __deref_out VOID **PseudoBaseAddress)
__inline CfxDevice * GetDevice(VOID)
Definition: fxioqueue.hpp:773
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxDevice * pDevice
_Must_inspect_result_ __drv_maxIRQL(PASSIVE_LEVEL) NTSTATUS WDFEXPORT(WdfDevicePostEvent)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
FxCmResList * resources
EventWriteEVENT_UMDF_FX_DDI_WRITE_TO_HARDWARE_START(Type, Size, Count)
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE Size
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG BufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T NumberOfBytes
#define STATUS_SUCCESS
Definition: shellext.h:65
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS PhysicalAddress
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
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFCONTEXT DispatchContext
_Must_inspect_result_ NTSTATUS FX_VF_FUNCTION() VerifyWdfDeviceWdmDispatchIrpToIoQueue(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ FxDevice *device, _In_ MdIrp Irp, _In_ FxIoQueue *queue, _In_ ULONG Flags)
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID EventGuid
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
static ULONG __inline GetLength(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size)
Definition: fxdevice.hpp:2118
#define FX_IN_DISPATCH_CALLBACK
Definition: fxpkgio.hpp:39
#define __in
Definition: dbghelp.h:35
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice, &pFxDriverGlobals)
SIZE_T ReadRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register)
Definition: fxdeviceum.hpp:186
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE CacheType
PVOID systemAddress
EventWriteEVENT_UMDF_FX_DDI_WRITE_TO_HARDWARE_END(Type, Size, Count)
ASSERT(pDevice->m_ParentDevice !=pQueue->GetDevice())
FxVerifierDbgBreakPoint(pFxDriverGlobals)
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ __in WDFDEVICE __in MdIrp Irp
Definition: ps.c:97