ReactOS  0.4.14-dev-583-g2a1ba2c
po.h File Reference
#include <guiddef.h>
#include <poclass.h>
Include dependency graph for po.h:

Go to the source code of this file.

Classes

struct  _PO_HIBER_PERF
 
struct  _PO_MEMORY_IMAGE
 
struct  _PO_MEMORY_RANGE_ARRAY_RANGE
 
struct  _PO_MEMORY_RANGE_ARRAY_LINK
 
struct  _PO_MEMORY_RANGE_ARRAY
 
struct  _POP_HIBER_CONTEXT
 
struct  _PO_NOTIFY_ORDER_LEVEL
 
struct  _POP_SHUTDOWN_BUG_CHECK
 
struct  _POP_DEVICE_POWER_IRP
 
struct  _PO_DEVICE_NOTIFY_ORDER
 
struct  _POP_DEVICE_SYS_STATE
 
struct  _POP_POWER_ACTION
 
struct  _POWER_CHANNEL_SUMMARY
 
struct  _DEVICE_OBJECT_POWER_EXTENSION
 
struct  _POP_SHUTDOWN_WAIT_ENTRY
 

Macros

#define _PO_DEBUG_   0x00
 
#define PO_STATE_DEBUG   0x01
 
#define POTRACE(x, fmt, ...)   DPRINT(fmt, ##__VA_ARGS__)
 

Typedefs

typedef struct _PO_HIBER_PERF PO_HIBER_PERF
 
typedef struct _PO_HIBER_PERFPPO_HIBER_PERF
 
typedef struct _PO_MEMORY_IMAGE PO_MEMORY_IMAGE
 
typedef struct _PO_MEMORY_IMAGEPPO_MEMORY_IMAGE
 
typedef struct _PO_MEMORY_RANGE_ARRAY_RANGE PO_MEMORY_RANGE_ARRAY_RANGE
 
typedef struct _PO_MEMORY_RANGE_ARRAY_LINK PO_MEMORY_RANGE_ARRAY_LINK
 
typedef struct _PO_MEMORY_RANGE_ARRAY PO_MEMORY_RANGE_ARRAY
 
typedef struct _PO_MEMORY_RANGE_ARRAYPPO_MEMORY_RANGE_ARRAY
 
typedef struct _POP_HIBER_CONTEXT POP_HIBER_CONTEXT
 
typedef struct _POP_HIBER_CONTEXTPPOP_HIBER_CONTEXT
 
typedef struct _PO_NOTIFY_ORDER_LEVEL PO_NOTIFY_ORDER_LEVEL
 
typedef struct _PO_NOTIFY_ORDER_LEVELPPO_NOTIFY_ORDER_LEVEL
 
typedef struct _POP_SHUTDOWN_BUG_CHECK POP_SHUTDOWN_BUG_CHECK
 
typedef struct _POP_SHUTDOWN_BUG_CHECKPPOP_SHUTDOWN_BUG_CHECK
 
typedef struct _POP_DEVICE_POWER_IRP POP_DEVICE_POWER_IRP
 
typedef struct _POP_DEVICE_POWER_IRPPPOP_DEVICE_POWER_IRP
 
typedef struct _PO_DEVICE_NOTIFY_ORDER PO_DEVICE_NOTIFY_ORDER
 
typedef struct _PO_DEVICE_NOTIFY_ORDERPPO_DEVICE_NOTIFY_ORDER
 
typedef struct _POP_DEVICE_SYS_STATE POP_DEVICE_SYS_STATE
 
typedef struct _POP_DEVICE_SYS_STATEPPOP_DEVICE_SYS_STATE
 
typedef struct _POP_POWER_ACTION POP_POWER_ACTION
 
typedef struct _POP_POWER_ACTIONPPOP_POWER_ACTION
 
typedef enum _POP_DEVICE_IDLE_TYPE POP_DEVICE_IDLE_TYPE
 
typedef enum _POP_DEVICE_IDLE_TYPEPPOP_DEVICE_IDLE_TYPE
 
typedef struct _POWER_CHANNEL_SUMMARY POWER_CHANNEL_SUMMARY
 
typedef struct _POWER_CHANNEL_SUMMARYPPOWER_CHANNEL_SUMMARY
 
typedef struct _DEVICE_OBJECT_POWER_EXTENSION DEVICE_OBJECT_POWER_EXTENSION
 
typedef struct _DEVICE_OBJECT_POWER_EXTENSIONPDEVICE_OBJECT_POWER_EXTENSION
 
typedef struct _POP_SHUTDOWN_WAIT_ENTRY POP_SHUTDOWN_WAIT_ENTRY
 
typedef struct _POP_SHUTDOWN_WAIT_ENTRYPPOP_SHUTDOWN_WAIT_ENTRY
 

Enumerations

enum  _POP_DEVICE_IDLE_TYPE { DeviceIdleNormal, DeviceIdleDisk }
 

Functions

INIT_FUNCTION BOOLEAN NTAPI PoInitSystem (IN ULONG BootPhase)
 
INIT_FUNCTION VOID NTAPI PoInitializePrcb (IN PKPRCB Prcb)
 
VOID NTAPI PopInitShutdownList (VOID)
 
VOID NTAPI PoInitializeDeviceObject (IN OUT PDEVOBJ_EXTENSION DeviceObjectExtension)
 
VOID NTAPI PoVolumeDevice (IN PDEVICE_OBJECT DeviceObject)
 
VOID NTAPI PoRemoveVolumeDevice (IN PDEVICE_OBJECT DeviceObject)
 
NTSTATUS NTAPI PopSetSystemPowerState (SYSTEM_POWER_STATE PowerState, POWER_ACTION PowerAction)
 
VOID NTAPI PopCleanupPowerState (IN PPOWER_STATE PowerState)
 
NTSTATUS NTAPI PopAddRemoveSysCapsCallback (IN PVOID NotificationStructure, IN PVOID Context)
 
VOID NTAPI PoNotifySystemTimeSet (VOID)
 
VOID NTAPI PopReadShutdownPolicy (VOID)
 
VOID NTAPI PopGracefulShutdown (IN PVOID Context)
 
VOID NTAPI PopFlushVolumes (IN BOOLEAN ShuttingDown)
 

Variables

PDEVICE_NODE PopSystemPowerDeviceNode
 
KGUARDED_MUTEX PopVolumeLock
 
LIST_ENTRY PopVolumeDevices
 
KSPIN_LOCK PopDopeGlobalLock
 
POP_POWER_ACTION PopAction
 
SYSTEM_POWER_CAPABILITIES PopCapabilities
 

Macro Definition Documentation

◆ _PO_DEBUG_

#define _PO_DEBUG_   0x00

Definition at line 15 of file po.h.

◆ PO_STATE_DEBUG

#define PO_STATE_DEBUG   0x01

Definition at line 20 of file po.h.

◆ POTRACE

#define POTRACE (   x,
  fmt,
  ... 
)    DPRINT(fmt, ##__VA_ARGS__)

Definition at line 33 of file po.h.

Typedef Documentation

◆ DEVICE_OBJECT_POWER_EXTENSION

◆ PDEVICE_OBJECT_POWER_EXTENSION

◆ PO_DEVICE_NOTIFY_ORDER

◆ PO_HIBER_PERF

◆ PO_MEMORY_IMAGE

◆ PO_MEMORY_RANGE_ARRAY

◆ PO_MEMORY_RANGE_ARRAY_LINK

◆ PO_MEMORY_RANGE_ARRAY_RANGE

◆ PO_NOTIFY_ORDER_LEVEL

◆ POP_DEVICE_IDLE_TYPE

◆ POP_DEVICE_POWER_IRP

◆ POP_DEVICE_SYS_STATE

◆ POP_HIBER_CONTEXT

◆ POP_POWER_ACTION

◆ POP_SHUTDOWN_BUG_CHECK

◆ POP_SHUTDOWN_WAIT_ENTRY

◆ POWER_CHANNEL_SUMMARY

◆ PPO_DEVICE_NOTIFY_ORDER

◆ PPO_HIBER_PERF

◆ PPO_MEMORY_IMAGE

◆ PPO_MEMORY_RANGE_ARRAY

◆ PPO_NOTIFY_ORDER_LEVEL

◆ PPOP_DEVICE_IDLE_TYPE

◆ PPOP_DEVICE_POWER_IRP

◆ PPOP_DEVICE_SYS_STATE

◆ PPOP_HIBER_CONTEXT

◆ PPOP_POWER_ACTION

◆ PPOP_SHUTDOWN_BUG_CHECK

◆ PPOP_SHUTDOWN_WAIT_ENTRY

◆ PPOWER_CHANNEL_SUMMARY

Enumeration Type Documentation

◆ _POP_DEVICE_IDLE_TYPE

Enumerator
DeviceIdleNormal 
DeviceIdleDisk 

Definition at line 230 of file po.h.

231 {
enum _POP_DEVICE_IDLE_TYPE POP_DEVICE_IDLE_TYPE
enum _POP_DEVICE_IDLE_TYPE * PPOP_DEVICE_IDLE_TYPE

Function Documentation

◆ PoInitializeDeviceObject()

VOID NTAPI PoInitializeDeviceObject ( IN OUT PDEVOBJ_EXTENSION  DeviceObjectExtension)

Definition at line 363 of file povolume.c.

364 {
365  PEXTENDED_DEVOBJ_EXTENSION DeviceExtension = (PVOID)DeviceObjectExtension;
366  PAGED_CODE();
367 
368  /* Initialize the power flags */
369  DeviceExtension->PowerFlags = PowerSystemUnspecified & 0xF;
370  DeviceExtension->PowerFlags |= ((PowerDeviceUnspecified << 4) & 0xF0);
371 
372  /* The device object is not on drugs yet */
373  DeviceExtension->Dope = NULL;
374 }
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
struct _DEVICE_OBJECT_POWER_EXTENSION * Dope
Definition: iotypes.h:917

Referenced by IoCreateDevice().

◆ PoInitializePrcb()

INIT_FUNCTION VOID NTAPI PoInitializePrcb ( IN PKPRCB  Prcb)

Definition at line 396 of file power.c.

397 {
398  /* Initialize the Power State */
399  RtlZeroMemory(&Prcb->PowerState, sizeof(Prcb->PowerState));
400  Prcb->PowerState.Idle0KernelTimeLimit = 0xFFFFFFFF;
401  Prcb->PowerState.CurrentThrottle = 100;
402  Prcb->PowerState.CurrentThrottleIndex = 0;
403  Prcb->PowerState.IdleFunction = PopIdle0;
404 
405  /* Initialize the Perf DPC and Timer */
406  KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
407  KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
408  KeInitializeTimerEx(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
409 }
VOID NTAPI PopPerfIdleDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: power.c:376
VOID FASTCALL PopIdle0(IN PPROCESSOR_POWER_STATE PowerState)
Definition: power.c:387
VOID NTAPI KeSetTargetProcessorDpc(IN PKDPC Dpc, IN CCHAR Number)
Definition: dpc.c:970
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
Definition: timerobj.c:244

Referenced by KiInitializeKernel(), and KiSystemStartupBootStack().

◆ PoInitSystem()

INIT_FUNCTION BOOLEAN NTAPI PoInitSystem ( IN ULONG  BootPhase)

Definition at line 296 of file power.c.

297 {
299  PCHAR CommandLine;
300  BOOLEAN ForceAcpiDisable = FALSE;
301 
302  /* Check if this is phase 1 init */
303  if (BootPhase == 1)
304  {
305  /* Register power button notification */
308  (PVOID)&GUID_DEVICE_SYS_BUTTON,
310  PhysicalDeviceObject->DriverObject,
312  NULL,
314 
315  /* Register lid notification */
318  (PVOID)&GUID_DEVICE_LID,
320  PhysicalDeviceObject->DriverObject,
322  NULL,
324  return TRUE;
325  }
326 
327  /* Initialize the power capabilities */
329 
330  /* Get the Command Line */
331  CommandLine = KeLoaderBlock->LoadOptions;
332 
333  /* Upcase it */
334  _strupr(CommandLine);
335 
336  /* Check for ACPI disable */
337  if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE;
338 
339  if (ForceAcpiDisable)
340  {
341  /* Set the ACPI State to False if it's been forced that way */
343  }
344  else
345  {
346  /* Otherwise check if the LoaderBlock has a ACPI Table */
348  }
349 
350  /* Enable shutdown by power button */
351  if (PopAcpiPresent)
353 
354  /* Initialize volume support */
357 
358  /* Initialize support for dope */
360 
361  /* Initialize support for shutdown waits and work-items */
363 
364  return TRUE;
365 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
PDEVICE_NODE IopRootDeviceNode
Definition: pnpmgr.c:18
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
PLOADER_PARAMETER_EXTENSION Extension
Definition: arc.h:512
#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
Definition: iotypes.h:1196
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
BOOLEAN PopAcpiPresent
Definition: power.c:26
_In_ ULONG _In_opt_ PVOID _In_ PDRIVER_OBJECT _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE _Inout_opt_ __drv_aliasesMem PVOID _Outptr_result_nullonfailure_ _At_ * NotificationEntry(return==0, __drv_allocatesMem(Mem))) PVOID *NotificationEntry
LIST_ENTRY PopVolumeDevices
Definition: povolume.c:27
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
unsigned char BOOLEAN
VOID NTAPI PopInitShutdownList(VOID)
Definition: poshtdwn.c:32
smooth NULL
Definition: ftsmooth.c:416
KGUARDED_MUTEX PopVolumeLock
Definition: povolume.c:26
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
NTSTATUS NTAPI IoRegisterPlugPlayNotification(IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, IN ULONG EventCategoryFlags, IN PVOID EventCategoryData OPTIONAL, IN PDRIVER_OBJECT DriverObject, IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, IN PVOID Context, OUT PVOID *NotificationEntry)
Definition: pnpnotify.c:249
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
SYSTEM_POWER_CAPABILITIES PopCapabilities
Definition: power.c:29
NTSTATUS NTAPI PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, IN PVOID Context)
Definition: events.c:147
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
KSPIN_LOCK PopDopeGlobalLock
Definition: povolume.c:28

Referenced by Phase1InitializationDiscard().

◆ PoNotifySystemTimeSet()

VOID NTAPI PoNotifySystemTimeSet ( VOID  )

Definition at line 39 of file events.c.

40 {
41  KIRQL OldIrql;
42 
43  /* Check if Win32k registered a notification callback */
44  if (PopEventCallout)
45  {
46  /* Raise to dispatch */
48 
49  /* Notify the callback */
51 
52  /* Lower IRQL back */
54  }
55 }
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
PCALLBACK_OBJECT SetSystemTimeCallback
Definition: callback.c:27
UCHAR KIRQL
Definition: env_spec_w32.h:591
PKWIN32_POWEREVENT_CALLOUT PopEventCallout
Definition: events.c:32
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI ExNotifyCallback(IN PCALLBACK_OBJECT CallbackObject, IN PVOID Argument1, IN PVOID Argument2)
Definition: callback.c:467
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696

Referenced by Phase1InitializationDiscard().

◆ PopAddRemoveSysCapsCallback()

NTSTATUS NTAPI PopAddRemoveSysCapsCallback ( IN PVOID  NotificationStructure,
IN PVOID  Context 
)

Definition at line 147 of file events.c.

149 {
151  PSYS_BUTTON_CONTEXT SysButtonContext;
156  PIRP Irp;
158  KEVENT Event;
159  BOOLEAN Arrival;
160  ULONG Caps;
162 
163  DPRINT("PopAddRemoveSysCapsCallback(%p %p)\n",
165 
167  if (Notification->Version != 1)
169  if (Notification->Size != sizeof(DEVICE_INTERFACE_CHANGE_NOTIFICATION))
171  if (RtlCompareMemory(&Notification->Event, &GUID_DEVICE_INTERFACE_ARRIVAL, sizeof(GUID)) == sizeof(GUID))
172  Arrival = TRUE;
173  else if (RtlCompareMemory(&Notification->Event, &GUID_DEVICE_INTERFACE_REMOVAL, sizeof(GUID)) == sizeof(GUID))
174  Arrival = FALSE;
175  else
177 
178  if (Arrival)
179  {
180  DPRINT("Arrival of %wZ\n", Notification->SymbolicLinkName);
181 
182  /* Open the device */
184  Notification->SymbolicLinkName,
186  NULL,
187  NULL);
191  &IoStatusBlock,
193  0);
194  if (!NT_SUCCESS(Status))
195  {
196  DPRINT1("ZwOpenFile() failed with status 0x%08lx\n", Status);
197  return Status;
198  }
202  KernelMode,
203  (PVOID*)&FileObject,
204  NULL);
205  if (!NT_SUCCESS(Status))
206  {
207  DPRINT1("ObReferenceObjectByHandle() failed with status 0x%08lx\n", Status);
209  return Status;
210  }
213 
214  /* Get capabilities (IOCTL_GET_SYS_BUTTON_CAPS) */
217  DeviceObject,
218  NULL,
219  0,
220  &Caps,
221  sizeof(Caps),
222  FALSE,
223  &Event,
224  &IoStatusBlock);
225  if (!Irp)
226  {
227  DPRINT1("IoBuildDeviceIoControlRequest() failed\n");
230  }
232  if (Status == STATUS_PENDING)
233  {
234  DPRINT("IOCTL_GET_SYS_BUTTON_CAPS pending\n");
237  }
238  if (!NT_SUCCESS(Status))
239  {
240  DPRINT1("Sending IOCTL_GET_SYS_BUTTON_CAPS failed with status 0x%08x\n", Status);
243  }
244 
245  DPRINT("Device capabilities: 0x%x\n", Caps);
246  if (Caps & SYS_BUTTON_POWER)
247  {
248  DPRINT("POWER button present\n");
250  }
251 
252  if (Caps & SYS_BUTTON_SLEEP)
253  {
254  DPRINT("SLEEP button present\n");
256  }
257 
258  if (Caps & SYS_BUTTON_LID)
259  {
260  DPRINT("LID present\n");
262  }
263 
264  SysButtonContext = ExAllocatePoolWithTag(NonPagedPool,
265  sizeof(SYS_BUTTON_CONTEXT),
266  'IWOP');
267  if (!SysButtonContext)
268  {
269  DPRINT1("ExAllocatePoolWithTag() failed\n");
272  }
273 
274  /* Queue a work item to get sys button event */
275  SysButtonContext->WorkItem = IoAllocateWorkItem(DeviceObject);
276  SysButtonContext->DeviceObject = DeviceObject;
277  if (!SysButtonContext->WorkItem)
278  {
279  DPRINT1("IoAllocateWorkItem() failed\n");
281  ExFreePoolWithTag(SysButtonContext, 'IWOP');
283  }
284  IoQueueWorkItem(SysButtonContext->WorkItem,
287  SysButtonContext);
288 
290  return STATUS_SUCCESS;
291  }
292  else
293  {
294  DPRINT1("Removal of a power capable device not implemented\n");
295  return STATUS_NOT_IMPLEMENTED;
296  }
297 }
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:311
#define IOCTL_GET_SYS_BUTTON_CAPS
Definition: poclass.h:57
_In_ PVOID NotificationStructure
Definition: iofuncs.h:1203
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION * PDEVICE_INTERFACE_CHANGE_NOTIFICATION
#define TRUE
Definition: types.h:120
const GUID GUID_DEVICE_INTERFACE_ARRIVAL
Definition: deviface.c:14
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define SYS_BUTTON_SLEEP
Definition: poclass.h:82
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define FILE_SHARE_READ
Definition: compat.h:125
#define SYS_BUTTON_LID
Definition: poclass.h:83
HANDLE FileHandle
Definition: stats.c:38
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define FILE_READ_DATA
Definition: nt_native.h:628
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
* PFILE_OBJECT
Definition: iotypes.h:1955
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
static VOID NTAPI PopGetSysButton(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
Definition: events.c:107
#define SYS_BUTTON_POWER
Definition: poclass.h:81
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
Status
Definition: gdiplustypes.h:24
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
struct _GUID GUID
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PDEVICE_OBJECT DeviceObject
Definition: events.c:19
const GUID GUID_DEVICE_INTERFACE_REMOVAL
Definition: deviface.c:15
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
SYSTEM_POWER_CAPABILITIES PopCapabilities
Definition: power.c:29
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
PIO_WORKITEM WorkItem
Definition: events.c:20

Referenced by PoInitSystem().

◆ PopCleanupPowerState()

VOID NTAPI PopCleanupPowerState ( IN PPOWER_STATE  PowerState)

Definition at line 63 of file power.c.

64 {
65  //UNIMPLEMENTED;
66 }

Referenced by PspExitProcess(), and PspExitThread().

◆ PopFlushVolumes()

VOID NTAPI PopFlushVolumes ( IN BOOLEAN  ShuttingDown)

Definition at line 229 of file povolume.c.

230 {
231  POP_FLUSH_VOLUME FlushContext = {{0}};
232  ULONG FlushPolicy;
233  UNICODE_STRING RegistryName = RTL_CONSTANT_STRING(L"\\Registry");
235  HANDLE RegistryHandle;
236  PLIST_ENTRY NextEntry;
238  ULONG VolumeCount = 0;
240  HANDLE ThreadHandle;
241  ULONG ThreadCount;
242 
243  /* Setup the flush context */
244  InitializeListHead(&FlushContext.List);
246 
247  /* What to flush */
248  FlushPolicy = ShuttingDown ? 1 | 2 : PopFlushPolicy;
249  if ((FlushPolicy & 1))
250  {
251  /* Registry flush requested, so open it */
252  DPRINT("Opening registry\n");
254  &RegistryName,
256  NULL,
257  NULL);
258  Status = ZwOpenKey(&RegistryHandle, KEY_READ, &ObjectAttributes);
259  if (NT_SUCCESS(Status))
260  {
261  /* Flush the registry */
262  DPRINT("Flushing registry\n");
263  ZwFlushKey(RegistryHandle);
264  ZwClose(RegistryHandle);
265  }
266  }
267 
268  /* Serialize with other flushes */
270 
271  /* Scan the volume list */
272  NextEntry = PopVolumeDevices.Flink;
273  while (NextEntry != &PopVolumeDevices)
274  {
275  /* Get the dope from the link */
277 
278  /* Grab the next entry now, since we'll be modifying the list */
279  NextEntry = NextEntry->Flink;
280 
281  /* Make sure the object is mounted, writable, exists, and is not a floppy */
282  if (!(Dope->DeviceObject->Vpb->Flags & VPB_MOUNTED) ||
283  (Dope->DeviceObject->Characteristics & FILE_FLOPPY_DISKETTE) ||
284  (Dope->DeviceObject->Characteristics & FILE_READ_ONLY_DEVICE) ||
285  ((Dope->DeviceObject->Vpb->RealDevice) &&
286  (Dope->DeviceObject->Vpb->RealDevice->Characteristics & FILE_FLOPPY_DISKETTE)))
287  {
288  /* Not flushable */
289  continue;
290  }
291 
292  /* Remove it from the dope and add it to the flush context list */
293  RemoveEntryList(&Dope->Volume);
294  InsertTailList(&FlushContext.List, &Dope->Volume);
295 
296  /* Next */
297  VolumeCount++;
298  }
299 
300  /* Check if we should skip non-removable devices */
301  if (!(FlushPolicy & 2))
302  {
303  /* ReactOS only implements this routine for shutdown, which requires it */
305  }
306 
307  /* Check if there were no volumes at all */
308  if (!VolumeCount)
309  {
310  /* Nothing to do */
312  return;
313  }
314 
315  /* Allocate up to 8 flusher threads */
316  ThreadCount = min(VolumeCount, 8);
318  NULL,
320  NULL,
321  NULL);
322 
323  /* We will ourselves become a flusher thread */
324  FlushContext.Count = 1;
325  ThreadCount--;
326 
327  /* Look for any extra ones we might need */
328  while (ThreadCount > 0)
329  {
330  /* Create a new one */
331  ThreadCount--;
332  DPRINT("Creating flush thread\n");
333  Status = PsCreateSystemThread(&ThreadHandle,
336  0L,
337  NULL,
339  &FlushContext);
340  if (NT_SUCCESS(Status))
341  {
342  /* One more created... */
343  FlushContext.Count++;
344  ZwClose(ThreadHandle);
345  }
346  }
347 
348  /* Allow flushes to go through */
350 
351  /* Enter the flush work */
352  DPRINT("Local flush\n");
353  PopFlushVolumeWorker(&FlushContext);
354 
355  /* Wait for all flushes to be over */
356  DPRINT("Waiting for flushes\n");
358  DPRINT("Flushes have completed\n");
359 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
#define InsertTailList(ListHead, Entry)
KGUARDED_MUTEX PopVolumeLock
Definition: povolume.c:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
LIST_ENTRY PopVolumeDevices
Definition: povolume.c:27
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: povolume.c:19
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Definition: typedefs.h:117
ULONG PopFlushPolicy
Definition: povolume.c:24
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
PDEVICE_OBJECT DeviceObject
Definition: po.h:249
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define FILE_FLOPPY_DISKETTE
Definition: nt_native.h:809
#define VPB_MOUNTED
Definition: iotypes.h:1764
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define FILE_READ_ONLY_DEVICE
Definition: nt_native.h:808
VOID NTAPI PopFlushVolumeWorker(IN PVOID Context)
Definition: povolume.c:150
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by NtSetSystemPowerState().

