ReactOS 0.4.15-dev-8419-g7f0e8a3
fxpkgpdo.hpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft. All rights reserved.
4
5Module Name:
6
7 FxPkgPdo.hpp
8
9Abstract:
10
11 This module implements the pnp package for Pdo objects.
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23
24--*/
25
26#ifndef _FXPKGPDO_H_
27#define _FXPKGPDO_H_
28
30
31class FxPkgPdo : public FxPkgPnp
32{
33public:
34 //
35 // Properties used in handling IRP_MN_QUERY_DEVICE_TEXT
36 //
39
41
43
44 //
45 // The following structure contains the function pointer table
46 // for the "events" this package can raise.
47 //
52
55
56 // added in 1.11
58
60
62
64
65 //
66 // This field is used to indicate that Requests on this PDO could be
67 // forwarded to the parent.
68 //
70
71protected:
72 //
73 // Pointer to a null terminated string which is the device ID. This is
74 // not a pointer that can be freed. m_IDsAllocation is the beginning of
75 // the allocation that can be freed.
76 //
78
79 //
80 // Pointer to a null terminated string which is the instance ID. This is
81 // not a pointer that can be freed. m_IDsAllocation is the beginning of
82 // the allocation that can be freed.
83 //
85
86 //
87 // Pointer to a multi sz which is the hardware IDs. This is
88 // not a pointer that can be freed. m_IDsAllocation is the beginning of
89 // the allocation that can be freed.
90 //
92
93 //
94 // Pointer to a multi sz which is the compatible IDs. This is
95 // not a pointer that can be freed. m_IDsAllocation is the beginning of
96 // the allocation that can be freed.
97 //
99
100 //
101 // Pointer to a null terminated string which is the unique ID. This is
102 // not a pointer that can be freed. m_IDsAllocation is the beginning of
103 // the allocation that can be freed.
104 //
106
107 //
108 // Single allocation for all static ID strings (device, instance, hw, compat)
109 // for the device
110 //
112
114
115 //
116 // IRP_MN_EJECT needs to be handled synchronously because PnP manager does
117 // not serialize it with other state changing PnP irps if not handled
118 // synchronously. This event is used to signal the completion of
119 // IRP_MN_EJECT processing.
120 //
122
124
125 //
126 // Parameter to track whether the EvtDeviceEnableWakeAtBus callback was
127 // invoked and to determine whether the EvtDeviceDisableWakeAtBus callback
128 // should be invoked or not. The EnableWakeAtBus callback may not get
129 // invoked if an upper driver in the stack completed the wait wake irp
130 // instead of passing it down the stack and the power policy owner is
131 // a PDO.
132 //
133 // This parameter can be referenced by either the power state machine or
134 // the power policy state machine when a PDO is the power policy owner
135 // but there is no locking mechanism necessary to synchronize access to
136 // the field. This is because the arrival of a Dx irp will move the power
137 // state machine to a state where it can no longer affect the value of
138 // this field and hence provides an implicit guard that allows the power
139 // policy state machine to use this field while processing the Dx irp.
140 //
142
143private:
144 //
145 // Table of internal methods to handle PnP minor function codes.
146 //
148
149 //
150 // Table of internal methods to handle power minor function codes.
151 //
153
154public:
155
156 FxPkgPdo(
157 __in PFX_DRIVER_GLOBALS FxDriverGlobals,
159 );
160
161 ~FxPkgPdo();
162
164 virtual
168 );
169
170 virtual
171 VOID
174 );
175
176 VOID
179 );
180
185 );
186
187 VOID
190 );
191
192 VOID
194 VOID
195 );
196
200 __in FxIrp* Irp,
202 );
203
204 __inline
205 BOOLEAN
207 VOID
208 )
209 {
211 }
212
213
214private:
216 virtual
219 __in FxIrp* Irp
220 );
221
223 virtual
227 );
228
229 //
230 // The following are static member function. The only reason
231 // I've defined them as member functions at all is so they can see
232 // the private data in this class.
233 //
234
236 static
241 );
242
244 static
249 );
250
255 );
256
258 static
262 IN FxIrp *Irp
263 );
264
266 static
271 );
272
277 );
278
279 VOID
281 __inout PDEVICE_CAPABILITIES ReportedCaps,
282 __in PDEVICE_CAPABILITIES ParentCaps
283 );
284
285 static
286 VOID
287 STDCALL
291 );
292
294 static
299 );
300
305 );
306
308 static
313 );
314
319 );
320
322 static
327 );
328
330 static
335 );
336
338 static
340 _PnpEject(
343 );
344
345 virtual
346 BOOLEAN
348 VOID
349 );
350
351 virtual
354 VOID
355 );
356
357 virtual
360 VOID
361 );
362
363 virtual
366 VOID
367 );
368
369 virtual
372 VOID
373 );
374
375 virtual
376 VOID
378 VOID
379 );
380
381 virtual
384 VOID
385 );
386
388 static
393 );
394
396 static
401 );
402
404 static
409 );
410
412 static
417 );
418
420 static
425 );
426
427 static
432 __in FxIrp *Irp
433 );
434
435 static
440 __in FxIrp *Irp
441 );
442
446 __in FxIrp *Irp
447 );
448
452 __in FxIrp *Irp
453 );
454
455 static
460 __in FxIrp *Irp
461 );
462
463 virtual
467 __in BOOLEAN* ParentOn
468 );
469
470 virtual
473 VOID
474 );
475
476 virtual
479 VOID
480 );
481
482 virtual
486 VOID
487 );
488
489 virtual
490 VOID
492 VOID
493 );
494
495 virtual
496 VOID
498 VOID
499 );
500
501 virtual
502 VOID
504 __in BOOLEAN IrpMustBePresent = TRUE
505 );
506
508 virtual
512 );
513
514 virtual
515 VOID
517 __in BOOLEAN GracefulRemove
518 );
519
520 virtual
521 VOID
523 VOID
524 )
525 {
526 //
527 // As the PDO, we already have the interface built in
528 //
529 DO_NOTHING();
530 }
531
532 virtual
533 VOID
535 VOID
536 )
537 {
538 //
539 // As the PDO, we already have the interface built in
540 //
541 DO_NOTHING();
542 }
543
545 virtual
548 VOID
549 );
550
552 virtual
555 VOID
556 );
557
558 virtual
561 VOID
562 )
563 {
565 }
566
567 virtual
570 VOID
571 )
572 {
574 }
575
576 static
577 VOID
578 STDCALL
581 );
582
583 VOID
585 VOID
586 );
587
588 VOID
590 VOID
591 );
592};
593
594#endif // _FXPKGPDO_H
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
Definition: fxirp.hpp:28
_Must_inspect_result_ NTSTATUS PnpQueryResourceRequirements(__inout FxIrp *Irp)
Definition: fxpkgpdokm.cpp:141
FxPowerDeviceEnableWakeAtBus m_DeviceEnableWakeAtBus
Definition: fxpkgpdo.hpp:53
_Must_inspect_result_ NTSTATUS DispatchDeviceSetPower(__in FxIrp *Irp)
Definition: pdopower.cpp:151
SINGLE_LIST_ENTRY m_DeviceTextHead
Definition: fxpkgpdo.hpp:37
virtual const PFN_PNP_POWER_CALLBACK * GetDispatchPower(VOID)
Definition: fxpkgpdo.hpp:569
virtual BOOLEAN PnpSendStartDeviceDownTheStackOverload(VOID)
Definition: fxpkgpdo.cpp:1294
virtual WDF_DEVICE_PNP_STATE PnpEventEjectHardwareOverload(VOID)
Definition: fxpkgpdo.cpp:1045
virtual VOID DeleteSymbolicLinkOverload(__in BOOLEAN GracefulRemove)
Definition: fxpkgpdo.cpp:1630
static _Must_inspect_result_ NTSTATUS _PnpFilterResourceRequirements(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdokm.cpp:343
virtual VOID PnpEventSurpriseRemovePendingOverload(VOID)
Definition: fxpkgpdo.cpp:1282
virtual WDF_DEVICE_PNP_STATE PnpGetPostRemoveState(VOID)
Definition: fxpkgpdo.cpp:1258
virtual _Must_inspect_result_ NTSTATUS ProcessRemoveDeviceOverload(__inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1753
static _Must_inspect_result_ NTSTATUS _PnpQueryResourceRequirements(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdokm.cpp:131
BOOLEAN m_AddedToStaticList
Definition: fxpkgpdo.hpp:63
static _Must_inspect_result_ NTSTATUS _PnpSurpriseRemoval(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1561
static VOID STDCALL _RemoveAndReenumerateSelf(__in PVOID Context)
Definition: fxpkgpdo.cpp:1665
static _Must_inspect_result_ NTSTATUS _PnpQueryResources(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdokm.cpp:39
VOID PowerNotifyParentChildWakeDisarmed(VOID)
Definition: pdopower.cpp:459
VOID HandleQueryCapabilities(__inout PDEVICE_CAPABILITIES ReportedCaps, __in PDEVICE_CAPABILITIES ParentCaps)
Definition: fxpkgpdo.cpp:666
virtual VOID PowerParentPowerDereference(VOID)
Definition: pdopower.cpp:403
static _Must_inspect_result_ NTSTATUS _PnpQueryDeviceText(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:858
PWSTR m_DeviceID
Definition: fxpkgpdo.hpp:77
virtual _Must_inspect_result_ NTSTATUS SendIrpSynchronously(__in FxIrp *Irp)
Definition: fxpkgpdo.cpp:361
virtual VOID PowerReleasePendingDeviceIrp(__in BOOLEAN IrpMustBePresent=TRUE)
Definition: pdopower.cpp:241
static _Must_inspect_result_ NTSTATUS _PnpEject(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:968
virtual VOID FinishInitialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgpdo.cpp:340
_Must_inspect_result_ NTSTATUS HandleQueryInterfaceForReenumerate(__in FxIrp *Irp, __out PBOOLEAN CompleteRequest)
Definition: fxpkgpdo.cpp:1687
FxPowerDeviceDisableWakeAtBus m_DeviceDisableWakeAtBus
Definition: fxpkgpdo.hpp:54
PWSTR m_CompatibleIDs
Definition: fxpkgpdo.hpp:98
static const PFN_PNP_POWER_CALLBACK m_PdoPowerFunctionTable[IRP_MN_QUERY_POWER+1]
Definition: fxpkgpdo.hpp:152
FxRelatedDeviceList * m_EjectionDeviceList
Definition: fxpkgpdo.hpp:113
static VOID STDCALL _QueryCapsWorkItem(__in MdDeviceObject DeviceObject, __in PVOID Context)
Definition: fxpkgpdo.cpp:779
virtual WDF_DEVICE_PNP_STATE PnpEventPdoRemovedOverload(VOID)
Definition: fxpkgpdo.cpp:1208
VOID RemoveEjectionDevice(__in MdDeviceObject DependentDevice)
Definition: fxpkgpdo.cpp:1890
virtual _Must_inspect_result_ NTSTATUS FireAndForgetIrp(__inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:384
virtual WDF_DEVICE_POWER_STATE PowerCheckDeviceTypeNPOverload(VOID)
Definition: pdopower.cpp:310
FxPnpDeviceSetLock m_DeviceSetLock
Definition: fxpkgpdo.hpp:51
_Must_inspect_result_ NTSTATUS DispatchSystemSetPower(__in FxIrp *Irp)
Definition: pdopower.cpp:95
VOID PowerNotifyParentChildWakeArmed(VOID)
Definition: pdopower.cpp:426
static _Must_inspect_result_ NTSTATUS _PnpQueryPnpDeviceState(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1483
static _Must_inspect_result_ NTSTATUS _PnpQueryInterface(IN FxPkgPnp *This, IN FxIrp *Irp)
Definition: fxpkgpdo.cpp:522
static _Must_inspect_result_ NTSTATUS _PnpSetLock(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1323
PWSTR m_ContainerID
Definition: fxpkgpdo.hpp:105
virtual VOID ReleaseReenumerationInterface(VOID)
Definition: fxpkgpdo.hpp:534
PWSTR m_InstanceID
Definition: fxpkgpdo.hpp:84
BOOLEAN m_Static
Definition: fxpkgpdo.hpp:61
static _Must_inspect_result_ NTSTATUS _PnpQueryBusInformation(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1529
static _Must_inspect_result_ NTSTATUS _PnpQueryDeviceRelations(__in FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:424
FxPnpDeviceResourceRequirementsQuery m_DeviceResourceRequirementsQuery
Definition: fxpkgpdo.hpp:49
virtual _Must_inspect_result_ NTSTATUS QueryForPowerThread(VOID)
Definition: fxpkgpdo.cpp:1804
FxChildList * m_OwningChildList
Definition: fxpkgpdo.hpp:42
LCID m_DefaultLocale
Definition: fxpkgpdo.hpp:38
FxDeviceDescriptionEntry * m_Description
Definition: fxpkgpdo.hpp:40
BOOLEAN m_AllowForwardRequestToParent
Definition: fxpkgpdo.hpp:69
VOID RegisterCallbacks(__in PWDF_PDO_EVENT_CALLBACKS DispatchTable)
Definition: fxpkgpdo.cpp:1576
static _Must_inspect_result_ NTSTATUS _PnpQueryCapabilities(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:551
virtual WDF_DEVICE_PNP_STATE PnpEventFdoRemovedOverload(VOID)
Definition: fxpkgpdo.cpp:1269
virtual _Must_inspect_result_ NTSTATUS PowerEnableWakeAtBusOverload(VOID)
Definition: pdopower.cpp:332
virtual VOID PowerDisableWakeAtBusOverload(VOID)
Definition: pdopower.cpp:374
FxPnpDeviceEject m_DeviceEject
Definition: fxpkgpdo.hpp:50
_Must_inspect_result_ NTSTATUS AddEjectionDevice(__in MdDeviceObject DependentDevice)
Definition: fxpkgpdo.cpp:1826
BOOLEAN m_EnableWakeAtBusInvoked
Definition: fxpkgpdo.hpp:141
_Must_inspect_result_ NTSTATUS PnpQueryResources(__inout FxIrp *Irp)
Definition: fxpkgpdokm.cpp:49
FxPnpDeviceResourcesQuery m_DeviceResourcesQuery
Definition: fxpkgpdo.hpp:48
PWSTR m_HardwareIDs
Definition: fxpkgpdo.hpp:91
static _Must_inspect_result_ NTSTATUS _DispatchSetPower(__inout FxPkgPnp *This, __in FxIrp *Irp)
Definition: pdopower.cpp:63
virtual _Must_inspect_result_ NTSTATUS AskParentToRemoveAndReenumerate(VOID)
Definition: fxpkgpdo.cpp:1598
FxPnpDeviceReportedMissing m_DeviceReportedMissing
Definition: fxpkgpdo.hpp:57
static _Must_inspect_result_ NTSTATUS _PnpCompleteIrp(__in FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:414
BOOLEAN m_RawOK
Definition: fxpkgpdo.hpp:59
virtual const PFN_PNP_POWER_CALLBACK * GetDispatchPnp(VOID)
Definition: fxpkgpdo.hpp:560
PWSTR m_IDsAllocation
Definition: fxpkgpdo.hpp:111
virtual VOID QueryForReenumerationInterface(VOID)
Definition: fxpkgpdo.hpp:522
_Must_inspect_result_ NTSTATUS PnpQueryCapabilities(__inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:561
virtual _Must_inspect_result_ NTSTATUS PowerCheckParentOverload(__in BOOLEAN *ParentOn)
Definition: pdopower.cpp:261
MxEvent * m_DeviceEjectProcessed
Definition: fxpkgpdo.hpp:121
virtual WDF_DEVICE_PNP_STATE PnpEventCheckForDevicePresenceOverload(VOID)
Definition: fxpkgpdo.cpp:1155
__inline BOOLEAN IsForwardRequestToParentEnabled(VOID)
Definition: fxpkgpdo.hpp:206
static const PFN_PNP_POWER_CALLBACK m_PdoPnpFunctionTable[IRP_MN_SURPRISE_REMOVAL+1]
Definition: fxpkgpdo.hpp:147
static _Must_inspect_result_ NTSTATUS _DispatchQueryPower(__inout FxPkgPnp *This, __in FxIrp *Irp)
Definition: pdopower.cpp:201
virtual WDF_DEVICE_POWER_STATE PowerCheckDeviceTypeOverload(VOID)
Definition: pdopower.cpp:289
BOOLEAN m_CanBeDeleted
Definition: fxpkgpdo.hpp:123
static _Must_inspect_result_ NTSTATUS _DispatchPowerSequence(__inout FxPkgPnp *This, __in FxIrp *Irp)
Definition: pdopower.cpp:39
static _Must_inspect_result_ NTSTATUS _PnpQueryId(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:1359
_Must_inspect_result_ NTSTATUS PnpQueryDeviceRelations(__inout FxIrp *Irp)
Definition: fxpkgpdo.cpp:434
_In_ PIRP Irp
Definition: csq.h:116
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define __out
Definition: dbghelp.h:62
#define TRUE
Definition: types.h:120
#define NTSTATUS
Definition: precomp.h:21
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
pPkgPdo ClearEjectionDevicesList()
NTSTATUS(FxPkgPdo::* PFN_PDO_HANDLER)(FxIrp *Irp)
Definition: fxpkgpdo.hpp:29
_Must_inspect_result_ NTSTATUS(* PFN_PNP_POWER_CALLBACK)(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgpnp.hpp:225
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define DO_NOTHING()
Definition: mxgeneral.h:32
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
DWORD LCID
Definition: nls.h:13
Definition: ntbasedef.h:628
uint16_t * PWSTR
Definition: typedefs.h:56
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define IN
Definition: typedefs.h:39
#define STDCALL
Definition: wdf.h:45
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
enum _WDF_DEVICE_POWER_STATE WDF_DEVICE_POWER_STATE
_Must_inspect_result_ _In_ WDFDEVICE _In_ PDEVICE_OBJECT DependentDevice
Definition: wdfdevice.h:2263
enum _WDF_DEVICE_PNP_STATE WDF_DEVICE_PNP_STATE
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965
#define IRP_MN_QUERY_POWER
static void Initialize()
Definition: xlate.c:212