aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/process.hpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-09-16 01:47:56 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-09-16 01:47:56 +0300
commitfbd6445c68745d484d5df8c75b0c12054185958f (patch)
treec8eb6da6b89d88f530647f408fd2c47669e1bb27 /process.hpp
parent.hpp instead of .h for C++ headers (diff)
downloadprivilege-check-fbd6445c68745d484d5df8c75b0c12054185958f.tar.gz
privilege-check-fbd6445c68745d484d5df8c75b0c12054185958f.zip
move source files to src/
Diffstat (limited to 'process.hpp')
-rw-r--r--process.hpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/process.hpp b/process.hpp
deleted file mode 100644
index 864d452..0000000
--- a/process.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#pragma once
-
-#include "error.hpp"
-
-#include <Windows.h>
-#include <shellapi.h>
-
-#include <array>
-#include <string>
-
-namespace process
-{
- std::wstring get_executable_path()
- {
- static constexpr DWORD max_path = MAX_PATH;
-
- std::array<wchar_t, max_path> buf;
-
- const auto ret = GetModuleFileNameW(NULL, buf.data(), max_path);
-
- if (GetLastError() != ERROR_SUCCESS)
- error::raise("GetModuleFileNameW");
-
- return buf.data();
- }
-
- void runas(const std::wstring& exe_path, HWND hwnd = NULL, int nShow = SW_NORMAL)
- {
- SHELLEXECUTEINFOW info;
- ZeroMemory(&info, sizeof(info));
- info.cbSize = sizeof(info);
- info.lpVerb = L"runas";
- info.lpFile = exe_path.c_str();
- info.hwnd = hwnd;
- info.nShow = nShow;
-
- if (!ShellExecuteExW(&info))
- error::raise("ShellExecuteExW");
- }
-}