Author: akhaldi
Date: Thu Jan 26 15:17:25 2012
New Revision: 55204

URL: http://svn.reactos.org/svn/reactos?rev=55204&view=rev
Log:
[MCIWAVE]
* Sync to Wine 1.3.37.

Modified:
    trunk/reactos/dll/win32/mciwave/mciwave.c
    trunk/reactos/media/doc/README.WINE

Modified: trunk/reactos/dll/win32/mciwave/mciwave.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mciwave/mciwave.c?rev=55204&r1=55203&r2=55204&view=diff
==============================================================================
--- trunk/reactos/dll/win32/mciwave/mciwave.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mciwave/mciwave.c [iso-8859-1] Thu Jan 26 15:17:25 
2012
@@ -465,7 +465,7 @@
     fn = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(filename) + 1) * 
sizeof(WCHAR));
     if (!fn) return MCIERR_OUT_OF_MEMORY;
     strcpyW(fn, filename);
-    HeapFree(GetProcessHeap(), 0, (void*)wmw->lpFileName);
+    HeapFree(GetProcessHeap(), 0, wmw->lpFileName);
     wmw->lpFileName = fn;
 
     if (strlenW(filename) > 0) {
@@ -483,7 +483,7 @@
         {
             LPMMCKINFO          lpckMainRIFF = &wmw->ckMainRIFF;
 
-            /* make sure we're are the beginning of the file */
+            /* make sure we're at the beginning of the file */
             mmioSeek(wmw->hFile, 0, SEEK_SET);
 
             /* first reading of this file. read the waveformat chunk */
@@ -568,6 +568,8 @@
        if (wmw->hFile != 0)
            mmioClose(wmw->hFile, 0);
        wmw->hFile = 0;
+       HeapFree(GetProcessHeap(), 0, wmw->lpFileName);
+       wmw->lpFileName = NULL;
     }
     return dwRet;
 }
@@ -680,7 +682,7 @@
     if (wmw->lpWaveFormat != &wmw->wfxRef)
        HeapFree(GetProcessHeap(), 0, wmw->lpWaveFormat);
     wmw->lpWaveFormat = &wmw->wfxRef;
-    HeapFree(GetProcessHeap(), 0, (void*)wmw->lpFileName);
+    HeapFree(GetProcessHeap(), 0, wmw->lpFileName);
     wmw->lpFileName = NULL;
 
     if ((dwFlags & MCI_NOTIFY) && lpParms) {
@@ -754,8 +756,8 @@
        return MCIERR_FILE_NOT_FOUND;
     }
 
-    if (wmw->dwStatus == MCI_MODE_PAUSE && !wmw->fInput) {
-       /* FIXME: parameters (start/end) in lpParams may not be used */
+    if (wmw->dwStatus == MCI_MODE_PAUSE && !wmw->fInput && !(dwFlags & 
(MCI_FROM | MCI_TO))) {
+       /* FIXME: notification is different with Resume than Play */
        return WAVE_mciResume(wDevID, dwFlags, (LPMCI_GENERIC_PARMS)lpParms);
     }
 
@@ -763,8 +765,12 @@
      * We have to set MCI_MODE_PLAY before we do this so that the app can spin
      * on MCI_STATUS, so we have to allow it here if we're not going to start 
this thread.
      */
-    if ((wmw->dwStatus != MCI_MODE_STOP) && ((wmw->dwStatus != MCI_MODE_PLAY) 
&& (dwFlags & MCI_WAIT))) {
-       return MCIERR_INTERNAL;
+    if ( !(wmw->dwStatus == MCI_MODE_STOP) &&
+       !((wmw->dwStatus == MCI_MODE_PLAY) && (dwFlags & MCI_WAIT) && 
!wmw->hWave)) {
+       /* FIXME: Check FROM/TO parameters first. */
+       /* FIXME: Play; Play [notify|wait] must hook into the running player. */
+       dwRet = WAVE_mciStop(wDevID, MCI_WAIT, NULL);
+       if (dwRet) return dwRet;
     }
 
     if (wmw->lpWaveFormat->wFormatTag == WAVE_FORMAT_PCM) {
@@ -916,7 +922,7 @@
 
     wmw->dwStatus = MCI_MODE_STOP;
 
-    /* Let the potentically asynchronous commands support FAILURE 
notification. */
+    /* Let the potentially asynchronous commands support FAILURE notification. 
*/
     if (oldcb) mciDriverNotify(oldcb, wDevID,
        dwRet ? MCI_NOTIFY_FAILURE : MCI_NOTIFY_SUCCESSFUL);
 
@@ -1009,7 +1015,8 @@
      * We have to set MCI_MODE_RECORD before we do this so that the app can 
spin
      * on MCI_STATUS, so we have to allow it here if we're not going to start 
this thread.
      */
-    if ((wmw->dwStatus != MCI_MODE_STOP) && ((wmw->dwStatus != 
MCI_MODE_RECORD) && (dwFlags & MCI_WAIT))) {
+    if ( !(wmw->dwStatus == MCI_MODE_STOP) &&
+       !((wmw->dwStatus == MCI_MODE_RECORD) && (dwFlags & MCI_WAIT) && 
!wmw->hWave)) {
        return MCIERR_INTERNAL;
     }
 
@@ -1025,7 +1032,7 @@
      * we don't modify the wave part of an existing file (ie. we always erase 
an
      * existing content, we don't overwrite)
      */
-    HeapFree(GetProcessHeap(), 0, (void*)wmw->lpFileName);
+    HeapFree(GetProcessHeap(), 0, wmw->lpFileName);
     dwRet = create_tmp_file(&wmw->hFile, (WCHAR**)&wmw->lpFileName);
     if (dwRet != 0) return dwRet;
 
@@ -1463,6 +1470,7 @@
     TRACE("(%u, %08X, %p);\n", wDevID, dwFlags, lpParms);
     if (lpParms == NULL)       return MCIERR_NULL_PARAMETER_BLOCK;
     if (wmw == NULL)           return MCIERR_INVALID_DEVICE_ID;
+    if (!(dwFlags & MCI_STATUS_ITEM))  return MCIERR_MISSING_PARAMETER;
 
     if (dwFlags & MCI_STATUS_ITEM) {
        switch (lpParms->dwItem) {
@@ -1572,7 +1580,7 @@
            break;
        default:
             WARN("unknown command %08X !\n", lpParms->dwItem);
-           return MCIERR_UNRECOGNIZED_COMMAND;
+           return MCIERR_UNSUPPORTED_FUNCTION;
        }
     }
     if ((dwFlags & MCI_NOTIFY) && HRESULT_CODE(ret)==0)
@@ -1665,14 +1673,14 @@
     if (!lpParms || !lpParms->lpstrReturn)
        return MCIERR_NULL_PARAMETER_BLOCK;
 
+    TRACE("buf=%p, len=%u\n", lpParms->lpstrReturn, lpParms->dwRetSize);
+
     if (wmw == NULL) {
        ret = MCIERR_INVALID_DEVICE_ID;
     } else {
         static const WCHAR wszAudio  [] = {'W','i','n','e','\'','s',' 
','a','u','d','i','o',' ','p','l','a','y','e','r',0};
         static const WCHAR wszWaveIn [] = {'W','i','n','e',' 
','W','a','v','e',' ','I','n',0};
         static const WCHAR wszWaveOut[] = {'W','i','n','e',' 
','W','a','v','e',' ','O','u','t',0};
-
-       TRACE("buf=%p, len=%u\n", lpParms->lpstrReturn, lpParms->dwRetSize);
 
        switch (dwFlags & ~(MCI_WAIT|MCI_NOTIFY)) {
        case MCI_INFO_PRODUCT: str = wszAudio; break;
@@ -1681,17 +1689,16 @@
        case MCI_WAVE_OUTPUT:  str = wszWaveOut; break;
        default:
             WARN("Don't know this info command (%u)\n", dwFlags);
-           ret = MCIERR_UNRECOGNIZED_COMMAND;
+           ret = MCIERR_UNRECOGNIZED_KEYWORD;
        }
     }
-    if (str) {
-       if (strlenW(str) + 1 > lpParms->dwRetSize) {
-           ret = MCIERR_PARAM_OVERFLOW;
-       } else {
-           lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize);
-       }
-    } else {
-       lpParms->lpstrReturn[0] = 0;
+    if (!ret) {
+       if (lpParms->dwRetSize) {
+           WCHAR zero = 0;
+           /* FIXME? Since NT, mciwave, mciseq and mcicda set dwRetSize
+            *        to the number of characters written, excluding \0. */
+           lstrcpynW(lpParms->lpstrReturn, str ? str : &zero, 
lpParms->dwRetSize);
+       } else ret = MCIERR_PARAM_OVERFLOW;
     }
     if (MMSYSERR_NOERROR==ret && (dwFlags & MCI_NOTIFY))
        WAVE_mciNotify(lpParms->dwCallback, wmw, MCI_NOTIFY_SUCCESSFUL);
@@ -1752,7 +1759,7 @@
     case MCI_CUT:
     case MCI_DELETE:
     case MCI_PASTE:
-       FIXME("Unsupported yet command [%u]\n", wMsg);
+       FIXME("Unsupported command [%u]\n", wMsg);
        break;
     case MCI_WINDOW:
        TRACE("Unsupported command [%u]\n", wMsg);

Modified: trunk/reactos/media/doc/README.WINE
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=55204&r1=55203&r2=55204&view=diff
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Thu Jan 26 15:17:25 2012
@@ -87,7 +87,7 @@
 reactos/dll/win32/mcicda          # Synced to Wine-1.3.37
 reactos/dll/win32/mciqtz32        # Autosync
 reactos/dll/win32/mciseq          # Synced to Wine-1.3.37
-reactos/dll/win32/mciwave         # Autosync
+reactos/dll/win32/mciwave         # Synced to Wine-1.3.37
 reactos/dll/win32/mlang           # Autosync
 reactos/dll/win32/mpr             # Autosync
 reactos/dll/win32/mprapi          # Autosync


Reply via email to