/************************************************************************** * MCIQTZ_drvClose [internal] */ static DWORD MCIQTZ_drvClose(DWORD dwDevID) { WINE_MCIQTZ* wma; TRACE("(%04x)\n", dwDevID); wma = MCIQTZ_mciGetOpenDev(dwDevID); if (wma) { /* finish all outstanding things */ MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL); mciFreeCommandResource(wma->command_table); mciSetDriverData(dwDevID, 0); HeapFree(GetProcessHeap(), 0, wma); return 1; } return (dwDevID == 0xFFFFFFFF) ? 1 : 0; }
/************************************************************************** * DriverProc (MCIQTZ.@) */ LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2) { TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n", dwDevID, hDriv, wMsg, dwParam1, dwParam2); switch (wMsg) { case DRV_LOAD: return 1; case DRV_FREE: return 1; case DRV_OPEN: return MCIQTZ_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2); case DRV_CLOSE: return MCIQTZ_drvClose(dwDevID); case DRV_ENABLE: return 1; case DRV_DISABLE: return 1; case DRV_QUERYCONFIGURE: return 1; case DRV_CONFIGURE: return MCIQTZ_drvConfigure(dwDevID); case DRV_INSTALL: return DRVCNF_RESTART; case DRV_REMOVE: return DRVCNF_RESTART; } /* session instance */ if (dwDevID == 0xFFFFFFFF) return 1; switch (wMsg) { case MCI_OPEN_DRIVER: return MCIQTZ_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2); case MCI_CLOSE_DRIVER: return MCIQTZ_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2); case MCI_PLAY: return MCIQTZ_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2); case MCI_SEEK: return MCIQTZ_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2); case MCI_STOP: return MCIQTZ_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2); case MCI_PAUSE: return MCIQTZ_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2); case MCI_GETDEVCAPS: return MCIQTZ_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2); case MCI_SET: return MCIQTZ_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2); case MCI_STATUS: return MCIQTZ_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2); case MCI_WHERE: return MCIQTZ_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2); /* Digital Video specific */ case MCI_SETAUDIO: return MCIQTZ_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2); case MCI_UPDATE: return MCIQTZ_mciUpdate(dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS)dwParam2); case MCI_WINDOW: return MCIQTZ_mciWindow(dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW)dwParam2); case MCI_PUT: case MCI_RECORD: case MCI_RESUME: case MCI_INFO: case MCI_LOAD: case MCI_SAVE: case MCI_FREEZE: case MCI_REALIZE: case MCI_UNFREEZE: case MCI_STEP: case MCI_COPY: case MCI_CUT: case MCI_DELETE: case MCI_PASTE: case MCI_CUE: /* Digital Video specific */ case MCI_CAPTURE: case MCI_MONITOR: case MCI_RESERVE: case MCI_SIGNAL: case MCI_SETVIDEO: case MCI_QUALITY: case MCI_LIST: case MCI_UNDO: case MCI_CONFIGURE: case MCI_RESTORE: FIXME("Unimplemented command [%08X]\n", wMsg); break; case MCI_SPIN: case MCI_ESCAPE: WARN("Unsupported command [%08X]\n", wMsg); break; case MCI_OPEN: case MCI_CLOSE: FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); break; default: TRACE("Sending msg [%08X] to default driver proc\n", wMsg); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } return MCIERR_UNRECOGNIZED_COMMAND; }
/*************************************************************************** * MCIQTZ_taskThread [internal] */ static DWORD CALLBACK MCIQTZ_taskThread(LPVOID arg) { WINE_MCIQTZ_TASK *task = (WINE_MCIQTZ_TASK *)arg; for (;;) { DWORD ret = WaitForSingleObject(task->notify, INFINITE); if (ret != WAIT_OBJECT_0) { TRACE("Got error (%u)\n", ret); continue; } switch (task->msg) { case MCI_OPEN_DRIVER: task->res = MCIQTZ_mciOpen(task->devid, task->flags, (LPMCI_DGV_OPEN_PARMSW)task->parms); break; case MCI_CLOSE_DRIVER: task->res = MCIQTZ_mciClose(task->devid, task->flags, (LPMCI_GENERIC_PARMS)task->parms); break; case MCI_PLAY: task->res = MCIQTZ_mciPlay(task->devid, task->flags, (LPMCI_PLAY_PARMS)task->parms); break; case MCI_SEEK: task->res = MCIQTZ_mciSeek(task->devid, task->flags, (LPMCI_SEEK_PARMS)task->parms); break; case MCI_STOP: task->res = MCIQTZ_mciStop(task->devid, task->flags, (LPMCI_GENERIC_PARMS)task->parms); break; case MCI_PAUSE: task->res = MCIQTZ_mciPause(task->devid, task->flags, (LPMCI_GENERIC_PARMS)task->parms); break; case MCI_RESUME: task->res = MCIQTZ_mciResume(task->devid, task->flags, (LPMCI_GENERIC_PARMS)task->parms); break; case MCI_GETDEVCAPS: task->res = MCIQTZ_mciGetDevCaps(task->devid, task->flags, (LPMCI_GETDEVCAPS_PARMS)task->parms); break; case MCI_SET: task->res = MCIQTZ_mciSet(task->devid, task->flags, (LPMCI_DGV_SET_PARMS)task->parms); break; case MCI_STATUS: task->res = MCIQTZ_mciStatus(task->devid, task->flags, (LPMCI_DGV_STATUS_PARMSW)task->parms); break; case MCI_WHERE: task->res = MCIQTZ_mciWhere(task->devid, task->flags, (LPMCI_DGV_RECT_PARMS)task->parms); break; case MCI_SETAUDIO: task->res = MCIQTZ_mciSetAudio(task->devid, task->flags, (LPMCI_DGV_SETAUDIO_PARMSW)task->parms); break; case MCI_UPDATE: task->res = MCIQTZ_mciUpdate(task->devid, task->flags, (LPMCI_DGV_UPDATE_PARMS)task->parms); break; case MCI_WINDOW: task->res = MCIQTZ_mciWindow(task->devid, task->flags, (LPMCI_DGV_WINDOW_PARMSW)task->parms); break; case MCI_PUT: task->res = MCIQTZ_mciPut(task->devid, task->flags, (MCI_GENERIC_PARMS*)task->parms); break; case MCI_CLOSE: /* Special internal message */ SetEvent(task->done); goto end; default: FIXME("Shouldn't receive another message (%04x)\n", task->msg); task->res = MCIERR_UNRECOGNIZED_COMMAND; break; } SetEvent(task->done); } end: return 0; }