Reworked patch: Convert HMIDI, HMIDIIN, HMIDIOUT, HMIDISTRM to void*

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

 



Hello,

as of Alexander's request here is a reworked patch.

Changelog:
    Eric Pouech <eric.pouech@wanadoo.fr>
    Michael Stefaniuc <mstefani@redhat.com>
    - Convert HMIDI, HMIDIIN, HMIDIOUT, HMIDISTRM to void*

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/winmm/lolvldrv.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v
retrieving revision 1.29
diff -u -r1.29 lolvldrv.c
--- dlls/winmm/lolvldrv.c	3 Jul 2002 21:10:44 -0000	1.29
+++ dlls/winmm/lolvldrv.c	1 Aug 2002 17:01:54 -0000
@@ -693,7 +693,7 @@
 		*(LPDWORD)((char*)ptr + sizeof(LPMIDIOPENDESC)) = *lpdwUser;
 		mod16 = (LPMIDIOPENDESC16)((LPSTR)ptr + sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD));
 
-		mod16->hMidi = mod32->hMidi;
+		mod16->hMidi = HMIDI_16(mod32->hMidi);
 		mod16->dwCallback = mod32->dwCallback;
 		mod16->dwInstance = mod32->dwInstance;
 		mod16->dnDevNode = mod32->dnDevNode;
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.63
diff -u -r1.63 mmsystem.c
--- dlls/winmm/mmsystem.c	29 Jul 2002 23:29:23 -0000	1.63
+++ dlls/winmm/mmsystem.c	1 Aug 2002 17:01:54 -0000
@@ -2188,7 +2188,7 @@
 	*lphMidiOut = hMidiOut;
 
     if (lpwm) {
-	lpwm->mod.hMidi = hMidiOut;
+	lpwm->mod.hMidi = (HMIDI) hMidiOut;
 	lpwm->mod.dwCallback = *lpdwCallback;
 	lpwm->mod.dwInstance = *lpdwInstance;
 	lpwm->mod.dnDevNode = 0;
@@ -2255,7 +2255,7 @@
     ret = MMSYSTEM_midiOutOpen(&hmo, uDeviceID, dwCallback, dwInstance,
 			       dwFlags, FALSE);
 
-    if (lphMidiOut != NULL) *lphMidiOut = hmo;
+    if (lphMidiOut != NULL) *lphMidiOut = HMIDIOUT_16(hmo);
     return ret;
 }
 
@@ -2283,7 +2283,7 @@
  */
 UINT16 WINAPI midiOutClose16(HMIDIOUT16 hMidiOut)
 {
-    return midiOutClose(hMidiOut);
+    return midiOutClose(HMIDIOUT_32(hMidiOut));
 }
 
 /**************************************************************************
@@ -2381,7 +2381,7 @@
  */
 UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16 hMidiOut, DWORD dwMsg)
 {
-    return midiOutShortMsg(hMidiOut, dwMsg);
+    return midiOutShortMsg(HMIDIOUT_32(hMidiOut), dwMsg);
 }
 
 /**************************************************************************
@@ -2437,7 +2437,7 @@
  */
 UINT16 WINAPI midiOutReset16(HMIDIOUT16 hMidiOut)
 {
-    return midiOutReset(hMidiOut);
+    return midiOutReset(HMIDIOUT_32(hMidiOut));
 }
 
 /**************************************************************************
@@ -2503,7 +2503,8 @@
 UINT16 WINAPI midiOutCachePatches16(HMIDIOUT16 hMidiOut, UINT16 uBank,
                                     WORD* lpwPatchArray, UINT16 uFlags)
 {
-    return midiOutCachePatches(hMidiOut, uBank, lpwPatchArray, uFlags);
+    return midiOutCachePatches(HMIDIOUT_32(hMidiOut), uBank, lpwPatchArray,
+			       uFlags);
 }
 
 /**************************************************************************
@@ -2739,7 +2740,7 @@
     if (lpwm == NULL)
 	return MMSYSERR_NOMEM;
 
-    lpwm->mod.hMidi = hMidiIn;
+    lpwm->mod.hMidi = (HMIDI) hMidiIn;
     lpwm->mod.dwCallback = dwCallback;
     lpwm->mod.dwInstance = dwInstance;
 
@@ -2778,7 +2779,7 @@
     ret = MMSYSTEM_midiInOpen(&xhmid, uDeviceID, dwCallback, dwInstance,
 			      dwFlags, FALSE);
 
-    if (lphMidiIn) *lphMidiIn = xhmid;
+    if (lphMidiIn) *lphMidiIn = HMIDIIN_16(xhmid);
     return ret;
 }
 
@@ -2805,7 +2806,7 @@
  */
 UINT16 WINAPI midiInClose16(HMIDIIN16 hMidiIn)
 {
-    return midiInClose(hMidiIn);
+    return midiInClose(HMIDIIN_32(hMidiIn));
 }
 
 /**************************************************************************
@@ -2936,7 +2937,7 @@
  */
 UINT16 WINAPI midiInStart16(HMIDIIN16 hMidiIn)
 {
-    return midiInStart(hMidiIn);
+    return midiInStart(HMIDIIN_32(hMidiIn));
 }
 
 /**************************************************************************
@@ -2959,7 +2960,7 @@
  */
 UINT16 WINAPI midiInStop16(HMIDIIN16 hMidiIn)
 {
-    return midiInStop(hMidiIn);
+    return midiInStop(HMIDIIN_32(hMidiIn));
 }
 
 /**************************************************************************
@@ -2982,7 +2983,7 @@
  */
 UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
 {
-    return midiInReset(hMidiIn);
+    return midiInReset(HMIDIIN_32(hMidiIn));
 }
 
 /**************************************************************************
@@ -3408,7 +3409,7 @@
     HeapFree(GetProcessHeap(), 0, lpMidiStrm);
     CloseHandle(lpMidiStrm->hEvent);
 
-    return midiOutClose(hMidiStrm);
+    return midiOutClose((HMIDIOUT)hMidiStrm);
 }
 
 /**************************************************************************
@@ -3444,7 +3445,7 @@
     lpwm = MIDI_OutAlloc(&hMidiOut, &dwCallback, &dwInstance, &fdwOpen, 1, &mosm, bFrom32);
     lpMidiStrm->hDevice = hMidiOut;
     if (lphMidiStrm)
-	*lphMidiStrm = hMidiOut;
+	*lphMidiStrm = (HMIDISTRM)hMidiOut;
 
     /* FIXME: is lpuDevice initialized upon entering midiStreamOpen ? */
     FIXME("*lpuDeviceID=%x\n", *lpuDeviceID);
@@ -3673,7 +3674,7 @@
  */
 MMRESULT16 WINAPI midiStreamClose16(HMIDISTRM16 hMidiStrm)
 {
-    return midiStreamClose(hMidiStrm);
+    return midiStreamClose(HMIDISTRM_32(hMidiStrm));
 }
 
 /**************************************************************************
@@ -3692,7 +3693,7 @@
     devid32 = *devid;
     ret = MMSYSTEM_MidiStream_Open(&hMidiStrm32, &devid32, cMidi, dwCallback,
 				   dwInstance, fdwOpen, FALSE);
-    *phMidiStrm = hMidiStrm32;
+    *phMidiStrm = HMIDISTRM_16(hMidiStrm32);
     *devid = devid32;
     return ret;
 }
@@ -3702,7 +3703,8 @@
  */
 MMRESULT16 WINAPI midiStreamOut16(HMIDISTRM16 hMidiStrm, LPMIDIHDR16 lpMidiHdr, UINT16 cbMidiHdr)
 {
-    return midiStreamOut(hMidiStrm, (LPMIDIHDR)lpMidiHdr, cbMidiHdr);
+    return midiStreamOut(HMIDISTRM_32(hMidiStrm), (LPMIDIHDR)lpMidiHdr,
+		         cbMidiHdr);
 }
 
 /**************************************************************************
@@ -3710,7 +3712,7 @@
  */
 MMRESULT16 WINAPI midiStreamPause16(HMIDISTRM16 hMidiStrm)
 {
-    return midiStreamPause(hMidiStrm);
+    return midiStreamPause(HMIDISTRM_32(hMidiStrm));
 }
 
 /**************************************************************************
@@ -3724,7 +3726,7 @@
     if (!lpmmt16)
 	return MMSYSERR_INVALPARAM;
     MMSYSTEM_MMTIME16to32(&mmt32, lpmmt16);
-    ret = midiStreamPosition(hMidiStrm, &mmt32, sizeof(MMTIME));
+    ret = midiStreamPosition(HMIDISTRM_32(hMidiStrm), &mmt32, sizeof(MMTIME));
     MMSYSTEM_MMTIME32to16(lpmmt16, &mmt32);
     return ret;
 }
@@ -3734,7 +3736,7 @@
  */
 MMRESULT16 WINAPI midiStreamProperty16(HMIDISTRM16 hMidiStrm, LPBYTE lpPropData, DWORD dwProperty)
 {
-    return midiStreamProperty(hMidiStrm, lpPropData, dwProperty);
+    return midiStreamProperty(HMIDISTRM_32(hMidiStrm), lpPropData, dwProperty);
 }
 
 /**************************************************************************
@@ -3742,7 +3744,7 @@
  */
 MMRESULT16 WINAPI midiStreamRestart16(HMIDISTRM16 hMidiStrm)
 {
-    return midiStreamRestart(hMidiStrm);
+    return midiStreamRestart(HMIDISTRM_32(hMidiStrm));
 }
 
 /**************************************************************************
@@ -3750,7 +3752,7 @@
  */
 MMRESULT16 WINAPI midiStreamStop16(HMIDISTRM16 hMidiStrm)
 {
-    return midiStreamStop(hMidiStrm);
+    return midiStreamStop(HMIDISTRM_32(hMidiStrm));
 }
 
 static	UINT WINAPI MMSYSTEM_waveOpen(HANDLE* lphndl, UINT uDeviceID, UINT uType,
Index: dlls/winmm/winemm.h
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winemm.h,v
retrieving revision 1.15
diff -u -r1.15 winemm.h
--- dlls/winmm/winemm.h	28 Jul 2002 23:48:28 -0000	1.15
+++ dlls/winmm/winemm.h	1 Aug 2002 17:01:54 -0000
@@ -226,3 +226,14 @@
 
 LPWINE_MM_IDATA			TIME_MMTimeStart(void);
 void				TIME_MMTimeStop(void);
+
+/* HANDLE16 -> HANDLE conversions */
+#define HMIDI_32(h16)		((HMIDI)(ULONG_PTR)(h16))
+#define HMIDIIN_32(h16)		((HMIDIIN)(ULONG_PTR)(h16))
+#define HMIDIOUT_32(h16)	((HMIDIOUT)(ULONG_PTR)(h16))
+#define HMIDISTRM_32(h16)	((HMIDISTRM)(ULONG_PTR)(h16))
+/* HANDLE -> HANDLE16 conversions */
+#define HMIDI_16(h32)		(LOWORD(h32))
+#define HMIDIIN_16(h32)		(LOWORD(h32))
+#define HMIDIOUT_16(h32)	(LOWORD(h32))
+#define HMIDISTRM_16(h32)	(LOWORD(h32))
Index: dlls/winmm/mciseq/mcimidi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mciseq/mcimidi.c,v
retrieving revision 1.16
diff -u -r1.16 mcimidi.c
--- dlls/winmm/mciseq/mcimidi.c	31 May 2002 23:40:57 -0000	1.16
+++ dlls/winmm/mciseq/mcimidi.c	1 Aug 2002 17:01:54 -0000
@@ -817,7 +817,7 @@
 
 	wmm->dwStatus = MCI_MODE_NOT_READY;
 	if (oldstat == MCI_MODE_PAUSE)
-	    dwRet = midiOutReset(wmm->hMidi);
+	    dwRet = midiOutReset((HMIDIOUT)wmm->hMidi);
 
 	while (wmm->dwStatus != MCI_MODE_STOP)
 	    Sleep(10);
@@ -962,7 +962,7 @@
 	MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */
     }
 
