PATCH: WINMM mixerGetControlDetailsW bugfix (Odin)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
- mixerGetControlDetailsW: translate strings for MIXER_GETCONTROLDETAILSF_LISTTEXT option

Author: Sander van Leeuwen/Odin (sandervl@xs4all.nl)



--- mmsystem.co	Mon May 27 12:14:18 2002
+++ mmsystem.c	Mon May 27 17:39:44 2002
@@ -1050,18 +1050,36 @@
 	break;
     case MIXER_GETCONTROLDETAILSF_LISTTEXT:
 	{
-	    LPVOID	paDetailsW = lpmcd->paDetails;
-	    int		size = max(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
+	    MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW = (MIXERCONTROLDETAILS_LISTTEXTW *)lpmcd->paDetails;
+            MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA;
+	    int size = max(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
+            int i;
 
-	    if (lpmcd->u.cMultipleItems != 0 && lpmcd->u.cMultipleItems != lpmcd->u.hwndOwner) {
+	    if (lpmcd->u.cMultipleItems != 0) {
 		size *= lpmcd->u.cMultipleItems;
 	    }
-	    lpmcd->paDetails = HeapAlloc(GetProcessHeap(), 0, size);
+	    pDetailsA = (MIXERCONTROLDETAILS_LISTTEXTA *)HeapAlloc(GetProcessHeap(), 0, size);
+            lpmcd->paDetails = pDetailsA;
+            lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
 	    /* set up lpmcd->paDetails */
 	    ret = mixerGetControlDetailsA(hmix, lpmcd, fdwDetails);
 	    /* copy from lpmcd->paDetails back to paDetailsW; */
-	    HeapFree(GetProcessHeap(), 0, lpmcd->paDetails);
-	    lpmcd->paDetails = paDetailsW;
+            if(ret == MMSYSERR_NOERROR) {
+                for(i=0;i<lpmcd->u.cMultipleItems*lpmcd->cChannels;i++) {
+                    pDetailsW->dwParam1 = pDetailsA->dwParam1;
+                    pDetailsW->dwParam2 = pDetailsA->dwParam2;
+                    MultiByteToWideChar( CP_ACP, 0, pDetailsA->szName, -1,
+                                         pDetailsW->szName,
+                                         sizeof(pDetailsW->szName)/sizeof(WCHAR) );
+                    pDetailsA++;
+                    pDetailsW++;
+                }
+                pDetailsA -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
+                pDetailsW -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
+            }
+	    HeapFree(GetProcessHeap(), 0, pDetailsA);
+	    lpmcd->paDetails = pDetailsW;
+            lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
 	}
 	break;
     default:




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux