public static void RegisterAsVirtualFolder(string extension, Guid shellFolderClassId)
        {
            if (extension == null)
            {
                throw new ArgumentNullException(nameof(extension));
            }

            const string classes = @"Software\Classes";
            string       progid  = null;

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, Path.Combine(classes, extension)))
            {
                progid = (string)key.GetValue(null);
                if (string.IsNullOrWhiteSpace(progid))
                {
                    progid = typeof(Program).Namespace;
                    key.SetValue(null, progid);
                }
            }

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, Path.Combine(classes, progid, "CLSID")))
            {
                SetStringKeyWithBackup(key, null, shellFolderClassId.ToString("B"));
            }

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, Path.Combine(classes, progid, "shell", "open", "command")))
            {
                SetStringKeyWithBackup(key, null, @"%SystemRoot%\explorer.exe /idlist,%I,%L");

                // this is CLSID_ExecuteFolder from shobjidl.h
                var CLSID_ExecuteFolder = new Guid("11dbb47c-a525-400b-9e80-a54615a090c0");
                SetStringKeyWithBackup(key, "DelegateExecute", CLSID_ExecuteFolder.ToString("B"));
            }
        }
        // https://stackoverflow.com/questions/23777688/pin-a-folder-to-navigation-pane-in-windows-explorer/34737590
        // register as a cloud provider in explorer tree view
        public static void RegisterCloudStorageProvider(string folderPath, string displayName, Guid id, string iconPath = null, int sortOrderIndex = 30)
        {
            if (folderPath == null)
            {
                throw new ArgumentNullException(nameof(folderPath));
            }

            if (displayName == null)
            {
                throw new ArgumentNullException(nameof(displayName));
            }

            if (id == Guid.Empty)
            {
                throw new ArgumentException(null, nameof(id));
            }

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, Path.Combine(@"Software\Classes\CLSID", id.ToString("B"))))
            {
                key.SetValue(null, displayName);
                key.SetValue("System.IsPinnedToNameSpaceTree", 1);
                key.SetValue("SortOrderIndex", sortOrderIndex);

                using (var icon = WindowsUtilities.EnsureSubKey(key, "DefaultIcon"))
                {
                    var path = iconPath.Nullify() ?? NativeProxy.Default.DllPath;
                    icon.SetValue(null, path);
                }

                using (var server = WindowsUtilities.EnsureSubKey(key, "InProcServer32"))
                {
                    server.SetValue(null, @"%systemroot%\system32\shell32.dll");
                }

                using (var folder = WindowsUtilities.EnsureSubKey(key, "ShellFolder"))
                {
                    var attributes = SFGAO.SFGAO_HASSUBFOLDER |
                                     SFGAO.SFGAO_CANCOPY |
                                     SFGAO.SFGAO_CANLINK |
                                     SFGAO.SFGAO_STORAGE |
                                     SFGAO.SFGAO_HASPROPSHEET |
                                     SFGAO.SFGAO_STORAGEANCESTOR |
                                     SFGAO.SFGAO_FILESYSANCESTOR |
                                     SFGAO.SFGAO_FOLDER |
                                     SFGAO.SFGAO_FILESYSTEM;
                    folder.SetValue("Attributes", (int)attributes);
                    folder.SetValue("FolderValueFlags", 0x28);
                }

                using (var instance = WindowsUtilities.EnsureSubKey(key, "Instance"))
                {
                    var CLSID_FileFolderBoth = new Guid("{0E5AAE11-A475-4C5b-AB00-C66DE400274E}");
                    instance.SetValue("CLSID", CLSID_FileFolderBoth.ToString("B"));

                    using (var bag = WindowsUtilities.EnsureSubKey(instance, "InitPropertyBag"))
                    {
                        bag.SetValue("Attributes", 0x11);
                        bag.SetValue("TargetFolderPath", folderPath);
                    }
                }
            }

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, Path.Combine(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace", id.ToString("B"))))
            {
                key.SetValue(null, displayName);
            }

            using (var key = WindowsUtilities.EnsureSubKey(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"))
            {
                key.SetValue(id.ToString("B"), 1);
            }
        }