mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-13 02:00:25 +08:00
Compare commits
11 Commits
copilot/fi
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1f87eebc7 | ||
|
|
eda48188ca | ||
|
|
0136755548 | ||
|
|
adcfacb785 | ||
|
|
5ebc3ec3db | ||
|
|
4c456fc14c | ||
|
|
45c5933901 | ||
|
|
65c832e430 | ||
|
|
5caaf749f7 | ||
|
|
d5655376f6 | ||
|
|
19af34ae51 |
@@ -26,11 +26,12 @@
|
||||
#define DOPUS_CLASS L"DOpus.ParentWindow"
|
||||
#define DOPUS_NAME L"Directory Opus"
|
||||
#define MSGWINDOW_CLASS L"QuickLook.Native.DOpus.MsgWindow"
|
||||
#define MAX_BUFFER_SIZE (10 * 1024 * 1024) // 10MB limit for IPC data
|
||||
|
||||
HWND hMsgWnd;
|
||||
HANDLE hGetResultEvent;
|
||||
|
||||
PCHAR pXmlBuffer;
|
||||
PCHAR pXmlBuffer = nullptr;
|
||||
|
||||
void DOpus::GetSelected(PWCHAR buffer)
|
||||
{
|
||||
@@ -72,9 +73,12 @@ void DOpus::GetSelected(PWCHAR buffer)
|
||||
|
||||
WaitForSingleObject(hGetResultEvent, 2000);
|
||||
|
||||
ParseXmlBuffer(buffer);
|
||||
|
||||
delete[] pXmlBuffer;
|
||||
if (pXmlBuffer != nullptr)
|
||||
{
|
||||
ParseXmlBuffer(buffer);
|
||||
delete[] pXmlBuffer;
|
||||
pXmlBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DOpus::ParseXmlBuffer(PWCHAR buffer)
|
||||
@@ -88,6 +92,9 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
|
||||
* ...
|
||||
*/
|
||||
|
||||
if (pXmlBuffer == nullptr)
|
||||
return;
|
||||
|
||||
using namespace rapidxml;
|
||||
|
||||
xml_document<> doc;
|
||||
@@ -130,8 +137,21 @@ LRESULT CALLBACK DOpus::msgWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
auto cds = reinterpret_cast<PCOPYDATASTRUCT>(lParam);
|
||||
// Validate COPYDATASTRUCT and enforce reasonable size limit (10MB)
|
||||
if (cds == nullptr || cds->lpData == nullptr || cds->cbData == 0 || cds->cbData > MAX_BUFFER_SIZE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto buf = static_cast<PCHAR>(cds->lpData);
|
||||
|
||||
// Clean up any previous buffer before allocating a new one
|
||||
if (pXmlBuffer != nullptr)
|
||||
{
|
||||
delete[] pXmlBuffer;
|
||||
pXmlBuffer = nullptr;
|
||||
}
|
||||
|
||||
pXmlBuffer = new CHAR[cds->cbData + 1]{'\0'};
|
||||
memcpy(pXmlBuffer, buf, cds->cbData);
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@ void MultiCommander::GetSelected(PWCHAR buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pCurrentItemPath == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto path = reinterpret_cast<PWCHAR>(pCurrentItemPath);
|
||||
wcscpy_s(buffer, wcslen(path) + 1, path);
|
||||
|
||||
@@ -84,8 +88,16 @@ LRESULT CALLBACK MultiCommander::msgWindowProc(HWND hWnd, UINT uMsg, WPARAM wPar
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
delete[] pCurrentItemPath;
|
||||
pCurrentItemPath = nullptr;
|
||||
|
||||
auto cds = reinterpret_cast<PCOPYDATASTRUCT>(lParam);
|
||||
// Validate COPYDATASTRUCT and enforce reasonable size limit (10MB)
|
||||
if (cds == nullptr || cds->lpData == nullptr || cds->cbData == 0 || cds->cbData > MAX_BUFFER_SIZE)
|
||||
{
|
||||
SetEvent(hGetResultEvent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto buf = static_cast<PCHAR>(cds->lpData);
|
||||
|
||||
pCurrentItemPath = new CHAR[cds->cbData + 1]{ '\0' };
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#define MULTICMD_CPF_GETCURITEMFULL 0x00000010L // Get full path of current item (file or folder) in focus
|
||||
#define MULTICMD_CPF_SOURCE 0x00000400L // Go to the new path in the source panel side
|
||||
#define MAX_BUFFER_SIZE (10 * 1024 * 1024) // 10MB limit for IPC data
|
||||
|
||||
#define MULTICMD_CLASS L"MultiCommander MainWnd"
|
||||
#define MULTICMD_MSGWINDOW_CLASS L"QuickLook.Native.MultiCmd.MsgWindow"
|
||||
|
||||
@@ -169,7 +169,7 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
|
||||
&pwba))))
|
||||
return;
|
||||
|
||||
if (HelperMethods::IsCursorActivated(0))
|
||||
if (HelperMethods::IsCursorActivated(reinterpret_cast<HWND>(LongToHandle(phwnd))))
|
||||
return;
|
||||
|
||||
CComPtr<IServiceProvider> psp;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<PackageReference Include="QuickLook.ImageGlass.WebP" Version="1.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.8.2">
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.9.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3405.78">
|
||||
|
||||
@@ -70,6 +70,8 @@ public partial class Plugin : IViewer, IMoreMenu
|
||||
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_currentPath = path;
|
||||
|
||||
if (path.EndsWith(".rtf", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var rtfBox = new RichTextBox();
|
||||
@@ -86,7 +88,6 @@ public partial class Plugin : IViewer, IMoreMenu
|
||||
else
|
||||
{
|
||||
_tvp = new TextViewerPanel();
|
||||
_currentPath = path;
|
||||
_tvp.LoadFileAsync(path, context);
|
||||
context.ViewerContent = _tvp;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Wpf.Ui.Violeta.Win32;
|
||||
using ToolTipIcon = Wpf.Ui.Violeta.Win32.ToolTipIcon;
|
||||
@@ -150,30 +149,9 @@ internal partial class TrayIconManager : IDisposable
|
||||
Action closeEvent = null)
|
||||
{
|
||||
var icon = GetInstance()._icon;
|
||||
|
||||
try
|
||||
{
|
||||
// Use reflection to call ShowBalloonTip to avoid JIT compilation errors
|
||||
// when the method signature doesn't match the expected one
|
||||
var showBalloonTipMethod = icon.GetType().GetMethod("ShowBalloonTip",
|
||||
new[] { typeof(int), typeof(string), typeof(string), typeof(ToolTipIcon) });
|
||||
|
||||
if (showBalloonTipMethod != null)
|
||||
{
|
||||
showBalloonTipMethod.Invoke(icon, new object[] { timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info });
|
||||
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
|
||||
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ShowBalloonTip method not found: {title} - {content}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Fallback: If reflection fails, log and continue without showing notification
|
||||
System.Diagnostics.Debug.WriteLine($"ShowBalloonTip failed: {title} - {content}. Error: {ex.Message}");
|
||||
}
|
||||
icon.ShowBalloonTip(timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info);
|
||||
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
|
||||
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
|
||||
|
||||
void OnIconOnBalloonTipClicked(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,8 @@ Get it from one of the following sources:
|
||||
|
||||
Here is the complete list of plugins from [Available-Plugins](https://github.com/QL-Win/QuickLook/wiki/Available-Plugins).
|
||||
|
||||
See [here](https://github.com/QL-Win/QuickLook/wiki/Available-Plugins#how-to-install-or-upgrade-a-plugin) for instructions on how to install plugins.
|
||||
|
||||
## Supported file formats
|
||||
|
||||
See the [Supported formats](SUPPORTED_FORMATS.md)
|
||||
|
||||
1
_codeql_detected_source_root
Symbolic link
1
_codeql_detected_source_root
Symbolic link
@@ -0,0 +1 @@
|
||||
.
|
||||
Reference in New Issue
Block a user