Skip to content

Commit 19373a2

Browse files
committed
First commit CLSIDViewer #1610
1 parent 1bc82c8 commit 19373a2

File tree

12 files changed

+325
-13
lines changed

12 files changed

+325
-13
lines changed

QuickLook.Native/QuickLook.Native32/HelperMethods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
6868
}
6969

7070
// If CF_HDROP fails, try CFSTR_SHELLIDLIST
71-
// Support Desktop Icon (This PC, Recycle Bin and so on)
71+
// Support Desktop Icons (This PC, Recycle Bin and so on)
7272
// https://github.com/QL-Win/QuickLook/issues/1610
7373
static const CLIPFORMAT cfShellIDList = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLIST);
7474
formatetc.cfFormat = cfShellIDList;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<UserControl x:Class="QuickLook.Plugin.CLSIDViewer.CLSIDInfoPanel"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:local="clr-namespace:QuickLook.Plugin.CLSIDViewer"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
Height="192"
8+
FontSize="14"
9+
UseLayoutRounding="True"
10+
mc:Ignorable="d">
11+
<Grid>
12+
<TextBlock x:Name="UnsupportedTextBlock"
13+
HorizontalAlignment="Center"
14+
VerticalAlignment="Center"
15+
Visibility="Collapsed" />
16+
<!-- EMPTY -->
17+
</Grid>
18+
</UserControl>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright © 2025 QL-Win Contributors
2+
//
3+
// This file is part of QuickLook program.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
using System.Windows;
19+
using System.Windows.Controls;
20+
21+
namespace QuickLook.Plugin.CLSIDViewer;
22+
23+
public partial class CLSIDInfoPanel : UserControl
24+
{
25+
public CLSIDInfoPanel()
26+
{
27+
InitializeComponent();
28+
}
29+
30+
public void DisplayInfo(string path)
31+
{
32+
switch (path.ToUpper())
33+
{
34+
case "::{645FF040-5081-101B-9F08-00AA002F954E}" // Recycle Bin
35+
or "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}": // This PC
36+
break;
37+
38+
default:
39+
UnsupportedTextBlock.Text = $"Unsupported for {path}";
40+
UnsupportedTextBlock.Visibility = Visibility.Visible;
41+
break;
42+
}
43+
}
44+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright © 2025 QL-Win Contributors
2+
//
3+
// This file is part of QuickLook program.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
using Microsoft.Win32;
19+
using System;
20+
using System.Diagnostics;
21+
22+
namespace QuickLook.Plugin.CLSIDViewer;
23+
24+
internal static class CLSIDRegister
25+
{
26+
public static string GetName(string clsid)
27+
{
28+
try
29+
{
30+
// Such as `Computer\HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}`
31+
string displayName = Registry.GetValue($@"HKEY_CLASSES_ROOT\CLSID\{clsid.Replace(":", string.Empty)}", string.Empty, null)?.ToString();
32+
return displayName;
33+
}
34+
catch (Exception ex)
35+
{
36+
Debug.WriteLine("Error reading registry: " + ex.Message);
37+
}
38+
return string.Empty;
39+
}
40+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright © 2025 QL-Win Contributors
2+
//
3+
// This file is part of QuickLook program.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
using QuickLook.Common.Plugin;
19+
using System;
20+
using System.Text.RegularExpressions;
21+
using System.Windows;
22+
23+
namespace QuickLook.Plugin.CLSIDViewer;
24+
25+
public class Plugin : IViewer
26+
{
27+
private CLSIDInfoPanel _ip;
28+
private string _path;
29+
30+
public int Priority => -1;
31+
32+
public void Init()
33+
{
34+
}
35+
36+
public bool CanHandle(string path)
37+
{
38+
if (string.IsNullOrWhiteSpace(path))
39+
return false;
40+
41+
// Use Regex to check whether a string like "::{645FF040-5081-101B-9F08-00AA002F954E}"
42+
bool isCLSID = path.StartsWith("::")
43+
&& Regex.IsMatch(path, @"^::\{[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}\}$");
44+
45+
return isCLSID;
46+
}
47+
48+
public void Prepare(string path, ContextObject context)
49+
{
50+
context.PreferredSize = new Size { Width = 520, Height = 192 };
51+
}
52+
53+
public void View(string path, ContextObject context)
54+
{
55+
_path = path;
56+
_ip = new CLSIDInfoPanel();
57+
58+
_ip.DisplayInfo(_path);
59+
_ip.Tag = context;
60+
61+
context.ViewerContent = _ip;
62+
context.Title = $"{CLSIDRegister.GetName(path)}";
63+
context.IsBusy = false;
64+
}
65+
66+
public void Cleanup()
67+
{
68+
GC.SuppressFinalize(this);
69+
70+
_ip = null;
71+
}
72+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright © 2025 QL-Win Contributors
2+
//
3+
// This file is part of QuickLook program.
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
18+
using System.Reflection;
19+
using System.Runtime.InteropServices;
20+
21+
// General Information about an assembly is controlled through the following
22+
// set of attributes. Change these attribute values to modify the information
23+
// associated with an assembly.
24+
[assembly: AssemblyTitle("QuickLook.Plugin.CLSIDViewer")]
25+
[assembly: AssemblyDescription("")]
26+
[assembly: AssemblyConfiguration("")]
27+
[assembly: AssemblyCompany("pooi.moe")]
28+
[assembly: AssemblyProduct("QuickLook.Plugin.CLSIDViewer")]
29+
[assembly: AssemblyCopyright("Copyright © QL-Win Contributors")]
30+
[assembly: AssemblyTrademark("")]
31+
[assembly: AssemblyCulture("")]
32+
33+
// Setting ComVisible to false makes the types in this assembly not visible
34+
// to COM components. If you need to access a type in this assembly from
35+
// COM, set the ComVisible attribute to true on that type.
36+
[assembly: ComVisible(false)]
37+
38+
// The following GUID is for the ID of the typelib if this project is exposed to COM
39+
[assembly: Guid("538fd6ba-2af1-4dda-93a2-6c0a12b00843")]
40+
41+
// Version information for an assembly consists of the following four values:
42+
//
43+
// Major Version
44+
// Minor Version
45+
// Build Number
46+
// Revision
47+
//
48+
// You can specify all the values or you can default the Build and Revision Numbers
49+
// by using the '*' as shown below:
50+
// [assembly: AssemblyVersion("1.0.*")]
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net462</TargetFramework>
6+
<RootNamespace>QuickLook.Plugin.CLSIDViewer</RootNamespace>
7+
<AssemblyName>QuickLook.Plugin.CLSIDViewer</AssemblyName>
8+
<FileAlignment>512</FileAlignment>
9+
<SignAssembly>false</SignAssembly>
10+
<UseWPF>true</UseWPF>
11+
<LangVersion>latest</LangVersion>
12+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
13+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
14+
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
15+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
16+
<ProjectGuid>{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}</ProjectGuid>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.CLSIDViewer\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
</PropertyGroup>
27+
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.CLSIDViewer\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
37+
<DebugSymbols>true</DebugSymbols>
38+
<DebugType>full</DebugType>
39+
<OutputPath>..\..\Build\Debug\QuickLook.Plugin\QuickLook.Plugin.CLSIDViewer\</OutputPath>
40+
<DefineConstants>DEBUG;TRACE</DefineConstants>
41+
<PlatformTarget>x86</PlatformTarget>
42+
<ErrorReport>prompt</ErrorReport>
43+
</PropertyGroup>
44+
45+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
46+
<OutputPath>..\..\Build\Release\QuickLook.Plugin\QuickLook.Plugin.CLSIDViewer\</OutputPath>
47+
<DefineConstants>TRACE</DefineConstants>
48+
<Optimize>true</Optimize>
49+
<DebugType>pdbonly</DebugType>
50+
<PlatformTarget>x86</PlatformTarget>
51+
<ErrorReport>prompt</ErrorReport>
52+
</PropertyGroup>
53+
54+
<ItemGroup>
55+
<ProjectReference Include="..\..\QuickLook.Common\QuickLook.Common.csproj">
56+
<Project>{85FDD6BA-871D-46C8-BD64-F6BB0CB5EA95}</Project>
57+
<Name>QuickLook.Common</Name>
58+
<Private>False</Private>
59+
</ProjectReference>
60+
</ItemGroup>
61+
62+
<ItemGroup>
63+
<Compile Include="..\..\GitVersion.cs">
64+
<Link>Properties\GitVersion.cs</Link>
65+
</Compile>
66+
</ItemGroup>
67+
68+
<ItemGroup>
69+
<None Update="Translations.config">
70+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
71+
</None>
72+
</ItemGroup>
73+
74+
</Project>

QuickLook.Plugin/QuickLook.Plugin.PEViewer/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright © 2024 ema
2-
//
2+
//
33
// This file is part of QuickLook program.
4-
//
4+
//
55
// This program is free software: you can redistribute it and/or modify
66
// it under the terms of the GNU General Public License as published by
77
// the Free Software Foundation, either version 3 of the License, or
88
// (at your option) any later version.
9-
//
9+
//
1010
// This program is distributed in the hope that it will be useful,
1111
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1212
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
// GNU General Public License for more details.
14-
//
14+
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

@@ -26,7 +26,7 @@
2626
[assembly: AssemblyConfiguration("")]
2727
[assembly: AssemblyCompany("pooi.moe")]
2828
[assembly: AssemblyProduct("QuickLook.Plugin.PEViewer")]
29-
[assembly: AssemblyCopyright("Copyright © ema 2024")]
29+
[assembly: AssemblyCopyright("Copyright © QL-Win Contributors")]
3030
[assembly: AssemblyTrademark("")]
3131
[assembly: AssemblyCulture("")]
3232

@@ -47,4 +47,4 @@
4747
//
4848
// You can specify all the values or you can default the Build and Revision Numbers
4949
// by using the '*' as shown below:
50-
// [assembly: AssemblyVersion("1.0.*")]
50+
// [assembly: AssemblyVersion("1.0.*")]

QuickLook.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "QuickLook.Installer", "Quic
5151
{BD58F3FC-7601-47BA-AAA1-D8A9D54A33DA} = {BD58F3FC-7601-47BA-AAA1-D8A9D54A33DA}
5252
{8D50A1DA-601C-4C26-9A7E-7D477EA8430A} = {8D50A1DA-601C-4C26-9A7E-7D477EA8430A}
5353
{CE40160D-5E3C-4A41-9BDA-C4F414C174EB} = {CE40160D-5E3C-4A41-9BDA-C4F414C174EB}
54+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843} = {538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}
5455
EndProjectSection
5556
EndProject
5657
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuickLook.Native64", "QuickLook.Native\QuickLook.Native64\QuickLook.Native64.vcxproj", "{794E4DCF-F715-4836-9D30-ABD296586D23}"
@@ -77,6 +78,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.PEViewer",
7778
EndProject
7879
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.FontViewer", "QuickLook.Plugin\QuickLook.Plugin.FontViewer\QuickLook.Plugin.FontViewer.csproj", "{CE40160D-5E3C-4A41-9BDA-C4F414C174EB}"
7980
EndProject
81+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLook.Plugin.CLSIDViewer", "QuickLook.Plugin\QuickLook.Plugin.CLSIDViewer\QuickLook.Plugin.CLSIDViewer.csproj", "{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}"
82+
EndProject
8083
Global
8184
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8285
Debug|Any CPU = Debug|Any CPU
@@ -223,6 +226,14 @@ Global
223226
{CE40160D-5E3C-4A41-9BDA-C4F414C174EB}.Release|Any CPU.Build.0 = Release|Any CPU
224227
{CE40160D-5E3C-4A41-9BDA-C4F414C174EB}.Release|x86.ActiveCfg = Release|Any CPU
225228
{CE40160D-5E3C-4A41-9BDA-C4F414C174EB}.Release|x86.Build.0 = Release|Any CPU
229+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
230+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Debug|Any CPU.Build.0 = Debug|Any CPU
231+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Debug|x86.ActiveCfg = Debug|Any CPU
232+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Debug|x86.Build.0 = Debug|Any CPU
233+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Release|Any CPU.ActiveCfg = Release|Any CPU
234+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Release|Any CPU.Build.0 = Release|Any CPU
235+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Release|x86.ActiveCfg = Release|Any CPU
236+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843}.Release|x86.Build.0 = Release|Any CPU
226237
EndGlobalSection
227238
GlobalSection(SolutionProperties) = preSolution
228239
HideSolutionNode = FALSE
@@ -243,6 +254,7 @@ Global
243254
{BD58F3FC-7601-47BA-AAA1-D8A9D54A33DA} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
244255
{8D50A1DA-601C-4C26-9A7E-7D477EA8430A} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
245256
{CE40160D-5E3C-4A41-9BDA-C4F414C174EB} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
257+
{538FD6BA-2AF1-4DDA-93A2-6C0A12B00843} = {06EFDBE0-6408-4B37-BCF2-0CF9EBEA2E93}
246258
EndGlobalSection
247259
GlobalSection(ExtensibilityGlobals) = postSolution
248260
SolutionGuid = {D3761C32-8C5F-498A-892B-3B0882994B62}

0 commit comments

Comments
 (0)