ReactOS 0.4.15-dev-8116-gf69e256
playsound.c
Go to the documentation of this file.
1/* -*- tab-width: 8; c-basic-offset: 4 -*- */
2
3/*
4 * MMSYSTEM functions
5 *
6 * Copyright 1993 Martin Ayotte
7 * 1998-2002 Eric Pouech
8 *
9 * Modified for use with ReactOS by Thamatip Chitpong, 2023
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include "winemm.h"
27
28#include <winternl.h>
29
31
32typedef struct tagWINE_PLAYSOUND
33{
34 unsigned bLoop : 1;
35 HMMIO hmmio;
36 HWAVEOUT hWave;
38
41
42static HMMIO get_mmioFromFile(LPCWSTR lpszName)
43{
44 HMMIO ret;
45 WCHAR buf[256];
47
48 ret = mmioOpenW((LPWSTR)lpszName, NULL,
50 if (ret != 0) return ret;
51 if (SearchPathW(NULL, lpszName, L".wav", ARRAY_SIZE(buf), buf, &dummy))
52 {
53 return mmioOpenW(buf, NULL,
55 }
56 return 0;
57}
58
59static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
60{
61 WCHAR str[128];
62 LPWSTR ptr, pszSnd;
63 HMMIO hmmio;
64 HKEY hUserKey, hRegSnd, hRegApp, hScheme, hSnd;
66 BOOL bIsDefault;
67
68 TRACE("searching in SystemSound list for %s\n", debugstr_w(lpszName));
69
70 bIsDefault = (_wcsicmp(lpszName, L"SystemDefault") == 0);
71
72 GetProfileStringW(L"Sounds",
73 bIsDefault ? L"Default" : lpszName,
74 L"",
75 str,
77 if (!*str)
78 goto Next;
79
80 for (ptr = str; *ptr && *ptr != L','; ptr++);
81
82 if (*ptr)
84
86 if (hmmio)
87 return hmmio;
88
89Next:
90 /* we look up the registry under
91 * HKCU\AppEvents\Schemes\Apps\.Default
92 * HKCU\AppEvents\Schemes\Apps<AppName>
93 */
94 err = RegOpenCurrentUser(KEY_READ, &hUserKey);
95 if (err == ERROR_SUCCESS)
96 {
97 err = RegOpenKeyW(hUserKey, L"AppEvents\\Schemes\\Apps", &hRegSnd);
98 RegCloseKey(hUserKey);
99 }
100
101 if (err != ERROR_SUCCESS)
102 goto None;
103
105 {
106 DWORD len;
107
108 err = ERROR_FILE_NOT_FOUND; /* error */
110 if (len > 0 && len < ARRAY_SIZE(str))
111 {
112 for (ptr = str + lstrlenW(str) - 1; ptr >= str; ptr--)
113 {
114 if (*ptr == L'.')
115 *ptr = UNICODE_NULL;
116
117 if (*ptr == L'\\')
118 {
119 err = RegOpenKeyW(hRegSnd, ptr + 1, &hRegApp);
120 break;
121 }
122 }
123 }
124 }
125 else
126 {
127 err = RegOpenKeyW(hRegSnd, L".Default", &hRegApp);
128 }
129
130 RegCloseKey(hRegSnd);
131
132 if (err != ERROR_SUCCESS)
133 goto None;
134
135 err = RegOpenKeyW(hRegApp,
136 bIsDefault ? L".Default" : lpszName,
137 &hScheme);
138
139 RegCloseKey(hRegApp);
140
141 if (err != ERROR_SUCCESS)
142 goto None;
143
144 err = RegOpenKeyW(hScheme, L".Current", &hSnd);
145
146 RegCloseKey(hScheme);
147
148 if (err != ERROR_SUCCESS)
149 goto None;
150
151 count = sizeof(str);
152 err = RegQueryValueExW(hSnd, NULL, 0, &type, (LPBYTE)str, &count);
153
154 RegCloseKey(hSnd);
155
156 if (err != ERROR_SUCCESS || !*str)
157 goto None;
158
159 if (type == REG_EXPAND_SZ)
160 {
162 if (count == 0)
163 goto None;
164
165 pszSnd = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR));
166 if (!pszSnd)
167 goto None;
168
169 if (ExpandEnvironmentStringsW(str, pszSnd, count) == 0)
170 {
171 HeapFree(GetProcessHeap(), 0, pszSnd);
172 goto None;
173 }
174 }
175 else if (type == REG_SZ)
176 {
177 /* The type is REG_SZ, no need to expand */
178 pszSnd = str;
179 }
180 else
181 {
182 /* Invalid type */
183 goto None;
184 }
185
187
188 if (type == REG_EXPAND_SZ)
189 HeapFree(GetProcessHeap(), 0, pszSnd);
190
191 if (hmmio)
192 return hmmio;
193
194None:
195 WARN("can't find SystemSound=%s !\n", debugstr_w(lpszName));
196 return NULL;
197}
198
199static HMMIO PlaySound_GetMMIO(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
200{
201 BOOL bIsDefault = FALSE;
202 HMMIO hmmio = NULL;
203
204 TRACE("SoundName=%s !\n", debugstr_w(pszSound));
205
206 if (fdwSound & SND_MEMORY)
207 {
208 PVOID data;
209 MMIOINFO mminfo;
210
211 /* NOTE: SND_RESOURCE has the SND_MEMORY bit set */
212 if ((fdwSound & SND_RESOURCE) == SND_RESOURCE)
213 {
214 HRSRC hRes;
215 HGLOBAL hGlob;
216
217 hRes = FindResourceW(hMod, pszSound, L"WAVE");
218 hGlob = LoadResource(hMod, hRes);
219 if (!hRes || !hGlob)
220 goto Quit;
221
222 data = LockResource(hGlob);
223 FreeResource(hGlob);
224 if (!data)
225 goto Quit;
226 }
227 else
228 {
229 data = (PVOID)pszSound;
230 }
231
232 ZeroMemory(&mminfo, sizeof(mminfo));
233 mminfo.fccIOProc = FOURCC_MEM;
234 mminfo.pchBuffer = data;
235 mminfo.cchBuffer = -1; /* FIXME: when a resource, could grab real size */
236
237 TRACE("Memory sound %p\n", data);
238
239 hmmio = mmioOpenW(NULL, &mminfo, MMIO_READ);
240 }
241 else if (fdwSound & SND_ALIAS)
242 {
243 LPCWSTR pszName;
244
245 /* NOTE: SND_ALIAS_ID has the SND_ALIAS bit set */
246 if ((fdwSound & SND_ALIAS_ID) == SND_ALIAS_ID)
247 {
248 if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMASTERISK)
249 pszName = L"SystemAsterisk";
250 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMDEFAULT)
251 pszName = L"SystemDefault";
252 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXCLAMATION)
253 pszName = L"SystemExclamation";
254 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMEXIT)
255 pszName = L"SystemExit";
256 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMHAND)
257 pszName = L"SystemHand";
258 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMQUESTION)
259 pszName = L"SystemQuestion";
260 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMSTART)
261 pszName = L"SystemStart";
262 else if (pszSound == (LPCWSTR)SND_ALIAS_SYSTEMWELCOME)
263 pszName = L"SystemWelcome";
264 else
265 goto Quit;
266 }
267 else
268 {
269 pszName = pszSound;
270 }
271
272 bIsDefault = (_wcsicmp(pszName, L"SystemDefault") == 0);
273 hmmio = get_mmioFromProfile(fdwSound, pszName);
274 }
275 else if (fdwSound & SND_FILENAME)
276 {
277 hmmio = get_mmioFromFile(pszSound);
278 }
279 else
280 {
281 hmmio = get_mmioFromProfile(fdwSound, pszSound);
282 if (!hmmio)
283 hmmio = get_mmioFromFile(pszSound);
284 }
285
286Quit:
287 if (!hmmio && !(fdwSound & SND_NODEFAULT))
288 {
289 if (fdwSound & SND_APPLICATION)
290 {
291 if (!bIsDefault)
292 {
293 /* Find application-defined default sound */
294 hmmio = get_mmioFromProfile(fdwSound, L"SystemDefault");
295 if (hmmio)
296 return hmmio;
297 }
298
299 /* Find system default sound */
300 hmmio = get_mmioFromProfile(fdwSound & ~SND_APPLICATION, L"SystemDefault");
301 }
302 else if (!bIsDefault)
303 {
304 hmmio = get_mmioFromProfile(fdwSound, L"SystemDefault");
305 }
306 }
307
308 return hmmio;
309}
310
312{
315};
316
317static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg,
318 DWORD_PTR dwInstance,
319 DWORD_PTR dwParam1, DWORD_PTR dwParam2)
320{
321 struct playsound_data* s = (struct playsound_data*)dwInstance;
322
323 switch (uMsg) {
324 case WOM_OPEN:
325 case WOM_CLOSE:
326 break;
327 case WOM_DONE:
328 InterlockedIncrement(&s->dwEventCount);
329 TRACE("Returning waveHdr=%lx\n", dwParam1);
330 SetEvent(s->hEvent);
331 break;
332 default:
333 ERR("Unknown uMsg=%d\n", uMsg);
334 }
335}
336
338{
339 for (;;) {
340 if (InterlockedDecrement(&s->dwEventCount) >= 0) break;
341 InterlockedIncrement(&s->dwEventCount);
342
344 }
345}
346
347static BOOL PlaySound_IsString(DWORD fdwSound, const void* psz)
348{
349 /* SND_RESOURCE is 0x40004 while
350 * SND_MEMORY is 0x00004
351 */
352 switch (fdwSound & (SND_RESOURCE | SND_ALIAS_ID | SND_FILENAME))
353 {
354 case SND_RESOURCE:
355 return HIWORD(psz) != 0; /* by name or by ID ? */
356
357 case SND_ALIAS_ID:
358 case SND_MEMORY:
359 return FALSE;
360
361 case SND_ALIAS:
362 case SND_FILENAME:
363 case 0:
364 return TRUE;
365
366 default:
367 FIXME("WTF\n");
368 return FALSE;
369 }
370}
371
373{
378 if (wps->hmmio) mmioClose(wps->hmmio, 0);
379 HeapFree(GetProcessHeap(), 0, wps);
380}
381
383 DWORD fdwSound, BOOL bUnicode)
384{
385 BOOL bIsString;
386 LPCWSTR pszSoundW;
387 UNICODE_STRING usBuffer;
388 WINE_PLAYSOUND* wps;
389
390 bIsString = PlaySound_IsString(fdwSound, pszSound);
391
392 if (bIsString && !bUnicode)
393 {
394 RtlCreateUnicodeStringFromAsciiz(&usBuffer, pszSound);
395 if (!usBuffer.Buffer)
396 return NULL;
397
398 pszSoundW = usBuffer.Buffer;
399 }
400 else
401 {
402 pszSoundW = pszSound;
403 }
404
405 wps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wps));
406 if (wps)
407 {
408 /* construct an MMIO stream (either in memory, or from a file) */
409 wps->hmmio = PlaySound_GetMMIO(pszSoundW, hmod, fdwSound);
410 if (!wps->hmmio)
411 {
412 PlaySound_Free(wps);
413 wps = NULL;
414 }
415 }
416
417 if (bIsString && !bUnicode)
418 RtlFreeUnicodeString(&usBuffer);
419
420 return wps;
421}
422
424{
425 BOOL bRet = FALSE;
426 MMCKINFO ckMainRIFF;
427 MMCKINFO mmckInfo;
428 LPWAVEFORMATEX lpWaveFormat = NULL;
429 HWAVEOUT hWave = 0;
430 LPWAVEHDR waveHdr = NULL;
432 struct playsound_data s;
433 LONG r;
434
435 s.hEvent = 0;
436
437 if (mmioDescend(wps->hmmio, &ckMainRIFF, NULL, 0))
438 goto errCleanUp;
439
440 TRACE("ParentChunk ckid=%.4s fccType=%.4s cksize=%08X\n",
441 (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
442
443 if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
444 (ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E')))
445 goto errCleanUp;
446
447 mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
448 if (mmioDescend(wps->hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK))
449 goto errCleanUp;
450
451 TRACE("Chunk Found ckid=%.4s fccType=%08x cksize=%08X\n",
452 (LPSTR)&mmckInfo.ckid, mmckInfo.fccType, mmckInfo.cksize);
453
454 lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
455 if (!lpWaveFormat)
456 goto errCleanUp;
457 r = mmioRead(wps->hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize);
458 if (r < 0 || r < sizeof(PCMWAVEFORMAT))
459 goto errCleanUp;
460
461 TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);
462 TRACE("nChannels=%d\n", lpWaveFormat->nChannels);
463 TRACE("nSamplesPerSec=%d\n", lpWaveFormat->nSamplesPerSec);
464 TRACE("nAvgBytesPerSec=%d\n", lpWaveFormat->nAvgBytesPerSec);
465 TRACE("nBlockAlign=%d\n", lpWaveFormat->nBlockAlign);
466 TRACE("wBitsPerSample=%u !\n", lpWaveFormat->wBitsPerSample);
467
468 /* move to end of 'fmt ' chunk */
469 mmioAscend(wps->hmmio, &mmckInfo, 0);
470
471 mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
472 if (mmioDescend(wps->hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK))
473 goto errCleanUp;
474
475 TRACE("Chunk Found ckid=%.4s fccType=%08x cksize=%08X\n",
476 (LPSTR)&mmckInfo.ckid, mmckInfo.fccType, mmckInfo.cksize);
477
478 s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
479 if (!s.hEvent || bPlaySoundStop)
480 goto errCleanUp;
481
484 goto errCleanUp;
485
486 /* make it so that 3 buffers per second are needed */
487 bufsize = (((lpWaveFormat->nAvgBytesPerSec / 3) - 1) / lpWaveFormat->nBlockAlign + 1) *
488 lpWaveFormat->nBlockAlign;
489 waveHdr = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(WAVEHDR) + 2 * bufsize);
490 if (!waveHdr)
491 goto errCleanUp;
492 waveHdr[0].lpData = (char*)waveHdr + 2 * sizeof(WAVEHDR);
493 waveHdr[1].lpData = (char*)waveHdr + 2 * sizeof(WAVEHDR) + bufsize;
494 waveHdr[0].dwUser = waveHdr[1].dwUser = 0L;
495 waveHdr[0].dwLoops = waveHdr[1].dwLoops = 0L;
496 waveHdr[0].dwFlags = waveHdr[1].dwFlags = 0L;
497 waveHdr[0].dwBufferLength = waveHdr[1].dwBufferLength = bufsize;
498 if (waveOutPrepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR)) ||
499 waveOutPrepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR))) {
500 goto errCleanUp;
501 }
502
503 wps->hWave = hWave;
504 s.dwEventCount = 1L; /* for first buffer */
505 index = 0;
506
507 do {
508 left = mmckInfo.cksize;
509
510 mmioSeek(wps->hmmio, mmckInfo.dwDataOffset, SEEK_SET);
511 while (left)
512 {
513 if (bPlaySoundStop)
514 {
515 wps->bLoop = FALSE;
516 break;
517 }
518 count = mmioRead(wps->hmmio, waveHdr[index].lpData, min(bufsize, left));
519 if (count < 1) break;
520 left -= count;
521 waveHdr[index].dwBufferLength = count;
522 if (waveOutWrite(hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) {
523 index ^= 1;
525 }
526 else {
527 ERR("Aborting play loop, waveOutWrite error\n");
528 wps->bLoop = FALSE;
529 break;
530 }
531 }
532 bRet = TRUE;
533 } while (wps->bLoop);
534
535 PlaySound_WaitDone(&s); /* to balance first buffer */
537
538 waveOutUnprepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR));
539 waveOutUnprepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR));
540
541errCleanUp:
542 TRACE("Done playing sound => %s!\n", bRet ? "ok" : "ko");
543 HeapFree(GetProcessHeap(), 0, lpWaveFormat);
544 if (hWave)
545 {
547 /* the CS prevents a concurrent waveOutReset */
548 wps->hWave = 0;
551 Sleep(100);
552 }
553 CloseHandle(s.hEvent);
554 HeapFree(GetProcessHeap(), 0, waveHdr);
555
556 PlaySound_Free(wps);
557
558 return bRet;
559}
560
562{
563 WINE_PLAYSOUND *wps = (WINE_PLAYSOUND*)lpParameter;
564
565 /* Play the sound */
566 proc_PlaySound(wps);
567
568 return 0;
569}
570
572{
574
575 /* Create a thread to play the sound asynchronously */
577 if (hThread)
578 {
581 return TRUE;
582 }
583
584 /* Error cases */
585 PlaySound_Free(wps);
586 return FALSE;
587}
588
589static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSound, BOOL bUnicode)
590{
591 WINE_PLAYSOUND* wps = NULL;
592
593 TRACE("pszSound='%p' hmod=%p fdwSound=%08X\n",
594 pszSound, hmod, fdwSound);
595
596 /* SND_NOWAIT is ignored in w95/2k/xp. */
597 if ((fdwSound & SND_NOSTOP) && PlaySoundCurrent != NULL)
598 return FALSE;
599
600 /* alloc internal structure, if we need to play something */
601 if (pszSound && !(fdwSound & SND_PURGE))
602 {
603 if (!(wps = PlaySound_AllocAndGetMMIO(pszSound, hmod, fdwSound, bUnicode)))
604 return FALSE;
605 }
606
608 /* since several threads can enter PlaySound in parallel, we're not
609 * sure, at this point, that another thread didn't start a new playsound
610 */
611 while (PlaySoundCurrent != NULL)
612 {
614 /* FIXME: doc says we have to stop all instances of pszSound if it's non
615 * NULL... as of today, we stop all playing instances */
619
623
625 }
626
627 PlaySoundCurrent = wps;
629
630 if (!wps) return TRUE;
631
632 if (fdwSound & SND_ASYNC)
633 {
634 wps->bLoop = (fdwSound & SND_LOOP) ? TRUE : FALSE;
635
636 return proc_PlaySoundAsync(wps);
637 }
638
639 return proc_PlaySound(wps);
640}
641
642/**************************************************************************
643 * PlaySoundA [WINMM.@]
644 */
646{
647 return MULTIMEDIA_PlaySound(pszSoundA, hmod, fdwSound, FALSE);
648}
649
650/**************************************************************************
651 * PlaySoundW [WINMM.@]
652 */
654{
655 return MULTIMEDIA_PlaySound(pszSoundW, hmod, fdwSound, TRUE);
656}
657
658/**************************************************************************
659 * sndPlaySoundA [WINMM.@]
660 */
662{
664 return MULTIMEDIA_PlaySound(pszSoundA, 0, uFlags, FALSE);
665}
666
667/**************************************************************************
668 * sndPlaySoundW [WINMM.@]
669 */
671{
673 return MULTIMEDIA_PlaySound(pszSound, 0, uFlags, TRUE);
674}
675
676/**************************************************************************
677 * mmsystemGetVersion [WINMM.@]
678 */
680{
681 TRACE("3.10 (Win95?)\n");
682 return 0x030a;
683}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:33
@ None
Definition: install.h:14
#define FIXME(fmt,...)
Definition: debug.h:114
#define WARN(fmt,...)
Definition: debug.h:115
#define ERR(fmt,...)
Definition: debug.h:113
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3209
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
UINT uFlags
Definition: api.c:59
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:700
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
INT WINAPI GetProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len)
Definition: profile.c:1267
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
Definition: mmio.c:1205
LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
Definition: mmio.c:836
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
Definition: mmio.c:702
MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, const MMCKINFO *lpckParent, UINT uFlags)
Definition: mmio.c:1107
LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
Definition: mmio.c:733
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
Definition: mmio.c:670
#define INFINITE
Definition: serial.h:102
HWAVEOUT hWave
Definition: main.h:78
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
#define SEEK_SET
Definition: jmemansi.c:26
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define WOM_DONE
Definition: mmsystem.h:183
struct wavehdr_tag WAVEHDR
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
#define FOURCC_RIFF
Definition: mmsystem.h:564
#define WOM_OPEN
Definition: mmsystem.h:181
#define WOM_CLOSE
Definition: mmsystem.h:182
#define MMIO_FINDCHUNK
Definition: mmsystem.h:551
#define SND_ALIAS_SYSTEMEXCLAMATION
Definition: mmsystem.h:174
#define SND_ALIAS_SYSTEMSTART
Definition: mmsystem.h:172
#define SND_ALIAS_SYSTEMDEFAULT
Definition: mmsystem.h:175
#define SND_ALIAS_SYSTEMHAND
Definition: mmsystem.h:170
#define WAVE_MAPPER
Definition: mmsystem.h:187
#define SND_PURGE
Definition: mmsystem.h:164
#define SND_ALIAS_SYSTEMEXIT
Definition: mmsystem.h:171
#define SND_RESOURCE
Definition: mmsystem.h:163
#define MMIO_DENYWRITE
Definition: mmsystem.h:540
#define SND_ALIAS_SYSTEMWELCOME
Definition: mmsystem.h:173
#define SND_FILENAME
Definition: mmsystem.h:162
#define SND_SYNC
Definition: mmsystem.h:153
#define FOURCC_MEM
Definition: mmsystem.h:567
#define SND_ALIAS_ID
Definition: mmsystem.h:161
#define SND_LOOP
Definition: mmsystem.h:157
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define SND_MEMORY
Definition: mmsystem.h:156
#define SND_ALIAS
Definition: mmsystem.h:160
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define SND_ASYNC
Definition: mmsystem.h:154
#define SND_ALIAS_SYSTEMQUESTION
Definition: mmsystem.h:169
#define SND_NOSTOP
Definition: mmsystem.h:158
#define MMIO_READ
Definition: mmsystem.h:535
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
#define SND_NODEFAULT
Definition: mmsystem.h:155
char * HPSTR
Definition: mmsystem.h:1477
#define SND_APPLICATION
Definition: mmsystem.h:165
#define SND_ALIAS_SYSTEMASTERISK
Definition: mmsystem.h:168
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
HANDLE hThread
Definition: wizard.c:28
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
BOOL WINAPI sndPlaySoundW(LPCWSTR pszSound, UINT uFlags)
Definition: playsound.c:670
static WINE_PLAYSOUND * PlaySoundCurrent
Definition: playsound.c:39
static DWORD WINAPI PlaySoundAsyncThreadProc(LPVOID lpParameter)
Definition: playsound.c:561
static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: playsound.c:317
static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
Definition: playsound.c:423
struct tagWINE_PLAYSOUND WINE_PLAYSOUND
static HMMIO get_mmioFromFile(LPCWSTR lpszName)
Definition: playsound.c:42
BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:653
UINT WINAPI mmsystemGetVersion(void)
Definition: playsound.c:679
static void PlaySound_Free(WINE_PLAYSOUND *wps)
Definition: playsound.c:372
static BOOL MULTIMEDIA_PlaySound(const void *pszSound, HMODULE hmod, DWORD fdwSound, BOOL bUnicode)
Definition: playsound.c:589
static WINE_PLAYSOUND * PlaySound_AllocAndGetMMIO(const void *pszSound, HMODULE hmod, DWORD fdwSound, BOOL bUnicode)
Definition: playsound.c:382
BOOL WINAPI sndPlaySoundA(LPCSTR pszSoundA, UINT uFlags)
Definition: playsound.c:661
static HMMIO PlaySound_GetMMIO(LPCWSTR pszSound, HMODULE hMod, DWORD fdwSound)
Definition: playsound.c:199
BOOL WINAPI PlaySoundA(LPCSTR pszSoundA, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:645
static BOOL bPlaySoundStop
Definition: playsound.c:40
static void PlaySound_WaitDone(struct playsound_data *s)
Definition: playsound.c:337
static BOOL proc_PlaySoundAsync(WINE_PLAYSOUND *wps)
Definition: playsound.c:571
static HMMIO get_mmioFromProfile(UINT uFlags, LPCWSTR lpszName)
Definition: playsound.c:59
static BOOL PlaySound_IsString(DWORD fdwSound, const void *psz)
Definition: playsound.c:347
#define err(...)
const WCHAR * str
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TRACE(s)
Definition: solgame.cpp:4
FOURCC ckid
Definition: mmsystem.h:1507
DWORD cksize
Definition: mmsystem.h:1508
DWORD dwDataOffset
Definition: mmsystem.h:1510
FOURCC fccType
Definition: mmsystem.h:1509
LONG cchBuffer
Definition: mmsystem.h:1491
HPSTR pchBuffer
Definition: mmsystem.h:1492
FOURCC fccIOProc
Definition: mmsystem.h:1487
WORD nBlockAlign
Definition: mmreg.h:82
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nChannels
Definition: mmreg.h:79
WORD wFormatTag
Definition: mmreg.h:78
WORD wBitsPerSample
Definition: mmreg.h:83
HANDLE hEvent
Definition: playsound.c:313
LONG dwEventCount
Definition: playsound.c:314
unsigned bLoop
Definition: playsound.c:34
HWAVEOUT hWave
Definition: playsound.c:36
DWORD dwBufferLength
Definition: mmsystem.h:1015
DWORD dwLoops
Definition: mmsystem.h:1019
DWORD dwFlags
Definition: mmsystem.h:1018
DWORD_PTR dwUser
Definition: mmsystem.h:1017
LPSTR lpData
Definition: mmsystem.h:1014
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
void * PVOID
Definition: typedefs.h:50
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
int ret
#define ZeroMemory
Definition: winbase.h:1712
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define THREAD_PRIORITY_TIME_CRITICAL
Definition: winbase.h:281
#define WINAPI
Definition: msvc.h:6
HANDLE psLastEvent
Definition: winmm.c:51
CRITICAL_SECTION WINMM_cs
Definition: winmm.c:53
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2385
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2341
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2307
MMRESULT WINAPI waveOutOpen(LPHWAVEOUT lphWaveOut, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2246
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, WAVEHDR *lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2277
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2257
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185