diff --git a/QuickLook.Native/QuickLook.Native32/DialogHook.cpp b/QuickLook.Native/QuickLook.Native32/DialogHook.cpp index ca504ba..c5c7a5e 100644 --- a/QuickLook.Native/QuickLook.Native32/DialogHook.cpp +++ b/QuickLook.Native/QuickLook.Native32/DialogHook.cpp @@ -34,6 +34,9 @@ static WCHAR filePathBuffer[MAX_PATH] = {'\0'}; void DialogHook::GetSelected(PWCHAR buffer) { + if (HelperMethods::IsUWP()) + return; + auto hwndfg = GetForegroundWindow(); DWORD pid = 0; auto tid = GetWindowThreadProcessId(hwndfg, &pid); diff --git a/QuickLook.Native/QuickLook.Native32/HelperMethods.cpp b/QuickLook.Native/QuickLook.Native32/HelperMethods.cpp index 0739b24..41e872b 100644 --- a/QuickLook.Native/QuickLook.Native32/HelperMethods.cpp +++ b/QuickLook.Native/QuickLook.Native32/HelperMethods.cpp @@ -71,3 +71,14 @@ bool HelperMethods::IsCursorActivated(HWND hwnd) GetGUIThreadInfo(tId, &gui); 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; +} diff --git a/QuickLook.Native/QuickLook.Native32/HelperMethods.h b/QuickLook.Native/QuickLook.Native32/HelperMethods.h index e558877..24e5d7e 100644 --- a/QuickLook.Native/QuickLook.Native32/HelperMethods.h +++ b/QuickLook.Native/QuickLook.Native32/HelperMethods.h @@ -22,4 +22,5 @@ public: static void GetSelectedInternal(CComQIPtr pWebBrowserApp, PWCHAR buffer); static void ObtainFirstItem(CComPtr dao, PWCHAR buffer); static bool IsCursorActivated(HWND hwndfg); + static bool HelperMethods::IsUWP(); }; diff --git a/QuickLook.Native/QuickLook.Native32/WoW64HookHelper.cpp b/QuickLook.Native/QuickLook.Native32/WoW64HookHelper.cpp index 75359fc..f0d32d9 100644 --- a/QuickLook.Native/QuickLook.Native32/WoW64HookHelper.cpp +++ b/QuickLook.Native/QuickLook.Native32/WoW64HookHelper.cpp @@ -17,6 +17,7 @@ #include "stdafx.h" #include "WoW64HookHelper.h" +#include "HelperMethods.h" #define HELPER_FILE L"\\QuickLook.WoW64HookHelper.exe" #define RUN_ARG L"033A853A-E4B2-4552-9A91-E88789761C48" @@ -37,6 +38,9 @@ bool WoW64HookHelper::Launch() return true; #endif + if (HelperMethods::IsUWP()) + return true; + if (CheckStatus()) return true; diff --git a/QuickLook.Native/QuickLook.Native32/stdafx.h b/QuickLook.Native/QuickLook.Native32/stdafx.h index 48f9a45..388b295 100644 --- a/QuickLook.Native/QuickLook.Native32/stdafx.h +++ b/QuickLook.Native/QuickLook.Native32/stdafx.h @@ -32,3 +32,4 @@ #include #include #include +#include