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
3410ab8b
Commit
3410ab8b
authored
Dec 14, 2009
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Jan 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Add stubs for MMDevEnum with tests.
parent
eae5829e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
3 deletions
+140
-3
devenum.c
dlls/mmdevapi/devenum.c
+121
-1
main.c
dlls/mmdevapi/main.c
+1
-0
mmdevapi.h
dlls/mmdevapi/mmdevapi.h
+1
-0
mmdevenum.c
dlls/mmdevapi/tests/mmdevenum.c
+17
-2
No files found.
dlls/mmdevapi/devenum.c
View file @
3410ab8b
...
...
@@ -33,8 +33,128 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mmdevapi
);
typedef
struct
MMDevEnumImpl
{
IMMDeviceEnumeratorVtbl
*
lpVtbl
;
LONG
ref
;
}
MMDevEnumImpl
;
static
MMDevEnumImpl
*
MMDevEnumerator
;
static
IMMDeviceEnumeratorVtbl
MMDevEnumVtbl
;
HRESULT
MMDevEnum_Create
(
REFIID
riid
,
void
**
ppv
)
{
MMDevEnumImpl
*
This
=
MMDevEnumerator
;
if
(
!
This
)
{
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
*
ppv
=
NULL
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
ref
=
1
;
This
->
lpVtbl
=
&
MMDevEnumVtbl
;
MMDevEnumerator
=
This
;
}
return
IUnknown_QueryInterface
((
IUnknown
*
)
This
,
riid
,
ppv
);
}
void
MMDevEnum_Free
(
void
)
{
HeapFree
(
GetProcessHeap
(),
0
,
MMDevEnumerator
);
MMDevEnumerator
=
NULL
;
}
static
HRESULT
WINAPI
MMDevEnum_QueryInterface
(
IMMDeviceEnumerator
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
if
(
!
ppv
)
return
E_POINTER
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IMMDeviceEnumerator
))
*
ppv
=
This
;
else
*
ppv
=
NULL
;
if
(
!*
ppv
)
return
E_NOINTERFACE
;
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
static
ULONG
WINAPI
MMDevEnum_AddRef
(
IMMDeviceEnumerator
*
iface
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"Refcount now %i
\n
"
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
MMDevEnum_Release
(
IMMDeviceEnumerator
*
iface
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
!
ref
)
MMDevEnum_Free
();
TRACE
(
"Refcount now %i
\n
"
,
ref
);
return
ref
;
}
static
HRESULT
WINAPI
MMDevEnum_EnumAudioEndpoints
(
IMMDeviceEnumerator
*
iface
,
EDataFlow
flow
,
DWORD
mask
,
IMMDeviceCollection
**
devices
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
TRACE
(
"(%p)->(%u,%u,%p)
\n
"
,
This
,
flow
,
mask
,
devices
);
if
(
!
devices
)
return
E_POINTER
;
*
devices
=
NULL
;
if
(
flow
>=
EDataFlow_enum_count
)
return
E_INVALIDARG
;
if
(
mask
&
~
DEVICE_STATEMASK_ALL
)
return
E_INVALIDARG
;
FIXME
(
"stub
\n
"
);
return
E_NOTFOUND
;
}
static
HRESULT
WINAPI
MMDevEnum_GetDefaultAudioEndpoint
(
IMMDeviceEnumerator
*
iface
,
EDataFlow
flow
,
ERole
role
,
IMMDevice
**
device
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
TRACE
(
"(%p)->(%u,%u,%p)
\n
"
,
This
,
flow
,
role
,
device
);
FIXME
(
"stub
\n
"
);
return
CLASS_E_CLASSNOTAVAILABLE
;
return
E_NOTFOUND
;
}
static
HRESULT
WINAPI
MMDevEnum_GetDevice
(
IMMDeviceEnumerator
*
iface
,
const
WCHAR
*
name
,
IMMDevice
**
device
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
debugstr_w
(
name
),
device
);
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
MMDevEnum_RegisterEndpointNotificationCallback
(
IMMDeviceEnumerator
*
iface
,
IMMNotificationClient
*
client
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
client
);
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
MMDevEnum_UnregisterEndpointNotificationCallback
(
IMMDeviceEnumerator
*
iface
,
IMMNotificationClient
*
client
)
{
MMDevEnumImpl
*
This
=
(
MMDevEnumImpl
*
)
iface
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
client
);
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
}
static
IMMDeviceEnumeratorVtbl
MMDevEnumVtbl
=
{
MMDevEnum_QueryInterface
,
MMDevEnum_AddRef
,
MMDevEnum_Release
,
MMDevEnum_EnumAudioEndpoints
,
MMDevEnum_GetDefaultAudioEndpoint
,
MMDevEnum_GetDevice
,
MMDevEnum_RegisterEndpointNotificationCallback
,
MMDevEnum_UnregisterEndpointNotificationCallback
};
dlls/mmdevapi/main.c
View file @
3410ab8b
...
...
@@ -44,6 +44,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
DisableThreadLibraryCalls
(
hinstDLL
);
break
;
case
DLL_PROCESS_DETACH
:
MMDevEnum_Free
();
break
;
}
...
...
dlls/mmdevapi/mmdevapi.h
View file @
3410ab8b
...
...
@@ -17,3 +17,4 @@
*/
extern
HRESULT
MMDevEnum_Create
(
REFIID
riid
,
void
**
ppv
);
extern
void
MMDevEnum_Free
(
void
);
dlls/mmdevapi/tests/mmdevenum.c
View file @
3410ab8b
...
...
@@ -26,6 +26,8 @@
#include "dshow.h"
#include "dsound.h"
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
/* Some of the QueryInterface tests are really just to check if I got the IID's right :) */
/* IMMDeviceCollection appears to have no QueryInterface method and instead forwards to mme */
...
...
@@ -82,11 +84,12 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
if
(
dev
)
IUnknown_Release
(
dev
);
}
/* Only do parameter tests here, the actual MMDevice testing should be a separate test */
START_TEST
(
mmdevenum
)
{
HRESULT
hr
;
IUnknown
*
unk
=
NULL
;
IMMDeviceEnumerator
*
mme
;
IMMDeviceEnumerator
*
mme
,
*
mme2
;
ULONG
ref
;
IMMDeviceCollection
*
col
;
...
...
@@ -110,6 +113,18 @@ START_TEST(mmdevenum)
ok
(
(
LONG_PTR
)
mme
==
(
LONG_PTR
)
unk
,
"Pointers are unequal %p/%p
\n
"
,
unk
,
mme
);
IUnknown_Release
(
unk
);
/* Proving that it is static.. */
hr
=
CoCreateInstance
(
&
CLSID_MMDeviceEnumerator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMMDeviceEnumerator
,
(
void
**
)
&
mme2
);
IUnknown_Release
(
mme2
);
ok
(
mme
==
mme2
,
"Pointers are not equal!
\n
"
);
hr
=
IUnknown_QueryInterface
(
mme
,
&
IID_IUnknown
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Null pointer on QueryInterface returned %08x
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
mme
,
&
GUID_NULL
,
(
void
**
)
&
unk
);
ok
(
!
unk
,
"Unk not reset to null after invalid QI
\n
"
);
ok
(
hr
==
E_NOINTERFACE
,
"Invalid hr %08x returned on IID_NULL
\n
"
,
hr
);
col
=
(
void
*
)(
LONG_PTR
)
0x12345678
;
hr
=
IMMDeviceEnumerator_EnumAudioEndpoints
(
mme
,
0xffff
,
DEVICE_STATEMASK_ALL
,
&
col
);
ok
(
hr
==
E_INVALIDARG
,
"Setting invalid data flow returned 0x%08x
\n
"
,
hr
);
...
...
@@ -122,7 +137,7 @@ START_TEST(mmdevenum)
ok
(
hr
==
E_POINTER
,
"Invalid pointer returned: 0x%08x
\n
"
,
hr
);
hr
=
IMMDeviceEnumerator_EnumAudioEndpoints
(
mme
,
eAll
,
DEVICE_STATEMASK_ALL
,
&
col
);
ok
(
hr
==
S_OK
,
"Valid EnumAudioEndpoints returned 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
hr
==
S_OK
,
"Valid EnumAudioEndpoints returned 0x%08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
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