don't reinitialize com

This commit is contained in:
2025-09-08 09:05:01 -05:00
parent 966d28cf5b
commit de74dbcbac

View File

@@ -23,7 +23,6 @@
#include "utils/windows.hpp" #include "utils/windows.hpp"
#include "utils/com_init_wrapper.hpp"
#include "utils/error.hpp" #include "utils/error.hpp"
#include "utils/file.hpp" #include "utils/file.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
@@ -143,8 +142,6 @@ auto run_process_elevated(std::vector<const char *> args) -> int {
void set_last_error_code(DWORD error_code) { ::SetLastError(error_code); } void set_last_error_code(DWORD error_code) { ::SetLastError(error_code); }
auto get_startup_folder() -> std::wstring { auto get_startup_folder() -> std::wstring {
utils::com_init_wrapper wrapper;
PWSTR raw{nullptr}; PWSTR raw{nullptr};
auto result = ::SHGetKnownFolderPath(FOLDERID_Startup, 0, nullptr, &raw); auto result = ::SHGetKnownFolderPath(FOLDERID_Startup, 0, nullptr, &raw);
if (FAILED(result)) { if (FAILED(result)) {
@@ -163,8 +160,6 @@ auto get_startup_folder() -> std::wstring {
auto create_shortcut(const shortcut_cfg &cfg, bool overwrite_existing) -> bool { auto create_shortcut(const shortcut_cfg &cfg, bool overwrite_existing) -> bool {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
utils::com_init_wrapper wrapper;
const auto hr_hex = [](HRESULT result) -> std::string { const auto hr_hex = [](HRESULT result) -> std::string {
std::ostringstream oss; std::ostringstream oss;
oss << "0x" << std::uppercase << std::hex << std::setw(8) oss << "0x" << std::uppercase << std::hex << std::setw(8)