MCI #3: Add MCI_SYSINFO command W to A mapping

Dmitry Timoshkov dmitry at baikal.ru
Tue Dec 30 10:47:56 CST 2003


Hello,

Please apply after MCI #2.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Add MCI_SYSINFO command W to A mapping.

--- cvs/hq/wine/dlls/winmm/winmm.c      2003-12-30 23:39:14.000000000 +0800
+++ wine/dlls/winmm/winmm.c     2003-12-31 00:05:01.000000000 +0800
@@ -890,8 +890,29 @@ static int MCI_MapMsgWtoA(UINT msg, DWOR
         }
         return 0;
 
-    case MCI_INFO:
     case MCI_SYSINFO:
+        {
+            MCI_SYSINFO_PARMSW *mci_sysinfoW = (MCI_SYSINFO_PARMSW *)*dwParam2;
+            MCI_SYSINFO_PARMSA *mci_sysinfoA;
+            DWORD_PTR *ptr;
+
+            ptr = HeapAlloc(GetProcessHeap(), 0, sizeof(*mci_sysinfoA) + sizeof(DWORD_PTR));
+            if (!ptr) return -1;
+
+            *ptr++ = *dwParam2; /* save the previous pointer */
+            *dwParam2 = (DWORD_PTR)ptr;
+            mci_sysinfoA = (MCI_SYSINFO_PARMSA *)ptr;
+
+            if (dwParam1 & MCI_NOTIFY)
+                mci_sysinfoA->dwCallback = mci_sysinfoW->dwCallback;
+
+            mci_sysinfoA->dwRetSize = mci_sysinfoW->dwRetSize; /* FIXME */
+            mci_sysinfoA->lpstrReturn = HeapAlloc(GetProcessHeap(), 0, mci_sysinfoA->dwRetSize);
+
+            return 1;
+        }
+
+    case MCI_INFO:
     case MCI_SAVE:
     case MCI_LOAD:
     case MCI_ESCAPE:
@@ -902,7 +923,8 @@ static int MCI_MapMsgWtoA(UINT msg, DWOR
     return 0;
 }
 
-static void MCI_UnmapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
+static DWORD MCI_UnmapMsgWtoA(UINT msg, DWORD_PTR dwParam1, DWORD_PTR dwParam2,
+                              DWORD result)
 {
     switch(msg)
     {
@@ -940,10 +962,31 @@ static void MCI_UnmapMsgWtoA(UINT msg, D
         }
         break;
 
+    case MCI_SYSINFO:
+        {
+            DWORD_PTR *ptr = (DWORD_PTR *)dwParam2 - 1;
+            MCI_SYSINFO_PARMSW *mci_sysinfoW = (MCI_SYSINFO_PARMSW *)*ptr;
+            MCI_SYSINFO_PARMSA *mci_sysinfoA = (MCI_SYSINFO_PARMSA *)(ptr + 1);
+
+            if (!result)
+            {
+                mci_sysinfoW->dwNumber = mci_sysinfoA->dwNumber;
+                mci_sysinfoW->wDeviceType = mci_sysinfoA->wDeviceType;
+                MultiByteToWideChar(CP_ACP, 0,
+                                    mci_sysinfoA->lpstrReturn, mci_sysinfoA->dwRetSize,
+                                    mci_sysinfoW->lpstrReturn, mci_sysinfoW->dwRetSize);
+            }
+
+            HeapFree(GetProcessHeap(), 0, mci_sysinfoA->lpstrReturn);
+            HeapFree(GetProcessHeap(), 0, ptr);
+        }
+        break;
+
     default:
         FIXME("Message 0x%04x needs unmapping\n", msg);
-        break;
     }
+
+    return result;
 }
 
 
@@ -969,7 +1012,7 @@ DWORD WINAPI mciSendCommandW(MCIDEVICEID
     }
     ret = mciSendCommandA(wDevID, wMsg, dwParam1, dwParam2);
     if (mapped)
-        MCI_UnmapMsgWtoA(wMsg, dwParam1, dwParam2);
+        MCI_UnmapMsgWtoA(wMsg, dwParam1, dwParam2, ret);
     return ret;
 }
 






More information about the wine-patches mailing list