Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion Build/AppxManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="com desktop4 desktop5">
<!-- Invalid package identity name: QL-Win.QuickLook (expected: 21090PaddyXu.QuickLook) -->
<!-- Invalid package family name: QL-Win.QuickLook_wgqddy12gm212 (expected: 21090PaddyXu.QuickLook_egxr34yet59cg) -->
<!-- Invalid package publisher name: CN=F4F538EC-55CB-41B8-9531-25CC140D0339 (expected: CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB) -->
Expand Down Expand Up @@ -36,6 +40,26 @@
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="QuickLookTask" Enabled="true" DisplayName="QuickLook" />
</desktop:Extension>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:SurrogateServer DisplayName="QuickLook">
<com:Class Id="A7C3E4B1-5D28-4F6A-9B30-8E1F2A4C6D70" Path="Package\QuickLook.Native64.dll" ThreadingModel="STA" />
</com:SurrogateServer>
</com:ComServer>
</com:Extension>
<desktop4:Extension Category="windows.fileExplorerContextMenus">
<desktop4:FileExplorerContextMenus>
<desktop5:ItemType Type="*">
<desktop5:Verb Id="QuickLookFile" Clsid="A7C3E4B1-5D28-4F6A-9B30-8E1F2A4C6D70" />
</desktop5:ItemType>
<desktop5:ItemType Type="Directory">
<desktop5:Verb Id="QuickLookDirectory" Clsid="A7C3E4B1-5D28-4F6A-9B30-8E1F2A4C6D70" />
</desktop5:ItemType>
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="QuickLookBackground" Clsid="A7C3E4B1-5D28-4F6A-9B30-8E1F2A4C6D70" />
</desktop5:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>
</Extensions>
<uap:VisualElements DisplayName="QuickLook"
Description="Bring macOS &#8220;Quick Look&#8221; feature to Windows"
Expand Down
12 changes: 11 additions & 1 deletion QuickLook.Common/Helpers/ProcessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

Expand All @@ -44,8 +45,17 @@ public static bool IsRunningAsUWP()
{
uint len = 0;
var r = Kernel32.GetCurrentPackageFullName(ref len, null);
if (r != ErrorInsufficientBuffer || len == 0)
return false;

return r == ErrorInsufficientBuffer;
var name = new StringBuilder((int)len);
r = Kernel32.GetCurrentPackageFullName(ref len, name);
if (r != 0)
return false;

// The shell sparse package also gives this process an identity.
// Store behavior applies only to the Store package.
return name.ToString().StartsWith("21090PaddyXu.QuickLook_", StringComparison.Ordinal);
}
catch (EntryPointNotFoundException)
{
Expand Down
49 changes: 49 additions & 0 deletions QuickLook.Native/QuickLook.Native32/ContextMenuExports.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright © 2017-2026 QL-Win Contributors
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#include "ExplorerCommand.h"

#include "ContextMenuGuid.h"

#include <new>

HMODULE g_module = nullptr;
long g_moduleRefs = 0;
long g_moduleLocks = 0;

STDAPI DllCanUnloadNow()
{
return (g_moduleRefs == 0 && g_moduleLocks == 0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
{
if (ppv == nullptr)
return E_POINTER;

*ppv = nullptr;
if (rclsid != CLSID_QuickLookCommand)
return CLASS_E_CLASSNOTAVAILABLE;

auto* factory = new (std::nothrow) ClassFactory();
if (factory == nullptr)
return E_OUTOFMEMORY;

const HRESULT hr = factory->QueryInterface(riid, ppv);
factory->Release();
return hr;
}
24 changes: 24 additions & 0 deletions QuickLook.Native/QuickLook.Native32/ContextMenuGuid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright © 2017-2026 QL-Win Contributors
//
// This file is part of QuickLook program.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <windows.h>

// {A7C3E4B1-5D28-4F6A-9B30-8E1F2A4C6D70}
static const GUID CLSID_QuickLookCommand = {
0xa7c3e4b1, 0x5d28, 0x4f6a, {0x9b, 0x30, 0x8e, 0x1f, 0x2a, 0x4c, 0x6d, 0x70}};
Loading
Loading