193{
194 static const WCHAR not_a_deviceW[] = {
'n',
'o',
't',
'a',
'd',
'e',
'v',
'i',
'c',
'e',0};
195
202
206 {
207 skip(
"mmdevapi not available: 0x%08x\n",
hr);
208 return;
209 }
210
211
212 ref = IMMDeviceEnumerator_AddRef(
mme);
213 ok(
ref == 3,
"Invalid reference count after incrementing: %u\n",
ref);
214 IMMDeviceEnumerator_Release(
mme);
215
219
221 IUnknown_Release(unk);
222
223
224 hr =
CoCreateInstance(&CLSID_MMDeviceEnumerator,
NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (
void**)&mme2);
225 ok(
hr ==
S_OK,
"CoCreateInstance failed: 0x%08x\n",
hr);
226 IMMDeviceEnumerator_Release(mme2);
227 ok(
mme == mme2,
"Pointers are not equal!\n");
228
230 ok(
hr ==
E_POINTER,
"Null pointer on QueryInterface returned %08x\n",
hr);
231
232 hr = IMMDeviceEnumerator_QueryInterface(
mme, &
GUID_NULL, (
void**)&unk);
233 ok(!unk,
"Unk not reset to null after invalid QI\n");
235
236 hr = IMMDeviceEnumerator_GetDevice(
mme, not_a_deviceW,
NULL);
238
241
242 hr = IMMDeviceEnumerator_GetDevice(
mme, not_a_deviceW, &
dev);
244
246 hr = IMMDeviceEnumerator_EnumAudioEndpoints(
mme, 0xffff, DEVICE_STATEMASK_ALL, &col);
248 ok(col ==
NULL,
"Collection pointer non-null on failure\n");
249
250 hr = IMMDeviceEnumerator_EnumAudioEndpoints(
mme,
eAll, DEVICE_STATEMASK_ALL+1, &col);
252
253 hr = IMMDeviceEnumerator_EnumAudioEndpoints(
mme,
eAll, DEVICE_STATEMASK_ALL,
NULL);
255
256 hr = IMMDeviceEnumerator_EnumAudioEndpoints(
mme,
eAll, DEVICE_STATEMASK_ALL, &col);
257 ok(
hr ==
S_OK,
"Valid EnumAudioEndpoints returned 0x%08x\n",
hr);
259 {
260 ok(!!col,
"Returned null pointer\n");
261 if (col)
263 }
264
265 hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(
mme,
NULL);
266 ok(
hr ==
E_POINTER,
"RegisterEndpointNotificationCallback failed: %08x\n",
hr);
267
268 hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(
mme, &
notif);
269 ok(
hr ==
S_OK,
"RegisterEndpointNotificationCallback failed: %08x\n",
hr);
270
271 hr = IMMDeviceEnumerator_RegisterEndpointNotificationCallback(
mme, &
notif);
272 ok(
hr ==
S_OK,
"RegisterEndpointNotificationCallback failed: %08x\n",
hr);
273
274 hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(
mme,
NULL);
275 ok(
hr ==
E_POINTER,
"UnregisterEndpointNotificationCallback failed: %08x\n",
hr);
276
278 ok(
hr == E_NOTFOUND,
"UnregisterEndpointNotificationCallback failed: %08x\n",
hr);
279
280 hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(
mme, &
notif);
281 ok(
hr ==
S_OK,
"UnregisterEndpointNotificationCallback failed: %08x\n",
hr);
282
283 hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(
mme, &
notif);
284 ok(
hr ==
S_OK,
"UnregisterEndpointNotificationCallback failed: %08x\n",
hr);
285
286 hr = IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(
mme, &
notif);
287 ok(
hr == E_NOTFOUND,
"UnregisterEndpointNotificationCallback failed: %08x\n",
hr);
288
289 IMMDeviceEnumerator_Release(
mme);
290}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
static IMMNotificationClient notif
static IMMDeviceEnumerator * mme