◆ PopGracefulShutdown()

VOID NTAPI PopGracefulShutdown ( IN PVOID  Context)

Definition at line 245 of file poshtdwn.c.

246 {
248 
249  /* Process the registered waits and work items */
251 
252  /* Loop every process */
254  while (Process)
255  {
256  /* Make sure this isn't the idle or initial process */
258  {
259  /* Print it */
260  DPRINT1("%15s is still RUNNING (%p)\n", Process->ImageFileName, Process->UniqueProcessId);
261  }
262 
263  /* Get the next process */
265  }
266 
267  /* First, the HAL handles any "end of boot" special functionality */
268  DPRINT("HAL shutting down\n");
269  HalEndOfBoot();
270 
271  /* Shut down the Shim cache if enabled */
273 
274  /* In this step, the I/O manager does first-chance shutdown notification */
275  DPRINT("I/O manager shutting down in phase 0\n");
276  IoShutdownSystem(0);
277 
278  /* In this step, all workers are killed and hives are flushed */
279  DPRINT("Configuration Manager shutting down\n");
281 
282  /* Shut down the Executive */
283  DPRINT("Executive shutting down\n");
285 
286  /* Note that modified pages should be written here (MiShutdownSystem) */
287  MmShutdownSystem(0);
288 
289  /* Flush all user files before we start shutting down IO */
290  /* This is where modified pages are written back by the IO manager */
292 
293  /* In this step, the I/O manager does last-chance shutdown notification */
294  DPRINT("I/O manager shutting down in phase 1\n");
295  IoShutdownSystem(1);
297 
298  /* FIXME: Calling Mm shutdown phase 1 here to get page file dereference
299  * but it shouldn't be called here. Only phase 2 should be called.
300  */
301  MmShutdownSystem(1);
302 
303  /* Note that here, we should broadcast the power IRP to devices */
304 
305  /* In this step, the HAL disables any wake timers */
306  DPRINT("Disabling wake timers\n");
308 
309  /* And finally the power request is sent */
310  DPRINT("Taking the system down\n");
312 }
VOID NTAPI IoShutdownSystem(IN ULONG Phase)
Definition: device.c:133
POWER_ACTION Action
Definition: po.h:216
VOID MmShutdownSystem(IN ULONG Phase)
Definition: shutdown.c:41
#define HalSetWakeEnable
Definition: halfuncs.h:39
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI PopShutdownSystem(IN POWER_ACTION SystemAction)
Definition: poshtdwn.c:190
#define HalEndOfBoot
Definition: haltypes.h:296
NTSTATUS NTAPI CcWaitForCurrentLazyWriterActivity(VOID)
Definition: lazyrite.c:30
VOID NTAPI CcShutdownSystem(VOID)
Definition: cachesub.c:299
VOID NTAPI CmShutdownSystem(VOID)
Definition: cmsysini.c:2088
POP_POWER_ACTION PopAction
Definition: power.c:27
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
VOID NTAPI PopProcessShutDownLists(VOID)
Definition: poshtdwn.c:100
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
VOID NTAPI ExShutdownSystem(VOID)
Definition: shutdown.c:21
VOID NTAPI ApphelpCacheShutdown(VOID)
Definition: apphelp.c:466

