ReactOS  0.4.15-dev-3326-ga91f5e8
power.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/po/power.c
5  * PURPOSE: Power Manager
6  * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7  * Herv� Poussineau (hpoussin@reactos.com)
8  */
9 
10 /* INCLUDES ******************************************************************/
11 
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* GLOBALS *******************************************************************/
17 
19 {
24 
30 
31 /* PRIVATE FUNCTIONS *********************************************************/
32 
33 static WORKER_THREAD_ROUTINE PopPassivePowerCall;
35 static
36 VOID
37 NTAPI
40 {
41  PIRP Irp = Parameter;
42  PIO_STACK_LOCATION IoStack;
43 
45 
47  IoStack = IoGetNextIrpStackLocation(Irp);
48 
49  (VOID)IoCallDriver(IoStack->DeviceObject, Irp);
50 }
51 
54 static
56 PopPresentIrp(
57  _In_ PIO_STACK_LOCATION NextStack,
58  _In_ PIRP Irp)
59 {
61  BOOLEAN CallAtPassiveLevel;
63  PWORK_QUEUE_ITEM WorkQueueItem;
64 
65  ASSERT(NextStack->MajorFunction == IRP_MJ_POWER);
66 
67  DeviceObject = NextStack->DeviceObject;
68 
69  /* Determine whether the IRP must be handled at PASSIVE_LEVEL.
70  * Only SET_POWER to working state can happen at raised IRQL. */
71  CallAtPassiveLevel = TRUE;
72  if ((NextStack->MinorFunction == IRP_MN_SET_POWER) &&
73  !(DeviceObject->Flags & DO_POWER_PAGABLE))
74  {
75  if (NextStack->Parameters.Power.Type == DevicePowerState &&
76  NextStack->Parameters.Power.State.DeviceState == PowerDeviceD0)
77  {
78  CallAtPassiveLevel = FALSE;
79  }
80  if (NextStack->Parameters.Power.Type == SystemPowerState &&
81  NextStack->Parameters.Power.State.SystemState == PowerSystemWorking)
82  {
83  CallAtPassiveLevel = FALSE;
84  }
85  }
86 
87  if (CallAtPassiveLevel)
88  {
89  /* We need to fit a work item into the DriverContext below */
90  C_ASSERT(sizeof(Irp->Tail.Overlay.DriverContext) >= sizeof(WORK_QUEUE_ITEM));
91 
93  {
94  /* Already at passive, call next driver directly */
95  return IoCallDriver(DeviceObject, Irp);
96  }
97 
98  /* Need to schedule a work item and return pending */
99  NextStack->Control |= SL_PENDING_RETURNED;
100 
101  WorkQueueItem = (PWORK_QUEUE_ITEM)&Irp->Tail.Overlay.DriverContext;
102  ExInitializeWorkItem(WorkQueueItem,
104  Irp);
105  ExQueueWorkItem(WorkQueueItem, DelayedWorkQueue);
106 
107  return STATUS_PENDING;
108  }
109 
110  /* Direct call. Raise IRQL in debug to catch invalid paged memory access. */
111 #if DBG
112  {
113  KIRQL OldIrql;
115 #endif
116 
118 
119 #if DBG
121  }
122 #endif
123 
124  return Status;
125 }
126 
127 static IO_COMPLETION_ROUTINE PopRequestPowerIrpCompletion;
128 
129 static
130 NTSTATUS
131 NTAPI
134  _In_ PIRP Irp,
135  _In_reads_opt_(_Inexpressible_("varies")) PVOID Context)
136 {
140 
143 
144  PowerState.DeviceState = (ULONG_PTR)Stack->Parameters.Others.Argument3;
145 
147  {
148  CompletionRoutine(Stack->Parameters.Others.Argument1,
149  (UCHAR)(ULONG_PTR)Stack->Parameters.Others.Argument2,
150  PowerState,
151  Stack->Parameters.Others.Argument4,
152  &Irp->IoStatus);
153  }
154 
156  IoFreeIrp(Irp);
158 
160 }
161 
162 VOID
163 NTAPI
165 {
166  //UNIMPLEMENTED;
167 }
168 
169 NTSTATUS
171 {
172  KEVENT Event;
175  PIRP Irp;
177 
180  FALSE);
181 
183  DeviceObject,
184  NULL,
185  0,
186  NULL,
187  &Event,
188  &IoStatusBlock);
189  if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
190 
193  IrpSp->Parameters.Power.Type = SystemPowerState;
194  IrpSp->Parameters.Power.State.SystemState = SystemState;
195  IrpSp->Parameters.Power.ShutdownType = PowerAction;
196 
197  Status = PoCallDriver(DeviceObject, Irp);
198  if (Status == STATUS_PENDING)
199  {
201  Executive,
202  KernelMode,
203  FALSE,
204  NULL);
206  }
207 
208  return Status;
209 }
210 
211 NTSTATUS
213 {
214  KEVENT Event;
217  PIRP Irp;
219 
222  FALSE);
223 
225  DeviceObject,
226  NULL,
227  0,
228  NULL,
229  &Event,
230  &IoStatusBlock);
231  if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
232 
235  IrpSp->Parameters.Power.Type = SystemPowerState;
236  IrpSp->Parameters.Power.State.SystemState = SystemState;
237  IrpSp->Parameters.Power.ShutdownType = PowerAction;
238 
239  Status = PoCallDriver(DeviceObject, Irp);
240  if (Status == STATUS_PENDING)
241  {
243  Executive,
244  KernelMode,
245  FALSE,
246  NULL);
248  }
249 
250  return Status;
251 }
252 
253 NTSTATUS
255  PVOID Context)
256 {
257  PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context;
258  PDEVICE_OBJECT TopDeviceObject;
260 
261  DPRINT("PopQuerySystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context);
262 
264  return STATUS_SUCCESS;
265 
266  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
267  return STATUS_SUCCESS;
268 
269  TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
270 
271  Status = PopSendQuerySystemPowerState(TopDeviceObject,
272  PowerStateContext->SystemPowerState,
273  PowerStateContext->PowerAction);
274  if (!NT_SUCCESS(Status))
275  {
276  DPRINT1("Device '%wZ' failed IRP_MN_QUERY_POWER\n", &DeviceNode->InstancePath);
277  }
278  ObDereferenceObject(TopDeviceObject);
279 
280 #if 0
281  return Status;
282 #else
283  return STATUS_SUCCESS;
284 #endif
285 }
286 
287 NTSTATUS
289  PVOID Context)
290 {
291  PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context;
292  PDEVICE_OBJECT TopDeviceObject;
294 
295  DPRINT("PopSetSystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context);
296 
298  return STATUS_SUCCESS;
299 
300  if (DeviceNode->PhysicalDeviceObject == PowerStateContext->PowerDevice)
301  return STATUS_SUCCESS;
302 
303  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
304  return STATUS_SUCCESS;
305 
306  TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
307  if (TopDeviceObject == PowerStateContext->PowerDevice)
308  {
309  ObDereferenceObject(TopDeviceObject);
310  return STATUS_SUCCESS;
311  }
312 
313  Status = PopSendSetSystemPowerState(TopDeviceObject,
314  PowerStateContext->SystemPowerState,
315  PowerStateContext->PowerAction);
316  if (!NT_SUCCESS(Status))
317  {
318  DPRINT1("Device '%wZ' failed IRP_MN_SET_POWER\n", &DeviceNode->InstancePath);
319  }
320 
321  ObDereferenceObject(TopDeviceObject);
322 
323 #if 0
324  return Status;
325 #else
326  return STATUS_SUCCESS;
327 #endif
328 }
329 
330 NTSTATUS
331 NTAPI
333 {
338  POWER_STATE_TRAVERSE_CONTEXT PowerContext;
339 
341  if (!NT_SUCCESS(Status))
342  {
343  DPRINT1("No system power driver available\n");
344  Fdo = NULL;
345  }
346  else
347  {
349  if (Fdo == DeviceObject)
350  {
351  DPRINT("An FDO was not attached\n");
352  return STATUS_UNSUCCESSFUL;
353  }
354  }
355 
356  /* Set up context */
357  PowerContext.PowerAction = PowerAction;
358  PowerContext.SystemPowerState = PowerState;
359  PowerContext.PowerDevice = Fdo;
360 
361  /* Query for system power change */
365  &PowerContext);
366 
368  if (!NT_SUCCESS(Status))
369  {
370  DPRINT1("Query system power state failed; changing state anyway\n");
371  }
372 
373  /* Set system power change */
377  &PowerContext);
378 
380 
382 
383  if (Fdo != NULL)
384  {
385  if (PowerAction != PowerActionShutdownReset)
387 
389  }
390 
391  return Status;
392 }
393 
394 CODE_SEG("INIT")
395 BOOLEAN
396 NTAPI
398 {
400  PCHAR CommandLine;
401  BOOLEAN ForceAcpiDisable = FALSE;
402 
403  /* Check if this is phase 1 init */
404  if (BootPhase == 1)
405  {
407  /* Register power button notification */
410  (PVOID)&GUID_DEVICE_SYS_BUTTON,
413  NULL,
415  if (!NT_SUCCESS(Status))
416  return FALSE;
417 
418  /* Register lid notification */
421  (PVOID)&GUID_DEVICE_LID,
424  NULL,
426  return NT_SUCCESS(Status);
427  }
428 
429  /* Initialize the power capabilities */
431 
432  /* Get the Command Line */
433  CommandLine = KeLoaderBlock->LoadOptions;
434 
435  /* Upcase it */
436  _strupr(CommandLine);
437 
438  /* Check for ACPI disable */
439  if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE;
440 
441  if (ForceAcpiDisable)
442  {
443  /* Set the ACPI State to False if it's been forced that way */
445  }
446  else
447  {
448  /* Otherwise check if the LoaderBlock has a ACPI Table */
450  }
451 
452  /* Enable shutdown by power button */
453  if (PopAcpiPresent)
455 
456  /* Initialize volume support */
459 
460  /* Initialize support for dope */
462 
463  /* Initialize support for shutdown waits and work-items */
465 
466  return TRUE;
467 }
468 
469 VOID
470 NTAPI
472 {
473  DPRINT1("PerfIdle function: %p\n", PowerState);
474 }
475 
476 VOID
477 NTAPI
482 {
483  /* Call the Perf Idle function */
485 }
486 
487 VOID
488 FASTCALL
490 {
491  /* FIXME: Extremly naive implementation */
493 }
494 
495 CODE_SEG("INIT")
496 VOID
497 NTAPI
499 {
500  /* Initialize the Power State */
501  RtlZeroMemory(&Prcb->PowerState, sizeof(Prcb->PowerState));
502  Prcb->PowerState.Idle0KernelTimeLimit = 0xFFFFFFFF;
503  Prcb->PowerState.CurrentThrottle = 100;
504  Prcb->PowerState.CurrentThrottleIndex = 0;
505  Prcb->PowerState.IdleFunction = PopIdle0;
506 
507  /* Initialize the Perf DPC and Timer */
508  KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
509  KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
510  KeInitializeTimerEx(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
511 }
512 
513 /* PUBLIC FUNCTIONS **********************************************************/
514 
515 /*
516  * @unimplemented
517  */
518 NTSTATUS
519 NTAPI
521 {
523  return STATUS_NOT_IMPLEMENTED;
524 }
525 
526 /*
527  * @unimplemented
528  */
529 NTSTATUS
530 NTAPI
532  IN ULONG Unknown1,
533  IN ULONG Unknown2,
534  IN ULONG Unknown3,
535  IN PVOID Unknown4,
536  IN PVOID Unknown5)
537 {
539  return STATUS_NOT_IMPLEMENTED;
540 }
541 
542 /*
543  * @unimplemented
544  */
545 VOID
546 NTAPI
548  IN ULONG BugCheckCode,
549  IN ULONG_PTR BugCheckParameter1,
550  IN ULONG_PTR BugCheckParameter2,
551  IN ULONG_PTR BugCheckParameter3,
552  IN ULONG_PTR BugCheckParameter4)
553 {
554  DPRINT1("PoShutdownBugCheck called\n");
555 
556  /* FIXME: Log error if requested */
557  /* FIXME: Initiate a shutdown */
558 
559  /* Bugcheck the system */
560  KeBugCheckEx(BugCheckCode,
561  BugCheckParameter1,
562  BugCheckParameter2,
563  BugCheckParameter3,
564  BugCheckParameter4);
565 }
566 
567 /*
568  * @unimplemented
569  */
570 VOID
571 NTAPI
572 PoSetHiberRange(IN PVOID HiberContext,
573  IN ULONG Flags,
575  IN ULONG Length,
576  IN ULONG PageTag)
577 {
579  return;
580 }
581 
582 /*
583  * @implemented
584  */
586 NTSTATUS
587 NTAPI
588 PoCallDriver(
591 {
592  PIO_STACK_LOCATION NextStack;
593 
595 
597  ASSERT(Irp);
598 
599  NextStack = IoGetNextIrpStackLocation(Irp);
600  ASSERT(NextStack->MajorFunction == IRP_MJ_POWER);
601 
602  /* Set DeviceObject for PopPresentIrp */
603  NextStack->DeviceObject = DeviceObject;
604 
605  /* Only QUERY_POWER and SET_POWER use special handling */
606  if (NextStack->MinorFunction != IRP_MN_SET_POWER &&
607  NextStack->MinorFunction != IRP_MN_QUERY_POWER)
608  {
609  return IoCallDriver(DeviceObject, Irp);
610  }
611 
612  /* Call the next driver, either directly or at PASSIVE_LEVEL */
613  return PopPresentIrp(NextStack, Irp);
614 }
615 
616 /*
617  * @unimplemented
618  */
619 PULONG
620 NTAPI
625 {
627  return NULL;
628 }
629 
630 /*
631  * @unimplemented
632  */
633 PVOID
634 NTAPI
637 {
639  return NULL;
640 }
641 
642 /*
643  * @implemented
644  */
645 NTSTATUS
646 NTAPI
654 {
655  PDEVICE_OBJECT TopDeviceObject;
657  PIRP Irp;
658 
663 
664  /* Always call the top of the device stack */
665  TopDeviceObject = IoGetAttachedDeviceReference(DeviceObject);
666 
667  Irp = IoAllocateIrp(TopDeviceObject->StackSize + 2, FALSE);
668  if (!Irp)
669  {
670  ObDereferenceObject(TopDeviceObject);
672  }
673 
674  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
675  Irp->IoStatus.Information = 0;
676 
678 
680  Stack->Parameters.Others.Argument1 = DeviceObject;
681  Stack->Parameters.Others.Argument2 = (PVOID)(ULONG_PTR)MinorFunction;
682  Stack->Parameters.Others.Argument3 = (PVOID)(ULONG_PTR)PowerState.DeviceState;
683  Stack->Parameters.Others.Argument4 = Context;
684  Stack->DeviceObject = TopDeviceObject;
686 
688  Stack->MajorFunction = IRP_MJ_POWER;
689  Stack->MinorFunction = MinorFunction;
691  {
692  Stack->Parameters.WaitWake.PowerState = PowerState.SystemState;
693  }
694  else
695  {
696  Stack->Parameters.Power.Type = DevicePowerState;
697  Stack->Parameters.Power.State = PowerState;
698  }
699 
700  if (pIrp != NULL)
701  *pIrp = Irp;
702 
704  PoCallDriver(TopDeviceObject, Irp);
705 
706  /* Always return STATUS_PENDING. The completion routine
707  * will call CompletionFunction and complete the Irp.
708  */
709  return STATUS_PENDING;
710 }
711 
712 /*
713  * @unimplemented
714  */
716 NTAPI
720 {
721  POWER_STATE ps;
722 
724 
725  ps.SystemState = PowerSystemWorking; // Fully on
726  ps.DeviceState = PowerDeviceD0; // Fully on
727 
728  return ps;
729 }
730 
731 /*
732  * @unimplemented
733  */
734 VOID
735 NTAPI
737 {
739 }
740 
741 /*
742  * @unimplemented
743  */
744 VOID
745 NTAPI
747 {
749 }
750 
751 /*
752  * @unimplemented
753  */
754 VOID
755 NTAPI
757 {
759 }
760 
761 /*
762  * @unimplemented
763  */
764 NTSTATUS
765 NTAPI
768  IN ULONG Flags,
770 {
772  return STATUS_NOT_IMPLEMENTED;
773 }
774 
775 /*
776  * @unimplemented
777  */
778 NTSTATUS
779 NTAPI
785 {
788 
789  PAGED_CODE();
790 
791  DPRINT("NtPowerInformation(PowerInformationLevel 0x%x, InputBuffer 0x%p, "
792  "InputBufferLength 0x%x, OutputBuffer 0x%p, OutputBufferLength 0x%x)\n",
793  PowerInformationLevel,
796 
797  if (PreviousMode != KernelMode)
798  {
799  _SEH2_TRY
800  {
803  }
805  {
807  }
808  _SEH2_END;
809  }
810 
811  switch (PowerInformationLevel)
812  {
813  case SystemBatteryState:
814  {
816 
817  if (InputBuffer != NULL)
821 
822  _SEH2_TRY
823  {
824  /* Just zero the struct (and thus set BatteryState->BatteryPresent = FALSE) */
825  RtlZeroMemory(BatteryState, sizeof(SYSTEM_BATTERY_STATE));
826  BatteryState->EstimatedTime = MAXULONG;
827 // BatteryState->AcOnLine = TRUE;
828 
830  }
832  {
834  }
835  _SEH2_END;
836 
837  break;
838  }
839 
841  {
843 
844  if (InputBuffer != NULL)
848 
849  _SEH2_TRY
850  {
853  sizeof(SYSTEM_POWER_CAPABILITIES));
854 
856  }
858  {
860  }
861  _SEH2_END;
862 
863  break;
864  }
865 
867  {
869 
870  if (InputBuffer != NULL)
874 
875  /* FIXME: return structures for all processors */
876 
877  _SEH2_TRY
878  {
879  /* FIXME: some values are hardcoded */
880  PowerInformation->Number = 0;
881  PowerInformation->MaxMhz = 1000;
882  PowerInformation->CurrentMhz = KeGetCurrentPrcb()->MHz;
883  PowerInformation->MhzLimit = 1000;
884  PowerInformation->MaxIdleState = 0;
885  PowerInformation->CurrentIdleState = 0;
886 
888  }
890  {
892  }
893  _SEH2_END;
894 
895  break;
896  }
897 
898  default:
900  DPRINT1("PowerInformationLevel 0x%x is UNIMPLEMENTED! Have a nice day.\n",
901  PowerInformationLevel);
902  break;
903  }
904 
905  return Status;
906 }
907 
908 NTSTATUS
909 NTAPI
912 {
914  return STATUS_NOT_IMPLEMENTED;
915 }
916 
917 BOOLEAN
918 NTAPI
920 {
922  return FALSE;
923 }
924 
925 NTSTATUS
926 NTAPI
928 {
930  return STATUS_NOT_IMPLEMENTED;
931 }
932 
933 NTSTATUS
934 NTAPI
937 {
941  PAGED_CODE();
942 
943  /* Validate flags */
944  if (esFlags & ~(ES_CONTINUOUS | ES_USER_PRESENT))
945  {
946  /* Fail the request */
948  }
949 
950  /* Check for user parameters */
951  if (PreviousMode != KernelMode)
952  {
953  /* Protect the probes */
954  _SEH2_TRY
955  {
956  /* Check if the pointer is valid */
958  }
960  {
961  /* It isn't -- fail */
963  }
964  _SEH2_END;
965  }
966 
967  /* Save the previous state, always masking in the continous flag */
968  PreviousState = Thread->PowerState | ES_CONTINUOUS;
969 
970  /* Check if we need to update the power state */
971  if (esFlags & ES_CONTINUOUS) Thread->PowerState = (UCHAR)esFlags;
972 
973  /* Protect the write back to user mode */
974  _SEH2_TRY
975  {
976  /* Return the previous flags */
978  }
980  {
981  /* Something's wrong, fail */
983  }
984  _SEH2_END;
985 
986  /* All is good */
987  return STATUS_SUCCESS;
988 }
989 
990 NTSTATUS
991 NTAPI
994  IN ULONG Flags)
995 {
997  POP_POWER_ACTION Action = {0};
999  ULONG Dummy;
1000 
1001  /* Check for invalid parameter combinations */
1004  (SystemAction > PowerActionWarmEject) ||
1005  (SystemAction < PowerActionReserved) ||
1013  {
1014  DPRINT1("NtSetSystemPowerState: Bad parameters!\n");
1015  DPRINT1(" SystemAction: 0x%x\n", SystemAction);
1016  DPRINT1(" MinSystemState: 0x%x\n", MinSystemState);
1017  DPRINT1(" Flags: 0x%x\n", Flags);
1018  return STATUS_INVALID_PARAMETER;
1019  }
1020 
1021  /* Check for user caller */
1022  if (PreviousMode != KernelMode)
1023  {
1024  /* Check for shutdown permission */
1026  {
1027  /* Not granted */
1028  DPRINT1("ERROR: Privilege not held for shutdown\n");
1030  }
1031 
1032  /* Do it as a kernel-mode caller for consistency with system state */
1033  return ZwSetSystemPowerState(SystemAction, MinSystemState, Flags);
1034  }
1035 
1036  /* Read policy settings (partial shutdown vs. full shutdown) */
1037  if (SystemAction == PowerActionShutdown) PopReadShutdownPolicy();
1038 
1039  /* Disable lazy flushing of registry */
1040  DPRINT("Stopping lazy flush\n");
1042 
1043  /* Setup the power action */
1044  Action.Action = SystemAction;
1045  Action.Flags = Flags;
1046 
1047  /* Notify callbacks */
1048  DPRINT("Notifying callbacks\n");
1050 
1051  /* Swap in any worker thread stacks */
1052  DPRINT("Swapping worker threads\n");
1054 
1055  /* Make our action global */
1056  PopAction = Action;
1057 
1058  /* Start power loop */
1060  while (TRUE)
1061  {
1062  /* Break out if there's nothing to do */
1063  if (Action.Action == PowerActionNone) break;
1064 
1065  /* Check for first-pass or restart */
1066  if (Status == STATUS_CANCELLED)
1067  {
1068  /* Check for shutdown action */
1072  {
1073  /* Set the action */
1075  }
1076 
1077  /* Now we are good to go */
1079  }
1080 
1081  /* Check if we're still in an invalid status */
1082  if (!NT_SUCCESS(Status)) break;
1083 
1084  /* Flush all volumes and the registry */
1085  DPRINT("Flushing volumes\n");
1087 
1088 #ifndef NEWCC
1089  /* Flush dirty cache pages */
1090  /* XXX: Is that still mandatory? As now we'll wait on lazy writer to complete? */
1092  DPRINT("Cache flushed %lu pages\n", Dummy);
1093 #else
1094  Dummy = 0;
1095 #endif
1096 
1097  /* Set IRP for drivers */
1099  if (PopAction.Shutdown)
1100  {
1101  DPRINT("Queueing shutdown thread\n");
1102  /* Check if we are running in the system context */
1104  {
1105  /* We're not, so use a worker thread for shutdown */
1108  NULL);
1109 
1111 
1112  /* Spend us -- when we wake up, the system is good to go down */
1115  goto Exit;
1116 
1117  }
1118  else
1119  {
1120  /* Do the shutdown inline */
1122  }
1123  }
1124 
1125  /* You should not have made it this far */
1126  // ASSERTMSG("System is still up and running?!\n", FALSE);
1127  DPRINT1("System is still up and running, you may not have chosen a yet supported power option: %u\n", PopAction.Action);
1128  break;
1129  }
1130 
1131 Exit:
1132  /* We're done, return */
1133  return Status;
1134 }
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
signed char * PCHAR
Definition: retypes.h:7
#define DO_POWER_PAGABLE
NTSTATUS PopQuerySystemPowerStateTraverse(PDEVICE_NODE DeviceNode, PVOID Context)
Definition: power.c:254
PCALLBACK_OBJECT PowerStateCallback
Definition: callback.c:29
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
enum _POWER_STATE_TYPE POWER_STATE_TYPE
#define IN
Definition: typedefs.h:39
return STATUS_NOT_SUPPORTED
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
PDEVICE_OBJECT PhysicalDeviceObject
Definition: iotypes.h:855
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:723
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
Definition: conport.c:35
VOID NTAPI ExSwapinWorkerThreads(IN BOOLEAN AllowSwap)
Definition: work.c:637
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:107
_In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
Definition: wdfdevice.h:3883
#define _In_opt_
Definition: ms_sal.h:309
#define SL_PENDING_RETURNED
Definition: iotypes.h:3325
#define _Inout_
Definition: ms_sal.h:378
VOID NTAPI PoShutdownBugCheck(IN BOOLEAN LogError, IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: power.c:547
#define IRP_MN_QUERY_POWER
REQUEST_POWER_COMPLETE * PREQUEST_POWER_COMPLETE
Definition: potypes.h:469
_In_ ULONG _In_ BOOLEAN LogError
Definition: classpnp.h:1310
NTSTATUS IopTraverseDeviceTree(PDEVICETREE_TRAVERSE_CONTEXT Context)
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
POWER_ACTION Action
Definition: po.h:216
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
UCHAR IrpMinor
Definition: po.h:220
PLOADER_PARAMETER_EXTENSION Extension
Definition: arc.h:512
#define POWER_ACTION_DISABLE_WAKES
Definition: ntpoapi.h:419
_In_ ULONG ConservationIdleTime
Definition: pofuncs.h:24
#define KeGetPreviousMode()
Definition: ketypes.h:1107
PULONG NTAPI PoRegisterDeviceForIdleDetection(IN PDEVICE_OBJECT DeviceObject, IN ULONG ConservationIdleTime, IN ULONG PerformanceIdleTime, IN DEVICE_POWER_STATE State)
Definition: power.c:621
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1079
#define POWER_ACTION_LOCK_CONSOLE
Definition: ntpoapi.h:418
#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
Definition: iotypes.h:1239
POWER_ACTION PowerAction
Definition: power.c:21
PDEVICE_NODE PopSystemPowerDeviceNode
Definition: power.c:25
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:318
FxIrp * pIrp
_In_ PVOID Parameter
Definition: ldrtypes.h:241
_In_ SYSTEM_POWER_STATE MinSystemState
Definition: ntpoapi.h:303
if(dx==0 &&dy==0)
Definition: linetemp.h:174
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 FASTCALL
Definition: nt_native.h:50
#define _In_reads_opt_(size)
Definition: ms_sal.h:320
BOOLEAN PopAcpiPresent
Definition: power.c:26
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
VOID NTAPI PopCleanupPowerState(IN PPOWER_STATE PowerState)
Definition: power.c:164
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
VOID NTAPI PoUnregisterSystemState(IN PVOID StateHandle)
Definition: power.c:756
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
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:647
#define _Use_decl_annotations_
Definition: ms_sal.h:275
_SEH2_TRY
Definition: create.c:4226
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
uint32_t ULONG_PTR
Definition: typedefs.h:65
int WINAPI StartPage(_In_ HDC)
NTSTATUS NTAPI PoCancelDeviceNotify(IN PVOID NotifyBlock)
Definition: power.c:520
VOID NTAPI PoSetSystemState(IN EXECUTION_STATE Flags)
Definition: power.c:736
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:318
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG NTAPI KeSuspendThread(PKTHREAD Thread)
Definition: thrdobj.c:610
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
#define _Analysis_assume_(expr)
Definition: ms_sal.h:2901
_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
_In_ SYSTEM_POWER_STATE _In_ ULONG _In_ BOOLEAN Asynchronous
Definition: ntpoapi.h:303
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _POWER_STATE_TRAVERSE_CONTEXT POWER_STATE_TRAVERSE_CONTEXT
#define FALSE
Definition: types.h:117
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
_In_ PIRP Irp
Definition: csq.h:116
#define POWER_ACTION_OVERRIDE_APPS
Definition: ntpoapi.h:416
struct SYSTEM_POWER_CAPABILITIES * PSYSTEM_POWER_CAPABILITIES
PRTL_UNICODE_STRING_BUFFER PULONG PULONG Unknown4
_IRQL_requires_max_(DISPATCH_LEVEL)
Definition: power.c:52
NTSTATUS PopSendQuerySystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE SystemState, POWER_ACTION PowerAction)
Definition: power.c:170
WORK_QUEUE_ITEM PopShutdownWorkItem
Definition: power.c:28
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1697
static IO_COMPLETION_ROUTINE PopRequestPowerIrpCompletion
Definition: power.c:127
#define __drv_aliasesMem
Definition: btrfs_drv.h:205
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
#define PsGetCurrentProcess
Definition: psfuncs.h:17
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
unsigned char BOOLEAN
NTSTATUS NTAPI NtInitiatePowerAction(IN POWER_ACTION SystemAction, IN SYSTEM_POWER_STATE MinSystemState, IN ULONG Flags, IN BOOLEAN Asynchronous)
Definition: power.c:766
VOID NTAPI PopReadShutdownPolicy(VOID)
Definition: poshtdwn.c:318
VOID NTAPI PopInitShutdownList(VOID)
Definition: poshtdwn.c:35
VOID NTAPI PoSetHiberRange(IN PVOID HiberContext, IN ULONG Flags, IN OUT PVOID StartPage, IN ULONG Length, IN ULONG PageTag)
Definition: power.c:572
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define _In_
Definition: ms_sal.h:308
#define _IRQL_requires_same_
Definition: driverspecs.h:232
POP_POWER_ACTION PopAction
Definition: power.c:27
NTSTATUS NTAPI NtSetSystemPowerState(IN POWER_ACTION SystemAction, IN SYSTEM_POWER_STATE MinSystemState, IN ULONG Flags)
Definition: power.c:992
#define C_ASSERT(e)
Definition: intsafe.h:73
KGUARDED_MUTEX PopVolumeLock
Definition: povolume.c:26
void * PVOID
Definition: retypes.h:9
#define POWER_ACTION_CRITICAL
Definition: ntpoapi.h:420
_Out_ EXECUTION_STATE * PreviousFlags
Definition: ntpoapi.h:288
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
VOID NTAPI HalProcessorIdle(VOID)
Definition: processor.c:83
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
LATENCY_TIME
Definition: potypes.h:215
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:859
KIRQL OldIrql
Definition: mm.h:1502
Status
Definition: gdiplustypes.h:24
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
struct _POWER_STATE_TRAVERSE_CONTEXT * PPOWER_STATE_TRAVERSE_CONTEXT
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
#define POWER_ACTION_QUERY_ALLOWED
Definition: ntpoapi.h:414
VOID NTAPI ExNotifyCallback(IN PCALLBACK_OBJECT CallbackObject, IN PVOID Argument1, IN PVOID Argument2)
Definition: callback.c:467
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:949
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
enum _DEVICE_POWER_STATE * PDEVICE_POWER_STATE
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define POWER_ACTION_UI_ALLOWED
Definition: ntpoapi.h:415
NTSYSCALLAPI NTSTATUS NTAPI ZwSetSystemPowerState(_In_ POWER_ACTION SystemAction, _In_ SYSTEM_POWER_STATE MinSystemState, _In_ ULONG Flags)
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS NTAPI NtGetDevicePowerState(IN HANDLE Device, IN PDEVICE_POWER_STATE PowerState)
Definition: power.c:910
VOID NTAPI CmSetLazyFlushState(IN BOOLEAN Enable)
Definition: cmlazy.c:442
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static void Exit(void)
Definition: sock.c:1331
VOID NTAPI PoInitializePrcb(IN PKPRCB Prcb)
Definition: power.c:498
BOOLEAN NTAPI NtIsSystemResumeAutomatic(VOID)
Definition: power.c:919
#define ObDereferenceObject
Definition: obfuncs.h:203
enum _POWER_INFORMATION_LEVEL POWER_INFORMATION_LEVEL
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
Type
Definition: Type.h:6
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Definition: Node.h:9
NTSTATUS IopGetSystemPowerDeviceObject(IN PDEVICE_OBJECT *DeviceObject)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IRP_MJ_POWER
NTSTATUS PopSendSetSystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE SystemState, POWER_ACTION PowerAction)
Definition: power.c:212
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
NTSTATUS NTAPI NtRequestWakeupLatency(IN LATENCY_TIME Latency)
Definition: power.c:927
ULONG EXECUTION_STATE
Definition: potypes.h:213
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
Definition: pofuncs.h:42
Definition: ketypes.h:687
POWER_ACTION
Definition: ntpoapi.h:122
#define VOID
Definition: acefi.h:82
#define DNF_LEGACY_DRIVER
Definition: iotypes.h:182
VOID NTAPI PopFlushVolumes(IN BOOLEAN ShuttingDown)
Definition: povolume.c:229
#define IRP_MN_SET_POWER
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
#define MAXULONG
Definition: typedefs.h:251
NTSTATUS NTAPI PoRegisterDeviceNotify(OUT PVOID Unknown0, IN ULONG Unknown1, IN ULONG Unknown2, IN ULONG Unknown3, IN PVOID Unknown4, IN PVOID Unknown5)
Definition: power.c:531
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
BOOLEAN NTAPI PoInitSystem(IN ULONG BootPhase)
Definition: power.c:397
#define POWER_ACTION_LIGHTEST_FIRST
Definition: ntpoapi.h:417
struct SYSTEM_BATTERY_STATE * PSYSTEM_BATTERY_STATE
const LUID SeShutdownPrivilege
Definition: priv.c:38
_SEH2_END
Definition: create.c:4400
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
static WORKER_THREAD_ROUTINE PopPassivePowerCall
Definition: power.c:33
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746
_In_ ULONG _In_ ULONG PerformanceIdleTime
Definition: pofuncs.h:24
#define ES_CONTINUOUS
Definition: potypes.h:211
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
VOID NTAPI PopPerfIdleDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: power.c:478
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3032
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
VOID NTAPI PopGracefulShutdown(IN PVOID Context)
Definition: poshtdwn.c:247
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:893
VOID FASTCALL PopIdle0(IN PPROCESSOR_POWER_STATE PowerState)
Definition: power.c:489
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
SYSTEM_POWER_CAPABILITIES PopCapabilities
Definition: power.c:29
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define _Outptr_opt_
Definition: ms_sal.h:429
struct _WORK_QUEUE_ITEM * PWORK_QUEUE_ITEM
#define ES_USER_PRESENT
Definition: potypes.h:210
NTSTATUS NTAPI NtPowerInformation(IN POWER_INFORMATION_LEVEL PowerInformationLevel, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength)
Definition: power.c:780
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
Definition: spinlock.c:27
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
VOID NTAPI PopPerfIdle(PPROCESSOR_POWER_STATE PowerState)
Definition: power.c:471
VOID NTAPI KeSetTargetProcessorDpc(IN PKDPC Dpc, IN CCHAR Number)
Definition: dpc.c:971
NTSTATUS NTAPI PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, IN PVOID Context)
Definition: events.c:147
struct tagContext Context
Definition: acpixf.h:1034
#define OUT
Definition: typedefs.h:40
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
#define IopInitDeviceTreeTraverseContext( _DeviceTreeTraverseContext, _DeviceNode, _Action, _Context)
Definition: io.h:229
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:115
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:717
#define ULONG_PTR
Definition: config.h:101
NTSTATUS NTAPI IoRegisterPlugPlayNotification(_In_ IO_NOTIFICATION_EVENT_CATEGORY EventCategory, _In_ ULONG EventCategoryFlags, _In_opt_ PVOID EventCategoryData, _In_ PDRIVER_OBJECT DriverObject, _In_ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine, _Inout_opt_ PVOID Context, _Out_ PVOID *NotificationEntry)
Definition: pnpnotify.c:345
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IRP_MN_WAIT_WAKE
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
KSPIN_LOCK PopDopeGlobalLock
Definition: povolume.c:28
#define STATUS_SUCCESS
Definition: shellext.h:65
PVOID NTAPI PoRegisterSystemState(IN PVOID StateHandle, IN EXECUTION_STATE Flags)
Definition: power.c:635
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7519
NTSTATUS NTAPI PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState, POWER_ACTION PowerAction)
Definition: power.c:332
#define DPRINT
Definition: sndvol32.h:71
#define KeGetCurrentThread
Definition: hal.h:55
PDEVICE_OBJECT PowerDevice
Definition: power.c:22
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
Definition: spinlock.c:39
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
SYSTEM_POWER_STATE SystemPowerState
Definition: power.c:20
#define UNIMPLEMENTED_ONCE
Definition: typedefs.h:30
BOOLEAN Shutdown
Definition: po.h:215
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD IN DWORD IN DWORD Unknown5
Definition: conport.c:35
NTSTATUS CcRosFlushDirtyPages(ULONG Target, PULONG Count, BOOLEAN Wait, BOOLEAN CalledFromLazy)
Definition: view.c:305
NTSTATUS PopSetSystemPowerStateTraverse(PDEVICE_NODE DeviceNode, PVOID Context)
Definition: power.c:288
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
struct _PROCESSOR_POWER_INFORMATION * PPROCESSOR_POWER_INFORMATION
NTSTATUS NTAPI NtSetThreadExecutionState(IN EXECUTION_STATE esFlags, OUT EXECUTION_STATE *PreviousFlags)
Definition: power.c:935
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
VOID NTAPI KeInitializeTimerEx(OUT PKTIMER Timer, IN TIMER_TYPE Type)
Definition: timerobj.c:244
#define STATUS_SYSTEM_SHUTDOWN
Definition: ntstatus.h:855
_In_ WDF_POWER_DEVICE_STATE PreviousState
Definition: wdfdevice.h:829
#define PAGED_CODE()
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675