EasyWindowsReboot Documentation

EasyWindowsReboot 2.0.0 - Documentation CelestiaDominance | Unreal Engine 5.7 and 5.8 | Windows / Win64

PURPOSE EasyWindowsReboot exposes Blueprint and C++ functions for requesting a shutdown or reboot of the Windows computer running your application. It also provides request preview, cancellation and structured results.

These functions control Windows, not just the Unreal application. Use them from deliberate application controls, such as an operator's restart button. The plugin does not supply input mappings, widgets or an automatic confirmation screen.

FUNCTIONS Easy Windows Reboot: the original node, now with an optional Allow In Editor Boolean (default false). Choose Shutdown Windows or Reboot Windows and a float countdown. It returns a Boolean indicating whether the request was accepted. Its original default countdown remains 0 seconds. In version 2.0.0 it does not request forced application closure. Editor/PIE execution requires Allow In Editor=true; commandlets always block execution.

Preview Windows Power Action: validates the action and normalizes the countdown. It returns an Easy Windows Reboot Result with Status=Ready when valid. It never requests a power action and does not check Windows permissions. This is the appropriate node for previewing settings in the editor or building your confirmation UI.

Schedule Windows Power Action: the richer execution node. Inputs are Action, Countdown Seconds (default 30), Force Apps Closed (default false) and Allow In Editor (default false). The two Boolean inputs are advanced pins. The returned result contains status, the effective countdown, clamp information, a Windows error code and a message.

Cancel Pending Windows Power Action: asks Windows to abort the pending local shutdown/reboot during its cancellable countdown. It has an advanced Allow In Editor input, default false. This is a system-wide operation: it can cancel a request initiated by another application. It is not limited to requests created by this plugin.

BLUEPRINT EXAMPLE: PREVIEW, CONFIRM, EXECUTE 1. Store your selected action and desired countdown in your widget or controller. 2. Call Preview Windows Power Action with those values. 3. Break the returned Easy Windows Reboot Result. If Success is false, display Message and let the user correct the request. 4. Display Effective Countdown Seconds and the selected action in your own confirmation UI. If Countdown Clamped is true, make the adjusted value clear. 5. When the operator confirms, call Schedule Windows Power Action using the same action and the displayed countdown. 6. Branch on the execution result's Success. On failure, display Message and, when relevant, Windows Error Code. On acceptance, explain that Windows has accepted the request. 7. If you offer a Cancel button, connect it to Cancel Pending Windows Power Action and handle that result separately.

Use an event such as a button click. Do not repeatedly request shutdown from Tick or assume that a successful preview authorized or scheduled anything.

COUNTDOWN RULES - The supported range is 0 to 315,360,000 seconds: 3,650 days, not 100 days. - Negative finite numbers clamp to 0. Values above the maximum clamp to the maximum. Countdown Clamped reports those adjustments. - Fractional seconds round to the nearest whole second; 0.49 becomes 0, and 0.5 becomes 1. - NaN and positive/negative infinity are rejected. - Invalid action enum values are rejected; they never silently become Reboot. - Clamping happens before integer conversion, so very large finite values cannot overflow that conversion.

Zero seconds requests an immediate action and provides no cancellation countdown. Review the effective value from Preview, especially when accepting user-entered negative or fractional numbers.

FORCE APPS CLOSED The default false value means the plugin does not request forced closure of applications with unsaved work. Applications or Windows policy can delay or prevent shutdown. This is not a guarantee that Windows will complete the operation at the exact requested time.

Set Force Apps Closed=true only when your product deliberately requires forced closure. Windows may discard unsaved work in other applications. A positive countdown does not automatically enable forced closure in this implementation; the plugin uses the native Windows API with your explicit choice.

EDITOR, PIE AND COMMANDLETS Preview works without requesting an OS action.

Execution and cancellation are blocked by default while GIsEditor is true, including normal PIE. Easy Windows Reboot, Schedule Windows Power Action and Cancel Pending Windows Power Action all have Allow In Editor for deliberate editor use. The original node exposes the checkbox directly; Schedule and Cancel place it under advanced pins. Enabling it controls the real Windows computer, not a simulated machine.

Commandlets always block execution and cancellation, even if Allow In Editor is true.

A standalone game process can have GIsEditor=false even when launched from the editor. Treat standalone and packaged games as real execution contexts.

RESULT FIELDS Success: preview validity or Windows request acceptance, according to the function called. Status: Ready - preview is valid; no OS request occurred. Accepted - Windows accepted a shutdown/reboot request. Cancelled - Windows accepted cancellation. Invalid Action - the action was not Shutdown or Reboot. Invalid Countdown - the number was not finite. Unsupported Platform - the execution path is not Windows. Execution Blocked - editor/commandlet protection prevented the request. Windows Error - the native Windows request or privilege preparation failed. Effective Countdown Seconds: the normalized whole-second value. It is 0 for cancellation and is not a live remaining-time query. Countdown Clamped: a finite value was moved into the supported range. Windows Error Code: the native error number when Status is Windows Error; otherwise normally 0. Message: a diagnostic description. Windows error messages can be localized; use Status and the numeric code for program logic.

Acceptance is not proof that shutdown completed. Windows performs the operation asynchronously and other applications or system policy can intervene.

PERMISSIONS AND ERROR HANDLING Windows must assign the executing identity the shutdown privilege. The plugin temporarily enables that existing privilege for a request and attempts to restore its previous state afterward. It cannot grant a missing privilege or bypass Windows policy, and it does not launch a UAC elevation prompt.

Common Windows errors include: 5 - access denied. 1300 or 1314 - the required privilege is unavailable or not held. 1115 - shutdown is already in progress. 1116 - no system shutdown is pending for cancellation. 21 - the system is not ready.

Do not treat an accepted request as permission to keep retrying it. A second scheduling request may be rejected because Windows already has a shutdown pending. The plugin does not silently replace or cancel an existing request.

CANCELLATION AND APPLICATION LIFETIME Cancellation is possible only while Windows permits it. An immediate request has no abort window, and a request that has advanced beyond its countdown may no longer be cancellable.

Closing your game does not automatically cancel a request already accepted by Windows. The plugin does not keep an authoritative live countdown, ownership record or completion event. If you show a countdown in your UI, it is an estimate; other applications can change the system's pending state.

LOCAL AND NETWORK USE The plugin does not replicate requests and does not target remote computer names. A call affects the Windows machine executing that process. If your own network code invokes it on a server, it acts on the server's computer.

C++ USE Add EasyWindowsReboot to your module dependencies and include EasyWindowsRebootBPLibrary.h.

Safe preview example: const FEasyWindowsRebootResult Preview = UEasyWindowsRebootBPLibrary::PreviewWindowsPowerAction( EEasyWindowsRebootAction::Reboot, 30.0);

The callable execution functions are ScheduleWindowsPowerAction and CancelPendingWindowsPowerAction. Invoke them only from your deliberate execution path. Their arguments and result fields match the Blueprint API. The original function is now EasyWindowsReboot(Action, float CountdownSeconds = 0.0f, bool bAllowInEditor = false). Existing one- or two-argument C++ calls remain source-compatible; rebuild native consumers after updating.

UPGRADING FROM 1.0.0 Existing Blueprint references retain the same library class, action enum values, node name and original inputs. An optional Allow In Editor pin has been added to the original node and defaults to false. If an existing node does not show it after restarting the editor, refresh the node or place a new instance and compile the Blueprint.

Two behavior changes are deliberate: - The legacy node no longer forces applications closed. Use Schedule Windows Power Action with Force Apps Closed=true when that behavior is explicitly required. - The legacy node is blocked in editor/PIE by default. Enable its Allow In Editor checkbox for intentional editor execution. Commandlets remain blocked even with opt-in.

Finite countdown clamping and nearest-second rounding are retained. Non-finite inputs and unknown action values now fail. The executable path is no longer hardcoded: native Windows API calls replace the shutdown.exe invocation.

VALIDATION BOUNDARY The release was compiled for Editor Development, Game Development and Game Shipping on both supported engines. Automated tests exercised numeric edges, blocked contexts, injected Windows failures and cancellation/force/action forwarding. Packaged test applications exercised the public preview API and C++ linkage.

Those checks did not issue a real shutdown, reboot or cancellation. Actual Windows power transitions, native permission changes and cancellation timing should be tested in a disposable Windows VM or a machine prepared for that operation before deploying your own application.

REFERENCE Windows scheduling semantics: https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-initiatesystemshutdownexw Windows cancellation semantics: https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-abortsystemshutdownw

SUPPORT https://discord.gg/9Zc4wbwqG9