Referenced by NtSetSystemPowerState().

◆ PopInitShutdownList()

VOID NTAPI PopInitShutdownList ( VOID  )

Definition at line 32 of file poshtdwn.c.

33 {
34  PAGED_CODE();
35 
36  /* Initialize the global shutdown event */
38 
39  /* Initialize the shutdown lists */
42 
43  /* Initialize the shutdown list lock */
45 
46  /* The list is available now */
48 }
#define TRUE
Definition: types.h:120
LIST_ENTRY PopShutdownQueue
Definition: poshtdwn.c:23
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN PopShutdownListAvailable
Definition: poshtdwn.c:25
KEVENT PopShutdownEvent
Definition: poshtdwn.c:21
PPOP_SHUTDOWN_WAIT_ENTRY PopShutdownThreadList
Definition: poshtdwn.c:22
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
KGUARDED_MUTEX PopShutdownListMutex
Definition: poshtdwn.c:24

Referenced by PoInitSystem().

◆ PopReadShutdownPolicy()

VOID NTAPI PopReadShutdownPolicy ( VOID  )

Definition at line 316 of file poshtdwn.c.

317 {
318  UNICODE_STRING KeyString;
322  ULONG Length;
323  UCHAR Buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(ULONG)];
325 
326  /* Setup object attributes */
327  RtlInitUnicodeString(&KeyString,
328  L"\\Registry\\Machine\\Software\\Policies\\Microsoft\\Windows NT");
330  &KeyString,
332  NULL,
333  NULL);
334 
335  /* Open the key */
336  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
337  if (NT_SUCCESS(Status))
338  {
339  /* Open the policy value and query it */
340  RtlInitUnicodeString(&KeyString, L"DontPowerOffAfterShutdown");
341  Status = ZwQueryValueKey(KeyHandle,
342  &KeyString,
344  &Info,
345  sizeof(Info),
346  &Length);
347  if ((NT_SUCCESS(Status)) && (Info->Type == REG_DWORD))
348  {
349  /* Read the policy */
350  PopShutdownPowerOffPolicy = *Info->Data == 1;
351  }
352 
353  /* Close the key */
355  }
356 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
ULONG PopShutdownPowerOffPolicy
Definition: poshtdwn.c:20
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_DWORD
Definition: sdbapi.c:596
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231

