ReactOS 0.4.16-dev-1946-g52006dd
fxdevicekm.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxDeviceKm.cpp
8
9Abstract:
10
11 This is the KM specific class implementation for the base Device class.
12
13Author:
14
15
16
17Environment:
18
19 Kernel mode only
20
21Revision History:
22
23--*/
24
25#include "coreprivshared.hpp"
26
27extern "C" {
28// #include "FxDeviceKm.tmh"
29}
30
35 )
36{
39 FxPkgFdo * pkgFdo;
40
42
43 if (DeviceInit->Fdo.EventCallbacks.EvtDeviceFilterAddResourceRequirements != NULL &&
44 DeviceInit->Fdo.EventCallbacks.EvtDeviceRemoveAddedResources == NULL) {
45 //
46 // Not allowed to add resources without filtering them out later
47 //
50 "Must set EvtDeviceRemoveAddedResources if "
51 "EvtDeviceFilterAddResourceRequirements (%p) is set",
52 DeviceInit->Fdo.EventCallbacks.EvtDeviceFilterAddResourceRequirements);
53
55
57 }
58
59 //
60 // All FDOs cannot be deleted through the driver calling WdfObjectDelete
61 //
63
65
66 //
67 // The PDO is known because it was used to bring up this FDO.
68 //
70
71 //
72 // Try to create and install the default packages that an FDO contains.
73 //
74
75 // PnP
76 status = FxPkgFdo::_Create(pGlobals, (CfxDevice*)this, &pkgFdo);
77
78 if (!NT_SUCCESS(status)) {
79 return status;
80 }
81 else {
82 m_PkgPnp = pkgFdo;
83 }
84
86
87 status = SetFilter(DeviceInit->Fdo.Filter);
88 if (!NT_SUCCESS(status)) {
89 return status;
90 }
91
93 if (!NT_SUCCESS(status)) {
94 return status;
95 }
96
97
98 //
99 // Should be done after invoking Initialize so that FxPkgFdo::m_EnumInfo is
100 // already allocated.
101 //
102 if (DeviceInit->Fdo.ListConfig.Size > 0) {
104 &DeviceInit->Fdo.ListConfig,
105 DeviceInit->Fdo.ListConfigAttributes.Size > 0
106 ? &DeviceInit->Fdo.ListConfigAttributes
107 : NULL);
108
109 if (!NT_SUCCESS(status)) {
110 return status;
111 }
112
114 }
115
116 //
117 // If the Size is zero then the driver writer never set any callbacks so we
118 // can skip this call.
119 //
120 if (DeviceInit->Fdo.EventCallbacks.Size != 0) {
121 status = GetFdoPkg()->RegisterCallbacks(&DeviceInit->Fdo.EventCallbacks);
122 if (!NT_SUCCESS(status)) {
123 return status;
124 }
125 }
126
128 if (NT_SUCCESS(status)) {
129 //
130 // If this is an FDO then the PhysicalDevice field will be initialized,
131 // and we need to attach to the device stack.
132 //
135
137 //
138 // We couldn't attach the device for some reason.
139 //
142
144 }
145 else {
146 //
147 // If we are a filter device, inherit some state from the
148 // attached device.
149 //
150 if (m_Filter) {
151 //
152 // Set the IO type and power pageable status on our device based
153 // on the attached device's settings.
154 //
156
159
162
163 //
164 // For devices other then filters, m_PowerPageableCapable gets
165 // set in CreateDevice, but since this is determined for filters
166 // by the device they have attached to, we must set this value
167 // later as a special case only for filters.
168 //
171 }
172 }
173 else {
174 //
175 // We are not a filter, we dictate our own DO flags
176 //
177
178 //
179 // Power pageable and inrush are mutually exclusive
180 //
181 if (DeviceInit->PowerPageable) {
183 }
184 else if (DeviceInit->Inrush) {
186 }
187 }
188 }
189 }
190
191 if (!NT_SUCCESS(status)) {
192 return status;
193 }
194
196 if (!NT_SUCCESS(status)) {
197 return status;
198 }
199
201 if (!NT_SUCCESS(status)) {
202 return status;
203 }
204
206
207 if (NT_SUCCESS(status)) {
208 //
209 // Do not clear the DO_DEVICE_INITIALIZING bit here. Instead, either
210 // let the caller do it in their AddDevice or do it after the AddDevice
211 // callback returns.
212 //
213 // FinishInitializing();
214 }
215
216 return status;
217}
218
223 )
224{
228
230
231 //
232 // If the child is static, the driver has the ability to delete the child
233 // device handle in between WdfDeviceCreate succeededing and then adding
234 // the child to the list of static children.
235 //
236 if (DeviceInit->Pdo.Static == FALSE) {
238 }
239
240 //
241 // Double check to make sure that the PDO has a name
242 //
243 if (DeviceInit->HasName() == FALSE) {
245 }
246
247 m_ParentDevice = DeviceInit->Pdo.Parent;
248
249 //
250 // This reference will be removed when this object is destroyed
251 //
252 m_ParentDevice->ADDREF(this);
253
255
257 if (m_PkgPnp == NULL) {
259 }
261
263 if (!NT_SUCCESS(status)) {
264 return status;
265 }
266
267 //
268 // If the Size is zero then the driver writer never set any callbacks so we
269 // can skip this call.
270 //
271 if (DeviceInit->Pdo.EventCallbacks.Size != 0) {
272 pPkgPdo->RegisterCallbacks(&DeviceInit->Pdo.EventCallbacks);
273 }
274
276
277 if (NT_SUCCESS(status)) {
278
279 //
280 // We are initializing the PDO, stash away the PDO's device object
281 // under m_PhysicalDevice as well so that we don't have to check
282 // for device type later.
283 //
285
286 if (DeviceInit->Pdo.Raw) {
288 }
289
290 //
291 // Power pageable and inrush are mutually exclusive
292 //
293 if (DeviceInit->PowerPageable) {
295 }
296 else if (DeviceInit->Inrush) {
298 }
299
300 if (DeviceInit->Pdo.ForwardRequestToParent) {
301 m_DeviceObject.SetStackSize(m_DeviceObject.GetStackSize() + DeviceInit->Pdo.Parent->GetDeviceObject()->StackSize);
303 }
304
305 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
306 // if (!NT_SUCCESS(status)) {
307 // return status;
308 // }
309
311 if (!NT_SUCCESS(status)) {
312 return status;
313 }
314
316
317 if (NT_SUCCESS(status)) {
318 //
319 // Clear the DO_DEVICE_INITIALIZING bit.
320 //
322 }
323 }
324
325 return status;
326}
327
328VOID
330 VOID
331 )
332{
333 //
334 // We must be at passive for IoDeleteDevice
335 //
337
338 if (m_DeviceObject.GetObject() != NULL) {
339 //
340 // The device object may not go away right away if there are pending
341 // references on it. But we can't look up our FxDevice anymore, so
342 // lets clear the DeviceExtension pointer.
343 //
345 }
346
347 //
348 // Since this can be called in the context of the destructor when the ref
349 // count is zero, use GetObjectHandleUnchecked() to get the handle value.
350 //
353 "Deleting !devobj %p, WDFDEVICE %p, attached to !devobj %p",
355
356 DetachDevice();
357
358 if (m_DeviceObject.GetObject() != NULL) {
360
362 //
363 // The device already deleted previously, release the reference we
364 // took at the time of delete.
365 //
367 }
368 else {
370 }
371
373 }
374
375 //
376 // Clean up any referenced objects
377 //
378 if (m_DeviceName.Buffer != NULL) {
381 }
382
386 }
387}
388
389VOID
391 VOID
392 )
393{
394 // NOTHING TO DO
395}
396
401 )
402{
404
405 m_Legacy = TRUE;
406
408
409 if (!NT_SUCCESS(status)) {
410 return status;
411 }
412
414 if (!NT_SUCCESS(status)) {
415 return status;
416 }
417
419 if (!NT_SUCCESS(status)) {
420 return status;
421 }
422
423 //
424 // NOTE: The driver writer must clear the DO_DEVICE_INITIALIZING bit
425 // via WdfControlFinishInitializing
426 //
427 return status;
428}
429
430VOID
433 )
434{
435 if (IsPnp()) {
437 }
438}
439
440VOID
443 )
444{
445 if (IsPnp()) {
447 }
448}
449
453 VOID
454 )
455{
456 if (IsPnp()) {
458 }
459 else {
460 return STATUS_SUCCESS;
461 }
462}
463
464VOID
466 __inout FxDmaEnabler* Enabler
467 )
468{
469 if (IsPnp()) {
470 m_PkgPnp->AddDmaEnabler(Enabler);
471 }
472}
473
474VOID
476 __inout FxDmaEnabler* Enabler
477 )
478{
479 if (IsPnp()) {
480 m_PkgPnp->RemoveDmaEnabler(Enabler);
481 }
482}
483
484
485
486
489 VOID
490 )
491{
492 return m_PkgWmi->Register();
493}
494
495VOID
497 VOID
498 )
499{
501}
502
503VOID
505 VOID
506 )
507{
508 m_PkgWmi->Cleanup();
509}
510
513 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
515 )
516{
520
521 //
522 // Ensure m_DeviceName has been set or we can get the PDO's name
523 //
524 if (m_DeviceName.Buffer == NULL) {
528
529 if (IsLegacy()) {
530 //
531 // No PDO on a legacy stack, can't call IoGetDeviceProperty
532 //
534
536 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
537 "WDFDEVICE %p has no device name (use WdfDeviceInitAssignName), "
538 "%!STATUS!", GetHandle(), status);
539
540 return status;
541 }
542
544 if (pPdo == NULL) {
545 //
546 // No PDO yet for this device, pnp doesn't know about it.
547 //
549
551 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
552 "WDFDEVICE %p has not yet been reported to pnp, cannot call "
553 "IoGetDeviceProperty in this state, %!STATUS!", GetHandle(), status);
554
555 return status;
556 }
557
558 length = 0;
559
562 0,
563 NULL,
564 &length);
565
568 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
569 "WDFDEVICE %p IoGetDeviceProperty failed %!STATUS!",
570 GetHandle(), status);
571 return status;
572 }
573 else if (length > USHORT_MAX) {
575
577 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
578 "WDFDEVICE %p PDO name too long (%d, max is %d), %!STATUS!",
580
581 return status;
582 }
583 else if (length == 0) {
584 //
585 // We can get zero back if the PDO is being deleted.
586 //
588
590 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
591 "WDFDEVICE %p PDO name length is zero, %!STATUS!",
592 GetHandle(), status);
593
594 return status;
595 }
596
597 pBuffer = (PWSTR) FxPoolAllocate(FxDriverGlobals, PagedPool, length);
598 if (pBuffer == NULL) {
600
602 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
603 "WDFDEVICE %p could not allocate buffer for PDO name, %!STATUS!",
604 GetHandle(), status);
605
606 return status;
607 }
608
609 //
610 // pdoName will free pBuffer when it is destructed
611 //
613
616 length,
617 pBuffer,
618 &length);
619
620 if (!NT_SUCCESS(status)) {
622 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
623 "WDFDEVICE %p IoGetDeviceProperty failed second time, %!STATUS!",
624 GetHandle(), status);
625 return status;
626 }
627
630
632 }
633 else {
635 }
636
637 status = FxDuplicateUnicodeString(FxDriverGlobals,
640
641 if (!NT_SUCCESS(status)) {
643 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
644 "WDFDEVICE %p allocate buffer for symbolic name failed, %!STATUS!",
645 GetHandle(), status);
646
647 return status;
648 }
649
651
652 if (!NT_SUCCESS(status)) {
654
656 sizeof(m_SymbolicLinkName));
657
659 "WDFDEVICE %p create sybolic link failed, %!STATUS!",
660 GetHandle(), status);
661 }
662
663 return status;
664}
665
673 )
674{
676 const DEVPROPKEY * propertyKey;
677 LCID lcid;
678 ULONG flags;
679 PWDF_DEVICE_PROPERTY_DATA deviceData;
680 PDEVICE_OBJECT pdo;
681
683
685
687
688 propertyKey = deviceData->PropertyKey;
689 lcid = deviceData->Lcid;
690 flags = deviceData->Flags;
691
692 pdo = GetSafePhysicalDevice();
693
694 if (pdo == NULL) {
695 //
696 // Pnp doesn't know about the PDO yet.
697 //
701 "WDFDEVICE %p is not yet known to PnP manager, cannot call "
702 "WdfDeviceAssignPropertyEx in this state, %!STATUS!",
703 GetHandle(), status);
704
705 return status;
706 }
707
708 status = IoSetDevicePropertyData(
709 pdo,
710 propertyKey,
711 lcid,
712 flags,
713 Type,
716 );
717
718 if (!NT_SUCCESS(status)) {
721 "WDFDEVICE %p failed to assign device property, %!STATUS!",
722 GetHandle(), status);
723 }
724
725 return status;
726}
727
731 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
737 _Out_ WDFKEY* Key
738 )
739{
740 FxRegKey* pKey;
741 WDFKEY keyHandle;
742 HANDLE hKey = NULL;
744 MdDeviceObject pdo;
745
747 if (!NT_SUCCESS(status)) {
748 return status;
749 }
750
752 if (!NT_SUCCESS(status)) {
753 return status;
754 }
755
756 status = _ValidateOpenKeyParams(FxDriverGlobals, DeviceInit, Device);
757 if (!NT_SUCCESS(status)) {
758 return status;
759 }
760
762
763 if (DeviceInit != NULL) {
764 pdo = DeviceInit->Fdo.PhysicalDevice;
765 }
766 else {
767 pdo = Device->GetSafePhysicalDevice();
768 if (pdo == NULL) {
769 //
770 // Pnp doesn't know about the PDO yet.
771 //
774 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
775 "WDFDEVICE %p is not yet known to PnP manager, cannot open "
776 "PNP registry keys in this state, %!STATUS!", Device->GetHandle(), status);
777 return status;
778 }
779 }
780
781 pKey = new(FxDriverGlobals, KeyAttributes) FxRegKey(FxDriverGlobals);
782
783 if (pKey == NULL) {
785 }
786
787 if (Device != NULL) {
789 }
790
792
793 if (NT_SUCCESS(status)) {
797 &hKey);
798 if (NT_SUCCESS(status)) {
800 *Key = keyHandle;
801 }
802 }
803
804 if (!NT_SUCCESS(status)) {
805 //
806 // No object is being returned, make sure the destroy callback will not
807 // be called.
808 //
810 }
811
812 return status;
813}
814
820 )
821{
824 MdDeviceObject pdo;
825
826 //
827 // We need a PDO to open this reg key. in the case of failure to create
828 // a static PDO, we will go down this path in the pnp state machine, so we
829 // must check for validity always.
830 //
831 pdo = GetSafePhysicalDevice();
832
833 if (pdo == NULL) {
835 }
836
840 &parent.m_Key);
841 if (NT_SUCCESS(status)) {
843
844 //
845 // Create the key if it does not already exist
846 //
847 status = FxRegKey::_Create(parent.m_Key,
848 &wdf,
849 Key,
851 }
852
853 return status;
854}
855
859 _In_ PFX_DRIVER_GLOBALS DriverGlobals,
868 )
869{
871 DEVPROPTYPE propType;
872 ULONG requiredLength = 0;
873 const DEVPROPKEY * propertyKey;
874 LCID lcid;
875 PWDF_DEVICE_PROPERTY_DATA deviceData;
876 MdDeviceObject pdo;
877
880
881 *ResultLength = 0;
882 *PropertyType = 0;
883
886 Device);
887 if (!NT_SUCCESS(status)) {
888 return status;
889 }
890
892
893 if (DeviceInit != NULL) {
894 pdo = DeviceInit->Fdo.PhysicalDevice;
895 }
896 else {
897 pdo = Device->GetSafePhysicalDevice();
898 if (pdo == NULL) {
899 //
900 // Pnp doesn't know about the PDO yet.
901 //
904 DriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
905 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
906 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
907 return status;
908 }
909 }
910
912 propertyKey = deviceData->PropertyKey;
913 lcid = deviceData->Lcid;
914
915 status = IoGetDevicePropertyData(pdo,
916 propertyKey,
917 lcid,
918 0,
921 &requiredLength,
922 &propType);
924 *ResultLength = requiredLength;
925 *PropertyType = propType;
926 }
927 else {
929 "Query for property buffer failed, %!STATUS!",
930 status);
931 }
932
933 return status;
934}
935
939 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
942 _In_opt_ MdDeviceObject RemotePdo,
947 )
948{
950 MdDeviceObject pdo;
951
952 ASSERT(DeviceInit != NULL || Device != NULL || RemotePdo != NULL);
953
954 if (RemotePdo != NULL) {
955 pdo = RemotePdo;
956 }
957 else {
960 Device);
961 if (!NT_SUCCESS(status)) {
962 return status;
963 }
964
965 if (DeviceInit != NULL) {
966 pdo = DeviceInit->Fdo.PhysicalDevice;
967 }
968 else {
969 pdo = Device->GetSafePhysicalDevice();
970 if (pdo == NULL) {
971 //
972 // Pnp doesn't know about the PDO yet.
973 //
976 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
977 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
978 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
979 return status;
980 }
981 }
982 }
983
989 return status;
990}
991
999 )
1000{
1001
1003 UNICODE_STRING registryKeyPath;
1004 wchar_t baseStringBuffer[256] = FX_DEVICEMAP_PATH;
1005
1006 //
1007 // Unlike UMDF, KMDF can open any DEVICEMAP key directly. Create a fully qualified
1008 // DEVICEMAP path from the provided subkey and pass it to FxRegKey::_OpenKey
1009 //
1010 registryKeyPath.Buffer = baseStringBuffer;
1011 registryKeyPath.MaximumLength = sizeof(baseStringBuffer);
1012 registryKeyPath.Length = sizeof(FX_DEVICEMAP_PATH) - sizeof(UNICODE_NULL);
1013
1014 status = RtlAppendUnicodeStringToString(&registryKeyPath, KeyName);
1015
1016 if (!NT_SUCCESS(status)) {
1018 "Unable to create a DEVICEMAP registry path for subkey %S, %!STATUS!",
1019 KeyName->Buffer, status);
1020 } else {
1021
1022 status = pKey->Create(NULL,
1023 &registryKeyPath,
1026 NULL);
1027
1028 if (!NT_SUCCESS(status)) {
1031 "WDFKEY open failed, %!STATUS!", status);
1032 }
1033 }
1034
1035 return status;
1036}
1037
Type
Definition: Type.h:7
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INTEGER_OVERFLOW
Definition: log.c:20
MxDeviceObject m_AttachedDevice
Definition: fxdevice.hpp:472
MxDeviceObject m_DeviceObject
Definition: fxdevice.hpp:471
MxDeviceObject m_PhysicalDevice
Definition: fxdevice.hpp:473
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:938
__inline BOOLEAN IsPnp(VOID)
Definition: fxdevice.hpp:1200
VOID WmiPkgCleanup(VOID)
Definition: fxdevicekm.cpp:504
virtual _Must_inspect_result_ NTSTATUS AllocateDmaEnablerList(VOID)
Definition: fxdevicekm.cpp:452
BOOLEAN m_PdoKnown
Definition: fxdevice.hpp:599
NTSTATUS CreateSymbolicLink(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING SymbolicLinkName)
Definition: fxdevicekm.cpp:512
FxWmiIrpHandler * m_PkgWmi
Definition: fxdevice.hpp:672
UNICODE_STRING m_DeviceName
Definition: fxdevice.hpp:578
BOOLEAN m_Legacy
Definition: fxdevice.hpp:547
VOID DeleteSymbolicLink(VOID)
VOID DestructorInternal(VOID)
Definition: fxdevicekm.cpp:390
virtual VOID AddChildList(__inout FxChildList *List)
Definition: fxdevicekm.cpp:431
_Must_inspect_result_ NTSTATUS SetFilter(__in BOOLEAN Value)
Definition: fxdevice.cpp:1851
__inline FxPkgFdo * GetFdoPkg(VOID)
Definition: fxdevice.hpp:1236
virtual VOID AddDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevicekm.cpp:465
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:858
VOID WmiPkgDeregister(VOID)
Definition: fxdevicekm.cpp:496
CfxDevice * m_ParentDevice
Definition: fxdevice.hpp:569
VOID Destroy(VOID)
Definition: fxdevicekm.cpp:329
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
MdDeviceObject __inline GetSafePhysicalDevice(VOID)
Definition: fxdevice.hpp:1005
_Must_inspect_result_ NTSTATUS OpenSettingsKey(__out HANDLE *Key, __in ACCESS_MASK DesiredAccess=STANDARD_RIGHTS_ALL)
Definition: fxdevicekm.cpp:817
UNICODE_STRING m_MofResourceName
Definition: fxdevice.hpp:585
_Must_inspect_result_ NTSTATUS PdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:221
VOID FinishInitializing(VOID)
Definition: fxdevice.cpp:1109
FxPkgGeneral * m_PkgGeneral
Definition: fxdevice.hpp:671
static _Must_inspect_result_ NTSTATUS _ValidateOpenKeyParams(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device)
Definition: fxdevice.cpp:2151
virtual VOID RemoveDmaEnabler(__inout FxDmaEnabler *Enabler)
Definition: fxdevicekm.cpp:475
VOID InstallPackage(__inout FxPackage *Package)
Definition: fxdevice.cpp:1611
BOOLEAN m_Filter
Definition: fxdevice.hpp:522
VOID SetFilterIoType(VOID)
Definition: fxdevice.cpp:1873
_Must_inspect_result_ NTSTATUS AssignProperty(_In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ DEVPROPTYPE Type, _In_ ULONG BufferLength, _In_opt_ PVOID PropertyBuffer)
Definition: fxdevicekm.cpp:667
__inline BOOLEAN IsLegacy(VOID)
Definition: fxdevice.hpp:1209
BOOLEAN m_DeviceObjectDeleted
Definition: fxdevice.hpp:553
virtual VOID RemoveChildList(__inout FxChildList *List)
Definition: fxdevicekm.cpp:441
NTSTATUS WmiPkgRegister(VOID)
Definition: fxdevicekm.cpp:488
UNICODE_STRING m_SymbolicLinkName
Definition: fxdevice.hpp:580
_Must_inspect_result_ NTSTATUS FdoInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:33
_Must_inspect_result_ NTSTATUS OpenDevicemapKeyWorker(_In_ PFX_DRIVER_GLOBALS pFxDriverGlobals, _In_ PCUNICODE_STRING KeyName, _In_ ACCESS_MASK DesiredAccess, _In_ FxRegKey *pKey)
Definition: fxdevicekm.cpp:994
_Must_inspect_result_ NTSTATUS CreateDevice(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevice.cpp:964
VOID DetachDevice(VOID)
BOOLEAN m_PowerPageableCapable
Definition: fxdevice.hpp:530
static __inline NTSTATUS _GetDeviceProperty(_In_ MdDeviceObject DeviceObject, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_ PULONG ResultLength)
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:730
_Must_inspect_result_ NTSTATUS ControlDeviceInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxdevicekm.cpp:399
static __inline NTSTATUS _OpenDeviceRegistryKey(_In_ MdDeviceObject DeviceObject, _In_ ULONG DevInstKeyType, _In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE DevInstRegKey)
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
Definition: fxdevice.hpp:1807
VOID SetDeviceBase(__in CfxDeviceBase *DeviceBase)
Definition: fxobject.hpp:797
PVOID __inline GetObjectHandleUnchecked(VOID)
Definition: fxobject.hpp:446
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS pGlobals, __in CfxDevice *Device, __deref_out FxPkgFdo **PkgFdo)
Definition: fxpkgfdo.cpp:195
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgfdokm.cpp:361
_Must_inspect_result_ NTSTATUS CreateDefaultDeviceList(__in PWDF_CHILD_LIST_CONFIG ListConfig, __in PWDF_OBJECT_ATTRIBUTES ListAttributes)
Definition: fxpkgfdo.cpp:816
_Must_inspect_result_ NTSTATUS RegisterCallbacks(__in PWDF_FDO_EVENT_CALLBACKS DispatchTable)
Definition: fxpkgfdo.cpp:796
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
Definition: fxpkgfdo.cpp:1524
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(__in PWDFDEVICE_INIT Init)
BOOLEAN m_AllowForwardRequestToParent
Definition: fxpkgpdo.hpp:69
VOID RegisterCallbacks(__in PWDF_PDO_EVENT_CALLBACKS DispatchTable)
Definition: fxpkgpdo.cpp:1576
BOOLEAN m_RawOK
Definition: fxpkgpdo.hpp:59
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgpnp.cpp:349
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
Definition: fxpkgpnp.cpp:1187
VOID AddChildList(__in FxChildList *List)
Definition: fxpkgpnp.cpp:4970
VOID RemoveDmaEnabler(__in FxDmaEnabler *Enabler)
Definition: fxpkgpnpkm.cpp:289
VOID RemoveChildList(__in FxChildList *List)
Definition: fxpkgpnp.cpp:4983
_Must_inspect_result_ NTSTATUS AllocateDmaEnablerList(VOID)
Definition: fxpkgpnpkm.cpp:241
VOID AddDmaEnabler(__in FxDmaEnabler *Enabler)
Definition: fxpkgpnpkm.cpp:277
__inline VOID SetHandle(__in HANDLE Key)
Definition: fxregkey.hpp:94
_Must_inspect_result_ NTSTATUS PostCreateDeviceInitialize(VOID)
_Must_inspect_result_ NTSTATUS Register(VOID)
__inline VOID SetObject(__in_opt MdDeviceObject DeviceObject)
VOID SetDeviceType(DEVICE_TYPE Value)
VOID SetCharacteristics(ULONG Characteristics)
DEVICE_TYPE GetDeviceType(VOID)
CCHAR GetStackSize(VOID)
ULONG GetFlags(VOID)
ULONG GetCharacteristics(VOID)
VOID SetStackSize(_In_ CCHAR Size)
__inline MdDeviceObject GetObject(VOID)
VOID SetDeviceExtension(PVOID Value)
VOID SetFlags(ULONG Flags)
static __inline VOID MxDereferenceObject(__in PVOID Object)
Definition: mxgeneralkm.h:247
static __inline NTSTATUS MxCreateSymbolicLink(_In_ PUNICODE_STRING SymbolicLinkName, _In_ PUNICODE_STRING DeviceName)
Definition: mxgeneralkm.h:579
static __inline VOID MxDeleteDevice(_In_ MdDeviceObject Device)
Definition: mxgeneralkm.h:493
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
static __inline MdDeviceObject MxAttachDeviceToDeviceStack(_In_ MdDeviceObject SourceDevice, _In_ MdDeviceObject TargetDevice)
Definition: mxgeneralkm.h:511
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define __out
Definition: dbghelp.h:62
#define TRACINGERROR
Definition: dbgtrace.h:63
#define TRACINGPNP
Definition: dbgtrace.h:67
#define TRACINGDEVICE
Definition: dbgtrace.h:58
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
LCID lcid
Definition: locale.c:5656
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define PagedPool
Definition: env_spec_w32.h:308
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxPropertyType
Definition: fxdevice.hpp:85
@ FxDeviceProperty
Definition: fxdevice.hpp:86
FxRegKey * pKey
FxAutoString pdoName
WDFKEY keyHandle
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE PropertyType
FxDevice * pPdo
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxPkgPdo * pPkgPdo
FxAutoRegKey hKey
PFX_DRIVER_GLOBALS pGlobals
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
@ DeviceInfoHasDynamicChildren
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define USHORT_MAX
Definition: intsafe.h:147
#define ASSERT(a)
Definition: mode.c:44
static LPSTR pName
Definition: security.c:75
#define FX_DEVICEMAP_PATH
Definition: mxkm.h:37
#define _Out_opt_
Definition: no_sal2.h:214
#define _Must_inspect_result_
Definition: no_sal2.h:62
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Analysis_assume_
Definition: no_sal2.h:388
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
unsigned short USHORT
Definition: pedump.c:61
PVOID pBuffer
DWORD LCID
Definition: nls.h:13
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
_Must_inspect_result_ NTSTATUS FxDuplicateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source, __out PUNICODE_STRING Destination)
Definition: stringutil.cpp:180
UNICODE_STRING m_UnicodeString
USHORT MaximumLength
Definition: env_spec_w32.h:370
_In_ const DEVPROPKEY * PropertyKey
Definition: wdfdevice.h:1918
Definition: ps.c:97
#define GetHandle(h)
Definition: treelist.c:116
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes
Definition: wdfdevice.h:2666
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3782
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2664
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG DeviceInstanceKeyType
Definition: wdfdevice.h:2662
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4443
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3745
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3775
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
struct _WDF_DEVICE_PROPERTY_DATA * PWDF_DEVICE_PROPERTY_DATA
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2786
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
@ DevicePropertyPhysicalDeviceObjectName
Definition: iotypes.h:1206
#define DO_POWER_PAGABLE
#define DO_POWER_INRUSH