Commit 8f813fd4 authored by Alexandre Julliard's avatar Alexandre Julliard

winmm: Fix some Win64 pointer truncations issues.

parent 1c66fab8
......@@ -125,7 +125,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
WINMM_MapType map;
int devID;
TRACE("(%s %u %u 0x%08x 0x%08lx 0x%08lx %c)\n",
TRACE("(%s %u %u 0x%08lx 0x%08lx 0x%08lx %c)\n",
llTypes[mld->type].typestr, mld->uDeviceID, wMsg,
mld->dwDriverInstance, dwParam1, dwParam2, bFrom32?'Y':'N');
......@@ -159,7 +159,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
assert(part->u.fnMessage32);
if (bFrom32) {
TRACE("Calling message(dev=%u msg=%u usr=0x%08x p1=0x%08lx p2=0x%08lx)\n",
TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
......@@ -175,7 +175,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
break;
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
TRACE("Calling message(dev=%u msg=%u usr=0x%08x p1=0x%08lx p2=0x%08lx)\n",
TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2);
......@@ -204,7 +204,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
break;
case WINMM_MAP_OK:
case WINMM_MAP_OKMEM:
TRACE("Calling message(dev=%u msg=%u usr=0x%08x p1=0x%08lx p2=0x%08lx)\n",
TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance,
......@@ -219,7 +219,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
break;
}
} else {
TRACE("Calling message(dev=%u msg=%u usr=0x%08x p1=0x%08lx p2=0x%08lx)\n",
TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance,
......@@ -237,7 +237,7 @@ LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance, BOOL bFrom32)
{
LPWINE_MLD mld;
UINT i;
UINT_PTR i;
TRACE("(%d, %04x, %p, %p, %p, %p, %c)\n",
size, type, hndl, dwFlags, dwCallback, dwInstance, bFrom32?'Y':'N');
......@@ -257,7 +257,7 @@ LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
*hndl = (HANDLE)(i | 0x8000);
mld->type = type;
if ((UINT)*hndl < MMDRV_GetNum(type) || HIWORD(*hndl) != 0) {
if ((UINT_PTR)*hndl < MMDRV_GetNum(type) || ((UINT_PTR)*hndl >> 16)) {
/* FIXME: those conditions must be fulfilled so that:
* - we can distinguish between device IDs and handles
* - we can use handles as 16 or 32 bit entities
......@@ -287,8 +287,8 @@ void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
{
TRACE("(%p, %p)\n", hndl, mld);
if ((UINT)hndl & 0x8000) {
unsigned idx = (UINT)hndl & ~0x8000;
if ((UINT_PTR)hndl & 0x8000) {
UINT_PTR idx = (UINT_PTR)hndl & ~0x8000;
if (idx < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
MM_MLDrvs[idx] = NULL;
HeapFree(GetProcessHeap(), 0, mld);
......@@ -301,14 +301,14 @@ void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
/**************************************************************************
* MMDRV_Open [internal]
*/
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwFlags)
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
{
DWORD dwRet = MMSYSERR_BADDEVICEID;
DWORD dwInstance;
DWORD_PTR dwInstance;
WINE_LLTYPE* llType = &llTypes[mld->type];
TRACE("(%p, %04x, 0x%08x, 0x%08x)\n", mld, wMsg, dwParam1, dwFlags);
TRACE("(%p, %04x, 0x%08lx, 0x%08x)\n", mld, wMsg, dwParam1, dwFlags);
mld->dwDriverInstance = (DWORD)&dwInstance;
mld->dwDriverInstance = (DWORD_PTR)&dwInstance;
if (mld->uDeviceID == (UINT)-1 || mld->uDeviceID == (UINT16)-1) {
TRACE("MAPPER mode requested !\n");
......@@ -371,7 +371,7 @@ static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
LPWINE_MLD MMDRV_Get(HANDLE _hndl, UINT type, BOOL bCanBeID)
{
LPWINE_MLD mld = NULL;
UINT hndl = (UINT)_hndl;
UINT_PTR hndl = (UINT_PTR)_hndl;
TRACE("(%p, %04x, %c)\n", _hndl, type, bCanBeID ? 'Y' : 'N');
assert(type < MMDRV_MAX);
......
......@@ -986,7 +986,7 @@ static DWORD MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSW lpParms,
lpParms->wDeviceID = wmd->wDeviceID;
return MCI_SendCommandFrom32(wmd->wDeviceID, MCI_OPEN_DRIVER, dwParam,
(DWORD)lpParms);
(DWORD_PTR)lpParms);
}
/**************************************************************************
......@@ -1470,7 +1470,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
MCI_UnLoadMciDriver(wmd);
/* FIXME: notification is not properly shared across two opens */
} else {
dwRet = MCI_SendCommand(wmd->wDeviceID, MCI_GetMessage(lpCmd), dwFlags, (DWORD)data, TRUE);
dwRet = MCI_SendCommand(wmd->wDeviceID, MCI_GetMessage(lpCmd), dwFlags, (DWORD_PTR)data, TRUE);
}
TRACE("=> 1/ %x (%s)\n", dwRet, debugstr_w(lpstrRet));
dwRet = MCI_HandleReturnValues(dwRet, wmd, retType, data, lpstrRet, uRetLen);
......@@ -1649,7 +1649,7 @@ static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
if (dwParam & MCI_OPEN_TYPE) {
if (dwParam & MCI_OPEN_TYPE_ID) {
WORD uDevType = LOWORD((DWORD)lpParms->lpstrDeviceType);
WORD uDevType = LOWORD(lpParms->lpstrDeviceType);
if (uDevType < MCI_DEVTYPE_FIRST ||
uDevType > MCI_DEVTYPE_LAST ||
......@@ -1792,7 +1792,7 @@ static DWORD MCI_Close(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms
return MCIERR_INVALID_DEVICE_ID;
}
dwRet = MCI_SendCommandFrom32(wDevID, MCI_CLOSE_DRIVER, dwParam, (DWORD)lpParms);
dwRet = MCI_SendCommandFrom32(wDevID, MCI_CLOSE_DRIVER, dwParam, (DWORD_PTR)lpParms);
MCI_UnLoadMciDriver(wmd);
......@@ -1837,8 +1837,8 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
TRACE("(%08x, %08X, %08X[num=%d, wDevTyp=%u])\n",
uDevID, dwFlags, (DWORD)lpParms, lpParms->dwNumber, lpParms->wDeviceType);
TRACE("(%08x, %08X, %p[num=%d, wDevTyp=%u])\n",
uDevID, dwFlags, lpParms, lpParms->dwNumber, lpParms->wDeviceType);
switch (dwFlags & ~MCI_SYSINFO_OPEN) {
case MCI_SYSINFO_QUANTITY:
......@@ -2066,7 +2066,7 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1,
* mciSendString), because MCI drivers return extra information for string
* transformation. This function gets rid of them.
*/
LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2)
LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD_PTR dwParam2)
{
if (LOWORD(dwRet))
return LOWORD(dwRet);
......@@ -2085,7 +2085,7 @@ LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2)
{
LPMCI_GETDEVCAPS_PARMS lmgp;
lmgp = (LPMCI_GETDEVCAPS_PARMS)(void*)dwParam2;
lmgp = (LPMCI_GETDEVCAPS_PARMS)dwParam2;
TRACE("Changing %08x to %08x\n", lmgp->dwReturn, LOWORD(lmgp->dwReturn));
lmgp->dwReturn = LOWORD(lmgp->dwReturn);
}
......
......@@ -158,8 +158,8 @@ struct playsound_data
};
static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg,
DWORD dwInstance,
DWORD dwParam1, DWORD dwParam2)
DWORD_PTR dwInstance,
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
struct playsound_data* s = (struct playsound_data*)dwInstance;
......@@ -169,7 +169,7 @@ static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg,
break;
case WOM_DONE:
InterlockedIncrement(&s->dwEventCount);
TRACE("Returning waveHdr=%x\n", dwParam1);
TRACE("Returning waveHdr=%lx\n", dwParam1);
SetEvent(s->hEvent);
break;
default:
......@@ -398,8 +398,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (waveOutOpen(&wps->hWave, WAVE_MAPPER, lpWaveFormat, (DWORD)PlaySound_Callback,
(DWORD)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
if (waveOutOpen(&wps->hWave, WAVE_MAPPER, lpWaveFormat, (DWORD_PTR)PlaySound_Callback,
(DWORD_PTR)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
goto errCleanUp;
/* make it so that 3 buffers per second are needed */
......
......@@ -95,7 +95,7 @@ typedef struct tagWINE_MLD {
UINT uDeviceID;
UINT type;
UINT mmdIndex; /* index to low-level driver in MMDrvs table */
DWORD dwDriverInstance; /* this value is driver related, as opposed to
DWORD_PTR dwDriverInstance; /* this value is driver related, as opposed to
* opendesc.dwInstance which is client (callback) related */
WORD bFrom32;
WORD dwFlags;
......@@ -176,9 +176,8 @@ typedef struct tagWINE_MMIO {
/* function prototypes */
typedef LONG (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
typedef WINMM_MapType (*MMDRV_MAPFUNC)(UINT wMsg, LPDWORD lpdwUser, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2);
typedef WINMM_MapType (*MMDRV_UNMAPFUNC)(UINT wMsg, LPDWORD lpdwUser, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT ret);
typedef WINMM_MapType (*MMDRV_MAPFUNC)(UINT wMsg, DWORD_PTR *lpdwUser, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2);
typedef WINMM_MapType (*MMDRV_UNMAPFUNC)(UINT wMsg, DWORD_PTR *lpdwUser, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT ret);
LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr);
BOOL DRIVER_GetLibName(LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz);
......@@ -191,7 +190,7 @@ UINT MMDRV_GetNum(UINT);
LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance, BOOL bFrom32);
void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld);
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD dwParam1, DWORD dwParam2);
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwParam2);
DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg);
LPWINE_MLD MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID);
LPWINE_MLD MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped);
......@@ -203,7 +202,7 @@ void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_UNMAPFUNC,
WINE_MCIDRIVER* MCI_GetDriver(UINT16 uDevID);
const char* MCI_MessageToString(UINT wMsg);
LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2);
LRESULT MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD_PTR dwParam2);
DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2, BOOL bFrom32);
UINT MCI_SetCommandTable(void *table, UINT uDevType);
BOOL MCI_DeleteCommandTable(UINT uTbl, BOOL delete);
......
......@@ -365,7 +365,7 @@ UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
wmld->uDeviceID = uDeviceID;
mod.hmx = hMix;
dwRet = MMDRV_Open(wmld, MXDM_OPEN, (DWORD)&mod, CALLBACK_FUNCTION);
dwRet = MMDRV_Open(wmld, MXDM_OPEN, (DWORD_PTR)&mod, CALLBACK_FUNCTION);
if (dwRet != MMSYSERR_NOERROR) {
MMDRV_Free(hMix, wmld);
......@@ -957,7 +957,7 @@ UINT MIDI_OutOpen(LPHMIDIOUT lphMidiOut, UINT uDeviceID, DWORD_PTR dwCallback,
lpwm->mld.uDeviceID = uDeviceID;
dwRet = MMDRV_Open((LPWINE_MLD)lpwm, MODM_OPEN, (DWORD)&lpwm->mod, dwFlags);
dwRet = MMDRV_Open((LPWINE_MLD)lpwm, MODM_OPEN, (DWORD_PTR)&lpwm->mod, dwFlags);
if (dwRet != MMSYSERR_NOERROR) {
MMDRV_Free(hMidiOut, (LPWINE_MLD)lpwm);
......@@ -1258,7 +1258,7 @@ UINT MIDI_InOpen(HMIDIIN* lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback,
lpwm->mod.dwInstance = dwInstance;
lpwm->mld.uDeviceID = uDeviceID;
dwRet = MMDRV_Open(&lpwm->mld, MIDM_OPEN, (DWORD)&lpwm->mod, dwFlags);
dwRet = MMDRV_Open(&lpwm->mld, MIDM_OPEN, (DWORD_PTR)&lpwm->mod, dwFlags);
if (dwRet != MMSYSERR_NOERROR) {
MMDRV_Free(hMidiIn, &lpwm->mld);
......@@ -1540,7 +1540,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
DriverCallback(lpwm->mod.dwCallback, lpMidiStrm->wFlags,
(HDRVR)lpMidiStrm->hDevice, MM_MOM_DONE,
lpwm->mod.dwInstance, (DWORD)lpMidiHdr, 0L);
lpwm->mod.dwInstance, (DWORD_PTR)lpMidiHdr, 0);
}
lpMidiStrm->lpMidiHdr = 0;
SetEvent(lpMidiStrm->hEvent);
......@@ -1614,7 +1614,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
DriverCallback(lpwm->mod.dwCallback, lpMidiStrm->wFlags,
(HDRVR)lpMidiStrm->hDevice, MM_MOM_DONE,
lpwm->mod.dwInstance, (DWORD)lpMidiHdr, 0L);
lpwm->mod.dwInstance, (DWORD_PTR)lpMidiHdr, 0);
break;
}
......@@ -1749,7 +1749,7 @@ static DWORD CALLBACK MMSYSTEM_MidiStream_Player(LPVOID pmt)
lpMidiStrm->lpMidiHdr = lpMidiHdr->lpNext;
DriverCallback(lpwm->mod.dwCallback, lpMidiStrm->wFlags,
(HDRVR)lpMidiStrm->hDevice, MM_MOM_DONE,
lpwm->mod.dwInstance, (DWORD)lpMidiHdr, 0L);
lpwm->mod.dwInstance, (DWORD_PTR)lpMidiHdr, 0);
lpData = 0;
}
}
......@@ -1834,7 +1834,7 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
lpwm->mld.uDeviceID = *lpuDeviceID;
ret = MMDRV_Open(&lpwm->mld, MODM_OPEN, (DWORD)&lpwm->mod, fdwOpen);
ret = MMDRV_Open(&lpwm->mld, MODM_OPEN, (DWORD_PTR)&lpwm->mod, fdwOpen);
lpMidiStrm->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
lpMidiStrm->wFlags = HIWORD(fdwOpen);
......@@ -1894,7 +1894,7 @@ MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr,
} else {
if (!PostThreadMessageA(lpMidiStrm->dwThreadID,
WINE_MSM_HEADER, cbMidiHdr,
(DWORD)lpMidiHdr)) {
(LPARAM)lpMidiHdr)) {
WARN("bad PostThreadMessageA\n");
ret = MMSYSERR_ERROR;
}
......@@ -2107,8 +2107,8 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
}
wmld->uDeviceID = uDeviceID;
dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN,
(DWORD)&wod, dwFlags);
dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN,
(DWORD_PTR)&wod, dwFlags);
TRACE("dwRet = %s\n", WINMM_ErrorToString(dwRet));
if (dwRet != WAVERR_BADFORMAT ||
......
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