Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
606cb45e
Commit
606cb45e
authored
Sep 14, 2022
by
Julian Klemann
Committed by
Alexandre Julliard
Sep 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.devices.enumeration: Add IDeviceInformationStatics2 stub.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53328
parent
310225a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
52 deletions
+148
-52
main.c
dlls/windows.devices.enumeration/main.c
+106
-52
private.h
dlls/windows.devices.enumeration/private.h
+42
-0
No files found.
dlls/windows.devices.enumeration/main.c
View file @
606cb45e
/* WinRT Windows.Devices.Enumeration implementation
*
* Copyright 2021 Gijs Vermeulen
* Copyright 2022 Julian Klemann for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -24,121 +25,174 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
enumeration
);
static
const
char
*
debugstr_hstring
(
HSTRING
hstr
)
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
);
str
=
WindowsGetStringRawBuffer
(
hstr
,
&
len
);
return
wine_dbgstr_wn
(
str
,
len
);
}
struct
windows_devices_enumeration
struct
device_information_statics
{
IActivationFactory
IActivationFactory_iface
;
IDeviceInformationStatics2
IDeviceInformationStatics2_iface
;
LONG
ref
;
};
static
inline
struct
windows_devices_enumeration
*
impl_from_IActivationFactory
(
IActivationFactory
*
iface
)
static
inline
struct
device_information_statics
*
impl_from_IActivationFactory
(
IActivationFactory
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
windows_devices_enumeration
,
IActivationFactory_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
device_information_statics
,
IActivationFactory_iface
);
}
static
HRESULT
WINAPI
windows_devices_enumeration_QueryInterface
(
IActivationFactory
*
iface
,
REFIID
iid
,
void
**
out
)
static
HRESULT
WINAPI
activation_factory_QueryInterface
(
IActivationFactory
*
iface
,
REFIID
iid
,
void
**
out
)
{
TRACE
(
"iface %p, iid %s, out %p stub!
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
struct
device_information_statics
*
impl
=
impl_from_IActivationFactory
(
iface
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IInspectable
)
||
IsEqualGUID
(
iid
,
&
IID_IAgileObject
)
||
IsEqualGUID
(
iid
,
&
IID_IActivationFactory
))
TRACE
(
"iface %p, iid %s, out %p stub!
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IInspectable
)
||
IsEqualGUID
(
iid
,
&
IID_IActivationFactory
))
{
IUnknown_AddRef
(
iface
);
*
out
=
iface
;
IInspectable_AddRef
(
(
*
out
=
&
impl
->
IActivationFactory_iface
)
);
return
S_OK
;
}
FIXME
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
));
if
(
IsEqualGUID
(
iid
,
&
IID_IDeviceInformationStatics2
))
{
IInspectable_AddRef
(
(
*
out
=
&
impl
->
IDeviceInformationStatics2_iface
)
);
return
S_OK
;
}
FIXME
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
)
);
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
windows_devices_enumeration_AddRef
(
IActivationFactory
*
iface
)
static
ULONG
WINAPI
activation_factory_AddRef
(
IActivationFactory
*
iface
)
{
struct
windows_devices_enumeration
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
struct
device_information_statics
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
windows_devices_enumeration_Release
(
IActivationFactory
*
iface
)
static
ULONG
WINAPI
activation_factory_Release
(
IActivationFactory
*
iface
)
{
struct
windows_devices_enumeration
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
struct
device_information_statics
*
impl
=
impl_from_IActivationFactory
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
TRACE
(
"iface %p, ref %lu.
\n
"
,
iface
,
ref
);
return
ref
;
}
static
HRESULT
WINAPI
windows_devices_enumeration_GetIids
(
IActivationFactory
*
iface
,
ULONG
*
iid_count
,
IID
**
iids
)
static
HRESULT
WINAPI
activation_factory_GetIids
(
IActivationFactory
*
iface
,
ULONG
*
iid_count
,
IID
**
iids
)
{
FIXME
(
"iface %p, iid_count %p, iids %p stub!
\n
"
,
iface
,
iid_count
,
iids
);
FIXME
(
"iface %p, iid_count %p, iids %p stub!
\n
"
,
iface
,
iid_count
,
iids
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
windows_devices_enumeration_GetRuntimeClassName
(
IActivationFactory
*
iface
,
HSTRING
*
class_name
)
static
HRESULT
WINAPI
activation_factory_GetRuntimeClassName
(
IActivationFactory
*
iface
,
HSTRING
*
class_name
)
{
FIXME
(
"iface %p, class_name %p stub!
\n
"
,
iface
,
class_name
);
FIXME
(
"iface %p, class_name %p stub!
\n
"
,
iface
,
class_name
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
windows_devices_enumeration_GetTrustLevel
(
IActivationFactory
*
iface
,
TrustLevel
*
trust_level
)
static
HRESULT
WINAPI
activation_factory_GetTrustLevel
(
IActivationFactory
*
iface
,
TrustLevel
*
trust_level
)
{
FIXME
(
"iface %p, trust_level %p stub!
\n
"
,
iface
,
trust_level
);
FIXME
(
"iface %p, trust_level %p stub!
\n
"
,
iface
,
trust_level
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
windows_devices_enumeration_ActivateInstance
(
IActivationFactory
*
iface
,
IInspectable
**
instance
)
static
HRESULT
WINAPI
activation_factory_ActivateInstance
(
IActivationFactory
*
iface
,
IInspectable
**
instance
)
{
FIXME
(
"iface %p, instance %p stub!
\n
"
,
iface
,
instance
);
FIXME
(
"iface %p, instance %p stub!
\n
"
,
iface
,
instance
);
return
E_NOTIMPL
;
}
static
const
struct
IActivationFactoryVtbl
activation_factory_vtbl
=
{
windows_devices_enumeration
_QueryInterface
,
windows_devices_enumeration
_AddRef
,
windows_devices_enumeration
_Release
,
activation_factory
_QueryInterface
,
activation_factory
_AddRef
,
activation_factory
_Release
,
/* IInspectable methods */
windows_devices_enumeration
_GetIids
,
windows_devices_enumeration
_GetRuntimeClassName
,
windows_devices_enumeration
_GetTrustLevel
,
activation_factory
_GetIids
,
activation_factory
_GetRuntimeClassName
,
activation_factory
_GetTrustLevel
,
/* IActivationFactory methods */
windows_devices_enumeration_ActivateInstance
,
activation_factory_ActivateInstance
,
};
DEFINE_IINSPECTABLE
(
device_statics2
,
IDeviceInformationStatics2
,
struct
device_information_statics
,
IActivationFactory_iface
);
static
HRESULT
WINAPI
device_statics2_GetAqsFilterFromDeviceClass
(
IDeviceInformationStatics2
*
iface
,
DeviceClass
device_class
,
HSTRING
*
filter
)
{
FIXME
(
"iface %p, device_class %u, filter %p stub!
\n
"
,
iface
,
device_class
,
filter
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
device_statics2_CreateFromIdAsync
(
IDeviceInformationStatics2
*
iface
,
HSTRING
device_id
,
IIterable_HSTRING
*
additional_properties
,
DeviceInformationKind
kind
,
IAsyncOperation_DeviceInformation
**
async_operation
)
{
FIXME
(
"iface %p, device_id %s, additional_properties %p, kind %u, async_operation %p stub!
\n
"
,
iface
,
debugstr_hstring
(
device_id
),
additional_properties
,
kind
,
async_operation
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
device_statics2_FindAllAsync
(
IDeviceInformationStatics2
*
iface
,
HSTRING
filter
,
IIterable_HSTRING
*
additional_properties
,
DeviceInformationKind
kind
,
IAsyncOperation_DeviceInformationCollection
**
async_operation
)
{
FIXME
(
"iface %p, filter %s, additional_properties %p, kind %u, async_operation %p stub!
\n
"
,
iface
,
debugstr_hstring
(
filter
),
additional_properties
,
kind
,
async_operation
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
device_statics2_CreateWatcher
(
IDeviceInformationStatics2
*
iface
,
HSTRING
filter
,
IIterable_HSTRING
*
additional_properties
,
DeviceInformationKind
kind
,
IDeviceWatcher
**
watcher
)
{
FIXME
(
"iface %p, filter %s, additional_properties %p, kind %u, watcher %p stub!
\n
"
,
iface
,
debugstr_hstring
(
filter
),
additional_properties
,
kind
,
watcher
);
return
E_NOTIMPL
;
}
static
const
struct
IDeviceInformationStatics2Vtbl
device_statics2_vtbl
=
{
device_statics2_QueryInterface
,
device_statics2_AddRef
,
device_statics2_Release
,
/* IInspectable methods */
device_statics2_GetIids
,
device_statics2_GetRuntimeClassName
,
device_statics2_GetTrustLevel
,
/* IDeviceInformationStatics2 methods */
device_statics2_GetAqsFilterFromDeviceClass
,
device_statics2_CreateFromIdAsync
,
device_statics2_FindAllAsync
,
device_statics2_CreateWatcher
};
static
struct
windows_devices_enumeration
windows_devices_enumeration
=
static
struct
device_information_statics
device_information_statics
=
{
{
&
activation_factory_vtbl
},
{
&
device_statics2_vtbl
},
1
};
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
clsid
,
REFIID
riid
,
void
**
out
)
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
);
FIXME
(
"clsid %s, riid %s, out %p stub!
\n
"
,
debugstr_guid
(
clsid
),
debugstr_guid
(
riid
),
out
);
return
CLASS_E_CLASSNOTAVAILABLE
;
}
HRESULT
WINAPI
DllGetActivationFactory
(
HSTRING
classid
,
IActivationFactory
**
factory
)
HRESULT
WINAPI
DllGetActivationFactory
(
HSTRING
classid
,
IActivationFactory
**
factory
)
{
TRACE
(
"classid %s, factory %p.
\n
"
,
debugstr_hstring
(
classid
),
factory
);
*
factory
=
&
windows_devices_enumeration
.
IActivationFactory_iface
;
IUnknown_AddRef
(
*
factory
);
TRACE
(
"classid %s, factory %p.
\n
"
,
debugstr_hstring
(
classid
),
factory
);
*
factory
=
&
device_information_statics
.
IActivationFactory_iface
;
IUnknown_AddRef
(
*
factory
);
return
S_OK
;
}
dlls/windows.devices.enumeration/private.h
View file @
606cb45e
...
...
@@ -37,4 +37,46 @@
#define WIDL_using_Windows_Devices_Enumeration
#include "windows.devices.enumeration.h"
#include "wine/list.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 )
#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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment