-
Notifications
You must be signed in to change notification settings - Fork 50
/
propset.c
640 lines (539 loc) · 19.9 KB
/
propset.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
/* DirectSound
*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Rob Riggs
* Copyright 2000-2002 TransGaming Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define CONST_VTABLE
#include <stdarg.h>
#include <string.h>
#include <windows.h>
#include <dsound.h>
#include <mmsystem.h>
#include <mmdeviceapi.h>
#include <dsconf.h>
#include <devpropdef.h>
#include "dsound_private.h"
DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e,0xdf1c,0x4efd,0x80,0x20,0x67,0xd1,0x46,0xa8,0x50,0xe0, 14);
static WCHAR *strdupW(const WCHAR *str)
{
WCHAR *ret;
int l = lstrlenW(str);
if(l < 0) return NULL;
ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (l+1)*sizeof(WCHAR));
if(!ret) return NULL;
memcpy(ret, str, l*sizeof(WCHAR));
return ret;
}
typedef struct IKsPrivatePropertySetImpl
{
IKsPropertySet IKsPropertySet_iface;
LONG ref;
} IKsPrivatePropertySetImpl;
static IKsPrivatePropertySetImpl *impl_from_IKsPropertySet(IKsPropertySet *iface)
{
return CONTAINING_RECORD(iface, IKsPrivatePropertySetImpl, IKsPropertySet_iface);
}
/*******************************************************************************
* IKsPrivatePropertySet
*/
/* IUnknown methods */
static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
IKsPropertySet *iface, REFIID riid, void **ppobj)
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IKsPropertySet)) {
*ppobj = iface;
IKsPropertySet_AddRef(iface);
return S_OK;
}
*ppobj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref %lu\n", iface, ref);
return ref;
}
static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref %lu\n", iface, ref);
if(!ref)
{
HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n", This);
}
return ref;
}
struct search_data {
const WCHAR *tgt_name;
GUID *found_guid;
};
static BOOL CALLBACK search_callback(EDataFlow flow, GUID *guid, const WCHAR *desc,
const WCHAR *module, void *user)
{
struct search_data *search = user;
(void)flow;
(void)module;
if(lstrcmpW(desc, search->tgt_name) != 0)
return TRUE;
*search->found_guid = *guid;
return FALSE;
}
static HRESULT DSPROPERTY_WaveDeviceMappingW(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
HRESULT hr;
PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd = pPropData;
struct search_data search;
TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
if (!ppd)
{
WARN("invalid parameter: pPropData\n");
return DSERR_INVALIDPARAM;
}
search.tgt_name = ppd->DeviceName;
search.found_guid = &ppd->DeviceId;
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER)
hr = enumerate_mmdevices(eRender, search_callback, &search);
else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE)
hr = enumerate_mmdevices(eCapture, search_callback, &search);
else
return DSERR_INVALIDPARAM;
if(hr != S_FALSE)
/* device was not found */
return DSERR_INVALIDPARAM;
if (pcbReturned)
*pcbReturned = cbPropData;
return DS_OK;
}
static HRESULT DSPROPERTY_WaveDeviceMappingA(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA *ppd = pPropData;
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA data;
DWORD len;
HRESULT hr;
TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
if (!ppd || !ppd->DeviceName) {
WARN("invalid parameter: ppd=%p\n", ppd);
return DSERR_INVALIDPARAM;
}
data.DataFlow = ppd->DataFlow;
len = MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, NULL, 0);
data.DeviceName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!data.DeviceName)
return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, data.DeviceName, len);
hr = DSPROPERTY_WaveDeviceMappingW(&data, cbPropData, pcbReturned);
HeapFree(GetProcessHeap(), 0, data.DeviceName);
ppd->DeviceId = data.DeviceId;
if (pcbReturned)
*pcbReturned = cbPropData;
return hr;
}
static HRESULT DSPROPERTY_DescriptionW(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA ppd = pPropData;
GUID dev_guid;
IMMDevice *mmdevice;
IPropertyStore *ps;
PROPVARIANT pv;
HRESULT hr, cohr;
TRACE("pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
TRACE("DeviceId=%s\n",debugstr_guid(&ppd->DeviceId));
if ( IsEqualGUID( &ppd->DeviceId , &GUID_NULL) ) {
/* default device of type specified by ppd->DataFlow */
if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) {
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n");
ppd->DeviceId = DSDEVID_DefaultCapture;
} else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) {
TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n");
ppd->DeviceId = DSDEVID_DefaultPlayback;
} else {
WARN("DataFlow=Unknown(%d)\n", ppd->DataFlow);
return E_PROP_ID_UNSUPPORTED;
}
}
DSOAL_GetDeviceID(&ppd->DeviceId, &dev_guid);
cohr = get_mmdevice(eRender, &dev_guid, &mmdevice);
if(!mmdevice){
cohr = get_mmdevice(eCapture, &dev_guid, &mmdevice);
if(!mmdevice)
return DSERR_INVALIDPARAM;
}
hr = IMMDevice_OpenPropertyStore(mmdevice, STGM_READ, &ps);
if(FAILED(hr))
{
release_mmdevice(mmdevice, cohr);
WARN("OpenPropertyStore failed: %08lx\n", hr);
return hr;
}
hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv);
if(FAILED(hr))
{
IPropertyStore_Release(ps);
release_mmdevice(mmdevice, cohr);
WARN("GetValue(FriendlyName) failed: %08lx\n", hr);
return hr;
}
ppd->Description = strdupW(pv.pwszVal);
ppd->Module = strdupW(aldriver_name);
ppd->Interface = strdupW(L"Interface");
ppd->Type = DIRECTSOUNDDEVICE_TYPE_WDM;
PropVariantClear(&pv);
IPropertyStore_Release(ps);
release_mmdevice(mmdevice, cohr);
if (pcbReturned)
{
*pcbReturned = sizeof(*ppd);
TRACE("*pcbReturned=%ld\n", *pcbReturned);
}
return S_OK;
}
static
BOOL CALLBACK enum_callback(EDataFlow flow, GUID *guid, const WCHAR *desc, const WCHAR *module,
void *user)
{
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = user;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
DWORD len;
BOOL ret;
TRACE("%s %ls %ls %p\n", debugstr_guid(guid), desc, module, user);
if(!guid)
return TRUE;
data.Type = DIRECTSOUNDDEVICE_TYPE_WDM;
data.DataFlow = (flow==eCapture) ? DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE :
DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.DeviceId = *guid;
len = lstrlenW(module) + 1;
data.Module = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
memcpy(data.Module, module, len * sizeof(WCHAR));
len = lstrlenW(desc) + 1;
data.Description = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
memcpy(data.Description, desc, len * sizeof(WCHAR));
data.Interface = L"Interface";
ret = ppd->Callback(&data, ppd->Context);
HeapFree(GetProcessHeap(), 0, data.Module);
HeapFree(GetProcessHeap(), 0, data.Description);
return ret;
}
static HRESULT DSPROPERTY_EnumerateW(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = pPropData;
HRESULT hr;
TRACE("(pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
pPropData,cbPropData,pcbReturned);
if (pcbReturned)
*pcbReturned = 0;
if (!ppd || !ppd->Callback)
{
WARN("Invalid ppd %p\n", ppd);
return E_PROP_ID_UNSUPPORTED;
}
hr = enumerate_mmdevices(eRender, enum_callback, ppd);
if(hr == S_OK)
hr = enumerate_mmdevices(eCapture, enum_callback, ppd);
return SUCCEEDED(hr) ? DS_OK : hr;
}
static BOOL DSPROPERTY_descWtoA(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *dataA)
{
static char Interface[] = "Interface";
DWORD modlen, desclen;
modlen = WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, NULL, 0, NULL, NULL);
desclen = WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, NULL, 0, NULL, NULL);
dataA->Type = dataW->Type;
dataA->DataFlow = dataW->DataFlow;
dataA->DeviceId = dataW->DeviceId;
dataA->WaveDeviceId = dataW->WaveDeviceId;
dataA->Interface = Interface;
dataA->Module = HeapAlloc(GetProcessHeap(), 0, modlen);
dataA->Description = HeapAlloc(GetProcessHeap(), 0, desclen);
if (!dataA->Module || !dataA->Description)
{
HeapFree(GetProcessHeap(), 0, dataA->Module);
HeapFree(GetProcessHeap(), 0, dataA->Description);
dataA->Module = dataA->Description = NULL;
return FALSE;
}
WideCharToMultiByte(CP_ACP, 0, dataW->Module, -1, dataA->Module, modlen, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, dataW->Description, -1, dataA->Description, desclen, NULL, NULL);
return TRUE;
}
static void DSPROPERTY_descWto1(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *dataW,
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *data1)
{
data1->DeviceId = dataW->DeviceId;
lstrcpynW(data1->ModuleW, dataW->Module, sizeof(data1->ModuleW)/sizeof(*data1->ModuleW));
lstrcpynW(data1->DescriptionW, dataW->Description, sizeof(data1->DescriptionW)/sizeof(*data1->DescriptionW));
WideCharToMultiByte(CP_ACP, 0, data1->DescriptionW, -1, data1->DescriptionA, sizeof(data1->DescriptionA)-1, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, data1->ModuleW, -1, data1->ModuleA, sizeof(data1->ModuleA)-1, NULL, NULL);
data1->DescriptionA[sizeof(data1->DescriptionA)-1] = 0;
data1->ModuleA[sizeof(data1->ModuleA)-1] = 0;
data1->Type = dataW->Type;
data1->DataFlow = dataW->DataFlow;
data1->WaveDeviceId = data1->Devnode = dataW->WaveDeviceId;
}
static BOOL CALLBACK DSPROPERTY_enumWtoA(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
{
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA descA;
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = data;
BOOL ret;
ret = DSPROPERTY_descWtoA(descW, &descA);
if (!ret)
return FALSE;
ret = ppd->Callback(&descA, ppd->Context);
HeapFree(GetProcessHeap(), 0, descA.Module);
HeapFree(GetProcessHeap(), 0, descA.Description);
return ret;
}
static HRESULT DSPROPERTY_EnumerateA(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned)
{
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA *ppd = pPropData;
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
if (!ppd || !ppd->Callback)
{
WARN("Invalid ppd %p\n", ppd);
return E_PROP_ID_UNSUPPORTED;
}
data.Callback = DSPROPERTY_enumWtoA;
data.Context = ppd;
return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
}
static BOOL CALLBACK DSPROPERTY_enumWto1(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA *descW, void *data)
{
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA desc1;
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = data;
BOOL ret;
DSPROPERTY_descWto1(descW, &desc1);
ret = ppd->Callback(&desc1, ppd->Context);
return ret;
}
static HRESULT DSPROPERTY_Enumerate1(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned)
{
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA *ppd = pPropData;
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
if (!ppd || !ppd->Callback)
{
WARN("Invalid ppd %p\n", ppd);
return E_PROP_ID_UNSUPPORTED;
}
data.Callback = DSPROPERTY_enumWto1;
data.Context = ppd;
return DSPROPERTY_EnumerateW(&data, cbPropData, pcbReturned);
}
static HRESULT DSPROPERTY_DescriptionA(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned)
{
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA *ppd = pPropData;
HRESULT hr;
if(cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA))
return E_INVALIDARG;
if (pcbReturned)
*pcbReturned = sizeof(*ppd);
if (!pPropData)
return S_OK;
data.DeviceId = ppd->DeviceId;
data.DataFlow = ppd->DataFlow;
hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
if (FAILED(hr))
return hr;
if (!DSPROPERTY_descWtoA(&data, ppd))
hr = E_OUTOFMEMORY;
HeapFree(GetProcessHeap(), 0, data.Description);
HeapFree(GetProcessHeap(), 0, data.Module);
HeapFree(GetProcessHeap(), 0, data.Interface);
return hr;
}
static HRESULT DSPROPERTY_Description1(
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned)
{
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA *ppd = pPropData;
HRESULT hr;
if(cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA))
return E_INVALIDARG;
if (pcbReturned)
*pcbReturned = sizeof(*ppd);
if (!pPropData)
return S_OK;
data.DeviceId = ppd->DeviceId;
data.DataFlow = ppd->DataFlow;
hr = DSPROPERTY_DescriptionW(&data, sizeof(data), NULL);
if (FAILED(hr))
return hr;
DSPROPERTY_descWto1(&data, ppd);
HeapFree(GetProcessHeap(), 0, data.Description);
HeapFree(GetProcessHeap(), 0, data.Module);
HeapFree(GetProcessHeap(), 0, data.Interface);
return hr;
}
static HRESULT WINAPI IKsPrivatePropertySetImpl_Get(
LPKSPROPERTYSET iface,
REFGUID guidPropSet,
ULONG dwPropID,
LPVOID pInstanceData,
ULONG cbInstanceData,
LPVOID pPropData,
ULONG cbPropData,
PULONG pcbReturned )
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
switch (dwPropID) {
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
return DSPROPERTY_WaveDeviceMappingA(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
return DSPROPERTY_Description1(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
return DSPROPERTY_Enumerate1(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
return DSPROPERTY_WaveDeviceMappingW(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
return DSPROPERTY_DescriptionA(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
return DSPROPERTY_DescriptionW(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
return DSPROPERTY_EnumerateA(pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
return DSPROPERTY_EnumerateW(pPropData,cbPropData,pcbReturned);
default:
FIXME("unsupported ID: %ld\n",dwPropID);
break;
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
return E_PROP_ID_UNSUPPORTED;
}
static HRESULT WINAPI IKsPrivatePropertySetImpl_Set(
LPKSPROPERTYSET iface,
REFGUID guidPropSet,
ULONG dwPropID,
LPVOID pInstanceData,
ULONG cbInstanceData,
LPVOID pPropData,
ULONG cbPropData )
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
FIXME("(%p,%s,%ld,%p,%ld,%p,%ld), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData);
return E_PROP_ID_UNSUPPORTED;
}
static HRESULT WINAPI IKsPrivatePropertySetImpl_QuerySupport(
LPKSPROPERTYSET iface,
REFGUID guidPropSet,
ULONG dwPropID,
PULONG pTypeSupport )
{
IKsPrivatePropertySetImpl *This = impl_from_IKsPropertySet(iface);
TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
switch (dwPropID) {
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
default:
FIXME("unsupported ID: %ld\n",dwPropID);
break;
}
} else {
FIXME("unsupported property: %s (propid: %lu)\n",debugstr_guid(guidPropSet),dwPropID);
}
return E_PROP_ID_UNSUPPORTED;
}
static IKsPropertySetVtbl ikspvt = {
IKsPrivatePropertySetImpl_QueryInterface,
IKsPrivatePropertySetImpl_AddRef,
IKsPrivatePropertySetImpl_Release,
IKsPrivatePropertySetImpl_Get,
IKsPrivatePropertySetImpl_Set,
IKsPrivatePropertySetImpl_QuerySupport
};
HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **ppv)
{
IKsPrivatePropertySetImpl *iks;
HRESULT hr;
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
iks = HeapAlloc(GetProcessHeap(), 0, sizeof(*iks));
if (!iks) {
WARN("out of memory\n");
return DSERR_OUTOFMEMORY;
}
iks->ref = 1;
iks->IKsPropertySet_iface.lpVtbl = &ikspvt;
hr = IKsPropertySet_QueryInterface(&iks->IKsPropertySet_iface, riid, ppv);
IKsPropertySet_Release(&iks->IKsPropertySet_iface);
return hr;
}