Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / systools / win32 / winstoreutil.hxx
blobaa0a70e64423d3c3a259efb5ad812177a870f0e0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <sal/config.h>
14 #include <prewin.h>
15 #include <postwin.h>
17 namespace sal::systools
19 // Returns true if the current process is run as a Windows store app, which has some specifics
20 inline bool IsStorePackagedApp()
22 // GetCurrentPackageFullName is only available since Windows 8
23 HMODULE hDll = GetModuleHandleW(L"kernel32.dll");
24 using Func_t = LONG WINAPI(UINT32*, PWSTR);
25 if (auto pFunc = reinterpret_cast<Func_t*>(GetProcAddress(hDll, "GetCurrentPackageFullName")))
26 if (UINT32 size = 0; pFunc(&size, nullptr) == ERROR_INSUFFICIENT_BUFFER)
27 return true;
28 return false;
30 } // sal::systools
32 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */