[vlc-devel] [PATCH] contrib: add the patched windows.storage.h in winstore builds

Steve Lhomme robux4 at ycbcr.xyz
Wed Apr 8 17:00:27 CEST 2020


This is needed so we can access the LocalCacheFolder of the app.

It's currently not available in the mingw64 headers.
---
 ...-IApplicationData2-storage-interface.patch | 170 ++++++++++++++++++
 contrib/src/pthreads/rules.mak                |  16 ++
 2 files changed, 186 insertions(+)
 create mode 100644 contrib/src/pthreads/0001-Add-the-IApplicationData2-storage-interface.patch

diff --git a/contrib/src/pthreads/0001-Add-the-IApplicationData2-storage-interface.patch b/contrib/src/pthreads/0001-Add-the-IApplicationData2-storage-interface.patch
new file mode 100644
index 00000000000..2ff0dfc611a
--- /dev/null
+++ b/contrib/src/pthreads/0001-Add-the-IApplicationData2-storage-interface.patch
@@ -0,0 +1,170 @@
+From 0f7be38e79e27ce8fa0ba5db46fa21319eeea7e3 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Mon, 6 Apr 2020 14:04:41 +0200
+Subject: [PATCH] Add the IApplicationData2 storage interface
+
+It allows getting the LocalCacheFolder
+https://docs.microsoft.com/en-us/uwp/api/windows.storage.applicationdata.localcachefolde
+---
+ mingw-w64-headers/include/windows.storage.h   | 114 ++++++++++++++++++
+ mingw-w64-headers/include/windows.storage.idl |   5 +
+ 2 files changed, 119 insertions(+)
+
+diff --git a/mingw-w64-headers/include/windows.storage.h b/mingw-w64-headers/include/windows.storage.h
+index c0c6c48e..7e4c429b 100644
+--- a/mingw-w64-headers/include/windows.storage.h
++++ b/mingw-w64-headers/include/windows.storage.h
+@@ -42,6 +42,11 @@ typedef interface IApplicationDataContainer IApplicationDataContainer;
+ typedef interface IApplicationData IApplicationData;
+ #endif
+ 
++#ifndef __IApplicationData2_FWD_DEFINED__
++#define __IApplicationData2_FWD_DEFINED__
++typedef interface IApplicationData2 IApplicationData2;
++#endif
++
+ #ifndef __IApplicationDataStatics_FWD_DEFINED__
+ #define __IApplicationDataStatics_FWD_DEFINED__
+ typedef interface IApplicationDataStatics IApplicationDataStatics;
+@@ -107,6 +112,11 @@ typedef interface IStorageFolder IStorageFolder;
+ typedef interface IApplicationData IApplicationData;
+ #endif
+ 
++#ifndef __IApplicationData2_FWD_DEFINED__
++#define __IApplicationData2_FWD_DEFINED__
++typedef interface IApplicationData2 IApplicationData2;
++#endif
++
+ #ifndef __IApplicationDataStatics_FWD_DEFINED__
+ #define __IApplicationDataStatics_FWD_DEFINED__
+ typedef interface IApplicationDataStatics IApplicationDataStatics;
+@@ -1562,6 +1572,110 @@ void __RPC_STUB IApplicationData_RoamingStorageQuota_Stub(
+ 
+ #endif  /* __IApplicationData_INTERFACE_DEFINED__ */
+ 
++/*****************************************************************************
++ * IApplicationData2 interface
++ */
++#ifndef __IApplicationData2_INTERFACE_DEFINED__
++#define __IApplicationData2_INTERFACE_DEFINED__
++
++DEFINE_GUID(IID_IApplicationData2, 0x9e65cd69, 0x0ba3, 0x4e32, 0xbe,0x29, 0xb0,0x2d,0xe6,0x60,0x76,0x38);
++#if defined(__cplusplus) && !defined(CINTERFACE)
++MIDL_INTERFACE("9e65cd69-0ba3-4e32-be29-b02de6607638")
++IApplicationData2 : public IInspectable
++{
++    virtual HRESULT STDMETHODCALLTYPE get_LocalCacheFolder(
++        IStorageFolder **value) = 0;
++
++};
++#ifdef __CRT_UUID_DECL
++__CRT_UUID_DECL(IApplicationData2, 0x9e65cd69, 0x0ba3, 0x4e32, 0xbe,0x29, 0xb0,0x2d,0xe6,0x60,0x76,0x38)
++#endif
++#else
++typedef struct IApplicationData2Vtbl {
++    BEGIN_INTERFACE
++
++    /*** IUnknown methods ***/
++    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
++        IApplicationData2 *This,
++        REFIID riid,
++        void **ppvObject);
++
++    ULONG (STDMETHODCALLTYPE *AddRef)(
++        IApplicationData2 *This);
++
++    ULONG (STDMETHODCALLTYPE *Release)(
++        IApplicationData2 *This);
++
++    /*** IInspectable methods ***/
++    HRESULT (STDMETHODCALLTYPE *GetIids)(
++        IApplicationData2 *This,
++        ULONG *iidCount,
++        IID **iids);
++
++    HRESULT (STDMETHODCALLTYPE *GetRuntimeClassName)(
++        IApplicationData2 *This,
++        HSTRING *className);
++
++    HRESULT (STDMETHODCALLTYPE *GetTrustLevel)(
++        IApplicationData2 *This,
++        TrustLevel *trustLevel);
++
++    /*** IApplicationData2 methods ***/
++    HRESULT (STDMETHODCALLTYPE *get_LocalCacheFolder)(
++        IApplicationData2 *This,
++        IStorageFolder **value);
++
++    END_INTERFACE
++} IApplicationData2Vtbl;
++
++interface IApplicationData2 {
++    CONST_VTBL IApplicationData2Vtbl* lpVtbl;
++};
++
++#ifdef COBJMACROS
++#ifndef WIDL_C_INLINE_WRAPPERS
++/*** IUnknown methods ***/
++#define IApplicationData2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
++#define IApplicationData2_AddRef(This) (This)->lpVtbl->AddRef(This)
++#define IApplicationData2_Release(This) (This)->lpVtbl->Release(This)
++/*** IInspectable methods ***/
++#define IApplicationData2_GetIids(This,iidCount,iids) (This)->lpVtbl->GetIids(This,iidCount,iids)
++#define IApplicationData2_GetRuntimeClassName(This,className) (This)->lpVtbl->GetRuntimeClassName(This,className)
++#define IApplicationData2_GetTrustLevel(This,trustLevel) (This)->lpVtbl->GetTrustLevel(This,trustLevel)
++/*** IApplicationData2 methods ***/
++#define IApplicationData2_get_LocalCacheFolder(This,value) (This)->lpVtbl->get_LocalCacheFolder(This,value)
++#else
++/*** IUnknown methods ***/
++static FORCEINLINE HRESULT IApplicationData2_QueryInterface(IApplicationData2* This,REFIID riid,void **ppvObject) {
++    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
++}
++static FORCEINLINE ULONG IApplicationData2_AddRef(IApplicationData2* This) {
++    return This->lpVtbl->AddRef(This);
++}
++static FORCEINLINE ULONG IApplicationData2_Release(IApplicationData2* This) {
++    return This->lpVtbl->Release(This);
++}
++/*** IInspectable methods ***/
++static FORCEINLINE HRESULT IApplicationData2_GetIids(IApplicationData2* This,ULONG *iidCount,IID **iids) {
++    return This->lpVtbl->GetIids(This,iidCount,iids);
++}
++static FORCEINLINE HRESULT IApplicationData2_GetRuntimeClassName(IApplicationData2* This,HSTRING *className) {
++    return This->lpVtbl->GetRuntimeClassName(This,className);
++}
++static FORCEINLINE HRESULT IApplicationData2_GetTrustLevel(IApplicationData2* This,TrustLevel *trustLevel) {
++    return This->lpVtbl->GetTrustLevel(This,trustLevel);
++}
++/*** IApplicationData2 methods ***/
++static FORCEINLINE HRESULT IApplicationData2_get_LocalCacheFolder(IApplicationData2* This,IStorageFolder **value) {
++    return This->lpVtbl->get_LocalCacheFolder(This,value);
++}
++#endif
++#endif
++
++#endif
++
++#endif  /* __IApplicationData2_INTERFACE_DEFINED__ */
++
+ /*****************************************************************************
+  * IApplicationDataStatics interface
+  */
+diff --git a/mingw-w64-headers/include/windows.storage.idl b/mingw-w64-headers/include/windows.storage.idl
+index da41e66b..61ad0408 100644
+--- a/mingw-w64-headers/include/windows.storage.idl
++++ b/mingw-w64-headers/include/windows.storage.idl
+@@ -158,6 +158,11 @@ namespace Windows {
+       HRESULT RoamingStorageQuota(UINT64* value);
+     }
+ 
++    [uuid(9E65CD69-0BA3-4E32-BE29-B02DE6607638)]
++    interface IApplicationData2 : IInspectable {
++      [propget] HRESULT LocalCacheFolder(IStorageFolder** value);
++    }
++
+     [uuid(5612147B-E843-45E3-94D8-06169E3C8E17)]
+     interface IApplicationDataStatics : IInspectable {
+       [propget] HRESULT Current(IApplicationData** data);
+-- 
+2.26.0.windows.1
+
diff --git a/contrib/src/pthreads/rules.mak b/contrib/src/pthreads/rules.mak
index b91e916ec98..9ec9ffc3b41 100644
--- a/contrib/src/pthreads/rules.mak
+++ b/contrib/src/pthreads/rules.mak
@@ -7,6 +7,13 @@ ifdef HAVE_WIN32
 PKGS += pthreads
 endif
 
+ifndef HAVE_VISUALSTUDIO
+ifdef HAVE_WINSTORE
+PKGS += winrt_headers
+PKGS_ALL += winrt_headers
+endif
+endif
+
 $(TARBALLS)/mingw-w64-v$(WINPTHREADS_VERSION).tar.bz2:
 	$(call download_pkg,$(WINPTHREADS_URL),winpthreads)
 
@@ -14,9 +21,18 @@ $(TARBALLS)/mingw-w64-v$(WINPTHREADS_VERSION).tar.bz2:
 
 pthreads: mingw-w64-v$(WINPTHREADS_VERSION).tar.bz2 .sum-pthreads
 	$(UNPACK)
+	$(APPLY) $(SRC)/pthreads/0001-Add-the-IApplicationData2-storage-interface.patch
 	$(MOVE)
 
 .pthreads: pthreads
 	cd $</mingw-w64-libraries/winpthreads && $(HOSTVARS) ./configure $(HOSTCONF)
 	cd $< && $(MAKE) -C mingw-w64-libraries -C winpthreads install
 	touch $@
+
+.sum-winrt_headers: .sum-pthreads
+	touch $@
+
+.winrt_headers: pthreads
+	mkdir -p -- "$(PREFIX)/include"
+	cd $< && cp mingw-w64-headers/include/windows.storage.h "$(PREFIX)/include"
+	touch $@
-- 
2.17.1



More information about the vlc-devel mailing list