Referenced by NtSetSystemPowerState().

◆ PopSetSystemPowerState()

NTSTATUS NTAPI PopSetSystemPowerState ( SYSTEM_POWER_STATE  PowerState,
POWER_ACTION  PowerAction 
)

Definition at line 231 of file power.c.

232 {
234  PDEVICE_OBJECT Fdo;
237  POWER_STATE_TRAVERSE_CONTEXT PowerContext;
238 
240  if (!NT_SUCCESS(Status))
241  {
242  DPRINT1("No system power driver available\n");
243  Fdo = NULL;
244  }
245  else
246  {
248  if (Fdo == DeviceObject)
249  {
250  DPRINT("An FDO was not attached\n");
251  return STATUS_UNSUCCESSFUL;
252  }
253  }
254 
255  /* Set up context */
256  PowerContext.PowerAction = PowerAction;
257  PowerContext.SystemPowerState = PowerState;
258  PowerContext.PowerDevice = Fdo;
259 
260  /* Query for system power change */
264  &PowerContext);
265 
267  if (!NT_SUCCESS(Status))
268  {
269  DPRINT1("Query system power state failed; changing state anyway\n");
270  }
271 
272  /* Set system power change */
276  &PowerContext);
277 
279 
281 
282  if (Fdo != NULL)
283  {
284  if (PowerAction != PowerActionShutdownReset)
285  PopSendSetSystemPowerState(Fdo, PowerState, PowerAction);
286 
287  ObDereferenceObject(Fdo);
288  }
289 
290  return Status;
291 }
NTSTATUS PopQuerySystemPowerStateTraverse(PDEVICE_NODE DeviceNode, PVOID Context)
Definition: power.c:153
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
PDEVICE_NODE IopRootDeviceNode
Definition: pnpmgr.c:18
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS IopTraverseDeviceTree(PDEVICETREE_TRAVERSE_CONTEXT Context)
Definition: pnpmgr.c:1570
LONG NTSTATUS
Definition: precomp.h:26
POWER_ACTION PowerAction
Definition: power.c:21
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
BOOLEAN PopAcpiPresent
Definition: power.c:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS IopGetSystemPowerDeviceObject(IN PDEVICE_OBJECT *DeviceObject)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS PopSendSetSystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE SystemState, POWER_ACTION PowerAction)
Definition: power.c:111
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IopInitDeviceTreeTraverseContext( _DeviceTreeTraverseContext, _DeviceNode, _Action, _Context)
Definition: io.h:225
struct tagContext Context
Definition: acpixf.h:1030
PDEVICE_OBJECT PowerDevice
Definition: power.c:22
SYSTEM_POWER_STATE SystemPowerState
Definition: power.c:20
NTSTATUS PopSetSystemPowerStateTraverse(PDEVICE_NODE DeviceNode, PVOID Context)
Definition: power.c:187

