12# include <KnownFolders.h>
15# include <propvarutil.h>
16# include <shlobj_core.h>
56 LPWSTR quick_launch_folder_path;
57 if (SHGetKnownFolderPath(
58 FOLDERID_ImplicitAppShortcuts, KF_FLAG_DEFAULT,
nullptr, &quick_launch_folder_path) !=
64 std::wstring search_path = quick_launch_folder_path;
65 CoTaskMemFree(quick_launch_folder_path);
67 for (
auto const &dir_entry : std::filesystem::recursive_directory_iterator(search_path)) {
69 Microsoft::WRL::ComPtr<IShellLinkW> shell_link;
70 if (CoCreateInstance(__uuidof(ShellLink),
nullptr, CLSCTX_ALL, IID_PPV_ARGS(&shell_link)) !=
76 Microsoft::WRL::ComPtr<IPersistFile> persist_file;
77 if (shell_link.As(&persist_file) != S_OK) {
81 if (persist_file->Load(dir_entry.path().c_str(), STGM_READWRITE) != S_OK) {
85 Microsoft::WRL::ComPtr<IPropertyStore> property_store;
86 if (shell_link.As(&property_store) != S_OK) {
91 PROPVARIANT app_model;
92 PropVariantInit(&app_model);
93 if (property_store->GetValue(PKEY_AppUserModel_ID, &app_model) == S_OK) {
94 if (app_model.vt == VT_LPWSTR && std::wstring(BLENDER_WIN_APPID_16) == app_model.pwszVal) {
95 shell_link->SetPath(launcher_path_w);
96 persist_file->Save(
nullptr, TRUE);
99 PropVariantClear(&app_model);
Compatibility-like things for windows.
bool BLI_windows_update_pinned_launcher(const char *launcher_path)
COM helper functions for windows.
static void initialize(const Object *obj, pxr::UsdSkelSkeleton &skel, pxr::UsdSkelAnimation &skel_anim, const blender::Map< blender::StringRef, const Bone * > *deform_bones, bool allow_unicode)
int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
#define UTF16_ENCODE(in8str)
#define UTF16_UN_ENCODE(in8str)