Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
91b68432
Commit
91b68432
authored
May 13, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
May 16, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: IMMDeviceEnumerator::GetDevice should fail on unknown device ids.
parent
b9bfc101
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
devenum.c
dlls/mmdevapi/devenum.c
+8
-9
mmdevenum.c
dlls/mmdevapi/tests/mmdevenum.c
+20
-0
No files found.
dlls/mmdevapi/devenum.c
View file @
91b68432
...
...
@@ -932,6 +932,9 @@ static HRESULT WINAPI MMDevEnum_GetDevice(IMMDeviceEnumerator *iface, const WCHA
DWORD
i
=
0
;
IMMDevice
*
dev
=
NULL
;
if
(
!
name
||
!
device
)
return
E_POINTER
;
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
debugstr_w
(
name
),
device
);
for
(
i
=
0
;
i
<
MMDevice_count
;
++
i
)
{
...
...
@@ -942,18 +945,14 @@ static HRESULT WINAPI MMDevEnum_GetDevice(IMMDeviceEnumerator *iface, const WCHA
if
(
str
&&
!
lstrcmpW
(
str
,
name
))
{
CoTaskMemFree
(
str
);
break
;
IUnknown_AddRef
(
dev
);
*
device
=
dev
;
return
S_OK
;
}
CoTaskMemFree
(
str
);
}
if
(
dev
)
{
IUnknown_AddRef
(
dev
);
*
device
=
dev
;
return
S_OK
;
}
WARN
(
"Could not find device %s
\n
"
,
debugstr_w
(
name
));
return
E_NOTFOUND
;
TRACE
(
"Could not find device %s
\n
"
,
debugstr_w
(
name
));
return
E_INVALIDARG
;
}
static
HRESULT
WINAPI
MMDevEnum_RegisterEndpointNotificationCallback
(
IMMDeviceEnumerator
*
iface
,
IMMNotificationClient
*
client
)
...
...
dlls/mmdevapi/tests/mmdevenum.c
View file @
91b68432
...
...
@@ -98,9 +98,17 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
WCHAR
*
id
=
NULL
;
if
(
IMMDevice_GetId
(
dev
,
&
id
)
==
S_OK
)
{
IMMDevice
*
dev2
;
temp
[
sizeof
(
temp
)
-
1
]
=
0
;
WideCharToMultiByte
(
CP_ACP
,
0
,
id
,
-
1
,
temp
,
sizeof
(
temp
)
-
1
,
NULL
,
NULL
);
trace
(
"Device found: %s
\n
"
,
temp
);
hr
=
IMMDeviceEnumerator_GetDevice
(
mme
,
id
,
&
dev2
);
ok
(
hr
==
S_OK
,
"GetDevice failed: %08x
\n
"
,
hr
);
IMMDevice_Release
(
dev2
);
CoTaskMemFree
(
id
);
}
}
...
...
@@ -113,11 +121,14 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
/* Only do parameter tests here, the actual MMDevice testing should be a separate test */
START_TEST
(
mmdevenum
)
{
static
const
WCHAR
not_a_deviceW
[]
=
{
'n'
,
'o'
,
't'
,
'a'
,
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
0
};
HRESULT
hr
;
IUnknown
*
unk
=
NULL
;
IMMDeviceEnumerator
*
mme
,
*
mme2
;
ULONG
ref
;
IMMDeviceCollection
*
col
;
IMMDevice
*
dev
;
CoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
hr
=
CoCreateInstance
(
&
CLSID_MMDeviceEnumerator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMMDeviceEnumerator
,
(
void
**
)
&
mme
);
...
...
@@ -152,6 +163,15 @@ START_TEST(mmdevenum)
ok
(
!
unk
,
"Unk not reset to null after invalid QI
\n
"
);
ok
(
hr
==
E_NOINTERFACE
,
"Invalid hr %08x returned on IID_NULL
\n
"
,
hr
);
hr
=
IMMDeviceEnumerator_GetDevice
(
mme
,
not_a_deviceW
,
NULL
);
ok
(
hr
==
E_POINTER
,
"GetDevice gave wrong error: %08x
\n
"
,
hr
);
hr
=
IMMDeviceEnumerator_GetDevice
(
mme
,
NULL
,
&
dev
);
ok
(
hr
==
E_POINTER
,
"GetDevice gave wrong error: %08x
\n
"
,
hr
);
hr
=
IMMDeviceEnumerator_GetDevice
(
mme
,
not_a_deviceW
,
&
dev
);
ok
(
hr
==
E_INVALIDARG
,
"GetDevice gave wrong error: %08x
\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
);
...
...
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