Browse Source

Experimentally reading Store license

Source commit: 01aed66d8e5d9169dce2416f1aa1a036cc959c05
Martin Prikryl 3 years ago
parent
commit
fa1ac850da

+ 2 - 0
source/core/Configuration.cpp

@@ -125,6 +125,7 @@ void __fastcall TConfiguration::Default()
   FScriptProgressFileNameLimit = 25;
   FKeyVersion = 0;
   CollectUsage = FDefaultCollectUsage;
+  FExperimentalFeatures = false;
 
   FLogging = false;
   FPermanentLogging = false;
@@ -262,6 +263,7 @@ UnicodeString __fastcall TConfiguration::PropertyToKey(const UnicodeString & Pro
     KEY(Integer,  KeyVersion); \
     KEY(Bool,     CollectUsage); \
     KEY(String,   CertificateStorage); \
+    KEY(Bool,     ExperimentalFeatures); \
   ); \
   BLOCK(L"Logging", CANCREATE, \
     KEYEX(Bool,  PermanentLogging, L"Logging"); \

+ 2 - 0
source/core/Configuration.h

@@ -82,6 +82,7 @@ private:
   int FKeyVersion;
   UnicodeString FCertificateStorage;
   UnicodeString FChecksumCommands;
+  bool FExperimentalFeatures;
 
   bool FDisablePasswordStoring;
   bool FForceBanners;
@@ -285,6 +286,7 @@ public:
   __property void * ApplicationInfo  = { read=GetApplicationInfo };
   __property TUsage * Usage = { read = FUsage };
   __property bool CollectUsage = { read = GetCollectUsage, write = SetCollectUsage };
+  __property bool ExperimentalFeatures = { read = FExperimentalFeatures, write = FExperimentalFeatures };
   __property UnicodeString StoredSessionsSubKey = {read=GetStoredSessionsSubKey};
   __property UnicodeString PuttyRegistryStorageKey  = { read=FPuttyRegistryStorageKey, write=SetPuttyRegistryStorageKey };
   __property UnicodeString PuttySessionsKey  = { read=DoGetPuttySessionsKey };

+ 281 - 0
source/windows/Setup.cpp

@@ -34,6 +34,8 @@
 #include <Soap.HTTPUtil.hpp>
 #include <Web.HTTPApp.hpp>
 #include <System.IOUtils.hpp>
+#include <WinApi.h>
+#include <Queue.h>
 //---------------------------------------------------------------------------
 #define KEY _T("SYSTEM\\CurrentControlSet\\Control\\") \
             _T("Session Manager\\Environment")
@@ -2817,3 +2819,282 @@ int ComRegistration(TConsole * Console)
   }
   return Result;
 }
