Commit 96d920fd authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Store a copy of MIDIOPENDESC information instead of pointer.

parent 13f3e846
...@@ -36,7 +36,7 @@ DEFAULT_DEBUG_CHANNEL(midi) ...@@ -36,7 +36,7 @@ DEFAULT_DEBUG_CHANNEL(midi)
typedef struct { typedef struct {
int state; int state;
DWORD bufsize; DWORD bufsize;
LPMIDIOPENDESC midiDesc; MIDIOPENDESC midiDesc;
WORD wFlags; WORD wFlags;
LPMIDIHDR lpQueueHdr; LPMIDIHDR lpQueueHdr;
DWORD dwTotalPlayed; DWORD dwTotalPlayed;
...@@ -49,7 +49,7 @@ typedef struct { ...@@ -49,7 +49,7 @@ typedef struct {
typedef struct { typedef struct {
int state; int state;
DWORD bufsize; DWORD bufsize;
LPMIDIOPENDESC midiDesc; MIDIOPENDESC midiDesc;
WORD wFlags; WORD wFlags;
LPMIDIHDR lpQueueHdr; LPMIDIHDR lpQueueHdr;
DWORD dwTotalPlayed; DWORD dwTotalPlayed;
...@@ -345,10 +345,10 @@ static DWORD MIDI_NotifyClient(UINT wDevID, WORD wMsg, ...@@ -345,10 +345,10 @@ static DWORD MIDI_NotifyClient(UINT wDevID, WORD wMsg,
if (wDevID > MAX_MIDIOUTDRV) if (wDevID > MAX_MIDIOUTDRV)
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
dwCallBack = MidiOutDev[wDevID].midiDesc->dwCallback; dwCallBack = MidiOutDev[wDevID].midiDesc.dwCallback;
uFlags = MidiOutDev[wDevID].wFlags; uFlags = MidiOutDev[wDevID].wFlags;
hDev = MidiOutDev[wDevID].midiDesc->hMidi; hDev = MidiOutDev[wDevID].midiDesc.hMidi;
dwInstance = MidiOutDev[wDevID].midiDesc->dwInstance; dwInstance = MidiOutDev[wDevID].midiDesc.dwInstance;
break; break;
case MIM_OPEN: case MIM_OPEN:
...@@ -358,10 +358,10 @@ static DWORD MIDI_NotifyClient(UINT wDevID, WORD wMsg, ...@@ -358,10 +358,10 @@ static DWORD MIDI_NotifyClient(UINT wDevID, WORD wMsg,
if (wDevID > MAX_MIDIINDRV) if (wDevID > MAX_MIDIINDRV)
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
dwCallBack = MidiInDev[wDevID].midiDesc->dwCallback; dwCallBack = MidiInDev[wDevID].midiDesc.dwCallback;
uFlags = MidiInDev[wDevID].wFlags; uFlags = MidiInDev[wDevID].wFlags;
hDev = MidiInDev[wDevID].midiDesc->hMidi; hDev = MidiInDev[wDevID].midiDesc.hMidi;
dwInstance = MidiInDev[wDevID].midiDesc->dwInstance; dwInstance = MidiInDev[wDevID].midiDesc.dwInstance;
break; break;
default: default:
WARN("Unsupported MSW-MIDI message %u\n", wMsg); WARN("Unsupported MSW-MIDI message %u\n", wMsg);
...@@ -629,7 +629,7 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags) ...@@ -629,7 +629,7 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
WARN("wDevID too large (%u) !\n", wDevID); WARN("wDevID too large (%u) !\n", wDevID);
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
if (MidiInDev[wDevID].midiDesc != 0) { if (MidiInDev[wDevID].midiDesc.hMidi != 0) {
WARN("device already open !\n"); WARN("device already open !\n");
return MMSYSERR_ALLOCATED; return MMSYSERR_ALLOCATED;
} }
...@@ -662,7 +662,7 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags) ...@@ -662,7 +662,7 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
MidiInDev[wDevID].lpQueueHdr = NULL; MidiInDev[wDevID].lpQueueHdr = NULL;
MidiInDev[wDevID].dwTotalPlayed = 0; MidiInDev[wDevID].dwTotalPlayed = 0;
MidiInDev[wDevID].bufsize = 0x3FFF; MidiInDev[wDevID].bufsize = 0x3FFF;
MidiInDev[wDevID].midiDesc = lpDesc; MidiInDev[wDevID].midiDesc = *lpDesc;
MidiInDev[wDevID].state = 0; MidiInDev[wDevID].state = 0;
MidiInDev[wDevID].incLen = 0; MidiInDev[wDevID].incLen = 0;
MidiInDev[wDevID].startTime = 0; MidiInDev[wDevID].startTime = 0;
...@@ -687,7 +687,7 @@ static DWORD midClose(WORD wDevID) ...@@ -687,7 +687,7 @@ static DWORD midClose(WORD wDevID)
WARN("wDevID too big (%u) !\n", wDevID); WARN("wDevID too big (%u) !\n", wDevID);
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
if (MidiInDev[wDevID].midiDesc == 0) { if (MidiInDev[wDevID].midiDesc.hMidi == 0) {
WARN("device not opened !\n"); WARN("device not opened !\n");
return MMSYSERR_ERROR; return MMSYSERR_ERROR;
} }
...@@ -713,7 +713,7 @@ static DWORD midClose(WORD wDevID) ...@@ -713,7 +713,7 @@ static DWORD midClose(WORD wDevID)
WARN("can't notify client !\n"); WARN("can't notify client !\n");
ret = MMSYSERR_INVALPARAM; ret = MMSYSERR_INVALPARAM;
} }
MidiInDev[wDevID].midiDesc = 0; MidiInDev[wDevID].midiDesc.hMidi = 0;
return ret; return ret;
} }
...@@ -974,7 +974,7 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags) ...@@ -974,7 +974,7 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
TRACE("MAX_MIDIOUTDRV reached !\n"); TRACE("MAX_MIDIOUTDRV reached !\n");
return MMSYSERR_BADDEVICEID; return MMSYSERR_BADDEVICEID;
} }
if (MidiOutDev[wDevID].midiDesc != 0) { if (MidiOutDev[wDevID].midiDesc.hMidi != 0) {
WARN("device already open !\n"); WARN("device already open !\n");
return MMSYSERR_ALLOCATED; return MMSYSERR_ALLOCATED;
} }
...@@ -1031,7 +1031,7 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags) ...@@ -1031,7 +1031,7 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
MidiOutDev[wDevID].lpQueueHdr = NULL; MidiOutDev[wDevID].lpQueueHdr = NULL;
MidiOutDev[wDevID].dwTotalPlayed = 0; MidiOutDev[wDevID].dwTotalPlayed = 0;
MidiOutDev[wDevID].bufsize = 0x3FFF; MidiOutDev[wDevID].bufsize = 0x3FFF;
MidiOutDev[wDevID].midiDesc = lpDesc; MidiOutDev[wDevID].midiDesc = *lpDesc;
if (MIDI_NotifyClient(wDevID, MOM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) { if (MIDI_NotifyClient(wDevID, MOM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
WARN("can't notify client !\n"); WARN("can't notify client !\n");
...@@ -1051,7 +1051,7 @@ static DWORD modClose(WORD wDevID) ...@@ -1051,7 +1051,7 @@ static DWORD modClose(WORD wDevID)
TRACE("(%04X);\n", wDevID); TRACE("(%04X);\n", wDevID);
if (MidiOutDev[wDevID].midiDesc == 0) { if (MidiOutDev[wDevID].midiDesc.hMidi == 0) {
WARN("device not opened !\n"); WARN("device not opened !\n");
return MMSYSERR_ERROR; return MMSYSERR_ERROR;
} }
...@@ -1084,7 +1084,7 @@ static DWORD modClose(WORD wDevID) ...@@ -1084,7 +1084,7 @@ static DWORD modClose(WORD wDevID)
WARN("can't notify client !\n"); WARN("can't notify client !\n");
ret = MMSYSERR_INVALPARAM; ret = MMSYSERR_INVALPARAM;
} }
MidiOutDev[wDevID].midiDesc = 0; MidiOutDev[wDevID].midiDesc.hMidi = 0;
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment