3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2002 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * Most thread locking is complete. There may be a few race
22 * conditions still lurking.
25 * Implement SetCooperativeLevel properly (need to address focus issues)
26 * Implement DirectSound3DBuffers (stubs in place)
27 * Use hardware 3D support if available
28 * Add critical section locking inside Release and AddRef methods
29 * Handle static buffers - put those in hardware, non-static not in hardware
30 * Hardware DuplicateSoundBuffer
31 * Proper volume calculation for 3d buffers
32 * Remove DS_HEL_FRAGS and use mixer fragment length for it
43 #include <mmdeviceapi.h>
44 #include <devpropdef.h>
46 #include "dsound_private.h"
47 #include "eax-presets.h"
49 #ifndef DECLSPEC_EXPORT
51 #define DECLSPEC_EXPORT __declspec(dllexport)
53 #define DECLSPEC_EXPORT
62 typedef struct DeviceList
{
66 static DeviceList PlaybackDevices
= { NULL
, 0 };
67 static DeviceList CaptureDevices
= { NULL
, 0 };
69 const WCHAR aldriver_name
[] = L
"dsoal-aldrv.dll";
72 const EAXREVERBPROPERTIES EnvironmentDefaults
[EAX_ENVIRONMENT_UNDEFINED
] = {
73 REVERB_PRESET_GENERIC
,
74 REVERB_PRESET_PADDEDCELL
,
76 REVERB_PRESET_BATHROOM
,
77 REVERB_PRESET_LIVINGROOM
,
78 REVERB_PRESET_STONEROOM
,
79 REVERB_PRESET_AUDITORIUM
,
80 REVERB_PRESET_CONCERTHALL
,
84 REVERB_PRESET_CARPETEDHALLWAY
,
85 REVERB_PRESET_HALLWAY
,
86 REVERB_PRESET_STONECORRIDOR
,
90 REVERB_PRESET_MOUNTAINS
,
93 REVERB_PRESET_PARKINGLOT
,
94 REVERB_PRESET_SEWERPIPE
,
95 REVERB_PRESET_UNDERWATER
,
96 REVERB_PRESET_DRUGGED
,
98 REVERB_PRESET_PSYCHOTIC
101 CRITICAL_SECTION openal_crst
;
103 int openal_loaded
= 0;
104 static HANDLE openal_handle
= NULL
;
105 LPALCCREATECONTEXT palcCreateContext
= NULL
;
106 LPALCMAKECONTEXTCURRENT palcMakeContextCurrent
= NULL
;
107 LPALCPROCESSCONTEXT palcProcessContext
= NULL
;
108 LPALCSUSPENDCONTEXT palcSuspendContext
= NULL
;
109 LPALCDESTROYCONTEXT palcDestroyContext
= NULL
;
110 LPALCGETCURRENTCONTEXT palcGetCurrentContext
= NULL
;
111 LPALCGETCONTEXTSDEVICE palcGetContextsDevice
= NULL
;
112 LPALCOPENDEVICE palcOpenDevice
= NULL
;
113 LPALCCLOSEDEVICE palcCloseDevice
= NULL
;
114 LPALCGETERROR palcGetError
= NULL
;
115 LPALCISEXTENSIONPRESENT palcIsExtensionPresent
= NULL
;
116 LPALCGETPROCADDRESS palcGetProcAddress
= NULL
;
117 LPALCGETENUMVALUE palcGetEnumValue
= NULL
;
118 LPALCGETSTRING palcGetString
= NULL
;
119 LPALCGETINTEGERV palcGetIntegerv
= NULL
;
120 LPALCCAPTUREOPENDEVICE palcCaptureOpenDevice
= NULL
;
121 LPALCCAPTURECLOSEDEVICE palcCaptureCloseDevice
= NULL
;
122 LPALCCAPTURESTART palcCaptureStart
= NULL
;
123 LPALCCAPTURESTOP palcCaptureStop
= NULL
;
124 LPALCCAPTURESAMPLES palcCaptureSamples
= NULL
;
125 LPALENABLE palEnable
= NULL
;
126 LPALDISABLE palDisable
= NULL
;
127 LPALISENABLED palIsEnabled
= NULL
;
128 LPALGETSTRING palGetString
= NULL
;
129 LPALGETBOOLEANV palGetBooleanv
= NULL
;
130 LPALGETINTEGERV palGetIntegerv
= NULL
;
131 LPALGETFLOATV palGetFloatv
= NULL
;
132 LPALGETDOUBLEV palGetDoublev
= NULL
;
133 LPALGETBOOLEAN palGetBoolean
= NULL
;
134 LPALGETINTEGER palGetInteger
= NULL
;
135 LPALGETFLOAT palGetFloat
= NULL
;
136 LPALGETDOUBLE palGetDouble
= NULL
;
137 LPALGETERROR palGetError
= NULL
;
138 LPALISEXTENSIONPRESENT palIsExtensionPresent
= NULL
;
139 LPALGETPROCADDRESS palGetProcAddress
= NULL
;
140 LPALGETENUMVALUE palGetEnumValue
= NULL
;
141 LPALLISTENERF palListenerf
= NULL
;
142 LPALLISTENER3F palListener3f
= NULL
;
143 LPALLISTENERFV palListenerfv
= NULL
;
144 LPALLISTENERI palListeneri
= NULL
;
145 LPALLISTENER3I palListener3i
= NULL
;
146 LPALLISTENERIV palListeneriv
= NULL
;
147 LPALGETLISTENERF palGetListenerf
= NULL
;
148 LPALGETLISTENER3F palGetListener3f
= NULL
;
149 LPALGETLISTENERFV palGetListenerfv
= NULL
;
150 LPALGETLISTENERI palGetListeneri
= NULL
;
151 LPALGETLISTENER3I palGetListener3i
= NULL
;
152 LPALGETLISTENERIV palGetListeneriv
= NULL
;
153 LPALGENSOURCES palGenSources
= NULL
;
154 LPALDELETESOURCES palDeleteSources
= NULL
;
155 LPALISSOURCE palIsSource
= NULL
;
156 LPALSOURCEF palSourcef
= NULL
;
157 LPALSOURCE3F palSource3f
= NULL
;
158 LPALSOURCEFV palSourcefv
= NULL
;
159 LPALSOURCEI palSourcei
= NULL
;
160 LPALSOURCE3I palSource3i
= NULL
;
161 LPALSOURCEIV palSourceiv
= NULL
;
162 LPALGETSOURCEF palGetSourcef
= NULL
;
163 LPALGETSOURCE3F palGetSource3f
= NULL
;
164 LPALGETSOURCEFV palGetSourcefv
= NULL
;
165 LPALGETSOURCEI palGetSourcei
= NULL
;
166 LPALGETSOURCE3I palGetSource3i
= NULL
;
167 LPALGETSOURCEIV palGetSourceiv
= NULL
;
168 LPALSOURCEPLAYV palSourcePlayv
= NULL
;
169 LPALSOURCESTOPV palSourceStopv
= NULL
;
170 LPALSOURCEREWINDV palSourceRewindv
= NULL
;
171 LPALSOURCEPAUSEV palSourcePausev
= NULL
;
172 LPALSOURCEPLAY palSourcePlay
= NULL
;
173 LPALSOURCESTOP palSourceStop
= NULL
;
174 LPALSOURCEREWIND palSourceRewind
= NULL
;
175 LPALSOURCEPAUSE palSourcePause
= NULL
;
176 LPALSOURCEQUEUEBUFFERS palSourceQueueBuffers
= NULL
;
177 LPALSOURCEUNQUEUEBUFFERS palSourceUnqueueBuffers
= NULL
;
178 LPALGENBUFFERS palGenBuffers
= NULL
;
179 LPALDELETEBUFFERS palDeleteBuffers
= NULL
;
180 LPALISBUFFER palIsBuffer
= NULL
;
181 LPALBUFFERF palBufferf
= NULL
;
182 LPALBUFFER3F palBuffer3f
= NULL
;
183 LPALBUFFERFV palBufferfv
= NULL
;
184 LPALBUFFERI palBufferi
= NULL
;
185 LPALBUFFER3I palBuffer3i
= NULL
;
186 LPALBUFFERIV palBufferiv
= NULL
;
187 LPALGETBUFFERF palGetBufferf
= NULL
;
188 LPALGETBUFFER3F palGetBuffer3f
= NULL
;
189 LPALGETBUFFERFV palGetBufferfv
= NULL
;
190 LPALGETBUFFERI palGetBufferi
= NULL
;
191 LPALGETBUFFER3I palGetBuffer3i
= NULL
;
192 LPALGETBUFFERIV palGetBufferiv
= NULL
;
193 LPALBUFFERDATA palBufferData
= NULL
;
194 LPALDOPPLERFACTOR palDopplerFactor
= NULL
;
195 LPALDOPPLERVELOCITY palDopplerVelocity
= NULL
;
196 LPALDISTANCEMODEL palDistanceModel
= NULL
;
197 LPALSPEEDOFSOUND palSpeedOfSound
= NULL
;
199 LPEAXSET pEAXSet
= NULL
;
200 LPEAXGET pEAXGet
= NULL
;
201 LPALDEFERUPDATESSOFT palDeferUpdatesSOFT
= NULL
;
202 LPALPROCESSUPDATESSOFT palProcessUpdatesSOFT
= NULL
;
203 LPALBUFFERSTORAGESOFT palBufferStorageSOFT
= NULL
;
204 LPALMAPBUFFERSOFT palMapBufferSOFT
= NULL
;
205 LPALUNMAPBUFFERSOFT palUnmapBufferSOFT
= NULL
;
206 LPALFLUSHMAPPEDBUFFERSOFT palFlushMappedBufferSOFT
= NULL
;
208 LPALCMAKECONTEXTCURRENT set_context
;
209 LPALCGETCURRENTCONTEXT get_context
;
213 static void AL_APIENTRY
wrap_DeferUpdates(void)
214 { alcSuspendContext(alcGetCurrentContext()); }
215 static void AL_APIENTRY
wrap_ProcessUpdates(void)
216 { alcProcessContext(alcGetCurrentContext()); }
218 static void EnterALSectionTLS(ALCcontext
*ctx
);
219 static void LeaveALSectionTLS(void);
220 static void EnterALSectionGlob(ALCcontext
*ctx
);
221 static void LeaveALSectionGlob(void);
224 void (*EnterALSection
)(ALCcontext
*ctx
) = EnterALSectionGlob
;
225 void (*LeaveALSection
)(void) = LeaveALSectionGlob
;
228 static BOOL
load_libopenal(void)
233 str
= getenv("DSOAL_LOGLEVEL");
235 LogLevel
= atoi(str
);
237 openal_handle
= LoadLibraryW(aldriver_name
);
240 ERR("Couldn't load %ls: %lu\n", aldriver_name
, GetLastError());
244 #define LOAD_FUNCPTR(f) do { \
245 union { void *ptr; FARPROC *proc; } func = { &p##f }; \
246 if((*func.proc = GetProcAddress(openal_handle, #f)) == NULL) \
248 ERR("Couldn't lookup %s in %ls\n", #f, aldriver_name); \
253 LOAD_FUNCPTR(alcCreateContext
);
254 LOAD_FUNCPTR(alcMakeContextCurrent
);
255 LOAD_FUNCPTR(alcProcessContext
);
256 LOAD_FUNCPTR(alcSuspendContext
);
257 LOAD_FUNCPTR(alcDestroyContext
);
258 LOAD_FUNCPTR(alcGetCurrentContext
);
259 LOAD_FUNCPTR(alcGetContextsDevice
);
260 LOAD_FUNCPTR(alcOpenDevice
);
261 LOAD_FUNCPTR(alcCloseDevice
);
262 LOAD_FUNCPTR(alcGetError
);
263 LOAD_FUNCPTR(alcIsExtensionPresent
);
264 LOAD_FUNCPTR(alcGetProcAddress
);
265 LOAD_FUNCPTR(alcGetEnumValue
);
266 LOAD_FUNCPTR(alcGetString
);
267 LOAD_FUNCPTR(alcGetIntegerv
);
268 LOAD_FUNCPTR(alcCaptureOpenDevice
);
269 LOAD_FUNCPTR(alcCaptureCloseDevice
);
270 LOAD_FUNCPTR(alcCaptureStart
);
271 LOAD_FUNCPTR(alcCaptureStop
);
272 LOAD_FUNCPTR(alcCaptureSamples
);
273 LOAD_FUNCPTR(alEnable
);
274 LOAD_FUNCPTR(alDisable
);
275 LOAD_FUNCPTR(alIsEnabled
);
276 LOAD_FUNCPTR(alGetString
);
277 LOAD_FUNCPTR(alGetBooleanv
);
278 LOAD_FUNCPTR(alGetIntegerv
);
279 LOAD_FUNCPTR(alGetFloatv
);
280 LOAD_FUNCPTR(alGetDoublev
);
281 LOAD_FUNCPTR(alGetBoolean
);
282 LOAD_FUNCPTR(alGetInteger
);
283 LOAD_FUNCPTR(alGetFloat
);
284 LOAD_FUNCPTR(alGetDouble
);
285 LOAD_FUNCPTR(alGetError
);
286 LOAD_FUNCPTR(alIsExtensionPresent
);
287 LOAD_FUNCPTR(alGetProcAddress
);
288 LOAD_FUNCPTR(alGetEnumValue
);
289 LOAD_FUNCPTR(alListenerf
);
290 LOAD_FUNCPTR(alListener3f
);
291 LOAD_FUNCPTR(alListenerfv
);
292 LOAD_FUNCPTR(alListeneri
);
293 LOAD_FUNCPTR(alListener3i
);
294 LOAD_FUNCPTR(alListeneriv
);
295 LOAD_FUNCPTR(alGetListenerf
);
296 LOAD_FUNCPTR(alGetListener3f
);
297 LOAD_FUNCPTR(alGetListenerfv
);
298 LOAD_FUNCPTR(alGetListeneri
);
299 LOAD_FUNCPTR(alGetListener3i
);
300 LOAD_FUNCPTR(alGetListeneriv
);
301 LOAD_FUNCPTR(alGenSources
);
302 LOAD_FUNCPTR(alDeleteSources
);
303 LOAD_FUNCPTR(alIsSource
);
304 LOAD_FUNCPTR(alSourcef
);
305 LOAD_FUNCPTR(alSource3f
);
306 LOAD_FUNCPTR(alSourcefv
);
307 LOAD_FUNCPTR(alSourcei
);
308 LOAD_FUNCPTR(alSource3i
);
309 LOAD_FUNCPTR(alSourceiv
);
310 LOAD_FUNCPTR(alGetSourcef
);
311 LOAD_FUNCPTR(alGetSource3f
);
312 LOAD_FUNCPTR(alGetSourcefv
);
313 LOAD_FUNCPTR(alGetSourcei
);
314 LOAD_FUNCPTR(alGetSource3i
);
315 LOAD_FUNCPTR(alGetSourceiv
);
316 LOAD_FUNCPTR(alSourcePlayv
);
317 LOAD_FUNCPTR(alSourceStopv
);
318 LOAD_FUNCPTR(alSourceRewindv
);
319 LOAD_FUNCPTR(alSourcePausev
);
320 LOAD_FUNCPTR(alSourcePlay
);
321 LOAD_FUNCPTR(alSourceStop
);
322 LOAD_FUNCPTR(alSourceRewind
);
323 LOAD_FUNCPTR(alSourcePause
);
324 LOAD_FUNCPTR(alSourceQueueBuffers
);
325 LOAD_FUNCPTR(alSourceUnqueueBuffers
);
326 LOAD_FUNCPTR(alGenBuffers
);
327 LOAD_FUNCPTR(alDeleteBuffers
);
328 LOAD_FUNCPTR(alIsBuffer
);
329 LOAD_FUNCPTR(alBufferf
);
330 LOAD_FUNCPTR(alBuffer3f
);
331 LOAD_FUNCPTR(alBufferfv
);
332 LOAD_FUNCPTR(alBufferi
);
333 LOAD_FUNCPTR(alBuffer3i
);
334 LOAD_FUNCPTR(alBufferiv
);
335 LOAD_FUNCPTR(alGetBufferf
);
336 LOAD_FUNCPTR(alGetBuffer3f
);
337 LOAD_FUNCPTR(alGetBufferfv
);
338 LOAD_FUNCPTR(alGetBufferi
);
339 LOAD_FUNCPTR(alGetBuffer3i
);
340 LOAD_FUNCPTR(alGetBufferiv
);
341 LOAD_FUNCPTR(alBufferData
);
342 LOAD_FUNCPTR(alDopplerFactor
);
343 LOAD_FUNCPTR(alDopplerVelocity
);
344 LOAD_FUNCPTR(alDistanceModel
);
345 LOAD_FUNCPTR(alSpeedOfSound
);
349 WARN("Unloading %ls\n", aldriver_name
);
350 if (openal_handle
!= NULL
)
351 FreeLibrary(openal_handle
);
352 openal_handle
= NULL
;
357 TRACE("Loaded %ls\n", aldriver_name
);
359 #define LOAD_FUNCPTR(f) p##f = alcGetProcAddress(NULL, #f)
360 LOAD_FUNCPTR(EAXSet
);
361 LOAD_FUNCPTR(EAXGet
);
362 LOAD_FUNCPTR(alDeferUpdatesSOFT
);
363 LOAD_FUNCPTR(alProcessUpdatesSOFT
);
364 LOAD_FUNCPTR(alBufferStorageSOFT
);
365 LOAD_FUNCPTR(alMapBufferSOFT
);
366 LOAD_FUNCPTR(alUnmapBufferSOFT
);
367 LOAD_FUNCPTR(alFlushMappedBufferSOFT
);
369 if(!palDeferUpdatesSOFT
|| !palProcessUpdatesSOFT
)
371 palDeferUpdatesSOFT
= wrap_DeferUpdates
;
372 palProcessUpdatesSOFT
= wrap_ProcessUpdates
;
375 local_contexts
= alcIsExtensionPresent(NULL
, "ALC_EXT_thread_local_context");
378 TRACE("Found ALC_EXT_thread_local_context\n");
380 set_context
= alcGetProcAddress(NULL
, "alcSetThreadContext");
381 get_context
= alcGetProcAddress(NULL
, "alcGetThreadContext");
382 if(!set_context
|| !get_context
)
384 ERR("TLS advertised but functions not found, disabling thread local contexts\n");
390 set_context
= alcMakeContextCurrent
;
391 get_context
= alcGetCurrentContext
;
395 EnterALSection
= EnterALSectionTLS
;
396 LeaveALSection
= LeaveALSectionTLS
;
403 static void EnterALSectionTLS(ALCcontext
*ctx
)
405 if(LIKELY(ctx
== TlsGetValue(TlsThreadPtr
)))
408 if(LIKELY(set_context(ctx
) != ALC_FALSE
))
409 TlsSetValue(TlsThreadPtr
, ctx
);
412 ERR("Couldn't set current context!!\n");
413 checkALCError(alcGetContextsDevice(ctx
));
416 static void LeaveALSectionTLS(void)
420 static void EnterALSectionGlob(ALCcontext
*ctx
)
422 EnterCriticalSection(&openal_crst
);
423 if(UNLIKELY(alcMakeContextCurrent(ctx
) == ALC_FALSE
))
425 ERR("Couldn't set current context!!\n");
426 checkALCError(alcGetContextsDevice(ctx
));
429 static void LeaveALSectionGlob(void)
431 LeaveCriticalSection(&openal_crst
);
435 static const char *get_device_id(LPCGUID pGuid
)
437 if(IsEqualGUID(&DSDEVID_DefaultPlayback
, pGuid
))
438 return "DSDEVID_DefaultPlayback";
439 if(IsEqualGUID(&DSDEVID_DefaultVoicePlayback
, pGuid
))
440 return "DSDEVID_DefaultVoicePlayback";
441 if(IsEqualGUID(&DSDEVID_DefaultCapture
, pGuid
))
442 return "DSDEVID_DefaultCapture";
443 if(IsEqualGUID(&DSDEVID_DefaultVoiceCapture
, pGuid
))
444 return "DSDEVID_DefaultVoiceCapture";
445 return debugstr_guid(pGuid
);
449 const CLSID CLSID_MMDeviceEnumerator
= {
452 { 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E }
455 const IID IID_IMMDeviceEnumerator
= {
458 { 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6 }
462 static HRESULT
get_mmdevenum(IMMDeviceEnumerator
**devenum
)
466 init_hr
= CoInitialize(NULL
);
468 hr
= CoCreateInstance(&CLSID_MMDeviceEnumerator
, NULL
,
469 CLSCTX_INPROC_SERVER
, &IID_IMMDeviceEnumerator
, (void**)devenum
);
472 if(SUCCEEDED(init_hr
))
475 ERR("CoCreateInstance failed: %08lx\n", hr
);
482 static void release_mmdevenum(IMMDeviceEnumerator
*devenum
, HRESULT init_hr
)
484 IMMDeviceEnumerator_Release(devenum
);
485 if(SUCCEEDED(init_hr
))
489 static HRESULT
get_mmdevice_guid(IMMDevice
*device
, IPropertyStore
*ps
, GUID
*guid
)
495 IPropertyStore_AddRef(ps
);
498 hr
= IMMDevice_OpenPropertyStore(device
, STGM_READ
, &ps
);
501 WARN("OpenPropertyStore failed: %08lx\n", hr
);
506 PropVariantInit(&pv
);
508 hr
= IPropertyStore_GetValue(ps
, &PKEY_AudioEndpoint_GUID
, &pv
);
511 IPropertyStore_Release(ps
);
512 WARN("GetValue(GUID) failed: %08lx\n", hr
);
516 CLSIDFromString(pv
.pwszVal
, guid
);
518 PropVariantClear(&pv
);
519 IPropertyStore_Release(ps
);
525 static BOOL
send_device(IMMDevice
*device
, EDataFlow flow
, DeviceList
*devlist
, PRVTENUMCALLBACK cb
, void *user
)
534 PropVariantInit(&pv
);
536 hr
= IMMDevice_OpenPropertyStore(device
, STGM_READ
, &ps
);
539 WARN("OpenPropertyStore failed: %08lx\n", hr
);
543 hr
= get_mmdevice_guid(device
, ps
, &guid
);
544 if(FAILED(hr
) || (devlist
->Count
> 0 && IsEqualGUID(&devlist
->Guids
[0], &guid
)))
546 IPropertyStore_Release(ps
);
550 hr
= IPropertyStore_GetValue(ps
, (const PROPERTYKEY
*)&DEVPKEY_Device_FriendlyName
, &pv
);
553 IPropertyStore_Release(ps
);
554 WARN("GetValue(FriendlyName) failed: %08lx\n", hr
);
558 dev_count
= devlist
->Count
++;
559 devlist
->Guids
[dev_count
] = guid
;
564 TRACE("Calling back with %s - %ls\n", debugstr_guid(&devlist
->Guids
[dev_count
]),
566 keep_going
= cb(flow
, &devlist
->Guids
[dev_count
], pv
.pwszVal
, aldriver_name
, user
);
569 PropVariantClear(&pv
);
570 IPropertyStore_Release(ps
);
575 HRESULT
get_mmdevice(EDataFlow flow
, const GUID
*tgt
, IMMDevice
**device
)
577 IMMDeviceEnumerator
*devenum
;
578 IMMDeviceCollection
*coll
;
584 init_hr
= get_mmdevenum(&devenum
);
585 if(!devenum
) return init_hr
;
587 hr
= IMMDeviceEnumerator_EnumAudioEndpoints(devenum
, flow
, DEVICE_STATE_ACTIVE
, &coll
);
590 WARN("EnumAudioEndpoints failed: %08lx\n", hr
);
591 release_mmdevenum(devenum
, init_hr
);
595 hr
= IMMDeviceCollection_GetCount(coll
, &count
);
598 IMMDeviceCollection_Release(coll
);
599 release_mmdevenum(devenum
, init_hr
);
600 WARN("GetCount failed: %08lx\n", hr
);
604 for(i
= 0; i
< count
;++i
)
608 hr
= IMMDeviceCollection_Item(coll
, i
, device
);
609 if(FAILED(hr
)) continue;
611 hr
= get_mmdevice_guid(*device
, NULL
, &guid
);
612 if(SUCCEEDED(hr
) && IsEqualGUID(&guid
, tgt
))
614 IMMDeviceCollection_Release(coll
);
615 IMMDeviceEnumerator_Release(devenum
);
619 IMMDevice_Release(*device
);
623 WARN("No device with GUID %s found!\n", debugstr_guid(tgt
));
625 IMMDeviceCollection_Release(coll
);
626 release_mmdevenum(devenum
, init_hr
);
628 return DSERR_INVALIDPARAM
;
631 void release_mmdevice(IMMDevice
*device
, HRESULT init_hr
)
633 IMMDevice_Release(device
);
634 if(SUCCEEDED(init_hr
))
638 /* S_FALSE means the callback returned FALSE at some point
639 * S_OK means the callback always returned TRUE */
640 HRESULT
enumerate_mmdevices(EDataFlow flow
, PRVTENUMCALLBACK cb
, void *user
)
642 static const WCHAR primary_desc
[] = L
"Primary Sound Driver";
644 IMMDeviceEnumerator
*devenum
;
645 IMMDeviceCollection
*coll
;
652 init_hr
= get_mmdevenum(&devenum
);
653 if(!devenum
) return init_hr
;
655 hr
= IMMDeviceEnumerator_EnumAudioEndpoints(devenum
, flow
, DEVICE_STATE_ACTIVE
, &coll
);
658 release_mmdevenum(devenum
, init_hr
);
659 WARN("EnumAudioEndpoints failed: %08lx\n", hr
);
663 hr
= IMMDeviceCollection_GetCount(coll
, &count
);
666 IMMDeviceCollection_Release(coll
);
667 release_mmdevenum(devenum
, init_hr
);
668 WARN("GetCount failed: %08lx\n", hr
);
674 IMMDeviceCollection_Release(coll
);
675 release_mmdevenum(devenum
, init_hr
);
679 devlist
= (flow
==eCapture
) ? &CaptureDevices
: &PlaybackDevices
;
681 HeapFree(GetProcessHeap(), 0, devlist
->Guids
);
683 devlist
->Guids
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
684 sizeof(devlist
->Guids
[0])*count
);
686 TRACE("Calling back with NULL (%ls)\n", primary_desc
);
687 keep_going
= cb(flow
, NULL
, primary_desc
, L
"", user
);
689 /* always send the default device first */
690 hr
= IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum
, flow
, eMultimedia
, &device
);
693 if(!keep_going
) cb
= NULL
;
694 keep_going
= send_device(device
, flow
, devlist
, cb
, user
);
695 IMMDevice_Release(device
);
698 for(i
= 0;i
< count
;++i
)
703 hr
= IMMDeviceCollection_Item(coll
, i
, &device
);
706 WARN("Item failed: %08lx\n", hr
);
710 keep_going
= send_device(device
, flow
, devlist
, cb
, user
);
712 IMMDevice_Release(device
);
714 IMMDeviceCollection_Release(coll
);
716 release_mmdevenum(devenum
, init_hr
);
718 return keep_going
? S_OK
: S_FALSE
;
721 /***************************************************************************
722 * GetDeviceID [DSOUND.9]
724 * Retrieves unique identifier of default device specified
727 * pGuidSrc [I] Address of device GUID.
728 * pGuidDest [O] Address to receive unique device GUID.
732 * Failure: DSERR_INVALIDPARAM
735 * pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
736 * DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
737 * DSDEVID_DefaultVoiceCapture.
738 * Returns pGuidSrc if pGuidSrc is a valid device or the device
739 * GUID for the specified constants.
741 HRESULT WINAPI
DSOAL_GetDeviceID(LPCGUID pGuidSrc
, LPGUID pGuidDest
)
743 IMMDeviceEnumerator
*devenum
;
749 TRACE("(%s, %p)\n", get_device_id(pGuidSrc
), pGuidDest
);
751 if(!pGuidSrc
|| !pGuidDest
)
752 return DSERR_INVALIDPARAM
;
755 if(IsEqualGUID(&DSDEVID_DefaultPlayback
, pGuidSrc
))
757 else if(IsEqualGUID(&DSDEVID_DefaultVoicePlayback
, pGuidSrc
))
758 role
= eCommunications
;
762 if(IsEqualGUID(&DSDEVID_DefaultCapture
, pGuidSrc
))
764 else if(IsEqualGUID(&DSDEVID_DefaultVoiceCapture
, pGuidSrc
))
765 role
= eCommunications
;
768 *pGuidDest
= *pGuidSrc
;
773 init_hr
= get_mmdevenum(&devenum
);
774 if(!devenum
) return init_hr
;
776 hr
= IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum
, flow
, role
, &device
);
779 WARN("GetDefaultAudioEndpoint failed: %08lx\n", hr
);
780 release_mmdevenum(devenum
, init_hr
);
781 return DSERR_NODRIVER
;
784 hr
= get_mmdevice_guid(device
, NULL
, pGuidDest
);
785 IMMDevice_Release(device
);
787 release_mmdevenum(devenum
, init_hr
);
793 struct morecontextW
{
794 LPDSENUMCALLBACKW callW
;
798 static BOOL CALLBACK
w_callback(EDataFlow flow
, LPGUID guid
, LPCWSTR descW
, LPCWSTR modW
, LPVOID data
)
800 struct morecontextW
*context
= data
;
803 return context
->callW(guid
, descW
, modW
, context
->data
);
806 struct morecontextA
{
807 LPDSENUMCALLBACKA callA
;
811 static BOOL CALLBACK
w_to_a_callback(EDataFlow flow
, LPGUID guid
, LPCWSTR descW
, LPCWSTR modW
, LPVOID data
)
813 struct morecontextA
*context
= data
;
819 dlen
= WideCharToMultiByte(CP_ACP
, 0, descW
, -1, NULL
, 0, NULL
, NULL
);
820 mlen
= WideCharToMultiByte(CP_ACP
, 0, modW
, -1, NULL
, 0, NULL
, NULL
);
821 if(dlen
< 0 || mlen
< 0) return FALSE
;
823 descA
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, dlen
+mlen
+2);
824 if(!descA
) return FALSE
;
825 modA
= descA
+ dlen
+1;
827 WideCharToMultiByte(CP_ACP
, 0, descW
, -1, descA
, dlen
, NULL
, NULL
);
828 WideCharToMultiByte(CP_ACP
, 0, modW
, -1, modA
, mlen
, NULL
, NULL
);
830 ret
= context
->callA(guid
, descA
, modA
, context
->data
);
832 HeapFree(GetProcessHeap(), 0, descA
);
836 /***************************************************************************
837 * DirectSoundEnumerateA [DSOUND.2]
839 * Enumerate all DirectSound drivers installed in the system
842 * lpDSEnumCallback [I] Address of callback function.
843 * lpContext [I] Address of user defined context passed to callback function.
847 * Failure: DSERR_INVALIDPARAM
849 HRESULT WINAPI
DSOAL_DirectSoundEnumerateA(
850 LPDSENUMCALLBACKA lpDSEnumCallback
,
853 struct morecontextA ctx
;
856 TRACE("(%p, %p)\n", lpDSEnumCallback
, lpContext
);
858 if(lpDSEnumCallback
== NULL
)
860 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
861 return DSERR_INVALIDPARAM
;
864 ctx
.callA
= lpDSEnumCallback
;
865 ctx
.data
= lpContext
;
867 hr
= enumerate_mmdevices(eRender
, w_to_a_callback
, &ctx
);
868 return SUCCEEDED(hr
) ? DS_OK
: hr
;
872 /***************************************************************************
873 * DirectSoundEnumerateW [DSOUND.3]
875 * Enumerate all DirectSound drivers installed in the system
878 * lpDSEnumCallback [I] Address of callback function.
879 * lpContext [I] Address of user defined context passed to callback function.
883 * Failure: DSERR_INVALIDPARAM
885 HRESULT WINAPI
DSOAL_DirectSoundEnumerateW(
886 LPDSENUMCALLBACKW lpDSEnumCallback
,
889 struct morecontextW ctx
;
892 TRACE("(%p, %p)\n", lpDSEnumCallback
, lpContext
);
894 if(lpDSEnumCallback
== NULL
)
896 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
897 return DSERR_INVALIDPARAM
;
900 ctx
.callW
= lpDSEnumCallback
;
901 ctx
.data
= lpContext
;
903 hr
= enumerate_mmdevices(eRender
, w_callback
, &ctx
);
904 return SUCCEEDED(hr
) ? DS_OK
: hr
;
907 /***************************************************************************
908 * DirectSoundCaptureEnumerateA [DSOUND.7]
910 * Enumerate all DirectSound drivers installed in the system.
913 * lpDSEnumCallback [I] Address of callback function.
914 * lpContext [I] Address of user defined context passed to callback function.
918 * Failure: DSERR_INVALIDPARAM
920 HRESULT WINAPI
DSOAL_DirectSoundCaptureEnumerateA(
921 LPDSENUMCALLBACKA lpDSEnumCallback
,
924 struct morecontextA ctx
;
927 TRACE("(%p, %p)\n", lpDSEnumCallback
, lpContext
);
929 if(lpDSEnumCallback
== NULL
)
931 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
932 return DSERR_INVALIDPARAM
;
935 ctx
.callA
= lpDSEnumCallback
;
936 ctx
.data
= lpContext
;
938 hr
= enumerate_mmdevices(eCapture
, w_to_a_callback
, &ctx
);
939 return SUCCEEDED(hr
) ? DS_OK
: hr
;
942 /***************************************************************************
943 * DirectSoundCaptureEnumerateW [DSOUND.8]
945 * Enumerate all DirectSound drivers installed in the system.
948 * lpDSEnumCallback [I] Address of callback function.
949 * lpContext [I] Address of user defined context passed to callback function.
953 * Failure: DSERR_INVALIDPARAM
955 HRESULT WINAPI
DSOAL_DirectSoundCaptureEnumerateW(
956 LPDSENUMCALLBACKW lpDSEnumCallback
,
959 struct morecontextW ctx
;
962 TRACE("(%p, %p)\n", lpDSEnumCallback
, lpContext
);
964 if(lpDSEnumCallback
== NULL
)
966 WARN("invalid parameter: lpDSEnumCallback == NULL\n");
967 return DSERR_INVALIDPARAM
;
970 ctx
.callW
= lpDSEnumCallback
;
971 ctx
.data
= lpContext
;
973 hr
= enumerate_mmdevices(eCapture
, w_callback
, &ctx
);
974 return SUCCEEDED(hr
) ? DS_OK
: hr
;
977 /*******************************************************************************
978 * DirectSoundCreate (DSOUND.1)
980 * Creates and initializes a DirectSound interface.
983 * lpcGUID [I] Address of the GUID that identifies the sound device.
984 * ppDS [O] Address of a variable to receive the interface pointer.
985 * pUnkOuter [I] Must be NULL.
989 * Failure: DSERR_ALLOCATED, DSERR_INVALIDPARAM, DSERR_NOAGGREGATION,
990 * DSERR_NODRIVER, DSERR_OUTOFMEMORY
993 DSOAL_DirectSoundCreate(LPCGUID lpcGUID
, IDirectSound
**ppDS
, IUnknown
*pUnkOuter
)
998 TRACE("(%s, %p, %p)\n", debugstr_guid(lpcGUID
), ppDS
, pUnkOuter
);
1001 WARN("invalid parameter: ppDS == NULL\n");
1002 return DSERR_INVALIDPARAM
;
1006 if (pUnkOuter
!= NULL
) {
1007 WARN("invalid parameter: pUnkOuter != NULL\n");
1008 return DSERR_INVALIDPARAM
;
1011 hr
= DSOUND_Create(&IID_IDirectSound
, &pDS
);
1015 hr
= IDirectSound_Initialize(*ppDS
, lpcGUID
);
1018 IDirectSound_Release(*ppDS
);
1026 /*******************************************************************************
1027 * DirectSoundCreate8 (DSOUND.11)
1029 * Creates and initializes a DirectSound8 interface.
1032 * lpcGUID [I] Address of the GUID that identifies the sound device.
1033 * ppDS [O] Address of a variable to receive the interface pointer.
1034 * pUnkOuter [I] Must be NULL.
1038 * Failure: DSERR_ALLOCATED, DSERR_INVALIDPARAM, DSERR_NOAGGREGATION,
1039 * DSERR_NODRIVER, DSERR_OUTOFMEMORY
1042 DSOAL_DirectSoundCreate8(LPCGUID lpcGUID
, IDirectSound8
**ppDS
, IUnknown
*pUnkOuter
)
1047 TRACE("(%s, %p, %p)\n", debugstr_guid(lpcGUID
), ppDS
, pUnkOuter
);
1050 WARN("invalid parameter: ppDS == NULL\n");
1051 return DSERR_INVALIDPARAM
;
1055 if (pUnkOuter
!= NULL
) {
1056 WARN("invalid parameter: pUnkOuter != NULL\n");
1057 return DSERR_INVALIDPARAM
;
1060 hr
= DSOUND_Create8(&IID_IDirectSound8
, &pDS
);
1064 hr
= IDirectSound8_Initialize(*ppDS
, lpcGUID
);
1067 IDirectSound8_Release(*ppDS
);
1075 /***************************************************************************
1076 * DirectSoundCaptureCreate [DSOUND.6]
1078 * Create and initialize a DirectSoundCapture interface.
1081 * lpcGUID [I] Address of the GUID that identifies the sound capture device.
1082 * lplpDSC [O] Address of a variable to receive the interface pointer.
1083 * pUnkOuter [I] Must be NULL.
1087 * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
1091 * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
1092 * or NULL for the default device or DSDEVID_DefaultCapture or
1093 * DSDEVID_DefaultVoiceCapture.
1095 * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
1098 DSOAL_DirectSoundCaptureCreate(LPCGUID lpcGUID
, IDirectSoundCapture
**ppDSC
, IUnknown
*pUnkOuter
)
1103 TRACE("(%s, %p, %p)\n", debugstr_guid(lpcGUID
), ppDSC
, pUnkOuter
);
1107 WARN("invalid parameter: pUnkOuter != NULL\n");
1108 return DSERR_NOAGGREGATION
;
1113 WARN("invalid parameter: ppDSC == NULL\n");
1114 return DSERR_INVALIDPARAM
;
1118 hr
= DSOUND_CaptureCreate(&IID_IDirectSoundCapture
, &pDSC
);
1122 hr
= IDirectSoundCapture_Initialize(*ppDSC
, lpcGUID
);
1125 IDirectSoundCapture_Release(*ppDSC
);
1133 /***************************************************************************
1134 * DirectSoundCaptureCreate8 [DSOUND.12]
1136 * Create and initialize a DirectSoundCapture interface.
1139 * lpcGUID [I] Address of the GUID that identifies the sound capture device.
1140 * lplpDSC [O] Address of a variable to receive the interface pointer.
1141 * pUnkOuter [I] Must be NULL.
1145 * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
1149 * lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
1150 * or NULL for the default device or DSDEVID_DefaultCapture or
1151 * DSDEVID_DefaultVoiceCapture.
1153 * DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
1156 DSOAL_DirectSoundCaptureCreate8(LPCGUID lpcGUID
, IDirectSoundCapture8
**ppDSC8
, IUnknown
*pUnkOuter
)
1161 TRACE("(%s, %p, %p)\n", debugstr_guid(lpcGUID
), ppDSC8
, pUnkOuter
);
1165 WARN("invalid parameter: pUnkOuter != NULL\n");
1166 return DSERR_NOAGGREGATION
;
1171 WARN("invalid parameter: ppDSC8 == NULL\n");
1172 return DSERR_INVALIDPARAM
;
1176 hr
= DSOUND_CaptureCreate8(&IID_IDirectSoundCapture
, &pDSC8
);
1180 hr
= IDirectSoundCapture_Initialize(*ppDSC8
, lpcGUID
);
1183 IDirectSoundCapture_Release(*ppDSC8
);
1191 /*******************************************************************************
1192 * DirectSound ClassFactory
1195 typedef HRESULT (*FnCreateInstance
)(REFIID riid
, LPVOID
*ppobj
);
1198 IClassFactory IClassFactory_iface
;
1201 FnCreateInstance pfnCreateInstance
;
1202 } IClassFactoryImpl
;
1204 static inline IClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
1206 return CONTAINING_RECORD(iface
, IClassFactoryImpl
, IClassFactory_iface
);
1209 static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface
, REFIID riid
, LPVOID
*ppobj
)
1211 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1212 TRACE("(%p, %s, %p)\n", This
, debugstr_guid(riid
), ppobj
);
1215 if (IsEqualIID(riid
, &IID_IUnknown
) ||
1216 IsEqualIID(riid
, &IID_IClassFactory
))
1219 IUnknown_AddRef(iface
);
1223 return E_NOINTERFACE
;
1226 static ULONG WINAPI
DSCF_AddRef(LPCLASSFACTORY iface
)
1228 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1229 ULONG ref
= InterlockedIncrement(&(This
->ref
));
1230 TRACE("(%p) ref %lu\n", iface
, ref
);
1234 static ULONG WINAPI
DSCF_Release(LPCLASSFACTORY iface
)
1236 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1237 ULONG ref
= InterlockedDecrement(&(This
->ref
));
1238 TRACE("(%p) ref %lu\n", iface
, ref
);
1239 /* static class, won't be freed */
1243 static HRESULT WINAPI
DSCF_CreateInstance(
1244 LPCLASSFACTORY iface
,
1249 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1250 TRACE("(%p, %p, %s, %p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
1253 return CLASS_E_NOAGGREGATION
;
1255 if (ppobj
== NULL
) {
1256 WARN("invalid parameter\n");
1257 return DSERR_INVALIDPARAM
;
1260 return This
->pfnCreateInstance(riid
, ppobj
);
1263 static HRESULT WINAPI
DSCF_LockServer(LPCLASSFACTORY iface
, BOOL dolock
)
1265 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1266 FIXME("(%p, %d) stub!\n", This
, dolock
);
1270 static const IClassFactoryVtbl DSCF_Vtbl
= {
1271 DSCF_QueryInterface
,
1274 DSCF_CreateInstance
,
1278 static IClassFactoryImpl DSOUND_CF
[] = {
1279 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSound
, DSOUND_Create
},
1280 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSound8
, DSOUND_Create8
},
1281 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSoundCapture
, DSOUND_CaptureCreate
},
1282 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSoundCapture8
, DSOUND_CaptureCreate8
},
1283 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSoundFullDuplex
, DSOUND_FullDuplexCreate
},
1284 { {&DSCF_Vtbl
}, 1, &CLSID_DirectSoundPrivate
, IKsPrivatePropertySetImpl_Create
},
1285 { {NULL
}, 0, NULL
, NULL
}
1288 /*******************************************************************************
1289 * DllGetClassObject [DSOUND.@]
1290 * Retrieves class object from a DLL object
1293 * Docs say returns STDAPI
1296 * rclsid [I] CLSID for the class object
1297 * riid [I] Reference to identifier of interface for class object
1298 * ppv [O] Address of variable to receive interface pointer for riid
1302 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
1305 HRESULT WINAPI
DSOAL_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
1308 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
1311 WARN("invalid parameter\n");
1312 return E_INVALIDARG
;
1317 if (!IsEqualIID(riid
, &IID_IClassFactory
) &&
1318 !IsEqualIID(riid
, &IID_IUnknown
)) {
1319 WARN("no interface for %s\n", debugstr_guid(riid
));
1320 return E_NOINTERFACE
;
1323 while (NULL
!= DSOUND_CF
[i
].rclsid
) {
1324 if (IsEqualGUID(rclsid
, DSOUND_CF
[i
].rclsid
)) {
1325 DSCF_AddRef(&DSOUND_CF
[i
].IClassFactory_iface
);
1326 *ppv
= &DSOUND_CF
[i
].IClassFactory_iface
;
1332 WARN("No class found for %s\n", debugstr_guid(rclsid
));
1333 return CLASS_E_CLASSNOTAVAILABLE
;
1337 /*******************************************************************************
1338 * DllCanUnloadNow [DSOUND.4]
1339 * Determines whether the DLL is in use.
1345 HRESULT WINAPI
DSOAL_DllCanUnloadNow(void)
1347 FIXME("(void): stub\n");
1351 /***********************************************************************
1352 * DllMain (DSOUND.init)
1354 DECLSPEC_EXPORT BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
1358 TRACE("(%p, %lu, %p)\n", hInstDLL
, fdwReason
, lpvReserved
);
1362 case DLL_PROCESS_ATTACH
:
1364 if((wstr
=_wgetenv(L
"DSOAL_LOGFILE")) != NULL
&& wstr
[0] != 0)
1366 FILE *f
= _wfopen(wstr
, L
"wt");
1367 if(!f
) ERR("Failed to open log file %ls\n", wstr
);
1371 if(!load_libopenal())
1373 TlsThreadPtr
= TlsAlloc();
1374 InitializeCriticalSection(&openal_crst
);
1375 /* Increase refcount on dsound by 1 */
1376 GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
, (LPCWSTR
)hInstDLL
, &hInstDLL
);
1379 case DLL_THREAD_ATTACH
:
1382 case DLL_THREAD_DETACH
:
1385 case DLL_PROCESS_DETACH
:
1386 HeapFree(GetProcessHeap(), 0, PlaybackDevices
.Guids
);
1387 PlaybackDevices
.Guids
= NULL
;
1388 PlaybackDevices
.Count
= 0;
1389 HeapFree(GetProcessHeap(), 0, CaptureDevices
.Guids
);
1390 CaptureDevices
.Guids
= NULL
;
1391 CaptureDevices
.Count
= 0;
1394 FreeLibrary(openal_handle
);
1395 TlsFree(TlsThreadPtr
);
1396 DeleteCriticalSection(&openal_crst
);
1397 if(LogFile
!= stderr
)
1406 /***********************************************************************
1407 * DllRegisterServer (DSOUND.@)
1409 HRESULT WINAPI
DllRegisterServer(void)
1411 return __wine_register_resources(instance
);
1414 /***********************************************************************
1415 * DllUnregisterServer (DSOUND.@)
1417 HRESULT WINAPI
DllUnregisterServer(void)
1419 return __wine_unregister_resources(instance
);