From: Rémi Bernon rbernon@codeweavers.com
--- MAINTAINERS | 4 ++ configure.ac | 1 + dlls/cryptowinrt/Makefile.in | 2 +- dlls/cryptowinrt/main.c | 9 --- dlls/cryptowinrt/private.h | 44 +----------- dlls/windows.devices.enumeration/Makefile.in | 2 +- dlls/windows.devices.enumeration/main.c | 9 --- dlls/windows.devices.enumeration/private.h | 43 +----------- dlls/windows.gaming.input/Makefile.in | 2 +- dlls/windows.gaming.input/private.h | 41 +---------- dlls/windows.gaming.ui.gamebar/Makefile.in | 2 +- dlls/windows.gaming.ui.gamebar/private.h | 38 +--------- dlls/windows.media.speech/Makefile.in | 2 +- dlls/windows.media.speech/private.h | 41 +---------- dlls/windows.media/Makefile.in | 2 +- dlls/windows.media/captions.c | 9 --- dlls/windows.media/private.h | 40 +---------- dlls/windows.perception.stub/Makefile.in | 2 +- dlls/windows.perception.stub/main.c | 9 --- dlls/windows.perception.stub/private.h | 40 +---------- .../Makefile.in | 2 +- .../main.c | 9 --- .../private.h | 38 +--------- include/Makefile.in | 1 + include/wine/winrt.idl | 70 +++++++++++++++++++ libs/winewinrt/Makefile.in | 4 ++ libs/winewinrt/debug.c | 28 ++++++++ libs/winewinrt/private.h | 35 ++++++++++ 28 files changed, 161 insertions(+), 368 deletions(-) create mode 100644 include/wine/winrt.idl create mode 100644 libs/winewinrt/Makefile.in create mode 100644 libs/winewinrt/debug.c create mode 100644 libs/winewinrt/private.h
diff --git a/MAINTAINERS b/MAINTAINERS index 9d60385414f..99b7ec6f6c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -388,6 +388,10 @@ M: Alexandre Julliard julliard@winehq.org P: Erich E. Hoover erich.e.hoover@wine-staging.com F: server/
+Wine WinRT +M: Rémi Bernon rbernon@codeweavers.com +F: libs/winewinrt/ + Winemaker M: André Zwing nerv@dawncrow.de F: tools/winemaker/ diff --git a/configure.ac b/configure.ac index 35af177b013..3eb27701acf 100644 --- a/configure.ac +++ b/configure.ac @@ -3275,6 +3275,7 @@ WINE_CONFIG_MAKEFILE(libs/tiff) WINE_CONFIG_MAKEFILE(libs/uuid) WINE_CONFIG_MAKEFILE(libs/vkd3d) WINE_CONFIG_MAKEFILE(libs/wbemuuid) +WINE_CONFIG_MAKEFILE(libs/winewinrt) WINE_CONFIG_MAKEFILE(libs/wmcodecdspuuid) WINE_CONFIG_MAKEFILE(libs/xml2) WINE_CONFIG_MAKEFILE(libs/xslt) diff --git a/dlls/cryptowinrt/Makefile.in b/dlls/cryptowinrt/Makefile.in index 6f11a7cd05d..e58476eb6d6 100644 --- a/dlls/cryptowinrt/Makefile.in +++ b/dlls/cryptowinrt/Makefile.in @@ -1,5 +1,5 @@ MODULE = cryptowinrt.dll -IMPORTS = combase bcrypt uuid +IMPORTS = winewinrt combase bcrypt uuid
C_SRCS = \ async.c \ diff --git a/dlls/cryptowinrt/main.c b/dlls/cryptowinrt/main.c index 5f28382eba9..e6f811b5d12 100644 --- a/dlls/cryptowinrt/main.c +++ b/dlls/cryptowinrt/main.c @@ -31,15 +31,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(crypto);
-const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct cryptobuffer_factory { IActivationFactory IActivationFactory_iface; diff --git a/dlls/cryptowinrt/private.h b/dlls/cryptowinrt/private.h index b1c195123f3..0cc2ba507b0 100644 --- a/dlls/cryptowinrt/private.h +++ b/dlls/cryptowinrt/private.h @@ -37,9 +37,9 @@ #define WIDL_using_Windows_Security_Credentials #include "windows.security.credentials.h"
-#include "provider.h" +#include "wine/winrt.h"
-extern const char *debugstr_hstring( HSTRING hstr ); +#include "provider.h"
extern IActivationFactory *credentials_activation_factory;
@@ -47,44 +47,4 @@ typedef HRESULT (WINAPI *async_operation_callback)( IUnknown *invoker, IUnknown extern HRESULT async_operation_boolean_create( IUnknown *invoker, IUnknown *param, async_operation_callback callback, IAsyncOperation_boolean **out );
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) -#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) - #endif diff --git a/dlls/windows.devices.enumeration/Makefile.in b/dlls/windows.devices.enumeration/Makefile.in index e5b492e2bb9..a77eb54987c 100644 --- a/dlls/windows.devices.enumeration/Makefile.in +++ b/dlls/windows.devices.enumeration/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.devices.enumeration.dll -IMPORTS = combase uuid +IMPORTS = winewinrt combase uuid
C_SRCS = \ access.c \ diff --git a/dlls/windows.devices.enumeration/main.c b/dlls/windows.devices.enumeration/main.c index 03bca4f0118..c87240df2db 100644 --- a/dlls/windows.devices.enumeration/main.c +++ b/dlls/windows.devices.enumeration/main.c @@ -25,15 +25,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(enumeration);
-const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - struct device_watcher { IDeviceWatcher IDeviceWatcher_iface; diff --git a/dlls/windows.devices.enumeration/private.h b/dlls/windows.devices.enumeration/private.h index dd06b25926e..d7bd623e499 100644 --- a/dlls/windows.devices.enumeration/private.h +++ b/dlls/windows.devices.enumeration/private.h @@ -38,54 +38,13 @@ #include "windows.devices.enumeration.h"
#include "wine/list.h" +#include "wine/winrt.h"
extern IActivationFactory *device_access_factory;
-extern const char *debugstr_hstring( HSTRING hstr ); - HRESULT typed_event_handlers_append( struct list *list, ITypedEventHandler_IInspectable_IInspectable *handler, EventRegistrationToken *token ); HRESULT typed_event_handlers_remove( struct list *list, EventRegistrationToken *token ); HRESULT typed_event_handlers_notify( struct list *list, IInspectable *sender, IInspectable *args ); HRESULT typed_event_handlers_clear( struct list *list );
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) -#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) - #endif diff --git a/dlls/windows.gaming.input/Makefile.in b/dlls/windows.gaming.input/Makefile.in index 3ec3dd0d864..273587444fb 100644 --- a/dlls/windows.gaming.input/Makefile.in +++ b/dlls/windows.gaming.input/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.gaming.input.dll -IMPORTS = combase uuid user32 dinput8 setupapi hid +IMPORTS = winewinrt combase uuid user32 dinput8 setupapi hid
C_SRCS = \ async.c \ diff --git a/dlls/windows.gaming.input/private.h b/dlls/windows.gaming.input/private.h index f53d5b5bc37..94904cfce8a 100644 --- a/dlls/windows.gaming.input/private.h +++ b/dlls/windows.gaming.input/private.h @@ -41,6 +41,7 @@
#include "wine/debug.h" #include "wine/list.h" +#include "wine/winrt.h"
#include "provider.h"
@@ -82,46 +83,6 @@ extern HRESULT async_operation_boolean_create( IUnknown *invoker, IUnknown *para extern HRESULT async_operation_effect_result_create( IUnknown *invoker, IUnknown *param, async_operation_callback callback, IAsyncOperation_ForceFeedbackLoadEffectResult **out );
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) -#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) - static inline const char *debugstr_vector3( const Vector3 *vector ) { if (!vector) return "(null)"; diff --git a/dlls/windows.gaming.ui.gamebar/Makefile.in b/dlls/windows.gaming.ui.gamebar/Makefile.in index a0eefc4b951..305bde3be3d 100644 --- a/dlls/windows.gaming.ui.gamebar/Makefile.in +++ b/dlls/windows.gaming.ui.gamebar/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.gaming.ui.gamebar.dll -IMPORTS = combase uuid +IMPORTS = winewinrt combase uuid
C_SRCS = \ main.c diff --git a/dlls/windows.gaming.ui.gamebar/private.h b/dlls/windows.gaming.ui.gamebar/private.h index 85f87b56e7b..0dd3a969804 100644 --- a/dlls/windows.gaming.ui.gamebar/private.h +++ b/dlls/windows.gaming.ui.gamebar/private.h @@ -30,40 +30,4 @@ #include "activation.h" #include "windows.gaming.ui.h"
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) +#include "wine/winrt.h" diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 10903cb1d7b..3cf24580732 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.media.speech.dll -IMPORTS = combase uuid +IMPORTS = winewinrt combase uuid
C_SRCS = \ async.c \ diff --git a/dlls/windows.media.speech/private.h b/dlls/windows.media.speech/private.h index e80d73ec1fb..79d39f69b8c 100644 --- a/dlls/windows.media.speech/private.h +++ b/dlls/windows.media.speech/private.h @@ -42,6 +42,7 @@ #include "windows.media.speechrecognition.h"
#include "wine/list.h" +#include "wine/winrt.h"
/* * @@ -86,44 +87,4 @@ HRESULT vector_hstring_create( IVector_HSTRING **out ); HRESULT vector_hstring_create_copy( IIterable_HSTRING *iterable, IVector_HSTRING **out ); HRESULT vector_inspectable_create( const struct vector_iids *iids, IVector_IInspectable **out );
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) -#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface ) - #endif diff --git a/dlls/windows.media/Makefile.in b/dlls/windows.media/Makefile.in index be5012c170f..f1832e43bf5 100644 --- a/dlls/windows.media/Makefile.in +++ b/dlls/windows.media/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.media.dll -IMPORTS = combase +IMPORTS = winewinrt combase
C_SRCS = \ captions.c \ diff --git a/dlls/windows.media/captions.c b/dlls/windows.media/captions.c index b7e07710603..d48445690d8 100644 --- a/dlls/windows.media/captions.c +++ b/dlls/windows.media/captions.c @@ -23,15 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(media);
-const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - struct captions_statics { IActivationFactory IActivationFactory_iface; diff --git a/dlls/windows.media/private.h b/dlls/windows.media/private.h index d6353dede56..1af85adf54b 100644 --- a/dlls/windows.media/private.h +++ b/dlls/windows.media/private.h @@ -37,46 +37,8 @@ #define WIDL_using_Windows_Media_ClosedCaptioning #include "windows.media.closedcaptioning.h"
-extern const char *debugstr_hstring( HSTRING hstr ); +#include "wine/winrt.h"
extern IActivationFactory *captions_factory;
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) - #endif diff --git a/dlls/windows.perception.stub/Makefile.in b/dlls/windows.perception.stub/Makefile.in index c19496cdd66..bca60da63b7 100644 --- a/dlls/windows.perception.stub/Makefile.in +++ b/dlls/windows.perception.stub/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.perception.stub.dll -IMPORTS = combase +IMPORTS = winewinrt combase
C_SRCS = \ main.c \ diff --git a/dlls/windows.perception.stub/main.c b/dlls/windows.perception.stub/main.c index 094b1b60654..5b7ace09332 100644 --- a/dlls/windows.perception.stub/main.c +++ b/dlls/windows.perception.stub/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(perception);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer( hstr, &len ); - return wine_dbgstr_wn( str, len ); -} - HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) { FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); diff --git a/dlls/windows.perception.stub/private.h b/dlls/windows.perception.stub/private.h index a32f8221380..bd0efdaf1c7 100644 --- a/dlls/windows.perception.stub/private.h +++ b/dlls/windows.perception.stub/private.h @@ -35,44 +35,8 @@ #define WIDL_using_Windows_Perception_Spatial_Surfaces #include "windows.perception.spatial.surfaces.h"
-extern IActivationFactory *observer_factory; +#include "wine/winrt.h"
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) +extern IActivationFactory *observer_factory;
#endif diff --git a/dlls/windows.system.profile.systemmanufacturers/Makefile.in b/dlls/windows.system.profile.systemmanufacturers/Makefile.in index 9d07caa287c..8ad1f35e5d2 100644 --- a/dlls/windows.system.profile.systemmanufacturers/Makefile.in +++ b/dlls/windows.system.profile.systemmanufacturers/Makefile.in @@ -1,5 +1,5 @@ MODULE = windows.system.profile.systemmanufacturers.dll -IMPORTS = combase oleaut32 +IMPORTS = winewinrt combase oleaut32
C_SRCS = \ main.c diff --git a/dlls/windows.system.profile.systemmanufacturers/main.c b/dlls/windows.system.profile.systemmanufacturers/main.c index d2feb32054e..ba30d84e00b 100644 --- a/dlls/windows.system.profile.systemmanufacturers/main.c +++ b/dlls/windows.system.profile.systemmanufacturers/main.c @@ -24,15 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(smbios);
-static const char *debugstr_hstring( HSTRING hstr ) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - struct smbios_statics { IActivationFactory IActivationFactory_iface; diff --git a/dlls/windows.system.profile.systemmanufacturers/private.h b/dlls/windows.system.profile.systemmanufacturers/private.h index 374a2829130..a3d5a552d48 100644 --- a/dlls/windows.system.profile.systemmanufacturers/private.h +++ b/dlls/windows.system.profile.systemmanufacturers/private.h @@ -32,40 +32,4 @@
#include "wbemcli.h"
-#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ - static inline impl_type *impl_from( iface_type *iface ) \ - { \ - return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ - } \ - static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ - } \ - static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_AddRef( (IInspectable *)(expr) ); \ - } \ - static ULONG WINAPI pfx##_Release( iface_type *iface ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_Release( (IInspectable *)(expr) ); \ - } \ - static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ - } \ - static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ - } \ - static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ - { \ - impl_type *impl = impl_from( iface ); \ - return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ - } -#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ - DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) +#include "wine/winrt.h" diff --git a/include/Makefile.in b/include/Makefile.in index 27360fa5f21..97d4466d36b 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -882,6 +882,7 @@ SOURCES = \ wine/winedxgi.idl \ wine/wingdi16.h \ wine/winnet16.h \ + wine/winrt.idl \ wine/winuser16.h \ winerror.h \ winevt.h \ diff --git a/include/wine/winrt.idl b/include/wine/winrt.idl new file mode 100644 index 00000000000..e64ae3fc328 --- /dev/null +++ b/include/wine/winrt.idl @@ -0,0 +1,70 @@ +/* WinRT implementation + * + * Copyright 2022 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep header +#endif + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "windows.foundation.idl"; + +extern const char *debugstr_hstring( HSTRING hstr ); + +cpp_quote("#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \") +cpp_quote(" static inline impl_type *impl_from( iface_type *iface ) \") +cpp_quote(" { \") +cpp_quote(" return CONTAINING_RECORD( iface, impl_type, iface_mem ); \") +cpp_quote(" } \") +cpp_quote(" static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \") +cpp_quote(" } \") +cpp_quote(" static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_AddRef( (IInspectable *)(expr) ); \") +cpp_quote(" } \") +cpp_quote(" static ULONG WINAPI pfx##_Release( iface_type *iface ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_Release( (IInspectable *)(expr) ); \") +cpp_quote(" } \") +cpp_quote(" static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \") +cpp_quote(" } \") +cpp_quote(" static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \") +cpp_quote(" } \") +cpp_quote(" static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \") +cpp_quote(" { \") +cpp_quote(" impl_type *impl = impl_from( iface ); \") +cpp_quote(" return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \") +cpp_quote(" }") +cpp_quote("#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \") +cpp_quote(" DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface )") +cpp_quote("#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \") +cpp_quote(" DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface )") diff --git a/libs/winewinrt/Makefile.in b/libs/winewinrt/Makefile.in new file mode 100644 index 00000000000..7c0f2c668d3 --- /dev/null +++ b/libs/winewinrt/Makefile.in @@ -0,0 +1,4 @@ +STATICLIB = libwinewinrt.a + +C_SRCS = \ + debug.c diff --git a/libs/winewinrt/debug.c b/libs/winewinrt/debug.c new file mode 100644 index 00000000000..99f2d28da29 --- /dev/null +++ b/libs/winewinrt/debug.c @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "private.h" + +const char *debugstr_hstring( HSTRING hstr ) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer( hstr, &len ); + return wine_dbgstr_wn( str, len ); +} diff --git a/libs/winewinrt/private.h b/libs/winewinrt/private.h new file mode 100644 index 00000000000..0b7ef8f9a8e --- /dev/null +++ b/libs/winewinrt/private.h @@ -0,0 +1,35 @@ +/* + * Copyright 2022 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stddef.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#define WIDL_using_Windows_Foundation_Numerics +#include "windows.foundation.h" + +#include "wine/debug.h" +#include "wine/list.h" +#include "wine/winrt.h"