ReactOS  0.4.15-dev-425-gc40b086
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) &&
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
128 NTSTATUS
129 NTAPI
131  IN PIRP Irp,
132  IN PVOID Context)
133 {
134  PIO_STACK_LOCATION Stack;
137 
140 
141  PowerState.DeviceState = (ULONG_PTR)Stack->Parameters.Others.Argument3;
142  CompletionRoutine(Stack->Parameters.Others.Argument1,
143  (UCHAR)(ULONG_PTR)Stack->Parameters.Others.Argument2,
144  PowerState,
145  Stack->Parameters.Others.Argument4,
146  &Irp->IoStatus);
147 
149  IoFreeIrp(Irp);
151 
153 }
154 
155 VOID
156 NTAPI
158 {
159  //UNIMPLEMENTED;
160 }
161 
162 NTSTATUS
164 {
165  KEVENT Event;
168  PIRP Irp;
170 
173  FALSE);
174 
176  DeviceObject,
177  NULL,
178  0,
179  NULL,
180  &Event,
181  &IoStatusBlock);
182  if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
183 
186  IrpSp->Parameters.Power.Type = SystemPowerState;
187  IrpSp->Parameters.Power.State.SystemState = SystemState;
188  IrpSp->Parameters.Power.ShutdownType = PowerAction;
189 
190  Status = PoCallDriver(DeviceObject, Irp);
191  if (Status == STATUS_PENDING)
192  {
194  Executive,
195  KernelMode,
196  FALSE,
197  NULL);
199  }
200 
201  return Status;
202 }
203 
204 NTSTATUS
206 {
207  KEVENT Event;
210  PIRP Irp;
212 
215  FALSE);
216 
218  DeviceObject,
219  NULL,
220  0,
221  NULL,
222  &Event,
223  &IoStatusBlock);
224  if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
225 
228  IrpSp->Parameters.Power.Type = SystemPowerState;
229  IrpSp->Parameters.Power.State.SystemState = SystemState;
230  IrpSp->Parameters.Power.ShutdownType = PowerAction;
231 
232  Status = PoCallDriver(DeviceObject, Irp);
233  if (Status == STATUS_PENDING)
234  {
236  Executive,
237  KernelMode,
238  FALSE,
239  NULL);
241  }
242 
243  return Status;
244 }
245 
246 NTSTATUS
248  PVOID Context)
249 {
250  PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context;
251  PDEVICE_OBJECT TopDeviceObject;
253 
254  DPRINT("PopQuerySystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context);
255 
257  return STATUS_SUCCESS;
258 
259  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
260  return STATUS_SUCCESS;
261 
262  TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
263 
264  Status = PopSendQuerySystemPowerState(TopDeviceObject,
265  PowerStateContext->SystemPowerState,
266  PowerStateContext->PowerAction);
267  if (!NT_SUCCESS(Status))
268  {
269  DPRINT1("Device '%wZ' failed IRP_MN_QUERY_POWER\n", &DeviceNode->InstancePath);
270  }
271  ObDereferenceObject(TopDeviceObject);
272 
273 #if 0
274  return Status;
275 #else
276  return STATUS_SUCCESS;
277 #endif
278 }
279 
280 NTSTATUS
282  PVOID Context)
283 {
284  PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context;
285  PDEVICE_OBJECT TopDeviceObject;
287 
288  DPRINT("PopSetSystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context);
289 
291  return STATUS_SUCCESS;
292 
293  if (DeviceNode->PhysicalDeviceObject == PowerStateContext->PowerDevice)
294  return STATUS_SUCCESS;
295 
296  if (DeviceNode->Flags & DNF_LEGACY_DRIVER)
297  return STATUS_SUCCESS;
298 
299  TopDeviceObject = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
300  if (TopDeviceObject == PowerStateContext->PowerDevice)
301  {
302  ObDereferenceObject(TopDeviceObject);
303  return STATUS_SUCCESS;
304  }
305 
306  Status = PopSendSetSystemPowerState(TopDeviceObject,
307  PowerStateContext->SystemPowerState,
308  PowerStateContext->PowerAction);
309  if (!NT_SUCCESS(Status))
310  {
311  DPRINT1("Device '%wZ' failed IRP_MN_SET_POWER\n", &DeviceNode->InstancePath);
312  }
313 
314  ObDereferenceObject(TopDeviceObject);
315 
316 #if 0
317  return Status;
318 #else
319  return STATUS_SUCCESS;
320 #endif
321 }
322 
323 NTSTATUS
324 NTAPI
326 {
328  PDEVICE_OBJECT Fdo;
331  POWER_STATE_TRAVERSE_CONTEXT PowerContext;
332 
334  if (!NT_SUCCESS(Status))
335  {
336  DPRINT1("No system power driver available\n");
337  Fdo = NULL;
338  }
339  else
340  {
342  if (Fdo == DeviceObject)
343  {
344  DPRINT("An FDO was not attached\n");
345  return STATUS_UNSUCCESSFUL;
346  }
347  }
348 
349  /* Set up context */
350  PowerContext.PowerAction = PowerAction;
351  PowerContext.SystemPowerState = PowerState;
352  PowerContext.PowerDevice = Fdo;
353 
354  /* Query for system power change */
358  &PowerContext);
359 
361  if (!NT_SUCCESS(Status))
362  {
363  DPRINT1("Query system power state failed; changing state anyway\n");
364  }
365 
366  /* Set system power change */
370  &PowerContext);
371 
373 
375 
376  if (Fdo != NULL)
377  {
378  if (PowerAction != PowerActionShutdownReset)
379  PopSendSetSystemPowerState(Fdo, PowerState, PowerAction);
380 
381  ObDereferenceObject(Fdo);
382  }
383 
384  return Status;
385 }
386 
387 INIT_FUNCTION
388 BOOLEAN
389 NTAPI
391 {
393  PCHAR CommandLine;
394  BOOLEAN ForceAcpiDisable = FALSE;
395 
396  /* Check if this is phase 1 init */
397  if (BootPhase == 1)
398  {
399  /* Register power button notification */
402  (PVOID)&GUID_DEVICE_SYS_BUTTON,
404  PhysicalDeviceObject->DriverObject,
406  NULL,
408 
409  /* Register lid notification */
412  (PVOID)&GUID_DEVICE_LID,
414  PhysicalDeviceObject->DriverObject,
416  NULL,
418  return TRUE;
419  }
420 
421  /* Initialize the power capabilities */
423 
424  /* Get the Command Line */
425  CommandLine = KeLoaderBlock->LoadOptions;
426 
427  /* Upcase it */
428  _strupr(CommandLine);
429 
430  /* Check for ACPI disable */
431  if (strstr(CommandLine, "NOACPI")) ForceAcpiDisable = TRUE;
432 
433  if (ForceAcpiDisable)
434  {
435  /* Set the ACPI State to False if it's been forced that way */
437  }
438  else
439  {
440  /* Otherwise check if the LoaderBlock has a ACPI Table */
442  }
443 
444  /* Enable shutdown by power button */
445  if (PopAcpiPresent)
447 
448  /* Initialize volume support */
451 
452  /* Initialize support for dope */
454 
455  /* Initialize support for shutdown waits and work-items */
457 
458  return TRUE;
459 }
460 
461 VOID
462 NTAPI
464 {
465  DPRINT1("PerfIdle function: %p\n", PowerState);
466 }
467 
468 VOID
469 NTAPI
474 {
475  /* Call the Perf Idle function */
477 }
478 
479 VOID
480 FASTCALL
482 {
483  /* FIXME: Extremly naive implementation */
485 }
486 
487 INIT_FUNCTION
488 VOID
489 NTAPI
491 {
492  /* Initialize the Power State */
493  RtlZeroMemory(&Prcb->PowerState, sizeof(Prcb->PowerState));
494  Prcb->PowerState.Idle0KernelTimeLimit = 0xFFFFFFFF;
495  Prcb->PowerState.CurrentThrottle = 100;
496  Prcb->PowerState.CurrentThrottleIndex = 0;
497  Prcb->PowerState.IdleFunction = PopIdle0;
498 
499  /* Initialize the Perf DPC and Timer */
500  KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
501  KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
502  KeInitializeTimerEx(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
503 }
504 
505 /* PUBLIC FUNCTIONS **********************************************************/
506 
507 /*
508  * @unimplemented
509  */
510 NTSTATUS
511 NTAPI
513 {
515  return STATUS_NOT_IMPLEMENTED;
516 }
517 
518 /*
519  * @unimplemented
520  */
521 NTSTATUS
522 NTAPI
524  IN ULONG Unknown1,
525  IN ULONG Unknown2,
526  IN ULONG Unknown3,
527  IN PVOID Unknown4,
528  IN PVOID Unknown5)
529 {
531  return STATUS_NOT_IMPLEMENTED;
532 }
533 
534 /*
535  * @unimplemented
536  */
537 VOID
538 NTAPI
540  IN ULONG BugCheckCode,
541  IN ULONG_PTR BugCheckParameter1,
542  IN ULONG_PTR BugCheckParameter2,
543  IN ULONG_PTR BugCheckParameter3,
544  IN ULONG_PTR BugCheckParameter4)
545 {
546  DPRINT1("PoShutdownBugCheck called\n");
547 
548  /* FIXME: Log error if requested */
549  /* FIXME: Initiate a shutdown */
550 
551  /* Bugcheck the system */
552  KeBugCheckEx(BugCheckCode,
553  BugCheckParameter1,
554  BugCheckParameter2,
555  BugCheckParameter3,
556  BugCheckParameter4);
557 }
558 
559 /*
560  * @unimplemented
561  */
562 VOID
563 NTAPI
564 PoSetHiberRange(IN PVOID HiberContext,
565  IN ULONG Flags,
567  IN ULONG Length,
568  IN ULONG PageTag)
569 {
571  return;
572 }
573 
574 /*
575  * @implemented
576  */
578 NTSTATUS
579 NTAPI
580 PoCallDriver(
583 {
584  PIO_STACK_LOCATION NextStack;
585 
587 
589  ASSERT(Irp);
590 
591  NextStack = IoGetNextIrpStackLocation(Irp);
592  ASSERT(NextStack->MajorFunction == IRP_MJ_POWER);
593 
594  /* Set DeviceObject for PopPresentIrp */
595  NextStack->DeviceObject = DeviceObject;
596 
597  /* Only QUERY_POWER and SET_POWER use special handling */
598  if (NextStack->MinorFunction != IRP_MN_SET_POWER &&
599  NextStack->MinorFunction != IRP_MN_QUERY_POWER)
600  {
601  return IoCallDriver(DeviceObject, Irp);
602  }
603 
604  /* Call the next driver, either directly or at PASSIVE_LEVEL */
605  return PopPresentIrp(NextStack, Irp);
606 }
607 
608 /*
609  * @unimplemented
610  */
611 PULONG
612 NTAPI
617 {
619  return NULL;
620 }
621 
622 /*
623  * @unimplemented
624  */
625 PVOID
626 NTAPI
629 {
631  return NULL;
632 }
633 
634 /*
635  * @implemented
636  */
637 NTSTATUS
638 NTAPI
643  IN PVOID Context,
644  OUT PIRP *pIrp OPTIONAL)
645 {
646  PDEVICE_OBJECT TopDeviceObject;
647  PIO_STACK_LOCATION Stack;
648  PIRP Irp;
649 
654 
655  /* Always call the top of the device stack */
656  TopDeviceObject = IoGetAttachedDeviceReference(DeviceObject);
657 
658  Irp = IoAllocateIrp(TopDeviceObject->StackSize + 2, FALSE);
659  if (!Irp)
660  {
661  ObDereferenceObject(TopDeviceObject);
663  }
664 
665  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
666  Irp->IoStatus.Information = 0;
667 
669 
671  Stack->Parameters.Others.Argument1 = DeviceObject;
672  Stack->Parameters.Others.Argument2 = (PVOID)(ULONG_PTR)MinorFunction;
673  Stack->Parameters.Others.Argument3 = (PVOID)(ULONG_PTR)PowerState.DeviceState;
674  Stack->Parameters.Others.Argument4 = Context;
675  Stack->DeviceObject = TopDeviceObject;
677 
679  Stack->MajorFunction = IRP_MJ_POWER;
680  Stack->MinorFunction = MinorFunction;
682  {
683  Stack->Parameters.WaitWake.PowerState = PowerState.SystemState;
684  }
685  else
686  {
687  Stack->Parameters.Power.Type = DevicePowerState;
688  Stack->Parameters.Power.State = PowerState;
689  }
690 
691  if (pIrp != NULL)
692  *pIrp = Irp;
693 
695  PoCallDriver(TopDeviceObject, Irp);
696 
697  /* Always return STATUS_PENDING. The completion routine
698  * will call CompletionFunction and complete the Irp.
699  */
700  return STATUS_PENDING;
701 }
702 
703 /*
704  * @unimplemented
705  */
707 NTAPI
711 {
712  POWER_STATE ps;
713 
715 
716  ps.SystemState = PowerSystemWorking; // Fully on
717  ps.DeviceState = PowerDeviceD0; // Fully on
718 
719  return ps;
720 }
721 
722 /*
723  * @unimplemented
724  */
725 VOID
726 NTAPI
728 {
730 }
731 
732 /*
733  * @unimplemented
734  */
735 VOID
736 NTAPI
738 {
740 }
741 
742 /*
743  * @unimplemented
744  */
745 VOID
746 NTAPI
748 {
750 }
751 
752 /*
753  * @unimplemented
754  */
755 NTSTATUS
756 NTAPI
759  IN ULONG Flags,
761 {
763  return STATUS_NOT_IMPLEMENTED;
764 }
765 
766 /*
767  * @unimplemented
768  */
769 NTSTATUS
770 NTAPI
776 {
779 
780  PAGED_CODE();
781 
782  DPRINT("NtPowerInformation(PowerInformationLevel 0x%x, InputBuffer 0x%p, "
783  "InputBufferLength 0x%x, OutputBuffer 0x%p, OutputBufferLength 0x%x)\n",
784  PowerInformationLevel,
787 
788  if (PreviousMode != KernelMode)
789  {
790  _SEH2_TRY
791  {
794  }
796  {
798  }
799  _SEH2_END;
800  }
801 
802  switch (PowerInformationLevel)
803  {
804  case SystemBatteryState:
805  {
807 
808  if (InputBuffer != NULL)
812 
813  _SEH2_TRY
814  {
815  /* Just zero the struct (and thus set BatteryState->BatteryPresent = FALSE) */
816  RtlZeroMemory(BatteryState, sizeof(SYSTEM_BATTERY_STATE));
817  BatteryState->EstimatedTime = MAXULONG;
818 // BatteryState->AcOnLine = TRUE;
819 
821  }
823  {
825  }
826  _SEH2_END;
827 
828  break;
829  }
830 
832  {
834 
835  if (InputBuffer != NULL)
839 
840  _SEH2_TRY
841  {
842  RtlCopyMemory(PowerCapabilities,
844  sizeof(SYSTEM_POWER_CAPABILITIES));
845 
847  }
849  {
851  }
852  _SEH2_END;
853 
854  break;
855  }
856 
858  {
860 
861  if (InputBuffer != NULL)
865 
866  /* FIXME: return structures for all processors */
867 
868  _SEH2_TRY
869  {
870  /* FIXME: some values are hardcoded */
871  PowerInformation->Number = 0;
872  PowerInformation->MaxMhz = 1000;
873  PowerInformation->CurrentMhz = KeGetCurrentPrcb()->MHz;
874  PowerInformation->MhzLimit = 1000;
875  PowerInformation->MaxIdleState = 0;
876  PowerInformation->CurrentIdleState = 0;
877 
879  }
881  {
883  }
884  _SEH2_END;
885 
886  break;
887  }
888 
889  default:
891  DPRINT1("PowerInformationLevel 0x%x is UNIMPLEMENTED! Have a nice day.\n",
892  PowerInformationLevel);
893  break;
894  }
895 
896  return Status;
897 }
898 
899 NTSTATUS
900 NTAPI
903 {
905  return STATUS_NOT_IMPLEMENTED;
906 }
907 
908 BOOLEAN
909 NTAPI
911 {
913  return FALSE;
914 }
915 
916 NTSTATUS
917 NTAPI
919 {
921  return STATUS_NOT_IMPLEMENTED;
922 }
923 
924 NTSTATUS
925 NTAPI
928 {
932  PAGED_CODE();
933 
934  /* Validate flags */
935  if (esFlags & ~(ES_CONTINUOUS | ES_USER_PRESENT))
936  {
937  /* Fail the request */
939  }
940 
941  /* Check for user parameters */
942  if (PreviousMode != KernelMode)
943  {
944  /* Protect the probes */
945  _SEH2_TRY
946  {
947  /* Check if the pointer is valid */
949  }
951  {
952  /* It isn't -- fail */
954  }
955  _SEH2_END;
956  }
957 
958  /* Save the previous state, always masking in the continous flag */
959  PreviousState = Thread->PowerState | ES_CONTINUOUS;
960 
961  /* Check if we need to update the power state */
962  if (esFlags & ES_CONTINUOUS) Thread->PowerState = (UCHAR)esFlags;
963 
964  /* Protect the write back to user mode */
965  _SEH2_TRY
966  {
967  /* Return the previous flags */
969  }
971  {
972  /* Something's wrong, fail */
974  }
975  _SEH2_END;
976 
977  /* All is good */
978  return STATUS_SUCCESS;
979 }
980 
981 NTSTATUS
982 NTAPI
985  IN ULONG Flags)
986 {
988  POP_POWER_ACTION Action = {0};
990  ULONG Dummy;
991 
992  /* Check for invalid parameter combinations */
995  (SystemAction > PowerActionWarmEject) ||
996  (SystemAction < PowerActionReserved) ||
1004  {
1005  DPRINT1("NtSetSystemPowerState: Bad parameters!\n");
1006  DPRINT1(" SystemAction: 0x%x\n", SystemAction);
1007  DPRINT1(" MinSystemState: 0x%x\n", MinSystemState);
1008  DPRINT1(" Flags: 0x%x\n", Flags);
1009  return STATUS_INVALID_PARAMETER;
1010  }
1011 
1012  /* Check for user caller */
1013  if (PreviousMode != KernelMode)
1014  {
1015  /* Check for shutdown permission */
1017  {
1018  /* Not granted */
1019  DPRINT1("ERROR: Privilege not held for shutdown\n");
1021  }
1022 
1023  /* Do it as a kernel-mode caller for consistency with system state */
1024  return ZwSetSystemPowerState(SystemAction, MinSystemState, Flags);
1025  }
1026 
1027  /* Read policy settings (partial shutdown vs. full shutdown) */
1028  if (SystemAction == PowerActionShutdown) PopReadShutdownPolicy();
1029 
1030  /* Disable lazy flushing of registry */
1031  DPRINT("Stopping lazy flush\n");
1033 
1034  /* Setup the power action */
1035  Action.Action = SystemAction;
1036  Action.Flags = Flags;
1037 
1038  /* Notify callbacks */
1039  DPRINT("Notifying callbacks\n");
1041 
1042  /* Swap in any worker thread stacks */
1043  DPRINT("Swapping worker threads\n");
1045 
1046  /* Make our action global */
1047  PopAction = Action;
1048 
1049  /* Start power loop */
1051  while (TRUE)
1052  {
1053  /* Break out if there's nothing to do */
1054  if (Action.Action == PowerActionNone) break;
1055 
1056  /* Check for first-pass or restart */
1057  if (Status == STATUS_CANCELLED)
1058  {
1059  /* Check for shutdown action */
1063  {
1064  /* Set the action */
1066  }
1067 
1068  /* Now we are good to go */
1070  }
1071 
1072  /* Check if we're still in an invalid status */
1073  if (!NT_SUCCESS(Status)) break;
1074 
1075 #ifndef NEWCC
1076  /* Flush dirty cache pages */
1077  /* XXX: Is that still mandatory? As now we'll wait on lazy writer to complete? */
1078  CcRosFlushDirtyPages(-1, &Dummy, FALSE, FALSE); //HACK: We really should wait here!
1079 #else
1080  Dummy = 0;
1081 #endif
1082 
1083  /* Flush all volumes and the registry */
1084  DPRINT("Flushing volumes, cache flushed %lu pages\n", Dummy);
1086 
1087  /* Set IRP for drivers */
1089  if (PopAction.Shutdown)
1090  {
1091  DPRINT("Queueing shutdown thread\n");
1092  /* Check if we are running in the system context */
1094  {
1095  /* We're not, so use a worker thread for shutdown */
1098  NULL);
1099 
1101 
1102  /* Spend us -- when we wake up, the system is good to go down */
1105  goto Exit;
1106 
1107  }
1108  else
1109  {
1110  /* Do the shutdown inline */
1112  }
1113  }
1114 
1115  /* You should not have made it this far */
1116  // ASSERTMSG("System is still up and running?!\n", FALSE);
1117  DPRINT1("System is still up and running, you may not have chosen a yet supported power option: %u\n", PopAction.Action);
1118  break;
1119  }
1120 
1121 Exit:
1122  /* We're done, return */
1123  return Status;
1124 }
#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:247
PCALLBACK_OBJECT PowerStateCallback
Definition: callback.c:29
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define _IRQL_requires_same_
Definition: no_sal2.h:652
enum _POWER_STATE_TYPE POWER_STATE_TYPE
#define IN
Definition: typedefs.h:39
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
PDEVICE_NODE IopRootDeviceNode
Definition: devnode.c:18
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
Definition: conport.c:35
VOID NTAPI ExSwapinWorkerThreads(IN BOOLEAN AllowSwap)
Definition: work.c:631
#define SL_PENDING_RETURNED
Definition: iotypes.h:2969
Type
Definition: Type.h:6
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2029
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:539
#define IRP_MN_QUERY_POWER
REQUEST_POWER_COMPLETE * PREQUEST_POWER_COMPLETE
Definition: potypes.h:404
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ ULONG _In_ BOOLEAN LogError
Definition: classpnp.h:1117
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
_In_ PIRP Irp
Definition: csq.h:116
#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:613
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1063
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
#define _Use_decl_annotations_
Definition: no_sal2.h:637
#define POWER_ACTION_LOCK_CONSOLE
Definition: ntpoapi.h:418
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:524
#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES
Definition: iotypes.h:1196
POWER_ACTION PowerAction
Definition: power.c:21
PDEVICE_NODE PopSystemPowerDeviceNode
Definition: power.c:25
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI CcRosFlushDirtyPages(ULONG Target, PULONG Count, BOOLEAN Wait, BOOLEAN CalledFromLazy)
Definition: view.c:183
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
_In_ PVOID Parameter
Definition: ldrtypes.h:241
_In_ SYSTEM_POWER_STATE MinSystemState
Definition: ntpoapi.h:303
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
BOOLEAN PopAcpiPresent
Definition: power.c:26
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
VOID NTAPI PopCleanupPowerState(IN PPOWER_STATE PowerState)
Definition: power.c:157
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:747
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_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:64
int WINAPI StartPage(_In_ HDC)
NTSTATUS NTAPI PoCancelDeviceNotify(IN PVOID NotifyBlock)
Definition: power.c:512
VOID NTAPI PoSetSystemState(IN EXECUTION_STATE Flags)
Definition: power.c:727
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG NTAPI KeSuspendThread(PKTHREAD Thread)
Definition: thrdobj.c:610
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_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
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
#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:163
WORK_QUEUE_ITEM PopShutdownWorkItem
Definition: power.c:28
#define __drv_aliasesMem
Definition: btrfs_drv.h:205
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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:757
VOID NTAPI PopReadShutdownPolicy(VOID)
Definition: poshtdwn.c:318
VOID NTAPI PopInitShutdownList(VOID)
Definition: poshtdwn.c:35
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI PoSetHiberRange(IN PVOID HiberContext, IN ULONG Flags, IN OUT PVOID StartPage, IN ULONG Length, IN ULONG PageTag)
Definition: power.c:564
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:462
void DPRINT(...)
Definition: polytest.cpp:61
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:983
#define C_ASSERT(e)
Definition: intsafe.h:79
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
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:171
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
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:511
enum _DEVICE_POWER_STATE * PDEVICE_POWER_STATE
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#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 _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#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:901
INIT_FUNCTION VOID NTAPI PoInitializePrcb(IN PKPRCB Prcb)
Definition: power.c:490
VOID NTAPI CmSetLazyFlushState(IN BOOLEAN Enable)
Definition: cmlazy.c:442
static void Exit(void)
Definition: sock.c:1331
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
BOOLEAN NTAPI NtIsSystemResumeAutomatic(VOID)
Definition: power.c:910
enum _POWER_INFORMATION_LEVEL POWER_INFORMATION_LEVEL
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2867
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define _Inout_
Definition: no_sal2.h:244
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Definition: Node.h:9
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSTATUS IopGetSystemPowerDeviceObject(IN PDEVICE_OBJECT *DeviceObject)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
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:205
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:918
ULONG EXECUTION_STATE
Definition: potypes.h:169
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
Definition: pofuncs.h:42
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:790
Definition: ketypes.h:687
POWER_ACTION
Definition: ntpoapi.h:122
#define VOID
Definition: acefi.h:82
#define DNF_LEGACY_DRIVER
Definition: iotypes.h:181
VOID NTAPI PopFlushVolumes(IN BOOLEAN ShuttingDown)
Definition: povolume.c:229
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
#define IRP_MN_SET_POWER
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_In_ UCHAR MinorFunction
Definition: pofuncs.h:42
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
#define MAXULONG
Definition: typedefs.h:250
static NTSTATUS NTAPI PopRequestPowerIrpCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: power.c:130
NTSTATUS NTAPI PoRegisterDeviceNotify(OUT PVOID Unknown0, IN ULONG Unknown1, IN ULONG Unknown2, IN ULONG Unknown3, IN PVOID Unknown4, IN PVOID Unknown5)
Definition: power.c:523
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define _In_
Definition: no_sal2.h:204
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define POWER_ACTION_LIGHTEST_FIRST
Definition: ntpoapi.h:417
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
struct SYSTEM_BATTERY_STATE * PSYSTEM_BATTERY_STATE
const LUID SeShutdownPrivilege
Definition: priv.c:40
_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:737
_In_ ULONG _In_ ULONG PerformanceIdleTime
Definition: pofuncs.h:24
#define ES_CONTINUOUS
Definition: potypes.h:167
VOID NTAPI PopPerfIdleDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: power.c:470
#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
INIT_FUNCTION BOOLEAN NTAPI PoInitSystem(IN ULONG BootPhase)
Definition: power.c:390
VOID FASTCALL PopIdle0(IN PPROCESSOR_POWER_STATE PowerState)
Definition: power.c:481
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
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
struct _WORK_QUEUE_ITEM * PWORK_QUEUE_ITEM
#define ES_USER_PRESENT
Definition: potypes.h:166
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:771
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
VOID NTAPI PopPerfIdle(PPROCESSOR_POWER_STATE PowerState)
Definition: power.c:463
VOID NTAPI KeSetTargetProcessorDpc(IN PKDPC Dpc, IN CCHAR Number)
Definition: dpc.c:970
NTSTATUS NTAPI PopAddRemoveSysCapsCallback(IN PVOID NotificationStructure, IN PVOID Context)
Definition: events.c:147
#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:225
struct tagContext Context
Definition: acpixf.h:1034
_In_ PIRP _In_opt_ PVOID _In_opt_ POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine
Definition: fsrtlfuncs.h:673
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:115
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:708
#define ULONG_PTR
Definition: config.h:101
#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:6
KSPIN_LOCK PopDopeGlobalLock
Definition: povolume.c:28
NTSTATUS NTAPI PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PREQUEST_POWER_COMPLETE CompletionFunction, IN PVOID Context, OUT PIRP *pIrp OPTIONAL)
Definition: power.c:639
PVOID NTAPI PoRegisterSystemState(IN PVOID StateHandle, IN EXECUTION_STATE Flags)
Definition: power.c:627
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
NTSTATUS NTAPI PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState, POWER_ACTION PowerAction)
Definition: power.c:325
#define KeGetCurrentThread
Definition: hal.h:44
PDEVICE_OBJECT PowerDevice
Definition: power.c:22
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
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
return STATUS_SUCCESS
Definition: btrfs.c:3014
NTSTATUS PopSetSystemPowerStateTraverse(PDEVICE_NODE DeviceNode, PVOID Context)
Definition: power.c:281
struct _PROCESSOR_POWER_INFORMATION * PPROCESSOR_POWER_INFORMATION
NTSTATUS NTAPI NtSetThreadExecutionState(IN EXECUTION_STATE esFlags, OUT EXECUTION_STATE *PreviousFlags)
Definition: power.c:926
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2632
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:841
#define _Analysis_assume_(expr)
Definition: no_sal2.h:10
#define PAGED_CODE()
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675