ReactOS 0.4.16-dev-122-g325d74c
fxpkgfdoum.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxPkgFdoUm.cpp
8
9Abstract:
10
11 This module implements the pnp/power package for the driver
12 framework.
13
14Author:
15
16
17
18
19Environment:
20
21 User mode only
22
23Revision History:
24
25
26
27--*/
28
29#include "../pnppriv.hpp"
30
31#include <initguid.h>
32#include <wdmguid.h>
33
34
35#if defined(EVENT_TRACING)
36// Tracing support
37extern "C" {
38#include "FxPkgFdoUm.tmh"
39}
40#endif
41
46 )
47
48/*++
49
50Routine Description:
51
52 This method is invoked in response to a Pnp FilterResourceRequirements IRP.
53
54Arguments:
55
56 Device - a pointer to the FxDevice
57
58 Irp - a pointer to the FxIrp
59
60Returns:
61
62 NTSTATUS
63
64--*/
65
66{
68 ASSERTMSG("Not implemented for UMDF\n", FALSE);
69
71}
72
77 )
78
79/*++
80
81Routine Description:
82
83 This method is invoked in response to a Pnp QueryCapabilities IRP.
84
85Arguments:
86
87 Device - a pointer to the FxDevice
88
89 Irp - a pointer to the FxIrp
90
91Returns:
92
93 NTSTATUS
94
95--*/
96
97{
99
100 //
101 // Set a completion routine on the IRP
102 //
103 Irp->CopyCurrentIrpStackLocationToNext();
104 Irp->SetCompletionRoutine(
106 this
107 );
108
109 //
110 // Send the IRP down the stack
111 //
112 Irp->CallDriver(m_Device->GetAttachedDevice());
113
114 return STATUS_SUCCESS;
115}
116
123 )
124{
126 FxPkgFdo* pThis;
127 FxIrp irp(Irp);
128
130
131 pThis = (FxPkgFdo*) Context;
132 status = irp.GetStatus();
133
134 //
135 // Now that the IRP has returned to us, we modify what the bus driver
136 // set up.
137 //
138 if (NT_SUCCESS(status)) {
140 }
141
142 pThis->CompletePnpRequest(&irp, status);
143
145}
146
152 )
153
154/*++
155
156Routine Description:
157
158 This method is invoked in response to a Pnp QueryPnpDeviceState IRP.
159
160Arguments:
161
162 Irp - a pointer to the FxIrp
163
164Returns:
165
166 NTSTATUS
167
168--*/
169
170{
171 FxPkgFdo* pThis;
172
173 pThis = (FxPkgFdo*) This;
174
175 //
176 // Set a completion routine on the IRP
177 //
178 Irp->CopyCurrentIrpStackLocationToNext();
179 Irp->SetCompletionRoutine(
181 pThis
182 );
183
184 //
185 // Send the IRP down the stack
186 //
187 Irp->CallDriver(pThis->m_Device->GetAttachedDevice());
188
189 return STATUS_SUCCESS;
190}
191
198 )
199{
201 FxPkgFdo* pThis;
202 FxIrp irp(Irp);
203
205
206 pThis = (FxPkgFdo*) Context;
207 status = irp.GetStatus();
208
210 //
211 // Morph into a successful code so that we process the request
212 //
215 }
216
217 if (NT_SUCCESS(status)) {
219 }
220 else {
223 "Lower stack returned error for query pnp device state, %!STATUS!",
224 status);
225 }
226
227 //
228 // Since we already sent the request down the stack, we must complete it
229 // now.
230 //
231 pThis->CompletePnpRequest(&irp, status);
232
234}
235
240 )
241/*++
242
243
244
245
246
247
248
249
250
251
252
253Routine Description:
254
255 After creating a FxPkgFdo, the driver writer will initialize it by passing
256 a set of driver callbacks that allow the driver writer to customize the
257 behavior when handling certain IRPs.
258
259 This is the place to do any initialization that might fail.
260
261Arguments:
262
263 Device - a pointer to the FxDevice
264
265 DispatchTable - a driver supplied table of callbacks
266
267Returns:
268
269 NTSTATUS
270
271--*/
272{
275
277
279 if (!NT_SUCCESS(status)) {
280 return status;
281 }
282
284 if (!NT_SUCCESS(status)) {
285 return status;
286 }
287
288 return status;
289}
290
294 VOID
295 )
296/*++
297
298Routine Description:
299 This routine asks the PDO to ask its parent bus driver to Surprise-Remove
300 and re-enumerate the PDO. This will be done only at the point of
301 catastrophic software failure, and occasionally after catastrophic hardware
302 failure.
303
304Arguments:
305 None
306
307Return Value:
308 status
309
310 --*/
311{
312 HRESULT hr;
313 IWudfDeviceStack2* pDevStack = m_Device->GetDeviceStack2();
314
315 hr = pDevStack->ReenumerateSelf();
316 if (SUCCEEDED(hr)) {
317 return STATUS_SUCCESS;
318 }
319
321}
322
LONG NTSTATUS
Definition: precomp.h:26
MdDeviceObject __inline GetAttachedDevice(VOID)
Definition: fxdevice.hpp:210
IWudfDeviceStack2 * GetDeviceStack2(VOID)
Definition: fxdeviceum.hpp:444
Definition: fxirp.hpp:28
VOID SetStatus(__in NTSTATUS Status)
Definition: fxirpum.cpp:457
NTSTATUS GetStatus()
Definition: fxirpum.cpp:466
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
CfxDevice * m_Device
Definition: fxobject.hpp:329
VOID HandleQueryPnpDeviceStateCompletion(__inout FxIrp *Irp)
Definition: fxpkgfdo.cpp:763
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgfdokm.cpp:361
static _Must_inspect_result_ NTSTATUS _PnpQueryCapabilitiesCompletionRoutine(__in MdDeviceObject DeviceObject, __inout MdIrp Irp, __inout PVOID Context)
Definition: fxpkgfdokm.cpp:227
VOID HandleQueryCapabilitiesCompletion(__inout FxIrp *Irp)
Definition: fxpkgfdo.cpp:613
static _Must_inspect_result_ NTSTATUS _PnpQueryPnpDeviceStateCompletionRoutine(__in MdDeviceObject DeviceObject, __inout MdIrp Irp, __inout PVOID Context)
Definition: fxpkgfdokm.cpp:288
_Must_inspect_result_ NTSTATUS PnpFilterResourceRequirements(__inout FxIrp *Irp)
Definition: fxpkgfdokm.cpp:43
_Must_inspect_result_ NTSTATUS PnpQueryCapabilities(__inout FxIrp *Irp)
Definition: fxpkgfdokm.cpp:244
static _Must_inspect_result_ NTSTATUS _PnpQueryPnpDeviceState(__inout FxPkgPnp *This, __inout FxIrp *Irp)
Definition: fxpkgfdokm.cpp:305
virtual _Must_inspect_result_ NTSTATUS AskParentToRemoveAndReenumerate(VOID)
Definition: fxpkgfdokm.cpp:567
VOID HandleQueryCapabilities(__inout FxIrp *Irp)
Definition: fxpkgfdo.cpp:572
_Must_inspect_result_ NTSTATUS AllocateEnumInfo(VOID)
Definition: fxpkgpnp.cpp:4920
virtual _Must_inspect_result_ NTSTATUS Initialize(__in PWDFDEVICE_INIT DeviceInit)
Definition: fxpkgpnp.cpp:349
NTSTATUS CompletePnpRequest(__inout FxIrp *Irp, __in NTSTATUS Status)
Definition: fxpkgpnp.cpp:5752
_In_ PIRP Irp
Definition: csq.h:116
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define TRACINGPNP
Definition: dbgtrace.h:67
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
IWudfDeviceStack * pDevStack
PFX_DRIVER_GLOBALS pGlobals
FxIrp * irp
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define _Must_inspect_result_
Definition: ms_sal.h:558
IWudfIrp * MdIrp
Definition: mxum.h:103
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
#define STATUS_SUCCESS
Definition: shellext.h:65
HRESULT hr
Definition: shlfolder.c:183
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055