-    dwRet = midiOutOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);
+    dwRet = midiOutOpen((LPHMIDIOUT)&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);
     /*	dwRet = midiInOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);*/
     if (dwRet != MMSYSERR_NOERROR) {
 	return dwRet;
@@ -1142,7 +1142,7 @@
 	    break;
 	default:
 	    if (doPlay) {
-		dwRet = midiOutShortMsg(wmm->hMidi, mmt->dwEventData);
+		dwRet = midiOutShortMsg((HMIDIOUT)wmm->hMidi, mmt->dwEventData);
 	    } else {
 		switch (LOBYTE(LOWORD(mmt->dwEventData)) & 0xF0) {
 		case MIDI_NOTEON:
@@ -1150,7 +1150,7 @@
 		    dwRet = 0;
 		    break;
 		default:
-		    dwRet = midiOutShortMsg(wmm->hMidi, mmt->dwEventData);
+		    dwRet = midiOutShortMsg((HMIDIOUT)wmm->hMidi, mmt->dwEventData);
 		}
 	    }
 	}
@@ -1163,9 +1163,9 @@
 	}
     }
 
-    midiOutReset(wmm->hMidi);
+    midiOutReset((HMIDIOUT)wmm->hMidi);
 
-    dwRet = midiOutClose(wmm->hMidi);
+    dwRet = midiOutClose((HMIDIOUT)wmm->hMidi);
     /* to restart playing at beginning when it's over */
     wmm->dwPositionMS = 0;
 
