I just compiled PortMidi for x86 and x64 on Windows 7 with VS 2013, including the patch and some other minor changes. The changes are on SVN but I'm holding off on downloads until we can do more testing. There are so many systems and compilers, it's going much more slowly than I would like.
    -Roger

On 1/8/14 4:15 AM, olivier tristan wrote:
Le 10/12/2013 18:26, olivier tristan a écrit :
Hi guys,

Please find enclosed a patch on PortMIDI regarding a crash on 64bits version of Windows.

It was previously reported here and I came across it when upgrading to Windows 8.1
http://sourceforge.net/p/portmedia/discussion/697912/thread/c2de24fd/?limit=50

The signature of some callback was wrong casting 64bits value in 32bits especially some pointer.

The definition of callbacks are the following:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd798460(v=vs.85).aspx <http://msdn.microsoft.com/en-us/library/windows/desktop/dd798460%28v=vs.85%29.aspx> http://msdn.microsoft.com/en-us/library/windows/desktop/dd798478(v=vs.85).aspx <http://msdn.microsoft.com/en-us/library/windows/desktop/dd798478%28v=vs.85%29.aspx>

Regards,


Any news about this ?
Patch inlined

Thanks,


Index: pm_win/pmwinmm.c
===================================================================
--- pm_win/pmwinmm.c    (revision 227)
+++ pm_win/pmwinmm.c    (working copy)
@@ -38,11 +38,11 @@

 /* callback routines */
 static void CALLBACK winmm_in_callback(HMIDIIN hMidiIn,
-                                       WORD wMsg, DWORD dwInstance,
-                                       DWORD dwParam1, DWORD dwParam2);
+                                       UINT wMsg, DWORD_PTR dwInstance,
+ DWORD_PTR dwParam1, DWORD_PTR dwParam2);
 static void CALLBACK winmm_streamout_callback(HMIDIOUT hmo, UINT wMsg,
- DWORD dwInstance, DWORD dwParam1,
-                                              DWORD dwParam2);
+ DWORD_PTR dwInstance, DWORD_PTR dwParam1,
+                                              DWORD_PTR dwParam2);
 #ifdef USE_SYSEX_BUFFERS
 static void CALLBACK winmm_out_callback(HMIDIOUT hmo, UINT wMsg,
DWORD dwInstance, DWORD dwParam1,
@@ -666,10 +666,10 @@
/* Callback function executed via midiInput SW interrupt (via midiInOpen). */
 static void FAR PASCAL winmm_in_callback(
     HMIDIIN hMidiIn,    /* midiInput device Handle */
-    WORD wMsg,          /* midi msg */
-    DWORD dwInstance,   /* application data */
-    DWORD dwParam1,     /* MIDI data */
- DWORD dwParam2) /* device timestamp (wrt most recent midiInStart) */
+    UINT wMsg,          /* midi msg */
+    DWORD_PTR dwInstance,   /* application data */
+    DWORD_PTR dwParam1,     /* MIDI data */
+ DWORD_PTR dwParam2) /* device timestamp (wrt most recent midiInStart) */
 {
     static int entry = 0;
     PmInternal *midi = (PmInternal *) dwInstance;
@@ -688,7 +688,6 @@
          * hardware interrupt? -- but I've seen reentrant behavior
          * using a debugger, so it happens.
          */
-        long new_driver_time;
         EnterCriticalSection(&m->lock);

/* dwParam1 is MIDI data received, packed into DWORD w/ 1st byte of
@@ -697,8 +696,6 @@
             in [ms] from when midiInStart called.
            each message is expanded to include the status byte */

-        new_driver_time = dwParam2;
-
         if ((dwParam1 & 0x80) == 0) {
             /* not a status byte -- ignore it. This happened running the
                sysex.c test under Win2K with MidiMan USB 1x1 interface,
@@ -709,8 +706,8 @@
             PmEvent event;
             if (midi->time_proc)
                 dwParam2 = (*midi->time_proc)(midi->time_info);
-            event.timestamp = dwParam2;
-            event.message = dwParam1;
+            event.timestamp = (PmTimestamp)dwParam2;
+            event.message = (PmMessage)dwParam1;
             pm_read_short(midi, &event);
         }
         LeaveCriticalSection(&m->lock);
@@ -731,7 +728,7 @@
         /* assume yes and iterate through them */
         while (remaining > 0) {
             unsigned int amt = pm_read_bytes(midi, data + processed,
-                                             remaining, dwParam2);
+ remaining, (PmTimestamp)dwParam2);
             remaining -= amt;
             processed += amt;
         }
@@ -1328,7 +1325,7 @@

 /* winmm_streamout_callback -- unprepare (free) buffer header */
 static void CALLBACK winmm_streamout_callback(HMIDIOUT hmo, UINT wMsg,
-        DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+        DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 {
     PmInternal *midi = (PmInternal *) dwInstance;
     midiwinmm_type m = (midiwinmm_type) midi->descriptor;


--
Olivier TRISTAN
uvi.net
--
Olivier Tristan
www.uvi.net


_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to