GetCurrentPackageFullName is available in the baseline Windows 10

Change-Id: Ie5d46f6a53af9a9a68ae98d4de28021fa1ee7eaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178088
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2024-12-08 19:08:00 +05:00
parent 46cfd8d2a7
commit b083e27de5

View file

@ -12,6 +12,7 @@
#include <sal/config.h>
#include <prewin.h>
#include <appmodel.h>
#include <postwin.h>
namespace sal::systools
@ -19,13 +20,8 @@ namespace sal::systools
// Returns true if the current process is run as a Windows store app, which has some specifics
inline bool IsStorePackagedApp()
{
// GetCurrentPackageFullName is only available since Windows 8
HMODULE hDll = GetModuleHandleW(L"kernel32.dll");
using Func_t = LONG WINAPI(UINT32*, PWSTR);
if (auto pFunc = reinterpret_cast<Func_t*>(GetProcAddress(hDll, "GetCurrentPackageFullName")))
if (UINT32 size = 0; pFunc(&size, nullptr) == ERROR_INSUFFICIENT_BUFFER)
return true;
return false;
UINT32 size = 0;
return GetCurrentPackageFullName(&size, nullptr) == ERROR_INSUFFICIENT_BUFFER;
}
} // sal::systools