| 249 | } |
| 250 | |
| 251 | HDESK syncThreadDesktop() { |
| 252 | auto hDesk = OpenInputDesktop(DF_ALLOWOTHERACCOUNTHOOK, FALSE, GENERIC_ALL); |
| 253 | if (!hDesk) { |
| 254 | auto err = GetLastError(); |
| 255 | BOOST_LOG(error) << "Failed to Open Input Desktop [0x"sv << util::hex(err).to_string_view() << ']'; |
| 256 | |
| 257 | return nullptr; |
| 258 | } |
| 259 | |
| 260 | if (!SetThreadDesktop(hDesk)) { |
| 261 | auto err = GetLastError(); |
| 262 | BOOST_LOG(error) << "Failed to sync desktop to thread [0x"sv << util::hex(err).to_string_view() << ']'; |
| 263 | } |
| 264 | |
| 265 | CloseDesktop(hDesk); |
| 266 | |
| 267 | return hDesk; |
| 268 | } |
| 269 | |
| 270 | void print_status(const std::string_view &prefix, HRESULT status) { |
| 271 | char err_string[1024]; |