@@ -1212,7 +1212,7 @@
     midiHdr.dwBufferLength = 1024;
     midiHdr.dwUser = 0L;
     midiHdr.dwFlags = 0L;
-    dwRet = midiInPrepareHeader(wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
+    dwRet = midiInPrepareHeader((HMIDIIN)wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
     TRACE("After MIDM_PREPARE \n");
     wmm->dwStatus = MCI_MODE_RECORD;
     /* FIXME: there is no buffer added */
@@ -1220,12 +1220,12 @@
 	TRACE("wmm->dwStatus=%p %d\n",
 	      &wmm->dwStatus, wmm->dwStatus);
 	midiHdr.dwBytesRecorded = 0;
-	dwRet = midiInStart(wmm->hMidi);
+	dwRet = midiInStart((HMIDIIN)wmm->hMidi);
 	TRACE("midiInStart => dwBytesRecorded=%lu\n", midiHdr.dwBytesRecorded);
 	if (midiHdr.dwBytesRecorded == 0) break;
     }
     TRACE("Before MIDM_UNPREPARE \n");
-    dwRet = midiInUnprepareHeader(wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
+    dwRet = midiInUnprepareHeader((HMIDIIN)wmm->hMidi, &midiHdr, sizeof(MIDIHDR));
     TRACE("After MIDM_UNPREPARE \n");
     if (midiHdr.lpData != NULL) {
 	HeapFree(GetProcessHeap(), 0, midiHdr.lpData);
@@ -1255,7 +1255,7 @@
 	/* stop all notes */
 	unsigned chn;
 	for (chn = 0; chn < 16; chn++)
-	    midiOutShortMsg(wmm->hMidi, 0x78B0 | chn);
+	    midiOutShortMsg((HMIDIOUT)(wmm->hMidi), 0x78B0 | chn);
 	wmm->dwStatus = MCI_MODE_PAUSE;
     }
     if (lpParms && (dwFlags & MCI_NOTIFY)) {
Index: dlls/winmm/midimap/midimap.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/midimap/midimap.c,v
retrieving revision 1.13
diff -u -r1.13 midimap.c
--- dlls/winmm/midimap/midimap.c	31 May 2002 23:40:57 -0000	1.13
+++ dlls/winmm/midimap/midimap.c	1 Aug 2002 17:01:54 -0000
@@ -81,7 +81,7 @@
 {
     char		name[MAXPNAMELEN];
     int			loaded;
-    HMIDI		hMidi;
+    HMIDIOUT		hMidi;
     unsigned short	uDevID;
     LPBYTE		lpbPatch;
     unsigned int	aChn[16];
@@ -494,7 +494,7 @@
 			     numMidiOutPorts * sizeof(MIDIOUTPORT));
     for (dev = 0; dev < numMidiOutPorts; dev++)
     {
-	if (midiOutGetDevCapsA((HMIDIOUT)dev, &moc, sizeof(moc)) == 0L)
+	if (midiOutGetDevCapsA(dev, &moc, sizeof(moc)) == 0L)
 	{
 	    strcpy(midiOutPorts[dev].name, moc.szPname);
 	    midiOutPorts[dev].loaded = 0;
Index: include/mmsystem.h
===================================================================
RCS file: /home/wine/wine/include/mmsystem.h,v
retrieving revision 1.51
diff -u -r1.51 mmsystem.h
--- include/mmsystem.h	31 May 2002 23:06:48 -0000	1.51
+++ include/mmsystem.h	1 Aug 2002 17:01:54 -0000
@@ -34,10 +34,10 @@
 DECLARE_OLD_HANDLE(HWAVE);
 DECLARE_OLD_HANDLE(HWAVEIN);
 DECLARE_OLD_HANDLE(HWAVEOUT);
-DECLARE_OLD_HANDLE(HMIDI);
-DECLARE_OLD_HANDLE(HMIDIIN);
-DECLARE_OLD_HANDLE(HMIDIOUT);
-DECLARE_OLD_HANDLE(HMIDISTRM);
+DECLARE_HANDLE(HMIDI);
+DECLARE_HANDLE(HMIDIIN);
+DECLARE_HANDLE(HMIDIOUT);
+DECLARE_HANDLE(HMIDISTRM);
 DECLARE_OLD_HANDLE(HMIXER);
 DECLARE_OLD_HANDLE(HMIXEROBJ);
 DECLARE_OLD_HANDLE(HMMIO);

Attachment: pgp00024.pgp
Description: PGP signature


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

  Powered by Linux