Referenced by PopShutdownSystem().

◆ PoRemoveVolumeDevice()

VOID NTAPI PoRemoveVolumeDevice ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 105 of file povolume.c.

106 {
108  PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
109  KIRQL OldIrql;
110  PAGED_CODE();
111 
112  /* If the device already has the dope, return it */
113  DeviceExtension = IoGetDevObjExtension(DeviceObject);
114  if (!DeviceExtension->Dope)
115  {
116  /* no dope */
117  return;
118  }
119 
120  /* Make sure we can flush safely */
122 
123  /* Get dope from device */
124  Dope = (PDEVICE_OBJECT_POWER_EXTENSION)DeviceExtension->Dope;
125 
126  if (Dope->Volume.Flink)
127  {
128  /* Remove from volume from list */
129  RemoveEntryList(&Dope->Volume);
130  }
131 
132  /* Allow flushes to go through */
134 
135  /* Now remove dope from device object */
137 
138  /* remove from dev obj */
139  DeviceExtension->Dope = NULL;
140 
141  /* Release lock */
143 
144  /* Free dope */
146 }
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
KGUARDED_MUTEX PopVolumeLock
Definition: povolume.c:26
#define PAGED_CODE()
Definition: video.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
smooth NULL
Definition: ftsmooth.c:416
#define TAG_PO_DOPE
Definition: povolume.c:30
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
if(!(yy_init))
Definition: macro.lex.yy.c:714
struct _DEVICE_OBJECT_POWER_EXTENSION * Dope
Definition: iotypes.h:917
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
struct _DEVICE_OBJECT_POWER_EXTENSION * PDEVICE_OBJECT_POWER_EXTENSION
KSPIN_LOCK PopDopeGlobalLock
Definition: povolume.c:28
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IoGetDevObjExtension(DeviceObject)
Definition: io.h:125

