ReactOS 0.4.15-dev-8236-g99f0937
power.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for power.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI PcRegisterAdapterPowerManagement (IN PUNKNOWN pUnknown, IN PVOID pvContext)
 
NTSTATUS NTAPI PcUnregisterAdapterPowerManagement (IN PDEVICE_OBJECT DeviceObject)
 
static VOID NTAPI PwrCompletionCallback (IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatus)
 
NTSTATUS NTAPI PcRequestNewPowerState (IN PDEVICE_OBJECT DeviceObject, IN DEVICE_POWER_STATE RequestedNewState)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file power.cpp.

Function Documentation

◆ PcRegisterAdapterPowerManagement()

NTSTATUS NTAPI PcRegisterAdapterPowerManagement ( IN PUNKNOWN  pUnknown,
IN PVOID  pvContext 
)

Definition at line 16 of file power.cpp.

19{
23 IAdapterPowerManagement * pPower;
24
25 DPRINT("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n", pUnknown, pvContext);
27
28 if (!pUnknown || !pvContext)
30
31 pDeviceObject = (PDEVICE_OBJECT)pvContext;
32 DeviceExt = (PPCLASS_DEVICE_EXTENSION)pDeviceObject->DeviceExtension;
33
34 Status = pUnknown->QueryInterface(IID_IAdapterPowerManagement, (PVOID*)&pPower);
35 if (!NT_SUCCESS(Status))
36 {
37 DPRINT1("PcRegisterAdapterPowerManagement no IAdapterPowerManagement interface %x\n", Status);
38 DeviceExt->AdapterPowerManagement = NULL;
39 return STATUS_SUCCESS;
40 }
41
42 DeviceExt->AdapterPowerManagement = pPower;
43 DPRINT("PcRegisterAdapterPowerManagement success %x\n", Status);
44 return STATUS_SUCCESS;
45}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
struct _DEVICE_OBJECT * PDEVICE_OBJECT
Status
Definition: gdiplustypes.h:25
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
IAdapterPowerManagement * AdapterPowerManagement
Definition: private.hpp:406
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by StartDevice().

◆ PcRequestNewPowerState()

NTSTATUS NTAPI PcRequestNewPowerState ( IN PDEVICE_OBJECT  DeviceObject,
IN DEVICE_POWER_STATE  RequestedNewState 
)

Definition at line 85 of file power.cpp.

88{
93
95
96 if (!DeviceObject || !RequestedNewState)
98
99 DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
101
102 PowerState.DeviceState = RequestedNewState;
104
106 if (NT_SUCCESS(Status))
107 {
109 }
110
111 return Status;
112}
#define FALSE
Definition: types.h:117
static VOID NTAPI PwrCompletionCallback(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatus)
Definition: power.cpp:73
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KernelMode
Definition: asm.h:34
@ SynchronizationEvent
NTSTATUS NTAPI PoRequestPowerIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ UCHAR MinorFunction, _In_ POWER_STATE PowerState, _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction, _In_opt_ __drv_aliasesMem PVOID Context, _Outptr_opt_ PIRP *pIrp)
Definition: power.c:659
@ PowerSystemUnspecified
Definition: ntpoapi.h:35
PDEVICE_OBJECT PhysicalDeviceObject
Definition: private.hpp:402
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034
#define IRP_MN_SET_POWER
@ Executive
Definition: ketypes.h:415

◆ PcUnregisterAdapterPowerManagement()

NTSTATUS NTAPI PcUnregisterAdapterPowerManagement ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 49 of file power.cpp.

51{
53
54 DPRINT("PcUnregisterAdapterPowerManagement pUnknown %p pvContext %p\n", DeviceObject);
56
57 if (!DeviceObject)
59
60 DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
61
62 if (DeviceExt->AdapterPowerManagement)
63 {
64 DeviceExt->AdapterPowerManagement->Release();
65 }
66 DeviceExt->AdapterPowerManagement = NULL;
67 return STATUS_SUCCESS;
68}
if(dx< 0)
Definition: linetemp.h:194

◆ PwrCompletionCallback()

static VOID NTAPI PwrCompletionCallback ( IN PDEVICE_OBJECT  DeviceObject,
IN UCHAR  MinorFunction,
IN POWER_STATE  PowerState,
IN PVOID  Context,
IN PIO_STATUS_BLOCK  IoStatus 
)
static

Definition at line 73 of file power.cpp.

79{
81}
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by PcRequestNewPowerState().