Starting implementation of MCI creator tasks

Fixed bug in MCI_OPEN handling (thanks to Adam for reporting this one)
Better implementation of mmTaskCreate16
This commit is contained in:
Eric Pouech 1999-04-01 10:18:01 +00:00 committed by Alexandre Julliard
parent 0f9901b4cc
commit 4e65995b16
2 changed files with 41 additions and 32 deletions

View File

@ -17,6 +17,7 @@
#include "selectors.h"
#include "debug.h"
#include "digitalv.h"
#include "wine/winbase16.h"
struct WINE_MCIDRIVER mciDrv[MAXMCIDRIVERS];
@ -1042,6 +1043,7 @@ DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSA lpParms)
if (LOWORD((DWORD)lpParms->lpstrDeviceType) != MCI_DEVTYPE_CD_AUDIO) {
FIXME(mci, "MCI_OPEN_TYPE_ID is no longer properly supported\n");
}
uDevType = LOWORD((DWORD)lpParms->lpstrDeviceType);
} else {
if (lpParms->lpstrDeviceType == NULL)
return MCIERR_NULL_PARAMETER_BLOCK;
@ -1096,6 +1098,7 @@ DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSA lpParms)
dwRet = MCI_SendCommand(wDevID, MCI_OPEN_DRIVER, dwParam, (DWORD)lpParms);
MCI_GetDrv(wDevID)->lpfnYieldProc = 0;
MCI_GetDrv(wDevID)->dwYieldData = 0;
MCI_GetDrv(wDevID)->hCreatorTask = GetCurrentTask();
if (dwRet == 0) {
/* only handled devices fall through */

View File

@ -1491,7 +1491,7 @@ DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwPar
break;
}
dwRet = MCI_CleanUp(dwRet, wMsg, dwParam2, TRUE);
TRACE(mci, "=> %08ld\n", dwRet);
TRACE(mci, "=> %08lx\n", dwRet);
return dwRet;
}
@ -1739,8 +1739,7 @@ YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD* lpdwYieldData)
*/
HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
{
FIXME(mci, "(%u) stub\n", uDeviceID);
return 0;
return mciGetCreatorTask(uDeviceID);
}
/**************************************************************************
@ -1748,8 +1747,15 @@ HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
*/
HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
{
FIXME(mci, "(%u) stub\n", uDeviceID);
return 0;
HTASK ret;
TRACE(mci, "(%u)\n", uDeviceID);
ret = (!MCI_DevIDValid(uDeviceID) || MCI_GetDrv(uDeviceID)->modp.wType == 0) ?
0 : MCI_GetDrv(uDeviceID)->hCreatorTask;
TRACE(mci, "=> %04x\n", ret);
return ret;
}
/**************************************************************************
@ -1762,7 +1768,7 @@ UINT16 WINAPI mciDriverYield16(UINT16 uDeviceID)
TRACE(mmsys,"(%04x)\n", uDeviceID);
if (!MCI_DevIDValid(uDeviceID) || MCI_GetDrv(uDeviceID)->modp.wType == 0 ||
!MCI_GetDrv(uDeviceID)->lpfnYieldProc || MCI_GetDrv(uDeviceID)->bIs32) {
OldYield16();
UserYield16();
} else {
ret = MCI_GetDrv(uDeviceID)->lpfnYieldProc(uDeviceID, MCI_GetDrv(uDeviceID)->dwYieldData);
}
@ -1780,7 +1786,7 @@ UINT WINAPI mciDriverYield(UINT uDeviceID)
TRACE(mmsys,"(%04x)\n", uDeviceID);
if (!MCI_DevIDValid(uDeviceID) || MCI_GetDrv(uDeviceID)->modp.wType == 0 ||
!MCI_GetDrv(uDeviceID)->lpfnYieldProc || !MCI_GetDrv(uDeviceID)->bIs32) {
OldYield16();
UserYield16();
} else {
ret = MCI_GetDrv(uDeviceID)->lpfnYieldProc(uDeviceID, MCI_GetDrv(uDeviceID)->dwYieldData);
}
@ -4356,19 +4362,19 @@ BOOL16 WINAPI mmThreadIsValid16(HANDLE16 handle)
*/
HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR lphnd, HINSTANCE16 *hMmTask, DWORD dwPmt)
{
#if 1
DWORD showCmd = 0x40002;
LPSTR cmdline;
WORD sel1, sel2;
LOADPARAMS16 *lp;
HINSTANCE16 ret, handle;
DWORD showCmd = 0x40002;
LPSTR cmdline;
WORD sel1, sel2;
LOADPARAMS16* lp;
HINSTANCE16 ret;
HINSTANCE16 handle;
TRACE(mmsys, "(%08lx,%p,%08lx);\n", lphnd, hMmTask, dwPmt);
cmdline = (LPSTR)HeapAlloc(GetProcessHeap(), 0, 0x0d);
cmdline[0] = 0x0d;
(DWORD)cmdline[1] = (DWORD)lphnd;
(DWORD)cmdline[5] = dwPmt;
(DWORD)cmdline[9] = 0;
*(LPDWORD)(cmdline + 1) = (DWORD)lphnd;
*(LPDWORD)(cmdline + 5) = dwPmt;
*(LPDWORD)(cmdline + 9) = 0;
sel1 = SELECTOR_AllocBlock(cmdline, 0x0d, SEGMENT_DATA, FALSE, FALSE);
sel2 = SELECTOR_AllocBlock(&showCmd, sizeof(showCmd),
@ -4380,16 +4386,11 @@ HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR lphnd, HINSTANCE16 *hMmTask, DWORD dwPm
lp->showCmd = PTR_SEG_OFF_TO_SEGPTR(sel2, 0);
lp->reserved = 0;
ret = LoadModule16("c:\\windows\\system\\mmtask.tsk", lp);
TRACE(mmsys, "MMtask's handle = 0x%04x\n", ret);
if (ret < 32) {
if (ret)
ret = 1;
else
ret = 2;
handle = LoadModule16("c:\\windows\\system\\mmtask.tsk", lp);
if (handle < 32) {
ret = (handle) ? 1 : 2;
handle = 0;
} else {
handle = ret;
ret = 0;
}
if (hMmTask)
@ -4400,15 +4401,9 @@ HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR lphnd, HINSTANCE16 *hMmTask, DWORD dwPm
HeapFree(GetProcessHeap(), 0, lp);
HeapFree(GetProcessHeap(), 0, cmdline);
TRACE(mmsys, "=> 0x%04x/%d %04x\n", handle, ret, *(LPWORD)PTR_SEG_TO_LIN(lphnd));
TRACE(mmsys, "=> 0x%04x/%d\n", handle, ret);
return ret;
#else
TRACE(mmsys, "(%p,%p,%08lx);\n", lphnd, hMmTask, x2);
if (hMmTask)
*hMmTask = 0xfade;
return 0;
#endif
}
/**************************************************************************
@ -4456,3 +4451,14 @@ BOOL16 WINAPI mmShowMMCPLPropertySheet16(WORD w1, WORD w2, WORD w3, WORD w4, WOR
FIXME(mmsys, "%04x %04x %04x %04x %04x %04x %04x\n", w1, w2, w3, w4, w5, w6, w7);
return TRUE;
}
/**************************************************************************
* StackEnter & StackLeave [MMSYSTEM.32][MMSYSTEM.33]
*/
void WINAPI StackEnterLeave16(void)
{
#ifdef __i386__
/* mmsystem.dll from Win 95 does only this: so does Wine */
__asm__("stc");
#endif
}