diff --git a/source/blender/blenlib/intern/winstuff_registration.cc b/source/blender/blenlib/intern/winstuff_registration.cc
index de215ef50eb8b23a2873ee7d2544081750e91072..b73b14eecb40ea86397deae84e08c13c3a68cd04 100644
--- a/source/blender/blenlib/intern/winstuff_registration.cc
+++ b/source/blender/blenlib/intern/winstuff_registration.cc
@@ -58,17 +58,19 @@ bool BLI_windows_update_pinned_launcher(const char *launcher_path)
   std::wstring search_path = quick_launch_folder_path;
   CoTaskMemFree(quick_launch_folder_path);
 
-  Microsoft::WRL::ComPtr<IShellLinkW> shell_link;
-  if (CoCreateInstance(__uuidof(ShellLink), NULL, CLSCTX_ALL, IID_PPV_ARGS(&shell_link)) != S_OK) {
-    return false;
-  }
+  for (auto const &dir_entry : std::filesystem::recursive_directory_iterator(search_path)) {
 
-  Microsoft::WRL::ComPtr<IPersistFile> persist_file;
-  if (shell_link.As(&persist_file) != S_OK) {
-    return false;
-  }
+    Microsoft::WRL::ComPtr<IShellLinkW> shell_link;
+    if (CoCreateInstance(__uuidof(ShellLink), NULL, CLSCTX_ALL, IID_PPV_ARGS(&shell_link)) != S_OK)
+    {
+      return false;
+    }
+
+    Microsoft::WRL::ComPtr<IPersistFile> persist_file;
+    if (shell_link.As(&persist_file) != S_OK) {
+      return false;
+    }
 
-  for (auto const &dir_entry : std::filesystem::recursive_directory_iterator(search_path)) {
     if (persist_file->Load(dir_entry.path().c_str(), STGM_READWRITE) != S_OK) {
       continue;
     }
@@ -82,7 +84,7 @@ bool BLI_windows_update_pinned_launcher(const char *launcher_path)
     PROPVARIANT app_model;
     PropVariantInit(&app_model);
     if (property_store->GetValue(PKEY_AppUserModel_ID, &app_model) == S_OK) {
-      if (std::wstring(BLENDER_WIN_APPID_16) == app_model.bstrVal) {
+      if (app_model.vt == VT_LPWSTR && std::wstring(BLENDER_WIN_APPID_16) == app_model.pwszVal) {
         shell_link->SetPath(launcher_path_w);
         persist_file->Save(NULL, TRUE);
       }