ReactOS  0.4.15-dev-3440-g915569a
poxinterfaceum.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) Microsoft. All rights reserved.
3 //
4 #include "../pnppriv.hpp"
5 
6 #include <initguid.h>
7 #include <wdmguid.h>
8 
9 extern "C" {
10 #if defined(EVENT_TRACING)
11 #include "PoxInterfaceUm.tmh"
12 #endif
13 }
14 
15 VOID
17  )
18 {
19  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxStartDevicePowerManagement();
20 
21  return;
22 }
23 
26  )
27 {
28  HRESULT hr;
29 
30  hr = m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxRegisterDevice();
31 
32  if (S_OK == hr)
33  {
34  return STATUS_SUCCESS;
35  }
36  else
37  {
38  PUMDF_VERSION_DATA driverVersion = m_PkgPnp->GetDevice()->GetDeviceStack()->GetMinDriverVersion();
39 
40  return CHostFxUtil::NtStatusFromHr(
41  hr,
42  driverVersion->MajorNumber,
43  driverVersion->MinorNumber,
44  m_PkgPnp->GetDevice()->GetDeviceStack()->ShouldPreserveIrpCompletionStatusCompatibility()
45  );
46  }
47 
48 }
49 
50 VOID
52  VOID
53  )
54 {
55  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxUnregisterDevice();
56  return;
57 }
58 
59 VOID
61  VOID
62  )
63 {
64  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxActivateComponent();
65  return;
66 }
67 
68 VOID
70  VOID
71  )
72 {
73  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxIdleComponent();
74  return;
75 }
76 
77 VOID
79  VOID
80  )
81 {
82  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxReportDevicePoweredOn();
83  return;
84 }
85 
86 VOID
88  __in ULONGLONG IdleTimeout
89  )
90 {
91  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxSetDeviceIdleTimeout(IdleTimeout);
92  return;
93 }
94 
95 
96 VOID
98  VOID
99  )
100 {
101  PowerRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
102  return;
103 }
104 
105 VOID
107  VOID
108  )
109 {
110  //
111  // Notice that it is important that we first acknowledge the callback
112  // because once we queue an event in the state machine, the state machine
113  // could end up calling PoFxUnregister from the same thread
114  //
115  m_PkgPnp->GetDevice()->GetDeviceStack2()->PoFxCompleteDevicePowerNotRequired();
116 
117  //
118  // The contract with the reflector is that the reflector guarantees to
119  // not send this event from the PoFx callback
120  //
121  PowerNotRequiredCallbackWorker(FALSE /* InvokedFromPoxCallback */);
122 
123  return;
124 }
125 
__inline CfxDevice * GetDevice(VOID)
Definition: fxpackage.hpp:46
HRESULT hr
Definition: shlfolder.c:183
VOID PowerRequiredCallbackWorker(__in BOOLEAN InvokedFromPoxCallback)
VOID PoxIdleComponent(VOID)
LONG NTSTATUS
Definition: precomp.h:26
VOID PoxReportDevicePoweredOn(VOID)
VOID PowerRequiredCallbackInvoked(VOID)
#define FALSE
Definition: types.h:117
VOID PoxStartDevicePowerManagement(VOID)
VOID PoxSetDeviceIdleTimeout(__in ULONGLONG IdleTimeout)
IWudfDeviceStack2 * GetDeviceStack2(VOID)
Definition: fxdeviceum.hpp:444
VOID PowerNotRequiredCallbackInvoked(VOID)
IWudfDeviceStack * GetDeviceStack(VOID)
Definition: fxdeviceum.hpp:435
LONG HRESULT
Definition: typedefs.h:79
uint64_t ULONGLONG
Definition: typedefs.h:67
NTSTATUS PoxRegisterDevice(VOID)
#define S_OK
Definition: intsafe.h:52
FxPkgPnp * m_PkgPnp
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID PoxActivateComponent(VOID)
#define __in
Definition: dbghelp.h:35
VOID PowerNotRequiredCallbackWorker(__in BOOLEAN InvokedFromPoxCallback)
VOID PoxUnregisterDevice(VOID)