Commit in reactos/lib/winmm on MAIN
Makefile.in+4-31.1 -> 1.2
winehq2ros.patch+11-1421.5 -> 1.6
winmm.c+57-321.9 -> 1.10
winmm_res.rc+1-11.3 -> 1.4
+73-178
4 modified files
Sync to Wine-20040813:
Alexandre Julliard
- Avoid some non-portable makefile constructs, and get rid of the
  ALTNAMES variable.
Robert Reif <reif@earthlink.net>
- Change MIXER_GetDev to take pointer to returned address pointer and
  return one of 3 possible return values rather than an address or
  NULL.
- Adds *GetDevCapsW bad pointer check.
- Adds waveOutGetDevCapsW test.
Filip Navara <xnavara@volny.cz>
- Implementation of mmTaskCreate. Based on patch by Eric Pouech.
- Fallback implementation in waveOut[Un]PrepareHeader.
Marcelo Duarte <wine-devel@bol.com.br>
- Localization of devenum to Portuguese and minor corrections.

reactos/lib/winmm
Makefile.in 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- Makefile.in	25 Feb 2004 20:00:41 -0000	1.1
+++ Makefile.in	14 Aug 2004 20:36:35 -0000	1.2
@@ -5,9 +5,6 @@
 VPATH     = @srcdir@
 MODULE    = winmm.dll
 IMPORTS   = user32 advapi32 kernel32 ntdll
-ALTNAMES  = mmsystem.dll sound.dll
-
-SPEC_SRCS16 = $(ALTNAMES:.dll=.spec)
 
 C_SRCS = \
 	driver.c \
@@ -24,6 +21,10 @@
 	mmsystem.c \
 	sound16.c
 
+SPEC_SRCS16 = \
+	mmsystem.spec \
+	sound.spec
+
 RC_SRCS = winmm_res.rc
 
 SUBDIRS = tests

reactos/lib/winmm
winehq2ros.patch 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- winehq2ros.patch	8 Aug 2004 21:36:20 -0000	1.5
+++ winehq2ros.patch	14 Aug 2004 20:36:35 -0000	1.6
@@ -4,7 +4,7 @@
 retrieving revision 1.58
 diff -u -r1.58 lolvldrv.c
 --- lolvldrv.c	1 Jun 2004 19:40:48 -0000	1.58
-+++ lolvldrv.c	8 Aug 2004 21:46:41 -0000
++++ lolvldrv.c	14 Aug 2004 20:50:50 -0000
 @@ -510,10 +510,12 @@
      case DRV_QUERYDEVICEINTERFACESIZE:
          return MMDRV_Message(mld, uMsg, dwParam1, dwParam2, TRUE);
@@ -45,7 +45,7 @@
 retrieving revision 1.26
 diff -u -r1.26 time.c
 --- time.c	12 Jan 2004 21:03:10 -0000	1.26
-+++ time.c	8 Aug 2004 21:46:42 -0000
++++ time.c	14 Aug 2004 20:50:50 -0000
 @@ -175,14 +175,19 @@
      volatile HANDLE *pActive = (volatile HANDLE *)&TIME_hMMTimer;
      DWORD last_time, cur_time;
@@ -69,22 +69,11 @@
 Index: winmm.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/winmm/winmm.c,v
-retrieving revision 1.38
-diff -u -r1.38 winmm.c
---- winmm.c	30 Jun 2004 18:12:20 -0000	1.38
-+++ winmm.c	8 Aug 2004 21:46:43 -0000
-@@ -102,8 +102,9 @@
- 	 * inside WINMM_IData */
-         CloseHandle(WINMM_IData->psStopEvent);
-         CloseHandle(WINMM_IData->psLastEvent);
-+        WINMM_IData->cs.DebugInfo = NULL;
-         DeleteCriticalSection(&WINMM_IData->cs);
--	HeapFree(GetProcessHeap(), 0, WINMM_IData);
-+        HeapFree(GetProcessHeap(), 0, WINMM_IData);
-         WINMM_IData = NULL;
-     }
- }
-@@ -126,10 +127,12 @@
+retrieving revision 1.41
+diff -u -r1.41 winmm.c
+--- winmm.c	9 Aug 2004 18:45:05 -0000	1.41
++++ winmm.c	14 Aug 2004 20:50:51 -0000
+@@ -126,10 +126,12 @@
          loaded = -1;
          if (h)
          {
@@ -97,133 +86,13 @@
                  loaded = 1;
          }
      }
-@@ -2658,6 +2661,7 @@
- 				 WAVEHDR* lpWaveOutHdr, UINT uSize)
- {
-     LPWINE_MLD		wmld;
-+    UINT		result;
- 
-     TRACE("(%p, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
- 
-@@ -2667,7 +2671,17 @@
-     if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, FALSE)) == NULL)
- 	return MMSYSERR_INVALHANDLE;
- 
--    return MMDRV_Message(wmld, WODM_PREPARE, (DWORD_PTR)lpWaveOutHdr, uSize, TRUE);
-+    if ((result = MMDRV_Message(wmld, WODM_PREPARE, (DWORD_PTR)lpWaveOutHdr,
-+                                uSize, TRUE)) != MMSYSERR_NOTSUPPORTED)
-+        return result;
-+
-+    if (lpWaveOutHdr->dwFlags & WHDR_INQUEUE)
-+	return WAVERR_STILLPLAYING;
-+
-+    lpWaveOutHdr->dwFlags |= WHDR_PREPARED;
-+    lpWaveOutHdr->dwFlags &= ~WHDR_DONE;
-+
-+    return MMSYSERR_NOERROR;
- }
- 
- /**************************************************************************
-@@ -2677,6 +2691,7 @@
- 				   LPWAVEHDR lpWaveOutHdr, UINT uSize)
- {
-     LPWINE_MLD		wmld;
-+    UINT		result;
- 
-     TRACE("(%p, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
- 
-@@ -2690,7 +2705,17 @@
-     if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, FALSE)) == NULL)
- 	return MMSYSERR_INVALHANDLE;
- 
--    return MMDRV_Message(wmld, WODM_UNPREPARE, (DWORD_PTR)lpWaveOutHdr, uSize, TRUE);
-+    if ((result = MMDRV_Message(wmld, WODM_UNPREPARE, (DWORD_PTR)lpWaveOutHdr,
-+                                uSize, TRUE)) != MMSYSERR_NOTSUPPORTED)
-+        return result;
-+
-+    if (lpWaveOutHdr->dwFlags & WHDR_INQUEUE)
-+	return WAVERR_STILLPLAYING;
-+
-+    lpWaveOutHdr->dwFlags &= ~WHDR_PREPARED;
-+    lpWaveOutHdr->dwFlags |= WHDR_DONE;
-+
-+    return MMSYSERR_NOERROR;
- }
- 
- /**************************************************************************
-@@ -3173,4 +3198,50 @@
- 
- 
-     return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
-+}
-+
-+struct mm_starter
-+{
-+    LPTASKCALLBACK      cb;
-+    DWORD               client;
-+    HANDLE              event;
-+};
-+
-+DWORD WINAPI mmTaskRun(void* pmt)
-+{
-+    struct mm_starter mms;
-+
-+    memcpy(&mms, pmt, sizeof(struct mm_starter));
-+    HeapFree(GetProcessHeap(), 0, pmt);
-+    mms.cb(mms.client);
-+    if (mms.event) SetEvent(mms.event);
-+    return 0;
-+}
-+
-+MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client)
-+{
-+    HANDLE               hThread;
-+    HANDLE               hEvent;
-+    struct mm_starter   *mms;
-+
-+    mms = HeapAlloc(GetProcessHeap(), 0, sizeof(struct mm_starter));
-+    if (mms == NULL) { return TASKERR_OUTOFMEMORY; }
-+
-+    mms->cb = cb;
-+    mms->client = client;
-+    if (ph) {
-+        mms->event = hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-+    } else {
-+        mms->event = NULL;
-+    }
-+
-+    hThread = CreateThread(0, 0, mmTaskRun, (LPVOID)mms, 0, NULL);
-+    if (!hThread) {
-+        HeapFree(GetProcessHeap(), 0, mms);
-+        CloseHandle(hEvent);
-+        return TASKERR_OUTOFMEMORY;
-+    }
-+    if (ph) *ph = hEvent;
-+    CloseHandle(hThread);
-+    return 0;
- }
-Index: winmm.spec
-===================================================================
-RCS file: /home/wine/wine/dlls/winmm/winmm.spec,v
-retrieving revision 1.20
-diff -u -r1.20 winmm.spec
---- winmm.spec	15 Sep 2003 20:13:30 -0000	1.20
-+++ winmm.spec	8 Aug 2004 21:46:43 -0000
-@@ -135,6 +135,7 @@
- @ stdcall mmioStringToFOURCCW(wstr long)
- @ stdcall mmioWrite(long ptr long)
- @ stdcall mmsystemGetVersion()
-+@ stdcall mmTaskCreate(ptr ptr long)
- @ stdcall sndPlaySoundA(ptr long)
- @ stdcall sndPlaySoundW(ptr long)
- @ stdcall timeBeginPeriod(long)
 Index: winmm_res.rc
 ===================================================================
 RCS file: /home/wine/wine/dlls/winmm/winmm_res.rc,v
-retrieving revision 1.15
-diff -u -r1.15 winmm_res.rc
---- winmm_res.rc	13 Jul 2004 23:36:37 -0000	1.15
-+++ winmm_res.rc	8 Aug 2004 21:46:43 -0000
+retrieving revision 1.16
+diff -u -r1.16 winmm_res.rc
+--- winmm_res.rc	29 Jul 2004 02:40:15 -0000	1.16
++++ winmm_res.rc	14 Aug 2004 20:50:51 -0000
 @@ -33,7 +33,7 @@
  #include "winmm_Es.rc"
  #include "winmm_Fr.rc"

reactos/lib/winmm
winmm.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- winmm.c	8 Aug 2004 21:36:20 -0000	1.9
+++ winmm.c	14 Aug 2004 20:36:35 -0000	1.10
@@ -83,7 +83,7 @@
 	return FALSE;
     WINMM_IData->hWinMM32Instance = hInstDLL;
     InitializeCriticalSection(&WINMM_IData->cs);
-    WINMM_IData->cs.DebugInfo = (void*)__FILE__ ": WinMM";
+    WINMM_IData->cs.DebugInfo->Spare[1] = (DWORD)"WINMM_IData";
     WINMM_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
     WINMM_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
     TRACE("Created IData (%p)\n", WINMM_IData);
@@ -102,7 +102,6 @@
 	 * inside WINMM_IData */
         CloseHandle(WINMM_IData->psStopEvent);
         CloseHandle(WINMM_IData->psLastEvent);
-        WINMM_IData->cs.DebugInfo = NULL;
         DeleteCriticalSection(&WINMM_IData->cs);
         HeapFree(GetProcessHeap(), 0, WINMM_IData);
         WINMM_IData = NULL;
@@ -210,9 +209,10 @@
 /**************************************************************************
  * find out the real mixer ID depending on hmix (depends on dwFlags)
  */
-static LPWINE_MIXER MIXER_GetDev(HMIXEROBJ hmix, DWORD dwFlags)
+static UINT MIXER_GetDev(HMIXEROBJ hmix, DWORD dwFlags, LPWINE_MIXER * lplpwm)
 {
     LPWINE_MIXER	lpwm = NULL;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     switch (dwFlags & 0xF0000000ul) {
     case MIXER_OBJECTF_MIXER:
@@ -249,10 +249,15 @@
 	lpwm = (LPWINE_MIXER)MMDRV_GetRelated(hmix, MMDRV_AUX,     TRUE,  MMDRV_MIXER);
 	break;
     default:
-	FIXME("Unsupported flag (%08lx)\n", dwFlags & 0xF0000000ul);
+	WARN("Unsupported flag (%08lx)\n", dwFlags & 0xF0000000ul);
+        lpwm = 0;
+        uRet = MMSYSERR_INVALFLAG;
 	break;
     }
-    return lpwm;
+    *lplpwm = lpwm;
+    if (lpwm == 0 && uRet == MMSYSERR_NOERROR)
+        uRet = MMSYSERR_INVALPARAM;
+    return uRet;
 }
 
 /**************************************************************************
@@ -284,8 +289,11 @@
 UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
 {
     MIXERCAPSA	micA;
-    UINT	ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
+    UINT	ret;
+
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
 
+    ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
     if (ret == MMSYSERR_NOERROR) {
 	MIXERCAPSW micW;
 	micW.wMid           = micA.wMid;
@@ -364,17 +372,17 @@
 UINT WINAPI mixerGetID(HMIXEROBJ hmix, LPUINT lpid, DWORD fdwID)
 {
     LPWINE_MIXER	lpwm;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     TRACE("(%p %p %08lx)\n", hmix, lpid, fdwID);
 
-    if ((lpwm = MIXER_GetDev(hmix, fdwID)) == NULL) {
-	return MMSYSERR_INVALHANDLE;
-    }
+    if ((uRet = MIXER_GetDev(hmix, fdwID, &lpwm)) != MMSYSERR_NOERROR)
+	return uRet;
 
     if (lpid)
       *lpid = lpwm->mld.uDeviceID;
 
-    return MMSYSERR_NOERROR;
+    return uRet;
 }
 
 /**************************************************************************
@@ -384,11 +392,12 @@
 				    DWORD fdwDetails)
 {
     LPWINE_MIXER	lpwm;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
 
-    if ((lpwm = MIXER_GetDev(hmix, fdwDetails)) == NULL)
-	return MMSYSERR_INVALHANDLE;
+    if ((uRet = MIXER_GetDev(hmix, fdwDetails, &lpwm)) != MMSYSERR_NOERROR)
+	return uRet;
 
     if (lpmcdA == NULL || lpmcdA->cbStruct != sizeof(*lpmcdA))
 	return MMSYSERR_INVALPARAM;
@@ -462,11 +471,12 @@
 				  DWORD fdwControls)
 {
     LPWINE_MIXER	lpwm;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     TRACE("(%p, %p, %08lx)\n", hmix, lpmlcA, fdwControls);
 
-    if ((lpwm = MIXER_GetDev(hmix, fdwControls)) == NULL)
-	return MMSYSERR_INVALHANDLE;
+    if ((uRet = MIXER_GetDev(hmix, fdwControls, &lpwm)) != MMSYSERR_NOERROR)
+	return uRet;
 
     if (lpmlcA == NULL || lpmlcA->cbStruct != sizeof(*lpmlcA))
 	return MMSYSERR_INVALPARAM;
@@ -542,11 +552,12 @@
 UINT WINAPI mixerGetLineInfoA(HMIXEROBJ hmix, LPMIXERLINEA lpmliW, DWORD fdwInfo)
 {
     LPWINE_MIXER	lpwm;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     TRACE("(%p, %p, %08lx)\n", hmix, lpmliW, fdwInfo);
 
-    if ((lpwm = MIXER_GetDev(hmix, fdwInfo)) == NULL)
-	return MMSYSERR_INVALHANDLE;
+    if ((uRet = MIXER_GetDev(hmix, fdwInfo, &lpwm)) != MMSYSERR_NOERROR)
+	return uRet;
 
     return MMDRV_Message(&lpwm->mld, MXDM_GETLINEINFO, (DWORD_PTR)lpmliW,
 			 fdwInfo, TRUE);
@@ -589,7 +600,8 @@
         WideCharToMultiByte( CP_ACP, 0, lpmliW->Target.szPname, -1, mliA.Target.szPname, sizeof(mliA.Target.szPname), NULL, NULL);
 	break;
     default:
-	FIXME("Unsupported fdwControls=0x%08lx\n", fdwInfo);
+	WARN("Unsupported fdwControls=0x%08lx\n", fdwInfo);
+        return MMSYSERR_INVALFLAG;
     }
 
     ret = mixerGetLineInfoA(hmix, &mliA, fdwInfo);
@@ -625,11 +637,12 @@
 				   DWORD fdwDetails)
 {
     LPWINE_MIXER	lpwm;
+    UINT		uRet = MMSYSERR_NOERROR;
 
     TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
 
-    if ((lpwm = MIXER_GetDev(hmix, fdwDetails)) == NULL)
-	return MMSYSERR_INVALHANDLE;
+    if ((uRet = MIXER_GetDev(hmix, fdwDetails, &lpwm)) != MMSYSERR_NOERROR)
+	return uRet;
 
     return MMDRV_Message(&lpwm->mld, MXDM_SETCONTROLDETAILS, (DWORD_PTR)lpmcdA,
 			 fdwDetails, TRUE);
@@ -665,8 +678,11 @@
 UINT WINAPI auxGetDevCapsW(UINT_PTR uDeviceID, LPAUXCAPSW lpCaps, UINT uSize)
 {
     AUXCAPSA	acA;
-    UINT	ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
+    UINT	ret;
 
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
+
+    ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
     if (ret == MMSYSERR_NOERROR) {
 	AUXCAPSW acW;
 	acW.wMid           = acA.wMid;
@@ -1217,8 +1233,11 @@
 			       UINT uSize)
 {
     MIDIOUTCAPSA	mocA;
-    UINT		ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
+    UINT		ret;
+
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
 
+    ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
     if (ret == MMSYSERR_NOERROR) {
 	MIDIOUTCAPSW mocW;
 	mocW.wMid		= mocA.wMid;
@@ -1594,8 +1613,11 @@
 UINT WINAPI midiInGetDevCapsW(UINT_PTR uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSize)
 {
     MIDIINCAPSA		micA;
-    UINT		ret = midiInGetDevCapsA(uDeviceID, &micA, sizeof(micA));
+    UINT		ret;
+
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
 
+    ret = midiInGetDevCapsA(uDeviceID, &micA, sizeof(micA));
     if (ret == MMSYSERR_NOERROR) {
 	MIDIINCAPSW micW;
 	micW.wMid           = micA.wMid;
@@ -2559,8 +2581,11 @@
 			       UINT uSize)
 {
     WAVEOUTCAPSA	wocA;
-    UINT 		ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
+    UINT 		ret;
 
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
+
+    ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
     if (ret == MMSYSERR_NOERROR) {
 	WAVEOUTCAPSW wocW;
 	wocW.wMid           = wocA.wMid;
@@ -2951,8 +2976,11 @@
 UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
 {
     WAVEINCAPSA		wicA;
-    UINT		ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
+    UINT		ret;
+
+    if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
 
+    ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
     if (ret == MMSYSERR_NOERROR) {
 	WAVEINCAPSW wicW;
 	wicW.wMid           = wicA.wMid;
@@ -3221,7 +3249,7 @@
 MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client)
 {
     HANDLE               hThread;
-    HANDLE               hEvent;
+    HANDLE               hEvent = 0;
     struct mm_starter   *mms;
 
     mms = HeapAlloc(GetProcessHeap(), 0, sizeof(struct mm_starter));
@@ -3229,16 +3257,13 @@
 
     mms->cb = cb;
     mms->client = client;
-    if (ph) {
-        mms->event = hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-    } else {
-        mms->event = NULL;
-    }
+    if (ph) hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+    mms->event = hEvent;
 
-    hThread = CreateThread(0, 0, mmTaskRun, (LPVOID)mms, 0, NULL);
+    hThread = CreateThread(0, 0, mmTaskRun, mms, 0, NULL);
     if (!hThread) {
         HeapFree(GetProcessHeap(), 0, mms);
-        CloseHandle(hEvent);
+        if (hEvent) CloseHandle(hEvent);
         return TASKERR_OUTOFMEMORY;
     }
     if (ph) *ph = hEvent;

reactos/lib/winmm
winmm_res.rc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- winmm_res.rc	8 Aug 2004 21:36:20 -0000	1.3
+++ winmm_res.rc	14 Aug 2004 20:36:35 -0000	1.4
@@ -1,4 +1,4 @@
-/* Multimedia resources (MMSYSTEM.DLL & WINMM.DLL
+/* Multimedia resources (MMSYSTEM.DLL & WINMM.DLL)
  *
  * Copyright (c) 1999, Eric Pouech
  *
CVSspam 0.2.8