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
5e9ec192
Commit
5e9ec192
authored
Dec 14, 2009
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Jan 05, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Add an empty IMMDeviceCollection implementation.
parent
056588ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
3 deletions
+100
-3
devenum.c
dlls/mmdevapi/devenum.c
+96
-2
mmdevenum.c
dlls/mmdevapi/tests/mmdevenum.c
+4
-1
No files found.
dlls/mmdevapi/devenum.c
View file @
5e9ec192
...
@@ -42,6 +42,101 @@ typedef struct MMDevEnumImpl
...
@@ -42,6 +42,101 @@ typedef struct MMDevEnumImpl
static
MMDevEnumImpl
*
MMDevEnumerator
;
static
MMDevEnumImpl
*
MMDevEnumerator
;
static
const
IMMDeviceEnumeratorVtbl
MMDevEnumVtbl
;
static
const
IMMDeviceEnumeratorVtbl
MMDevEnumVtbl
;
typedef
struct
MMDevColImpl
{
const
IMMDeviceCollectionVtbl
*
lpVtbl
;
LONG
ref
;
MMDevEnumImpl
*
parent
;
EDataFlow
flow
;
DWORD
state
;
}
MMDevColImpl
;
static
const
IMMDeviceCollectionVtbl
MMDevColVtbl
;
static
HRESULT
MMDevCol_Create
(
IMMDeviceCollection
**
ppv
,
MMDevEnumImpl
*
parent
,
EDataFlow
flow
,
DWORD
state
)
{
MMDevColImpl
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
*
ppv
=
NULL
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
lpVtbl
=
&
MMDevColVtbl
;
This
->
ref
=
1
;
This
->
parent
=
parent
;
This
->
flow
=
flow
;
This
->
state
=
state
;
*
ppv
=
(
IMMDeviceCollection
*
)
This
;
return
S_OK
;
}
static
void
MMDevCol_Destroy
(
MMDevColImpl
*
This
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
static
HRESULT
WINAPI
MMDevCol_QueryInterface
(
IMMDeviceCollection
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
MMDevColImpl
*
This
=
(
MMDevColImpl
*
)
iface
;
if
(
!
ppv
)
return
E_POINTER
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IMMDeviceCollection
))
*
ppv
=
This
;
else
*
ppv
=
NULL
;
if
(
!*
ppv
)
return
E_NOINTERFACE
;
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
static
ULONG
WINAPI
MMDevCol_AddRef
(
IMMDeviceCollection
*
iface
)
{
MMDevColImpl
*
This
=
(
MMDevColImpl
*
)
iface
;
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"Refcount now %i
\n
"
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
MMDevCol_Release
(
IMMDeviceCollection
*
iface
)
{
MMDevColImpl
*
This
=
(
MMDevColImpl
*
)
iface
;
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"Refcount now %i
\n
"
,
ref
);
if
(
!
ref
)
MMDevCol_Destroy
(
This
);
return
ref
;
}
static
HRESULT
WINAPI
MMDevCol_GetCount
(
IMMDeviceCollection
*
iface
,
UINT
*
numdevs
)
{
MMDevColImpl
*
This
=
(
MMDevColImpl
*
)
iface
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
numdevs
);
if
(
!
numdevs
)
return
E_POINTER
;
*
numdevs
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
MMDevCol_Item
(
IMMDeviceCollection
*
iface
,
UINT
i
,
IMMDevice
**
dev
)
{
MMDevColImpl
*
This
=
(
MMDevColImpl
*
)
iface
;
TRACE
(
"(%p)->(%u, %p)
\n
"
,
This
,
i
,
dev
);
if
(
!
dev
)
return
E_POINTER
;
*
dev
=
NULL
;
return
E_INVALIDARG
;
}
static
const
IMMDeviceCollectionVtbl
MMDevColVtbl
=
{
MMDevCol_QueryInterface
,
MMDevCol_AddRef
,
MMDevCol_Release
,
MMDevCol_GetCount
,
MMDevCol_Item
};
HRESULT
MMDevEnum_Create
(
REFIID
riid
,
void
**
ppv
)
HRESULT
MMDevEnum_Create
(
REFIID
riid
,
void
**
ppv
)
{
{
MMDevEnumImpl
*
This
=
MMDevEnumerator
;
MMDevEnumImpl
*
This
=
MMDevEnumerator
;
...
@@ -111,8 +206,7 @@ static HRESULT WINAPI MMDevEnum_EnumAudioEndpoints(IMMDeviceEnumerator *iface, E
...
@@ -111,8 +206,7 @@ static HRESULT WINAPI MMDevEnum_EnumAudioEndpoints(IMMDeviceEnumerator *iface, E
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
mask
&
~
DEVICE_STATEMASK_ALL
)
if
(
mask
&
~
DEVICE_STATEMASK_ALL
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
FIXME
(
"stub
\n
"
);
return
MMDevCol_Create
(
devices
,
This
,
flow
,
mask
);
return
E_NOTFOUND
;
}
}
static
HRESULT
WINAPI
MMDevEnum_GetDefaultAudioEndpoint
(
IMMDeviceEnumerator
*
iface
,
EDataFlow
flow
,
ERole
role
,
IMMDevice
**
device
)
static
HRESULT
WINAPI
MMDevEnum_GetDefaultAudioEndpoint
(
IMMDeviceEnumerator
*
iface
,
EDataFlow
flow
,
ERole
role
,
IMMDevice
**
device
)
...
...
dlls/mmdevapi/tests/mmdevenum.c
View file @
5e9ec192
...
@@ -45,6 +45,9 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
...
@@ -45,6 +45,9 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
IUnknown_Release
(
col
);
IUnknown_Release
(
col
);
ok
(
ref
==
2
,
"Invalid reference count %u on collection
\n
"
,
ref
);
ok
(
ref
==
2
,
"Invalid reference count %u on collection
\n
"
,
ref
);
hr
=
IUnknown_QueryInterface
(
col
,
&
IID_IUnknown
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Null ppv returns %08x
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
col
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
hr
=
IUnknown_QueryInterface
(
col
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"Cannot query for IID_IUnknown: 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Cannot query for IID_IUnknown: 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
...
@@ -137,7 +140,7 @@ START_TEST(mmdevenum)
...
@@ -137,7 +140,7 @@ START_TEST(mmdevenum)
ok
(
hr
==
E_POINTER
,
"Invalid pointer returned: 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"Invalid pointer returned: 0x%08x
\n
"
,
hr
);
hr
=
IMMDeviceEnumerator_EnumAudioEndpoints
(
mme
,
eAll
,
DEVICE_STATEMASK_ALL
,
&
col
);
hr
=
IMMDeviceEnumerator_EnumAudioEndpoints
(
mme
,
eAll
,
DEVICE_STATEMASK_ALL
,
&
col
);
todo_wine
ok
(
hr
==
S_OK
,
"Valid EnumAudioEndpoints returned 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Valid EnumAudioEndpoints returned 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
ok
(
!!
col
,
"Returned null pointer
\n
"
);
ok
(
!!
col
,
"Returned null pointer
\n
"
);
...
...
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