winmm: Create real 16<>32 thunks for mmio support in MMSystem.
This commit is contained in:
parent
f4c561746c
commit
e5b4559d2e
|
@ -45,8 +45,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mmio);
|
||||
|
||||
LRESULT (*pFnMmioCallback16)(DWORD,LPMMIOINFO,UINT,LPARAM,LPARAM) /* = NULL */;
|
||||
|
||||
static WINE_MMIO *MMIOList;
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -255,7 +253,7 @@ static struct IOProcList* MMIO_FindProcNode(FOURCC fccIOProc)
|
|||
/****************************************************************
|
||||
* MMIO_InstallIOProc [INTERNAL]
|
||||
*/
|
||||
LPMMIOPROC MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
|
||||
static LPMMIOPROC MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
|
||||
DWORD dwFlags, enum mmioProcType type)
|
||||
{
|
||||
LPMMIOPROC lpProc = NULL;
|
||||
|
@ -352,11 +350,6 @@ static LRESULT send_message(struct IOProcList* ioProc, LPMMIOINFO mmioinfo,
|
|||
}
|
||||
|
||||
switch (ioProc->type) {
|
||||
case MMIO_PROC_16:
|
||||
if (pFnMmioCallback16)
|
||||
result = pFnMmioCallback16((DWORD)ioProc->pIOProc,
|
||||
mmioinfo, wMsg, lp1, lp2);
|
||||
break;
|
||||
case MMIO_PROC_32A:
|
||||
case MMIO_PROC_32W:
|
||||
if (ioProc->type != type) {
|
||||
|
@ -438,7 +431,7 @@ static FOURCC MMIO_ParseExtA(LPCSTR szFileName)
|
|||
*
|
||||
* Retrieves the mmio object from current process
|
||||
*/
|
||||
LPWINE_MMIO MMIO_Get(HMMIO h)
|
||||
static LPWINE_MMIO MMIO_Get(HMMIO h)
|
||||
{
|
||||
LPWINE_MMIO wm = NULL;
|
||||
|
||||
|
@ -593,7 +586,7 @@ static MMRESULT MMIO_SetBuffer(WINE_MMIO* wm, void* pchBuffer, LONG cchBuffer,
|
|||
/**************************************************************************
|
||||
* MMIO_Open [internal]
|
||||
*/
|
||||
HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
|
||||
static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
|
||||
enum mmioProcType type)
|
||||
{
|
||||
LPWINE_MMIO wm;
|
||||
|
@ -939,9 +932,6 @@ MMRESULT WINAPI mmioGetInfo(HMMIO hmmio, MMIOINFO* lpmmioinfo, UINT uFlags)
|
|||
return MMSYSERR_INVALHANDLE;
|
||||
|
||||
*lpmmioinfo = wm->info;
|
||||
/* don't expose 16 bit ioproc:s */
|
||||
if (wm->ioProc->type != MMIO_PROC_16)
|
||||
lpmmioinfo->pIOProc = wm->ioProc->pIOProc;
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
@ -1112,7 +1102,7 @@ LPMMIOPROC WINAPI mmioInstallIOProcW(FOURCC fccIOProc,
|
|||
*
|
||||
*
|
||||
*/
|
||||
LRESULT MMIO_SendMessage(HMMIO hmmio, UINT uMessage, LPARAM lParam1,
|
||||
static LRESULT MMIO_SendMessage(HMMIO hmmio, UINT uMessage, LPARAM lParam1,
|
||||
LPARAM lParam2, enum mmioProcType type)
|
||||
{
|
||||
LPWINE_MMIO wm;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* MMSYSTEM mmio* functions
|
||||
*
|
||||
* Copyright 1993 Martin Ayotte
|
||||
* 1998-2003 Eric Pouech
|
||||
* 1998-2003,2009 Eric Pouech
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -32,7 +32,6 @@
|
|||
#include "winnls.h"
|
||||
|
||||
#include "wine/winuser16.h"
|
||||
#include "winemm.h"
|
||||
#include "winemm16.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
@ -43,6 +42,31 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmsys);
|
|||
* # MMIO #
|
||||
* ###################################################
|
||||
*/
|
||||
#include <pshpack1.h>
|
||||
#define MMIO_MAX_THUNKS 32
|
||||
|
||||
static struct mmio_thunk
|
||||
{
|
||||
BYTE popl_eax; /* popl %eax (return address) */
|
||||
BYTE pushl_func; /* pushl $pfn16 (16bit callback function) */
|
||||
LPMMIOPROC16 pfn16;
|
||||
BYTE pushl_eax; /* pushl %eax */
|
||||
BYTE jmp; /* ljmp MMIO_Callback1632 */
|
||||
DWORD callback;
|
||||
HMMIO hMmio; /* Handle to 32bit mmio object */
|
||||
SEGPTR segbuffer; /* actual segmented ptr to buffer */
|
||||
} *MMIO_Thunks;
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
static CRITICAL_SECTION mmio_cs;
|
||||
static CRITICAL_SECTION_DEBUG mmio_critsect_debug =
|
||||
{
|
||||
0, 0, &mmio_cs,
|
||||
{ &mmio_critsect_debug.ProcessLocksList, &mmio_critsect_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": mmsystem_mmio_cs") }
|
||||
};
|
||||
static CRITICAL_SECTION mmio_cs = { &mmio_critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
/****************************************************************
|
||||
* MMIO_Map32To16 [INTERNAL]
|
||||
|
@ -100,11 +124,11 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
|
|||
}
|
||||
|
||||
/******************************************************************
|
||||
* MMIO_Callback16
|
||||
* MMIO_Callback3216
|
||||
*
|
||||
*
|
||||
*/
|
||||
LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage,
|
||||
static LRESULT MMIO_Callback3216(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage,
|
||||
LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
DWORD result;
|
||||
|
@ -113,6 +137,8 @@ LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage,
|
|||
LPARAM lp1 = lParam1, lp2 = lParam2;
|
||||
WORD args[7];
|
||||
|
||||
if (!cb16) return MMSYSERR_INVALPARAM;
|
||||
|
||||
memset(&mmioInfo16, 0, sizeof(MMIOINFO16));
|
||||
mmioInfo16.lDiskOffset = lpmmioinfo->lDiskOffset;
|
||||
mmioInfo16.adwInfo[0] = lpmmioinfo->adwInfo[0];
|
||||
|
@ -143,18 +169,68 @@ LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage,
|
|||
}
|
||||
|
||||
/******************************************************************
|
||||
* MMIO_ResetSegmentedData
|
||||
* MMIO_AddThunk
|
||||
*
|
||||
*/
|
||||
static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr, BOOL release)
|
||||
static struct mmio_thunk* MMIO_AddThunk(LPMMIOPROC16 pfn16, HPSTR segbuf)
|
||||
{
|
||||
LPWINE_MMIO wm;
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
if ((wm = MMIO_Get(hmmio)) == NULL)
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
if (release) UnMapLS(wm->segBuffer16);
|
||||
wm->segBuffer16 = ptr;
|
||||
return MMSYSERR_NOERROR;
|
||||
if (!MMIO_Thunks)
|
||||
{
|
||||
MMIO_Thunks = VirtualAlloc(NULL, MMIO_MAX_THUNKS * sizeof(*MMIO_Thunks), MEM_COMMIT,
|
||||
PAGE_EXECUTE_READWRITE);
|
||||
if (!MMIO_Thunks) return NULL;
|
||||
for (thunk = MMIO_Thunks; thunk < &MMIO_Thunks[MMIO_MAX_THUNKS]; thunk++)
|
||||
{
|
||||
thunk->popl_eax = 0x58; /* popl %eax */
|
||||
thunk->pushl_func = 0x68; /* pushl $pfn16 */
|
||||
thunk->pfn16 = 0;
|
||||
thunk->pushl_eax = 0x50; /* pushl %eax */
|
||||
thunk->jmp = 0xe9; /* jmp MMIO_Callback3216 */
|
||||
thunk->callback = (char *)MMIO_Callback3216 - (char *)(&thunk->callback + 1);
|
||||
thunk->hMmio = NULL;
|
||||
thunk->segbuffer = 0;
|
||||
}
|
||||
}
|
||||
for (thunk = MMIO_Thunks; thunk < &MMIO_Thunks[MMIO_MAX_THUNKS]; thunk++)
|
||||
{
|
||||
if (thunk->pfn16 == 0 && thunk->hMmio == NULL)
|
||||
{
|
||||
thunk->pfn16 = pfn16;
|
||||
thunk->hMmio = NULL;
|
||||
thunk->segbuffer = (SEGPTR)segbuf;
|
||||
return thunk;
|
||||
}
|
||||
}
|
||||
FIXME("Out of mmio-thunks. Bump MMIO_MAX_THUNKS\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MMIO_HasThunk
|
||||
*
|
||||
*/
|
||||
static struct mmio_thunk* MMIO_HasThunk(HMMIO hmmio)
|
||||
{
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
if (!MMIO_Thunks) return NULL;
|
||||
for (thunk = MMIO_Thunks; thunk < &MMIO_Thunks[MMIO_MAX_THUNKS]; thunk++)
|
||||
{
|
||||
if (thunk->hMmio == hmmio) return thunk;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MMIO_SetSegmentedBuffer
|
||||
*
|
||||
*/
|
||||
static void MMIO_SetSegmentedBuffer(struct mmio_thunk* thunk, SEGPTR ptr, BOOL release)
|
||||
{
|
||||
if (release) UnMapLS(thunk->segbuffer);
|
||||
thunk->segbuffer = ptr;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -167,12 +243,20 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
|
|||
|
||||
if (lpmmioinfo16) {
|
||||
MMIOINFO mmioinfo;
|
||||
struct mmio_thunk* thunk = NULL;
|
||||
|
||||
memset(&mmioinfo, 0, sizeof(mmioinfo));
|
||||
|
||||
EnterCriticalSection(&mmio_cs);
|
||||
if (lpmmioinfo16->pIOProc && !(thunk = MMIO_AddThunk(lpmmioinfo16->pIOProc, lpmmioinfo16->pchBuffer)))
|
||||
{
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mmioinfo.dwFlags = lpmmioinfo16->dwFlags;
|
||||
mmioinfo.fccIOProc = lpmmioinfo16->fccIOProc;
|
||||
mmioinfo.pIOProc = (LPMMIOPROC)lpmmioinfo16->pIOProc;
|
||||
mmioinfo.pIOProc = (LPMMIOPROC)thunk;
|
||||
mmioinfo.cchBuffer = lpmmioinfo16->cchBuffer;
|
||||
mmioinfo.pchBuffer = MapSL((DWORD)lpmmioinfo16->pchBuffer);
|
||||
mmioinfo.adwInfo[0] = lpmmioinfo16->adwInfo[0];
|
||||
|
@ -182,13 +266,22 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
|
|||
mmioinfo.adwInfo[1] = lpmmioinfo16->adwInfo[1];
|
||||
mmioinfo.adwInfo[2] = lpmmioinfo16->adwInfo[2];
|
||||
|
||||
ret = MMIO_Open(szFileName, &mmioinfo, dwOpenFlags, MMIO_PROC_16);
|
||||
MMIO_SetSegmentedBuffer(mmioinfo.hmmio, (SEGPTR)lpmmioinfo16->pchBuffer, FALSE);
|
||||
ret = mmioOpenA(szFileName, &mmioinfo, dwOpenFlags);
|
||||
if (thunk)
|
||||
{
|
||||
if (!ret || (dwOpenFlags & (MMIO_PARSE|MMIO_EXIST)))
|
||||
{
|
||||
thunk->pfn16 = NULL;
|
||||
thunk->hMmio = NULL;
|
||||
}
|
||||
else thunk->hMmio = ret;
|
||||
}
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
|
||||
lpmmioinfo16->wErrorRet = mmioinfo.wErrorRet;
|
||||
lpmmioinfo16->hmmio = HMMIO_16(mmioinfo.hmmio);
|
||||
} else {
|
||||
ret = MMIO_Open(szFileName, NULL, dwOpenFlags, MMIO_PROC_32A);
|
||||
ret = mmioOpenA(szFileName, NULL, dwOpenFlags);
|
||||
}
|
||||
return HMMIO_16(ret);
|
||||
}
|
||||
|
@ -198,8 +291,23 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
|
|||
*/
|
||||
MMRESULT16 WINAPI mmioClose16(HMMIO16 hmmio, UINT16 uFlags)
|
||||
{
|
||||
MMIO_SetSegmentedBuffer(HMMIO_32(hmmio), 0, TRUE);
|
||||
return mmioClose(HMMIO_32(hmmio), uFlags);
|
||||
MMRESULT ret;
|
||||
|
||||
EnterCriticalSection(&mmio_cs);
|
||||
ret = mmioClose(HMMIO_32(hmmio), uFlags);
|
||||
if (ret == MMSYSERR_NOERROR)
|
||||
{
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
if ((thunk = MMIO_HasThunk(HMMIO_32(hmmio))))
|
||||
{
|
||||
MMIO_SetSegmentedBuffer(thunk, 0, TRUE);
|
||||
thunk->pfn16 = NULL;
|
||||
thunk->hMmio = NULL;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -233,27 +341,34 @@ MMRESULT16 WINAPI mmioGetInfo16(HMMIO16 hmmio, MMIOINFO16* lpmmioinfo, UINT16 uF
|
|||
{
|
||||
MMIOINFO mmioinfo;
|
||||
MMRESULT ret;
|
||||
LPWINE_MMIO wm;
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
TRACE("(0x%04x,%p,0x%08x)\n", hmmio, lpmmioinfo, uFlags);
|
||||
|
||||
if ((wm = MMIO_Get(HMMIO_32(hmmio))) == NULL)
|
||||
EnterCriticalSection(&mmio_cs);
|
||||
if ((thunk = MMIO_HasThunk(HMMIO_32(hmmio))) == NULL)
|
||||
{
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
|
||||
ret = mmioGetInfo(HMMIO_32(hmmio), &mmioinfo, uFlags);
|
||||
if (ret != MMSYSERR_NOERROR) return ret;
|
||||
if (ret != MMSYSERR_NOERROR)
|
||||
{
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lpmmioinfo->dwFlags = mmioinfo.dwFlags;
|
||||
lpmmioinfo->fccIOProc = mmioinfo.fccIOProc;
|
||||
lpmmioinfo->pIOProc = (wm->ioProc->type == MMIO_PROC_16) ?
|
||||
(LPMMIOPROC16)wm->ioProc->pIOProc : NULL;
|
||||
lpmmioinfo->pIOProc = thunk->pfn16;
|
||||
lpmmioinfo->wErrorRet = mmioinfo.wErrorRet;
|
||||
lpmmioinfo->hTask = HTASK_16(mmioinfo.hTask);
|
||||
lpmmioinfo->cchBuffer = mmioinfo.cchBuffer;
|
||||
lpmmioinfo->pchBuffer = (void*)wm->segBuffer16;
|
||||
lpmmioinfo->pchNext = (void*)(wm->segBuffer16 + (mmioinfo.pchNext - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->pchEndRead = (void*)(wm->segBuffer16 + (mmioinfo.pchEndRead - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->pchEndWrite = (void*)(wm->segBuffer16 + (mmioinfo.pchEndWrite - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->pchBuffer = (void*)thunk->segbuffer;
|
||||
lpmmioinfo->pchNext = (void*)(thunk->segbuffer + (mmioinfo.pchNext - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->pchEndRead = (void*)(thunk->segbuffer + (mmioinfo.pchEndRead - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->pchEndWrite = (void*)(thunk->segbuffer + (mmioinfo.pchEndWrite - mmioinfo.pchBuffer));
|
||||
lpmmioinfo->lBufOffset = mmioinfo.lBufOffset;
|
||||
lpmmioinfo->lDiskOffset = mmioinfo.lDiskOffset;
|
||||
lpmmioinfo->adwInfo[0] = mmioinfo.adwInfo[0];
|
||||
|
@ -262,6 +377,7 @@ MMRESULT16 WINAPI mmioGetInfo16(HMMIO16 hmmio, MMIOINFO16* lpmmioinfo, UINT16 uF
|
|||
lpmmioinfo->dwReserved1 = 0;
|
||||
lpmmioinfo->dwReserved2 = 0;
|
||||
lpmmioinfo->hmmio = HMMIO_16(mmioinfo.hmmio);
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
@ -310,7 +426,16 @@ MMRESULT16 WINAPI mmioSetBuffer16(HMMIO16 hmmio, LPSTR pchBuffer,
|
|||
cchBuffer, uFlags);
|
||||
|
||||
if (ret == MMSYSERR_NOERROR)
|
||||
MMIO_SetSegmentedBuffer(HMMIO_32(hmmio), (DWORD)pchBuffer, TRUE);
|
||||
{
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
if ((thunk = MMIO_HasThunk(HMMIO_32(hmmio))) == NULL)
|
||||
{
|
||||
FIXME("really ?\n");
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
MMIO_SetSegmentedBuffer(thunk, (DWORD)pchBuffer, TRUE);
|
||||
}
|
||||
else
|
||||
UnMapLS((DWORD)pchBuffer);
|
||||
return ret;
|
||||
|
@ -375,8 +500,61 @@ FOURCC WINAPI mmioStringToFOURCC16(LPCSTR sz, UINT16 uFlags)
|
|||
LPMMIOPROC16 WINAPI mmioInstallIOProc16(FOURCC fccIOProc, LPMMIOPROC16 pIOProc,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
return (LPMMIOPROC16)MMIO_InstallIOProc(fccIOProc, (LPMMIOPROC)pIOProc,
|
||||
dwFlags, MMIO_PROC_16);
|
||||
struct mmio_thunk* thunk = NULL;
|
||||
LPMMIOPROC pIOProc32;
|
||||
|
||||
EnterCriticalSection(&mmio_cs);
|
||||
|
||||
switch (dwFlags & (MMIO_INSTALLPROC|MMIO_REMOVEPROC|MMIO_FINDPROC)) {
|
||||
case MMIO_INSTALLPROC:
|
||||
if (!(thunk = MMIO_AddThunk(pIOProc, NULL)))
|
||||
{
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
return NULL;
|
||||
}
|
||||
if (!mmioInstallIOProcA(fccIOProc, (LPMMIOPROC)thunk, dwFlags))
|
||||
{
|
||||
thunk->pfn16 = NULL;
|
||||
pIOProc = NULL;
|
||||
}
|
||||
break;
|
||||
case MMIO_REMOVEPROC:
|
||||
if (MMIO_Thunks)
|
||||
{
|
||||
for (thunk = MMIO_Thunks; thunk < &MMIO_Thunks[MMIO_MAX_THUNKS]; thunk++)
|
||||
{
|
||||
if (thunk->pfn16 == pIOProc && thunk->segbuffer == 0)
|
||||
{
|
||||
if (mmioInstallIOProcA(fccIOProc, (LPMMIOPROC)thunk, dwFlags))
|
||||
thunk->pfn16 = NULL;
|
||||
else
|
||||
pIOProc = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!thunk) pIOProc = NULL;
|
||||
break;
|
||||
case MMIO_FINDPROC:
|
||||
if ((pIOProc32 = mmioInstallIOProcA(fccIOProc, NULL, dwFlags)) && MMIO_Thunks)
|
||||
{
|
||||
for (thunk = MMIO_Thunks; thunk < &MMIO_Thunks[MMIO_MAX_THUNKS]; thunk++)
|
||||
{
|
||||
if ((LPMMIOPROC)thunk == pIOProc32)
|
||||
{
|
||||
pIOProc = thunk->pfn16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WINE_FIXME("Unsupported flags %08x\n", dwFlags);
|
||||
pIOProc = NULL;
|
||||
}
|
||||
LeaveCriticalSection(&mmio_cs);
|
||||
|
||||
return pIOProc;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -385,8 +563,22 @@ LPMMIOPROC16 WINAPI mmioInstallIOProc16(FOURCC fccIOProc, LPMMIOPROC16 pIOProc,
|
|||
LRESULT WINAPI mmioSendMessage16(HMMIO16 hmmio, UINT16 uMessage,
|
||||
LPARAM lParam1, LPARAM lParam2)
|
||||
{
|
||||
return MMIO_SendMessage(HMMIO_32(hmmio), uMessage,
|
||||
lParam1, lParam2, MMIO_PROC_16);
|
||||
struct mmio_thunk* thunk;
|
||||
|
||||
if ((thunk = MMIO_HasThunk(HMMIO_32(hmmio))))
|
||||
{
|
||||
MMIOINFO mmioinfo;
|
||||
if (mmioGetInfo(HMMIO_32(hmmio), &mmioinfo, 0) == MMSYSERR_NOERROR)
|
||||
{
|
||||
return MMIO_Callback3216((SEGPTR)thunk->pfn16, &mmioinfo, uMessage, lParam1, lParam2);
|
||||
}
|
||||
return MMSYSERR_INVALHANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: we need to map lParam1 and lParam2 to 32bit entities */
|
||||
return mmioSendMessage(HMMIO_32(hmmio), uMessage, lParam1, lParam2);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -434,16 +626,15 @@ MMRESULT16 WINAPI mmioRename16(LPCSTR szFileName, LPCSTR szNewFileName,
|
|||
* but a non installed ioproc without a fourcc won't do
|
||||
*/
|
||||
if (lpmmioinfo && lpmmioinfo->fccIOProc && lpmmioinfo->pIOProc) {
|
||||
MMIO_InstallIOProc(lpmmioinfo->fccIOProc, (LPMMIOPROC)lpmmioinfo->pIOProc,
|
||||
MMIO_INSTALLPROC, MMIO_PROC_16);
|
||||
mmioInstallIOProc16(lpmmioinfo->fccIOProc, lpmmioinfo->pIOProc,
|
||||
MMIO_INSTALLPROC);
|
||||
inst = TRUE;
|
||||
}
|
||||
memset(&mmioinfo, 0, sizeof(mmioinfo));
|
||||
mmioinfo.fccIOProc = lpmmioinfo->fccIOProc;
|
||||
ret = mmioRenameA(szFileName, szNewFileName, &mmioinfo, dwRenameFlags);
|
||||
if (inst) {
|
||||
MMIO_InstallIOProc(lpmmioinfo->fccIOProc, NULL,
|
||||
MMIO_REMOVEPROC, MMIO_PROC_16);
|
||||
mmioInstallIOProc16(lpmmioinfo->fccIOProc, NULL, MMIO_REMOVEPROC);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16);
|
|||
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCWSTR, LPCWSTR, LPARAM);
|
||||
static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM);
|
||||
static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM);
|
||||
extern LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
|
||||
|
||||
/* ###################################################
|
||||
* # LIBRARY #
|
||||
|
@ -83,7 +82,6 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
|
|||
pFnOpenDriver16 = DRIVER_OpenDriver16;
|
||||
pFnCloseDriver16 = DRIVER_CloseDriver16;
|
||||
pFnSendMessage16 = DRIVER_SendMessage16;
|
||||
pFnMmioCallback16 = MMIO_Callback16;
|
||||
pFnReleaseThunkLock = ReleaseThunkLock;
|
||||
pFnRestoreThunkLock = RestoreThunkLock;
|
||||
MMDRV_Init16();
|
||||
|
@ -93,7 +91,6 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
|
|||
pFnOpenDriver16 = NULL;
|
||||
pFnCloseDriver16 = NULL;
|
||||
pFnSendMessage16 = NULL;
|
||||
pFnMmioCallback16 = NULL;
|
||||
pFnReleaseThunkLock = NULL;
|
||||
pFnRestoreThunkLock = NULL;
|
||||
/* FIXME: add equivalent for MMDRV_Init16() */
|
||||
|
|
|
@ -153,7 +153,7 @@ typedef struct tagWINE_MCIDRIVER {
|
|||
|
||||
#define WINE_TIMER_IS32 0x80
|
||||
|
||||
enum mmioProcType {MMIO_PROC_16,MMIO_PROC_32A,MMIO_PROC_32W};
|
||||
enum mmioProcType {MMIO_PROC_32A,MMIO_PROC_32W};
|
||||
|
||||
struct IOProcList
|
||||
{
|
||||
|
@ -170,7 +170,6 @@ typedef struct tagWINE_MMIO {
|
|||
struct IOProcList* ioProc;
|
||||
unsigned bTmpIOProc : 1,
|
||||
bBufferLoaded : 1;
|
||||
DWORD segBuffer16;
|
||||
DWORD dwFileSize;
|
||||
} WINE_MMIO, *LPWINE_MMIO;
|
||||
|
||||
|
@ -225,14 +224,6 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
|
|||
LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback,
|
||||
DWORD_PTR dwInstance, DWORD dwFlags, BOOL bFrom32);
|
||||
|
||||
HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo,
|
||||
DWORD dwOpenFlags, enum mmioProcType type);
|
||||
LPMMIOPROC MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
|
||||
DWORD dwFlags, enum mmioProcType type);
|
||||
LRESULT MMIO_SendMessage(HMMIO hmmio, UINT uMessage, LPARAM lParam1,
|
||||
LPARAM lParam2, enum mmioProcType type);
|
||||
LPWINE_MMIO MMIO_Get(HMMIO h);
|
||||
|
||||
WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc,
|
||||
DWORD_PTR dwUser, UINT wFlags);
|
||||
void TIME_MMTimeStop(void);
|
||||
|
@ -256,7 +247,6 @@ extern WINMM_MapType (*pFnMciMapMsg32WTo16)(WORD,WORD,DWORD,DWORD_PTR*);
|
|||
extern WINMM_MapType (*pFnMciUnMapMsg32WTo16)(WORD,WORD,DWORD,DWORD_PTR);
|
||||
extern LRESULT (*pFnCallMMDrvFunc16)(DWORD /* in fact FARPROC16 */,WORD,WORD,LONG,LONG,LONG);
|
||||
extern unsigned (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
|
||||
extern LRESULT (*pFnMmioCallback16)(DWORD,LPMMIOINFO,UINT,LPARAM,LPARAM);
|
||||
extern void (WINAPI *pFnReleaseThunkLock)(DWORD*);
|
||||
extern void (WINAPI *pFnRestoreThunkLock)(DWORD);
|
||||
|
||||
|
|
Loading…
Reference in New Issue