mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Do not run elevated by default (#884)
Make the runner not run as elevated by default. Add a setting for "run PowerToys as elevated" and buttons to restart the process with the different elevation levels.
This commit is contained in:
committed by
GitHub
parent
fd8fc679be
commit
619ed234a9
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
|
||||
@@ -51,6 +52,12 @@ bool is_process_elevated();
|
||||
// Drops the elevated privilages if present
|
||||
bool drop_elevated_privileges();
|
||||
|
||||
// Run command as elevated user, returns true if succeeded
|
||||
bool run_elevated(const std::wstring& file, const std::wstring& params);
|
||||
|
||||
// Run command as non-elevated user, returns true if succeeded
|
||||
bool run_non_elevated(const std::wstring& file, const std::wstring& params);
|
||||
|
||||
// Get the executable path or module name for modern apps
|
||||
std::wstring get_process_path(DWORD pid) noexcept;
|
||||
// Get the executable path or module name for modern apps
|
||||
@@ -60,3 +67,11 @@ std::wstring get_product_version();
|
||||
|
||||
std::wstring get_module_filename(HMODULE mod = nullptr);
|
||||
std::wstring get_module_folderpath(HMODULE mod = nullptr);
|
||||
|
||||
// Get a string from the resource file
|
||||
std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback);
|
||||
// Wrapper for getting a string from the resource file. Returns the resource id text when fails.
|
||||
// Requires that
|
||||
// extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
// is added to the .cpp file.
|
||||
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
|
||||
Reference in New Issue
Block a user