mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 17:29:08 +00:00
Prevent hook helper from running when in UWP mode
This commit is contained in:
@@ -34,6 +34,9 @@ static WCHAR filePathBuffer[MAX_PATH] = {'\0'};
|
|||||||
|
|
||||||
void DialogHook::GetSelected(PWCHAR buffer)
|
void DialogHook::GetSelected(PWCHAR buffer)
|
||||||
{
|
{
|
||||||
|
if (HelperMethods::IsUWP())
|
||||||
|
return;
|
||||||
|
|
||||||
auto hwndfg = GetForegroundWindow();
|
auto hwndfg = GetForegroundWindow();
|
||||||
DWORD pid = 0;
|
DWORD pid = 0;
|
||||||
auto tid = GetWindowThreadProcessId(hwndfg, &pid);
|
auto tid = GetWindowThreadProcessId(hwndfg, &pid);
|
||||||
|
@@ -71,3 +71,14 @@ bool HelperMethods::IsCursorActivated(HWND hwnd)
|
|||||||
GetGUIThreadInfo(tId, &gui);
|
GetGUIThreadInfo(tId, &gui);
|
||||||
return gui.flags || gui.hwndCaret;
|
return gui.flags || gui.hwndCaret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HelperMethods::IsUWP()
|
||||||
|
{
|
||||||
|
auto pGCPFN = decltype(&GetCurrentPackageFullName)(GetProcAddress(GetModuleHandle(L"kernel32.dll"), "GetCurrentPackageFullName"));
|
||||||
|
|
||||||
|
if (!pGCPFN)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
UINT32 pn = 0;
|
||||||
|
return pGCPFN(&pn, nullptr) == ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
}
|
||||||
|
@@ -22,4 +22,5 @@ public:
|
|||||||
static void GetSelectedInternal(CComQIPtr<IWebBrowserApp> pWebBrowserApp, PWCHAR buffer);
|
static void GetSelectedInternal(CComQIPtr<IWebBrowserApp> pWebBrowserApp, PWCHAR buffer);
|
||||||
static void ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer);
|
static void ObtainFirstItem(CComPtr<IDataObject> dao, PWCHAR buffer);
|
||||||
static bool IsCursorActivated(HWND hwndfg);
|
static bool IsCursorActivated(HWND hwndfg);
|
||||||
|
static bool HelperMethods::IsUWP();
|
||||||
};
|
};
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "WoW64HookHelper.h"
|
#include "WoW64HookHelper.h"
|
||||||
|
#include "HelperMethods.h"
|
||||||
|
|
||||||
#define HELPER_FILE L"\\QuickLook.WoW64HookHelper.exe"
|
#define HELPER_FILE L"\\QuickLook.WoW64HookHelper.exe"
|
||||||
#define RUN_ARG L"033A853A-E4B2-4552-9A91-E88789761C48"
|
#define RUN_ARG L"033A853A-E4B2-4552-9A91-E88789761C48"
|
||||||
@@ -37,6 +38,9 @@ bool WoW64HookHelper::Launch()
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (HelperMethods::IsUWP())
|
||||||
|
return true;
|
||||||
|
|
||||||
if (CheckStatus())
|
if (CheckStatus())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@@ -32,3 +32,4 @@
|
|||||||
#include<Shlobj.h>
|
#include<Shlobj.h>
|
||||||
#include<Shellapi.h>
|
#include<Shellapi.h>
|
||||||
#include<Psapi.h>
|
#include<Psapi.h>
|
||||||
|
#include<AppModel.h>
|
||||||
|
Reference in New Issue
Block a user