mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 17:29:08 +00:00
@@ -111,7 +111,7 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer)
|
|||||||
|
|
||||||
void DOpus::PrepareMessageWindow()
|
void DOpus::PrepareMessageWindow()
|
||||||
{
|
{
|
||||||
WNDCLASSEX wx = {'\0'};
|
WNDCLASSEX wx = {sizeof wx};
|
||||||
wx.cbSize = sizeof(WNDCLASSEX);
|
wx.cbSize = sizeof(WNDCLASSEX);
|
||||||
wx.lpfnWndProc = msgWindowProc;
|
wx.lpfnWndProc = msgWindowProc;
|
||||||
wx.lpszClassName = MSGWINDOW_CLASS;
|
wx.lpszClassName = MSGWINDOW_CLASS;
|
||||||
|
@@ -42,7 +42,7 @@ void HelperMethods::GetSelectedInternal(CComQIPtr<IWebBrowserApp> pwba, PWCHAR b
|
|||||||
void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
|
void HelperMethods::ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer)
|
||||||
{
|
{
|
||||||
FORMATETC formatetc;
|
FORMATETC formatetc;
|
||||||
STGMEDIUM medium;
|
STGMEDIUM medium = {sizeof medium};
|
||||||
|
|
||||||
formatetc.cfFormat = CF_HDROP;
|
formatetc.cfFormat = CF_HDROP;
|
||||||
formatetc.ptd = nullptr;
|
formatetc.ptd = nullptr;
|
||||||
|
@@ -106,12 +106,12 @@ void Shell32::getSelectedFromExplorer(PWCHAR buffer)
|
|||||||
for (auto i = 0; i < count; i++)
|
for (auto i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
VARIANT vi;
|
VARIANT vi;
|
||||||
|
VariantInit(&vi);
|
||||||
V_VT(&vi) = VT_I4;
|
V_VT(&vi) = VT_I4;
|
||||||
V_I4(&vi) = i;
|
V_I4(&vi) = i;
|
||||||
|
|
||||||
CComPtr<IDispatch> pdisp;
|
CComPtr<IDispatch> pdisp;
|
||||||
// ReSharper disable once CppSomeObjectMembersMightNotBeInitialized
|
if (S_OK != psw->Item(vi, &pdisp))
|
||||||
if (FAILED(psw->Item(vi, &pdisp)))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CComQIPtr<IWebBrowserApp> pwba;
|
CComQIPtr<IWebBrowserApp> pwba;
|
||||||
@@ -139,7 +139,8 @@ void Shell32::getSelectedFromDesktop(PWCHAR buffer)
|
|||||||
if (FAILED(psw.CoCreateInstance(CLSID_ShellWindows)))
|
if (FAILED(psw.CoCreateInstance(CLSID_ShellWindows)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VARIANT pvarLoc = {VT_EMPTY};
|
VARIANT pvarLoc;
|
||||||
|
VariantInit(&pvarLoc);
|
||||||
long phwnd;
|
long phwnd;
|
||||||
if (FAILED(psw->FindWindowSW(&pvarLoc, &pvarLoc, SWC_DESKTOP, &phwnd, SWFO_NEEDDISPATCH, reinterpret_cast<IDispatch**>(&pwba))))
|
if (FAILED(psw->FindWindowSW(&pvarLoc, &pvarLoc, SWC_DESKTOP, &phwnd, SWFO_NEEDDISPATCH, reinterpret_cast<IDispatch**>(&pwba))))
|
||||||
return;
|
return;
|
||||||
|
@@ -51,7 +51,7 @@ bool WoW64HookHelper::Launch()
|
|||||||
auto p = wcsrchr(fullPath, L'\\');
|
auto p = wcsrchr(fullPath, L'\\');
|
||||||
memcpy(p, HELPER_FILE, wcslen(HELPER_FILE) * sizeof WCHAR);
|
memcpy(p, HELPER_FILE, wcslen(HELPER_FILE) * sizeof WCHAR);
|
||||||
|
|
||||||
STARTUPINFO si = {'\0'};
|
STARTUPINFO si = {sizeof si};
|
||||||
PROCESS_INFORMATION pi = {nullptr};
|
PROCESS_INFORMATION pi = {nullptr};
|
||||||
si.cb = sizeof si;
|
si.cb = sizeof si;
|
||||||
|
|
||||||
@@ -70,9 +70,9 @@ void WoW64HookHelper::createJob()
|
|||||||
|
|
||||||
hJob = CreateJobObject(nullptr, nullptr);
|
hJob = CreateJobObject(nullptr, nullptr);
|
||||||
|
|
||||||
JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation = {'\0'};
|
JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation = {sizeof BasicLimitInformation};
|
||||||
BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo = {'\0'};
|
JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo = {sizeof lpJobObjectInfo};
|
||||||
lpJobObjectInfo.BasicLimitInformation = BasicLimitInformation;
|
lpJobObjectInfo.BasicLimitInformation = BasicLimitInformation;
|
||||||
|
|
||||||
SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &lpJobObjectInfo, sizeof JOBOBJECT_EXTENDED_LIMIT_INFORMATION);
|
SetInformationJobObject(hJob, JobObjectExtendedLimitInformation, &lpJobObjectInfo, sizeof JOBOBJECT_EXTENDED_LIMIT_INFORMATION);
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -23,7 +25,7 @@ namespace QuickLook.NativeMethods
|
|||||||
{
|
{
|
||||||
internal static class QuickLook
|
internal static class QuickLook
|
||||||
{
|
{
|
||||||
private const int MaxPath = 260;
|
private const int MaxPath = 8192;
|
||||||
|
|
||||||
[DllImport("QuickLook.Native32.dll", EntryPoint = "Init",
|
[DllImport("QuickLook.Native32.dll", EntryPoint = "Init",
|
||||||
CallingConvention = CallingConvention.Cdecl)]
|
CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -50,21 +52,38 @@ namespace QuickLook.NativeMethods
|
|||||||
private static extern void GetCurrentSelectionNative_64([MarshalAs(UnmanagedType.LPWStr)] StringBuilder sb);
|
private static extern void GetCurrentSelectionNative_64([MarshalAs(UnmanagedType.LPWStr)] StringBuilder sb);
|
||||||
|
|
||||||
internal static void Init()
|
internal static void Init()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (App.Is64Bit)
|
if (App.Is64Bit)
|
||||||
Init_64();
|
Init_64();
|
||||||
else
|
else
|
||||||
Init_32();
|
Init_32();
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static FocusedWindowType GetFocusedWindowType()
|
internal static FocusedWindowType GetFocusedWindowType()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return App.Is64Bit ? GetFocusedWindowTypeNative_64() : GetFocusedWindowTypeNative_32();
|
return App.Is64Bit ? GetFocusedWindowTypeNative_64() : GetFocusedWindowTypeNative_32();
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
|
return FocusedWindowType.Invalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static string GetCurrentSelection()
|
internal static string GetCurrentSelection()
|
||||||
{
|
{
|
||||||
StringBuilder sb = null;
|
StringBuilder sb = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
// communicate with COM in a separate thread
|
// communicate with COM in a separate thread
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -74,7 +93,11 @@ namespace QuickLook.NativeMethods
|
|||||||
else
|
else
|
||||||
GetCurrentSelectionNative_32(sb);
|
GetCurrentSelectionNative_32(sb);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
|
}
|
||||||
return sb?.ToString() ?? string.Empty;
|
return sb?.ToString() ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user