+#define StringModuleName L"api-ms-win-core-winrt-string-l1-1-0.dll"
+//---------------------------------------------------------------------------
+class TCollectStoreDataThread : public TSimpleThread, IAsyncOperationCompletedHandler<IStoreAppLicense *>
+{
+public:
+  TCollectStoreDataThread()
+  {
+    FEvent = CreateEvent(NULL, false, false, NULL);
+  }
+
+  virtual __fastcall ~TCollectStoreDataThread()
+  {
+    CloseHandle(FEvent);
+    AppLog("Destroying store data collection thread");
+  }
+
+protected:
+  #pragma warn -hid
+  virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID ClassId, void ** Intf)
+  {
+    AppLog(L"Querying IAsyncOperationCompletedHandler interface");
+    HRESULT Result = S_OK;
+    if (ClassId == IID_IUnknown)
+    {
+      *Intf = static_cast<IUnknown *>(this);
+    }
+    else if (ClassId == System::Sysutils::StringToGUID(IAsyncOperationCompletedHandlerStoreAppLicenseGUID))
+    {
+      *Intf = static_cast<IAsyncOperationCompletedHandler<IStoreAppLicense *> *>(this);
+    }
+    else
+    {
+      Result = E_NOINTERFACE;
+    }
+    return Result;
+  }
+  #pragma warn .hid
+
+  virtual ULONG STDMETHODCALLTYPE AddRef()
+  {
+    AppLog(L"Adding IAsyncOperationCompletedHandler reference");
+    return -1;
+  }
+
+  virtual ULONG STDMETHODCALLTYPE Release()
+  {
+    AppLog(L"Releasing IAsyncOperationCompletedHandler reference");
+    return -1;
+  }
+
+  virtual HRESULT STDMETHODCALLTYPE Invoke(IAsyncOperation_RT<IStoreAppLicense *> * AsyncInfo, AsyncStatus Status)
+  {
+    AppLog(L"Invoking IAsyncOperationCompletedHandler");
+    try
+    {
+      if (Status != AsyncStatus::Completed)
+      {
+        AppLogFmt(L"Unexpected status: %d", (static_cast<int>(Status)));
+      }
+      else
+      {
+        AppLog(L"Completed");
+        IStoreAppLicense * AppLicense;
+        HRESULT Result = AsyncInfo->GetResults(&AppLicense);
+        if (FAILED(Result))
+        {
+          AppLogFmt(L"Failed to get results [%d]", (Result));
+        }
+        else
+        {
+          AppLog(L"Got results");
+          try
+          {
+            HSTRING SkuStoreId = 0;
+            Result = AppLicense->get_SkuStoreId(&SkuStoreId);
+            if (FAILED(Result))
+            {
+              AppLogFmt(L"Failed to get Store ID [%d]", (Result));
+            }
+            else
+            {
+              if (SkuStoreId == NULL)
+              {
+                AppLog(L"Got NULL Store ID");
+              }
+              else
+              {
+                AppLog(L"Got Store ID");
+                typedef PCWSTR (* TWindowsGetStringRawBuffer)(HSTRING string, UINT32  *length);
+                TWindowsGetStringRawBuffer WindowsGetStringRawBuffer =
+                  (TWindowsGetStringRawBuffer)GetProcAddress(GetModuleHandle(StringModuleName), "WindowsGetStringRawBuffer");
+                AppLog(L"Resolved function");
+                UINT32 Length;
+                PCWSTR Buffer = WindowsGetStringRawBuffer(SkuStoreId, &Length);
+                UnicodeString StoreID(Buffer);
+                AppLogFmt(L"Store ID: %s", (StoreID));
+              }
+            }
+
+            boolean Active = 0;
+            Result = AppLicense->get_IsActive(&Active);
+            if (FAILED(Result))
+            {
+              AppLogFmt(L"Failed to get Active [%d]", (Result));
+            }
+            else
+            {
+              AppLogFmt(L"Active: %s", (BooleanToEngStr(Active != 0)));
+            }
+
+            boolean Trial = 0;
+            Result = AppLicense->get_IsTrial(&Trial);
+            if (FAILED(Result))
+            {
+              AppLogFmt(L"Failed to get Trial [%d]", (Result));
+            }
+            else
+            {
+              AppLogFmt(L"Trial: %s", (BooleanToEngStr(Trial != 0)));
+            }
+          }
+          __finally
+          {
+            AppLog(L"Releasing license");
+            AppLicense->Release();
+          }
+        }
+      }
+    }
+    catch (Exception & E)
+    {
+      AppLogFmt("Failed in IAsyncOperationCompletedHandler: %s", (E.Message));
+    }
+    AppLog(L"Setting event");
+    SetEvent(FEvent);
+    AppLog(L"IAsyncOperationCompletedHandler done");
+    return S_OK;
+  }
+
+  virtual bool __fastcall Finished()
+  {
+    // self-destroy
+    return true;
+  }
+
+  void __fastcall Terminate()
+  {
+    DebugFail();
+  }
+
+  virtual void __fastcall Execute()
+  {
+    AppLog("Started store data collection thread");
+    try
+    {
+      CoInitialize(NULL);
+      AppLog("Initialized COM library");
+      typedef HRESULT (* TRoGetActivationFactory)(HSTRING activatableClassId, REFIID  iid, void **factory);
+      TRoGetActivationFactory RoGetActivationFactory =
+        (TRoGetActivationFactory)GetProcAddress(GetModuleHandle(L"Combase.dll"), "RoGetActivationFactory");
+      typedef HRESULT (* TWindowsCreateString)(PCNZWCH sourceString, UINT32 length, HSTRING *string);
+      HMODULE StringModule = GetModuleHandle(StringModuleName);
+      TWindowsCreateString WindowsCreateString =
+        (TWindowsCreateString)GetProcAddress(StringModule, "WindowsCreateString");
+      typedef HRESULT (* TWindowsDeleteString)(HSTRING string);
+      TWindowsDeleteString WindowsDeleteString =
+        (TWindowsDeleteString)GetProcAddress(StringModule, "WindowsDeleteString");
+      if ((RoGetActivationFactory != NULL) && (WindowsCreateString != NULL) && (WindowsDeleteString != NULL))
+      {
+        AppLog(L"Resolved store functions");
+        const wchar_t * StoreContextStr = L"Windows.Services.Store.StoreContext";
+        HSTRING StoreContextString;
+        HRESULT Result = WindowsCreateString(StoreContextStr, wcslen(StoreContextStr), &StoreContextString);
+        if (DebugAlwaysFalse(FAILED(Result)))
+        {
+          AppLogFmt(L"Failed to created store context service string [%d]", (Result));
+        }
+        else
+        {
+          AppLog(L"Created store context service string");
+          try
+          {
+            TGUID IID_IStoreContextStatics(System::Sysutils::StringToGUID(IStoreContextStaticsGUID));
+            IStoreContextStatics * StoreContextStatics;
+            Result = RoGetActivationFactory(StoreContextString, IID_IStoreContextStatics, &static_cast<void *>(StoreContextStatics));
+            if (FAILED(Result))
+            {
+              AppLogFmt(L"Failed to retrieve store context service activation factory [%d]", (Result));
+            }
+            else
+            {
+              AppLog(L"Got store context service activation factory");
+              try
+              {
+                IStoreContext * StoreContext;
+                Result = StoreContextStatics->GetDefault(&StoreContext);
+                if (FAILED(Result))
+                {
+                  AppLogFmt(L"Failed to retrieve default store context [%d]", (Result));
+                }
+                else
+                {
+                  AppLog(L"Got default store context");
+                  try
+                  {
+                    IAsyncOperation_RT<IStoreAppLicense *> * GetLicenseOperation;
+                    Result = StoreContext->GetAppLicenseAsync(&static_cast<IUnknown *>(GetLicenseOperation));
+                    if (FAILED(Result))
+                    {
+                      AppLogFmt(L"Failed to retrieve store license [%d]", (Result));
+                    }
+                    else
+                    {
+                      AppLog(L"Got store license");
+                      try
+                      {
+                        GetLicenseOperation->put_Completed(this);
+                        AppLog(L"Added handler, waiting for response");
+                        DWORD WaitResult = WaitForSingleObject(FEvent, 60000);
+                        if (WaitResult != WAIT_OBJECT_0)
+                        {
+                          AppLogFmt(L"Could not wait for store data [%d]", (WaitResult));
+                        }
+                        else
+                        {
+                          AppLog("Done waiting for store data");
+                        }
+                      }
+                      __finally
+                      {
+                        AppLog(L"Releasing store license");
+                        GetLicenseOperation->Release();
+                      }
+                    }
+                  }
+                  __finally
+                  {
+                    AppLog(L"Releasing store context");
+                    StoreContext->Release();
+                  }
+                }
+              }
+              __finally
+              {
+                AppLog(L"Releasing factory");
+                StoreContextStatics->Release();
+              }
+            }
+          }
+          __finally
+          {
+            AppLog(L"Deleting string");
+            DebugCheck(SUCCEEDED(WindowsDeleteString(StoreContextString)));
+          }
+        }
+      }
+    }
+    catch (Exception & E)
+    {
+      AppLogFmt("Failed while collecting store data: %s", (E.Message));
+    }
+  }
+
+private:
+  HANDLE FEvent;
+};
+//---------------------------------------------------------------------------
+void CollectStoreData()
+{
+  if (!Configuration->ExperimentalFeatures)
+  {
+    AppLog(L"Not contacting store, experimental features disabled");
+  }
+  else
+  {
+    AppLog("Starting store data collection thread");
+    new TCollectStoreDataThread()->Start();
+  }
+}

+ 1 - 0
source/windows/Setup.h

@@ -38,5 +38,6 @@ UnicodeString GetNetCoreVersionStr();
 UnicodeString GetPowerShellVersionStr();
 UnicodeString GetPowerShellCoreVersionStr();
 int ComRegistration(TConsole * Console);
+void CollectStoreData();
 //---------------------------------------------------------------------------
 #endif

+ 265 - 0
source/windows/WinApi.h

@@ -192,4 +192,269 @@ public:
 #define SES_EX_HANDLEFRIENDLYURL (0x100)
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
+typedef struct HSTRING__{
+    int unused;
+} HSTRING__;
+typedef HSTRING__* HSTRING;
+//---------------------------------------------------------------------------
+// Windows Kits\10\Include\10.0.16299.0\winrt\inspectable.h
+typedef enum TrustLevel {
+  BaseTrust = 0,
+  PartialTrust,
+  FullTrust
+} TrustLevel;
+//---------------------------------------------------------------------------
+class IInspectable : public IUnknown
+{
+public:
+  virtual HRESULT STDMETHODCALLTYPE GetIids(
+    /* [out] */ __RPC__out ULONG *iidCount,
+    /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids) = 0;
+
+  virtual HRESULT STDMETHODCALLTYPE GetRuntimeClassName(
+    /* [out] */ __RPC__deref_out_opt HSTRING *className) = 0;
+
+  virtual HRESULT STDMETHODCALLTYPE GetTrustLevel(
+    /* [out] */ __RPC__out TrustLevel *trustLevel) = 0;
+};
+//---------------------------------------------------------------------------
+template <class T>
+struct not_yet_specialized_placeholder
+{
+    enum { value = false };
+};
+//---------------------------------------------------------------------------
+template <class WasNotSpecialized>
+struct not_yet_specialized
+{
+};
+//---------------------------------------------------------------------------
+template <class T>
+struct GetAbiType
+{
+    typedef T type;
+};
+//---------------------------------------------------------------------------
+template <class T>
+struct GetLogicalType
+{
+    typedef T type;
+};
+//---------------------------------------------------------------------------
+#define IAsyncOperationCompletedHandlerStoreAppLicenseGUID L"{ceff1e09-e506-50ad-a908-52038c256552}"
+template <class TResult>
+struct IAsyncOperationCompletedHandler_impl;
+template <class TResult>
+        struct IAsyncOperationCompletedHandler
+        : public IAsyncOperationCompletedHandler_impl<TResult>
+        , not_yet_specialized<IAsyncOperationCompletedHandler<TResult> >
+{
+};
+//---------------------------------------------------------------------------
+template <class TResult>
+struct IAsyncOperation_impl : IInspectable
+{
+private:
+  typedef typename GetAbiType<TResult>::type     TResult_abi;
+  typedef typename GetLogicalType<TResult>::type TResult_logical;
+public:
+  // For all types which are neither InterfaceGroups nor RuntimeClasses, the
+  // following three typedefs are synonyms for a single C++ type.  But for
+  // InterfaceGroups and RuntimeClasses, they are different types:
+  //   T_logical: The C++ Type for the InterfaceGroup or RuntimeClass, when
+  //              used as a template parameter.  Eg "RCFoo*"
+  //   T_abi:     The C++ type for the default interface used to represent the
+  //              InterfaceGroup or RuntimeClass when passed as a method parameter.
+  //              Eg "IFoo*"
+  //   T_complex: An instantiation of the Internal "AggregateType" template that
+  //              combines T_logical with T_abi. Eg "AggregateType<RCFoo*,IFoo*>"
+  // See the declaration above of Windows::Foundation::Internal::AggregateType
+  // for more details.
+  typedef TResult                                                                 TResult_complex;
+
+  virtual HRESULT STDMETHODCALLTYPE put_Completed( IAsyncOperationCompletedHandler<TResult_logical> *handler) = 0;
+  virtual HRESULT STDMETHODCALLTYPE get_Completed( IAsyncOperationCompletedHandler<TResult_logical> **handler) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetResults(  TResult_abi *results) = 0;
+};
+//---------------------------------------------------------------------------
+// Windows Kits\10\Include\10.0.16299.0\winrt\windows.foundation.collections.h
+template <class TResult>
+        struct IAsyncOperation_RT // Conflict with shldisp.h IAsyncOperation
+        : IAsyncOperation_impl<TResult>
+        , not_yet_specialized<IAsyncOperation_RT<TResult> >
+{
+};
+//---------------------------------------------------------------------------
+enum class AsyncStatus {
+  Started = 0,
+  Completed,
+  Canceled,
+  Error,
+};
+//---------------------------------------------------------------------------
+template <class TResult>
+struct IAsyncOperationCompletedHandler_impl : public IUnknown
+{
+private:
+  typedef typename GetAbiType<TResult>::type     TResult_abi;
+  typedef typename GetLogicalType<TResult>::type TResult_logical;
+
+public:
+  // For all types which are neither InterfaceGroups nor RuntimeClasses, the
+  // following three typedefs are synonyms for a single C++ type.  But for
+  // InterfaceGroups and RuntimeClasses, they are different types:
+  //   T_logical: The C++ Type for the InterfaceGroup or RuntimeClass, when
+  //              used as a template parameter.  Eg "RCFoo*"
+  //   T_abi:     The C++ type for the default interface used to represent the
+  //              InterfaceGroup or RuntimeClass when passed as a method parameter.
+  //              Eg "IFoo*"
+  //   T_complex: An instantiation of the Internal "AggregateType" template that
+  //              combines T_logical with T_abi. Eg "AggregateType<RCFoo*,IFoo*>"
+  // See the declaration above of Windows::Foundation::Internal::AggregateType
+  // for more details.
+  typedef TResult                                                                 TResult_complex;
+
+  virtual HRESULT STDMETHODCALLTYPE Invoke(IAsyncOperation_RT<TResult> *asyncInfo, AsyncStatus status) = 0;
+};
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+#define IStoreContextStaticsGUID L"{9C06EE5F-15C0-4E72-9330-D6191CEBD19C}"
+// Windows Kits\10\Include\10.0.16299.0\winrt\windows.services.store.h
+class IStoreContext : public IInspectable
+{
+public:
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_User(
+      /* [retval, out] */__RPC__deref_out_opt /*ABI::Windows::System::IUser*/IUnknown * * value
+      ) = 0;
+  /* [eventadd] */virtual HRESULT STDMETHODCALLTYPE add_OfflineLicensesChanged(
+      /* [in] */__RPC__in_opt /*__FITypedEventHandler_2_Windows__CServices__CStore__CStoreContext_IInspectable*/IUnknown * handler,
+      /* [retval, out] */__RPC__out /*EventRegistrationToken*/__int64 * token
+      ) = 0;
+  /* [eventremove] */virtual HRESULT STDMETHODCALLTYPE remove_OfflineLicensesChanged(
+      /* [in] *//*EventRegistrationToken*/__int64 token
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetCustomerPurchaseIdAsync(
+      /* [in] */__RPC__in HSTRING serviceTicket,
+      /* [in] */__RPC__in HSTRING publisherUserId,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_HSTRING*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetCustomerCollectionsIdAsync(
+      /* [in] */__RPC__in HSTRING serviceTicket,
+      /* [in] */__RPC__in HSTRING publisherUserId,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_HSTRING*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetAppLicenseAsync(
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreAppLicense*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetStoreProductForCurrentAppAsync(
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetStoreProductsAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * storeIds,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetAssociatedStoreProductsAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetAssociatedStoreProductsWithPagingAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
+      /* [in] */UINT32 maxItemsToRetrievePerPage,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductPagedQueryResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetUserCollectionAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductQueryResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetUserCollectionWithPagingAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * productKinds,
+      /* [in] */UINT32 maxItemsToRetrievePerPage,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreProductPagedQueryResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE ReportConsumableFulfillmentAsync(
+      /* [in] */__RPC__in HSTRING productStoreId,
+      /* [in] */UINT32 quantity,
+      /* [in] */GUID trackingId,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreConsumableResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetConsumableBalanceRemainingAsync(
+      /* [in] */__RPC__in HSTRING productStoreId,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreConsumableResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE AcquireStoreLicenseForOptionalPackageAsync(
+      /* [in] */__RPC__in_opt /*ABI::Windows::ApplicationModel::IPackage*/IUnknown * optionalPackage,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStoreAcquireLicenseResult*/IUnknown * * operation
+      ) = 0;
+  /* [overload] */virtual HRESULT STDMETHODCALLTYPE RequestPurchaseAsync(
+      /* [in] */__RPC__in HSTRING storeId,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStorePurchaseResult*/IUnknown * * operation
+      ) = 0;
+  /* [overload] */virtual HRESULT STDMETHODCALLTYPE RequestPurchaseWithPurchasePropertiesAsync(
+      /* [in] */__RPC__in HSTRING storeId,
+      /* [in] */__RPC__in_opt /*ABI::Windows::Services::Store::IStorePurchaseProperties*/IUnknown * storePurchaseProperties,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1_Windows__CServices__CStore__CStorePurchaseResult*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetAppAndOptionalStorePackageUpdatesAsync(
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperation_1___FIVectorView_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE RequestDownloadStorePackageUpdatesAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * storePackageUpdates,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE RequestDownloadAndInstallStorePackageUpdatesAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_Windows__CServices__CStore__CStorePackageUpdate*/IUnknown * storePackageUpdates,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
+      ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE RequestDownloadAndInstallStorePackagesAsync(
+      /* [in] */__RPC__in_opt /*__FIIterable_1_HSTRING*/IUnknown * storeIds,
+      /* [retval, out] */__RPC__deref_out_opt /*__FIAsyncOperationWithProgress_2_Windows__CServices__CStore__CStorePackageUpdateResult_Windows__CServices__CStore__CStorePackageUpdateStatus*/IUnknown * * operation
+      ) = 0;
+};
+//---------------------------------------------------------------------------
+class IStoreContextStatics : public IInspectable
+{
+public:
+  virtual HRESULT STDMETHODCALLTYPE GetDefault(
+    /* [retval, out] */__RPC__deref_out_opt IStoreContext * * value
+    ) = 0;
+  virtual HRESULT STDMETHODCALLTYPE GetForUser(
+    /* [in] */__RPC__in_opt /*ABI::Windows::System::IUser*/IUnknown * user,
+    /* [retval, out] */__RPC__deref_out_opt IStoreContext * * value
+    ) = 0;
+};
+//---------------------------------------------------------------------------
+class IStoreAppLicense : public IInspectable
+{
+public:
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_SkuStoreId(
+      /* [retval, out] */__RPC__deref_out_opt HSTRING * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsActive(
+      /* [retval, out] */__RPC__out boolean * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsTrial(
+      /* [retval, out] */__RPC__out boolean * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_ExpirationDate(
+      /* [retval, out] */__RPC__out /*ABI::Windows::Foundation::DateTime*/void * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_ExtendedJsonData(
+      /* [retval, out] */__RPC__deref_out_opt HSTRING * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_AddOnLicenses(
+      /* [retval, out] */__RPC__deref_out_opt /*__FIMapView_2_HSTRING_Windows__CServices__CStore__CStoreLicense*/IUnknown * * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_TrialTimeRemaining(
+      /* [retval, out] */__RPC__out /*ABI::Windows::Foundation::TimeSpan*/void * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_IsTrialOwnedByThisUser(
+      /* [retval, out] */__RPC__out boolean * value
+      ) = 0;
+  /* [propget] */virtual HRESULT STDMETHODCALLTYPE get_TrialUniqueId(
+      /* [retval, out] */__RPC__deref_out_opt HSTRING * value
+      ) = 0;
+};
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 #endif  // WinApiH

+ 1 - 0
source/windows/WinMain.cpp

@@ -463,6 +463,7 @@ void __fastcall UpdateStaticUsage()
   Configuration->Usage->Set(L"Windows64", IsWin64());
   Configuration->Usage->Set(L"UWP", IsUWP());
   Configuration->Usage->Set(L"PackageName", GetPackageName());
+  CollectStoreData();
   Configuration->Usage->Set(L"DefaultLocale",
     // See TGUIConfiguration::GetAppliedLocaleHex()
     IntToHex(static_cast<int>(GetDefaultLCID()), 4));