25 lines
865 B
C++
25 lines
865 B
C++
#pragma once
|
|
|
|
#include "config.hpp"
|
|
|
|
#include <windows.h>
|
|
#include <string>
|
|
|
|
namespace startup {
|
|
|
|
[[nodiscard]] bool isProcessElevated();
|
|
|
|
// Returns true only in the elevated instance that should continue running.
|
|
// A non-elevated launch starts one elevated copy through UAC and returns false.
|
|
// When an existing NightShot window is already running, it returns false without
|
|
// producing another UAC prompt.
|
|
[[nodiscard]] bool ensureElevated(const wchar_t* mainWindowClass);
|
|
|
|
// Normal mode stores an HKCU Run entry. At logon that starts a tiny unelevated
|
|
// instance which immediately requests UAC once. Silent mode replaces it with a
|
|
// highest-privilege Task Scheduler task, so no UAC appears at logon.
|
|
[[nodiscard]] bool applyAutostart(bool enabled, bool silentAdmin,
|
|
std::wstring* error = nullptr);
|
|
|
|
} // namespace startup
|