Initial elevated windows work

This commit is contained in:
Zlatko Zahariev
2021-01-15 02:07:49 -05:00
parent 415dec37ad
commit 83dd07469e
6 changed files with 65 additions and 8 deletions
+18
View File
@@ -0,0 +1,18 @@
namespace platf {
using namespace std::literals;
inline auto pairInputDesktop(){
auto hDesk = OpenInputDesktop(DF_ALLOWOTHERACCOUNTHOOK, FALSE, GENERIC_ALL);
if (NULL == hDesk) {
auto err = GetLastError();
BOOST_LOG(error) << "Failed to OpenInputDesktop [0x"sv << util::hex(err).to_string_view() << ']';
} else {
BOOST_LOG(info) << std::endl << "Opened desktop [0x"sv << util::hex(hDesk).to_string_view() << ']';
if (!SetThreadDesktop(hDesk) ) {
auto err = GetLastError();
BOOST_LOG(error) << "Failed to SetThreadDesktop [0x"sv << util::hex(err).to_string_view() << ']';
}
CloseDesktop(hDesk);
}
return hDesk;
};
};