ReactOS 0.4.15-dev-8119-g4fb2fdb
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
195 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
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
413 // status = m_PkgWmi->PostCreateDeviceInitialize(); __REACTOS__
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(); __REACTOS__
493 return STATUS_SUCCESS;
494}
495
496VOID
498 VOID
499 )
500{
501 // m_PkgWmi->Deregister(); __REACTOS__
502}
503
504VOID
506 VOID
507 )
508{
509 // m_PkgWmi->Cleanup(); __REACTOS__
510}
511
514 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
516 )
517{
521
522 //
523 // Ensure m_DeviceName has been set or we can get the PDO's name
524 //
525 if (m_DeviceName.Buffer == NULL) {
529
530 if (IsLegacy()) {
531 //
532 // No PDO on a legacy stack, can't call IoGetDeviceProperty
533 //
535
537 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
538 "WDFDEVICE %p has no device name (use WdfDeviceInitAssignName), "
539 "%!STATUS!", GetHandle(), status);
540
541 return status;
542 }
543
545 if (pPdo == NULL) {
546 //
547 // No PDO yet for this device, pnp doesn't know about it.
548 //
550
552 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
553 "WDFDEVICE %p has not yet been reported to pnp, cannot call "
554 "IoGetDeviceProperty in this state, %!STATUS!", GetHandle(), status);
555
556 return status;
557 }
558
559 length = 0;
560
563 0,
564 NULL,
565 &length);
566
569 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
570 "WDFDEVICE %p IoGetDeviceProperty failed %!STATUS!",
571 GetHandle(), status);
572 return status;
573 }
574 else if (length > USHORT_MAX) {
576
578 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
579 "WDFDEVICE %p PDO name too long (%d, max is %d), %!STATUS!",
581
582 return status;
583 }
584 else if (length == 0) {
585 //
586 // We can get zero back if the PDO is being deleted.
587 //
589
591 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
592 "WDFDEVICE %p PDO name length is zero, %!STATUS!",
593 GetHandle(), status);
594
595 return status;
596 }
597
598 pBuffer = (PWSTR) FxPoolAllocate(FxDriverGlobals, PagedPool, length);
599 if (pBuffer == NULL) {
601
603 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
604 "WDFDEVICE %p could not allocate buffer for PDO name, %!STATUS!",
605 GetHandle(), status);
606
607 return status;
608 }
609
610 //
611 // pdoName will free pBuffer when it is destructed
612 //
614
617 length,
618 pBuffer,
619 &length);
620
621 if (!NT_SUCCESS(status)) {
623 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
624 "WDFDEVICE %p IoGetDeviceProperty failed second time, %!STATUS!",
625 GetHandle(), status);
626 return status;
627 }
628
631
633 }
634 else {
636 }
637
638 status = FxDuplicateUnicodeString(FxDriverGlobals,
641
642 if (!NT_SUCCESS(status)) {
644 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
645 "WDFDEVICE %p allocate buffer for symbolic name failed, %!STATUS!",
646 GetHandle(), status);
647
648 return status;
649 }
650
652
653 if (!NT_SUCCESS(status)) {
655
657 sizeof(m_SymbolicLinkName));
658
660 "WDFDEVICE %p create sybolic link failed, %!STATUS!",
661 GetHandle(), status);
662 }
663
664 return status;
665}
666
674 )
675{
677 const DEVPROPKEY * propertyKey;
678 LCID lcid;
679 ULONG flags;
680 PWDF_DEVICE_PROPERTY_DATA deviceData;
681 PDEVICE_OBJECT pdo;
682
684
686
688
689 propertyKey = deviceData->PropertyKey;
690 lcid = deviceData->Lcid;
691 flags = deviceData->Flags;
692
693 pdo = GetSafePhysicalDevice();
694
695 if (pdo == NULL) {
696 //
697 // Pnp doesn't know about the PDO yet.
698 //
702 "WDFDEVICE %p is not yet known to PnP manager, cannot call "
703 "WdfDeviceAssignPropertyEx in this state, %!STATUS!",
704 GetHandle(), status);
705
706 return status;
707 }
708
709 status = IoSetDevicePropertyData(
710 pdo,
711 propertyKey,
712 lcid,
713 flags,
714 Type,
717 );
718
719 if (!NT_SUCCESS(status)) {
722 "WDFDEVICE %p failed to assign device property, %!STATUS!",
723 GetHandle(), status);
724 }
725
726 return status;
727}
728
732 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
738 _Out_ WDFKEY* Key
739 )
740{
741 FxRegKey* pKey;
742 WDFKEY keyHandle;
743 HANDLE hKey = NULL;
745 MdDeviceObject pdo;
746
748 if (!NT_SUCCESS(status)) {
749 return status;
750 }
751
753 if (!NT_SUCCESS(status)) {
754 return status;
755 }
756
757 status = _ValidateOpenKeyParams(FxDriverGlobals, DeviceInit, Device);
758 if (!NT_SUCCESS(status)) {
759 return status;
760 }
761
763
764 if (DeviceInit != NULL) {
765 pdo = DeviceInit->Fdo.PhysicalDevice;
766 }
767 else {
768 pdo = Device->GetSafePhysicalDevice();
769 if (pdo == NULL) {
770 //
771 // Pnp doesn't know about the PDO yet.
772 //
775 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
776 "WDFDEVICE %p is not yet known to PnP manager, cannot open "
777 "PNP registry keys in this state, %!STATUS!", Device->GetHandle(), status);
778 return status;
779 }
780 }
781
782 pKey = new(FxDriverGlobals, KeyAttributes) FxRegKey(FxDriverGlobals);
783
784 if (pKey == NULL) {
786 }
787
788 if (Device != NULL) {
790 }
791
793
794 if (NT_SUCCESS(status)) {
798 &hKey);
799 if (NT_SUCCESS(status)) {
801 *Key = keyHandle;
802 }
803 }
804
805 if (!NT_SUCCESS(status)) {
806 //
807 // No object is being returned, make sure the destroy callback will not
808 // be called.
809 //
811 }
812
813 return status;
814}
815
821 )
822{
825 MdDeviceObject pdo;
826
827 //
828 // We need a PDO to open this reg key. in the case of failure to create
829 // a static PDO, we will go down this path in the pnp state machine, so we
830 // must check for validity always.
831 //
832 pdo = GetSafePhysicalDevice();
833
834 if (pdo == NULL) {
836 }
837
841 &parent.m_Key);
842 if (NT_SUCCESS(status)) {
844
845 //
846 // Create the key if it does not already exist
847 //
848 status = FxRegKey::_Create(parent.m_Key,
849 &wdf,
850 Key,
852 }
853
854 return status;
855}
856
869 )
870{
872 DEVPROPTYPE propType;
873 ULONG requiredLength = 0;
874 const DEVPROPKEY * propertyKey;
875 LCID lcid;
876 PWDF_DEVICE_PROPERTY_DATA deviceData;
877 MdDeviceObject pdo;
878
881
882 *ResultLength = 0;
883 *PropertyType = 0;
884
887 Device);
888 if (!NT_SUCCESS(status)) {
889 return status;
890 }
891
893
894 if (DeviceInit != NULL) {
895 pdo = DeviceInit->Fdo.PhysicalDevice;
896 }
897 else {
898 pdo = Device->GetSafePhysicalDevice();
899 if (pdo == NULL) {
900 //
901 // Pnp doesn't know about the PDO yet.
902 //
906 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
907 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
908 return status;
909 }
910 }
911
913 propertyKey = deviceData->PropertyKey;
914 lcid = deviceData->Lcid;
915
916 status = IoGetDevicePropertyData(pdo,
917 propertyKey,
918 lcid,
919 0,
922 &requiredLength,
923 &propType);
925 *ResultLength = requiredLength;
926 *PropertyType = propType;
927 }
928 else {
930 "Query for property buffer failed, %!STATUS!",
931 status);
932 }
933
934 return status;
935}
936
940 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
943 _In_opt_ MdDeviceObject RemotePdo,
948 )
949{
951 MdDeviceObject pdo;
952
953 ASSERT(DeviceInit != NULL || Device != NULL || RemotePdo != NULL);
954
955 if (RemotePdo != NULL) {
956 pdo = RemotePdo;
957 }
958 else {
961 Device);
962 if (!NT_SUCCESS(status)) {
963 return status;
964 }
965
966 if (DeviceInit != NULL) {
967 pdo = DeviceInit->Fdo.PhysicalDevice;
968 }
969 else {
970 pdo = Device->GetSafePhysicalDevice();
971 if (pdo == NULL) {
972 //
973 // Pnp doesn't know about the PDO yet.
974 //
977 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
978 "WDFDEVICE %p is not yet known to PnP manager, cannot query "
979 "device properties in this state, %!STATUS!", Device->GetHandle(), status);
980 return status;
981 }
982 }
983 }
984
990 return status;
991}
992
1000 )
1001{
1002
1004 UNICODE_STRING registryKeyPath;
1005 wchar_t baseStringBuffer[256] = FX_DEVICEMAP_PATH;
1006
1007 //
1008 // Unlike UMDF, KMDF can open any DEVICEMAP key directly. Create a fully qualified
1009 // DEVICEMAP path from the provided subkey and pass it to FxRegKey::_OpenKey
1010 //
1011 registryKeyPath.Buffer = baseStringBuffer;
1012 registryKeyPath.MaximumLength = sizeof(baseStringBuffer);
1013 registryKeyPath.Length = sizeof(FX_DEVICEMAP_PATH) - sizeof(UNICODE_NULL);
1014
1015 status = RtlAppendUnicodeStringToString(&registryKeyPath, KeyName);
1016
1017 if (!NT_SUCCESS(status)) {
1019 "Unable to create a DEVICEMAP registry path for subkey %S, %!STATUS!",
1020 KeyName->Buffer, status);
1021 } else {
1022
1023 status = pKey->Create(NULL,
1024 &registryKeyPath,
1027 NULL);
1028
1029 if (!NT_SUCCESS(status)) {
1032 "WDFKEY open failed, %!STATUS!", status);
1033 }
1034 }
1035
1036 return status;
1037}
1038
Type
Definition: Type.h:7
LONG NTSTATUS
Definition: precomp.h:26
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:939
__inline BOOLEAN IsPnp(VOID)
Definition: fxdevice.hpp:1200
VOID WmiPkgCleanup(VOID)
Definition: fxdevicekm.cpp:505
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:513
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:859
VOID WmiPkgDeregister(VOID)
Definition: fxdevicekm.cpp:497
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:818
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:668
__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:995
_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:731
_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
__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:32
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
DriverGlobals
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 _Out_opt_
Definition: ms_sal.h:346
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define _Analysis_assume_(expr)
Definition: ms_sal.h:2901
#define FX_DEVICEMAP_PATH
Definition: mxkm.h:37
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:1060
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
#define L(x)
Definition: ntvdm.h:50
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:1912
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:2660
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG DeviceInstanceKeyType
Definition: wdfdevice.h:2656
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4437
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3739
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3769
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
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