ReactOS 0.4.16-dev-297-gc569aee
power.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Win32k subsystem
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Power management of the Win32 kernel-mode subsystem
5 * COPYRIGHT: Copyright 2024 George Bișoc <george.bisoc@reactos.org>
6 */
7
8#pragma once
9
10//
11// Power Callout type enumeration
12//
14{
18
19//
20// Power Callout structure
21//
23{
24 /* Links the power callout with the global queue list */
26
27 /*
28 * Set to POWER_CALLOUT_STATE if the upcoming power callout is a power state
29 * (IntHandlePowerState does that), POWER_CALLOUT_EVENT otherwise
30 */
32
33 /* The captured Win32 power event parameters (the params are set to none if Type == POWER_STATE) */
36
37//
38// Ensures the power callout mutex lock is acquired
39//
40#define ASSERT_POWER_CALLOUT_LOCK_ACQUIRED() \
41 ASSERT(gpPowerCalloutMutexOwnerThread == KeGetCurrentThread())
42
43//
44// Power Manager data
45//
50
51//
52// Function prototypes
53//
57 _In_ HANDLE hPowerRequestEvent);
58
62
66 _In_ PWIN32_POWEREVENT_PARAMETERS pWin32PwrEventParams);
67
71 _In_ PWIN32_POWERSTATE_PARAMETERS pWin32PwrStateParams);
72
73//
74// Power Callout locking mechanism
75//
77VOID
79{
83}
84
86VOID
88{
92}
93
94//
95// Checks if the following thread is a Win32 thread
96//
98BOOL
101{
102 return (Thread->Tcb.Win32Thread != NULL) ? TRUE : FALSE;
103}
104
105/* EOF */
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define KeGetCurrentThread
Definition: hal.h:55
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define _In_
Definition: no_sal2.h:158
VOID FASTCALL ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
Definition: fmutex.c:86
VOID FASTCALL ExAcquireFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
Definition: fmutex.c:75
tagPOWER_CALLOUT_TYPE
Definition: power.h:14
@ POWER_CALLOUT_EVENT
Definition: power.h:15
@ POWER_CALLOUT_STATE
Definition: power.h:16
LIST_ENTRY gPowerCalloutsQueueList
Definition: power.c:15
struct tagWIN32POWERCALLOUT * PWIN32POWERCALLOUT
FORCEINLINE VOID IntReleasePowerCalloutLock(VOID)
Definition: power.h:87
PFAST_MUTEX gpPowerCalloutMutexLock
Definition: power.c:16
FORCEINLINE BOOL IntIsThreadWin32Thread(_In_ PETHREAD Thread)
Definition: power.h:99
NTSTATUS NTAPI IntWin32PowerManagementCleanup(VOID)
Cleanup procedure that frees all the allocated resources by the power manager. It is triggered during...
Definition: power.c:315
FORCEINLINE VOID IntAcquirePowerCalloutLock(VOID)
Definition: power.h:78
struct tagWIN32POWERCALLOUT WIN32POWERCALLOUT
NTSTATUS NTAPI IntHandlePowerState(_In_ PWIN32_POWERSTATE_PARAMETERS pWin32PwrStateParams)
Handles an incoming power state callout from the NT power manager.
Definition: power.c:419
NTSTATUS NTAPI IntInitWin32PowerManagement(_In_ HANDLE hPowerRequestEvent)
Initializes the power management side of Win32 kernel-mode subsystem component. This enables communic...
Definition: power.c:271
NTSTATUS NTAPI IntHandlePowerEvent(_In_ PWIN32_POWEREVENT_PARAMETERS pWin32PwrEventParams)
Handles an incoming power event callout from the NT power manager.
Definition: power.c:362
PKTHREAD gpPowerCalloutMutexOwnerThread
Definition: power.c:18
enum tagPOWER_CALLOUT_TYPE POWER_CALLOUT_TYPE
PKEVENT gpPowerRequestCalloutEvent
Definition: power.c:17
KTHREAD Tcb
Definition: pstypes.h:1104
PVOID Win32Thread
Definition: ketypes.h:1866
Definition: typedefs.h:120
POWER_CALLOUT_TYPE Type
Definition: power.h:31
LIST_ENTRY Link
Definition: power.h:25
WIN32_POWEREVENT_PARAMETERS Params
Definition: power.h:34
#define NTAPI
Definition: typedefs.h:36
#define FORCEINLINE
Definition: wdftypes.h:67
* PFAST_MUTEX
Definition: extypes.h:17