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