Referenced by IoDeleteDevice().

◆ PoVolumeDevice()

VOID NTAPI PoVolumeDevice ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 83 of file povolume.c.

84 {
86  PAGED_CODE();
87 
88  /* Get dope from the device (if the device has no dope, it will receive some) */
89  Dope = PopGetDope(DeviceObject);
90  if (Dope)
91  {
92  /* Make sure we can flush safely */
94 
95  /* Add this volume into the list of power-manager volumes */
96  if (!Dope->Volume.Flink) InsertTailList(&PopVolumeDevices, &Dope->Volume);
97 
98  /* Allow flushes to go through */
100  }
101 }
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
#define InsertTailList(ListHead, Entry)
KGUARDED_MUTEX PopVolumeLock
Definition: povolume.c:26
#define PAGED_CODE()
Definition: video.h:57
LIST_ENTRY PopVolumeDevices
Definition: povolume.c:27
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
PDEVICE_OBJECT_POWER_EXTENSION NTAPI PopGetDope(IN PDEVICE_OBJECT DeviceObject)
Definition: povolume.c:36

Referenced by IoCreateDevice(), and IoVerifyVolume().

Variable Documentation

◆ PopAction

POP_POWER_ACTION PopAction

Definition at line 27 of file power.c.

Referenced by NtSetSystemPowerState(), and PopGracefulShutdown().

◆ PopCapabilities

SYSTEM_POWER_CAPABILITIES PopCapabilities

Definition at line 29 of file power.c.

Referenced by NtPowerInformation(), PoInitSystem(), and PopAddRemoveSysCapsCallback().

◆ PopDopeGlobalLock

KSPIN_LOCK PopDopeGlobalLock

Definition at line 28 of file povolume.c.

Referenced by PoInitSystem(), PopGetDope(), and PoRemoveVolumeDevice().

◆ PopSystemPowerDeviceNode

PDEVICE_NODE PopSystemPowerDeviceNode

Definition at line 25 of file power.c.

Referenced by IopGetSystemPowerDeviceObject(), and IopInitializeDevice().

◆ PopVolumeDevices

LIST_ENTRY PopVolumeDevices

Definition at line 27 of file povolume.c.

Referenced by PoInitSystem(), PopFlushVolumes(), PopFlushVolumeWorker(), and PoVolumeDevice().

◆ PopVolumeLock