push 149f0a5527ac85057a8ef03858d34d91c36f97e8
[wine/hacks.git] / dlls / mciqtz32 / mciqtz.c
blob354a9f5cfadec62fd1fcabb8493a648826305daa
1 /*
2 * DirectShow MCI Driver
4 * Copyright 2009 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "mmddk.h"
26 #include "wine/debug.h"
27 #include "mciqtz_private.h"
28 #include "digitalv.h"
29 #include "wownt32.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(mciqtz);
33 static DWORD MCIQTZ_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
34 static DWORD MCIQTZ_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
36 /*======================================================================*
37 * MCI QTZ implementation *
38 *======================================================================*/
40 HINSTANCE MCIQTZ_hInstance = 0;
42 /***********************************************************************
43 * DllMain (MCIQTZ.0)
45 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
47 switch (fdwReason) {
48 case DLL_PROCESS_ATTACH:
49 DisableThreadLibraryCalls(hInstDLL);
50 MCIQTZ_hInstance = hInstDLL;
51 break;
53 return TRUE;
56 /**************************************************************************
57 * MCIQTZ_mciGetOpenDev [internal]
59 static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
61 WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
63 if (!wma) {
64 WARN("Invalid wDevID=%u\n", wDevID);
65 return NULL;
67 return wma;
70 /**************************************************************************
71 * MCIQTZ_drvOpen [internal]
73 static DWORD MCIQTZ_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
75 WINE_MCIQTZ* wma;
77 TRACE("(%s, %p)\n", debugstr_w(str), modp);
79 /* session instance */
80 if (!modp)
81 return 0xFFFFFFFF;
83 wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIQTZ));
84 if (!wma)
85 return 0;
87 wma->wDevID = modp->wDeviceID;
88 mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
90 return modp->wDeviceID;
93 /**************************************************************************
94 * MCIQTZ_drvClose [internal]
96 static DWORD MCIQTZ_drvClose(DWORD dwDevID)
98 WINE_MCIQTZ* wma;
100 TRACE("(%04x)\n", dwDevID);
102 wma = MCIQTZ_mciGetOpenDev(dwDevID);
104 if (wma) {
105 /* finish all outstanding things */
106 MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
108 mciSetDriverData(dwDevID, 0);
109 HeapFree(GetProcessHeap(), 0, wma);
110 return 1;
113 return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
116 /**************************************************************************
117 * MCIQTZ_drvConfigure [internal]
119 static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
121 WINE_MCIQTZ* wma;
123 TRACE("(%04x)\n", dwDevID);
125 wma = MCIQTZ_mciGetOpenDev(dwDevID);
126 if (!wma)
127 return 0;
129 MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
131 MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
133 return 1;
136 /***************************************************************************
137 * MCIQTZ_mciOpen [internal]
139 static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
140 LPMCI_DGV_OPEN_PARMSW lpOpenParms)
142 WINE_MCIQTZ* wma;
143 HRESULT hr;
145 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
147 if (!lpOpenParms)
148 return MCIERR_NULL_PARAMETER_BLOCK;
150 wma = MCIQTZ_mciGetOpenDev(wDevID);
151 if (!wma)
152 return MCIERR_INVALID_DEVICE_ID;
154 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
156 CoInitializeEx(NULL, COINIT_MULTITHREADED);
158 hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
159 if (FAILED(hr)) {
160 TRACE("Cannot create filtergraph (hr = %x)\n", hr);
161 goto err;
164 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaControl, (LPVOID*)&wma->pmctrl);
165 if (FAILED(hr)) {
166 TRACE("Cannot get IMediaControl interface (hr = %x)\n", hr);
167 goto err;
170 if (!(dwFlags & MCI_OPEN_ELEMENT) || (dwFlags & MCI_OPEN_ELEMENT_ID)) {
171 TRACE("Wrong dwFlags %x\n", dwFlags);
172 goto err;
175 if (!lpOpenParms->lpstrElementName || !lpOpenParms->lpstrElementName[0]) {
176 TRACE("Invalid filename specified\n");
177 goto err;
180 TRACE("Open file %s\n", debugstr_w(lpOpenParms->lpstrElementName));
182 hr = IGraphBuilder_RenderFile(wma->pgraph, lpOpenParms->lpstrElementName, NULL);
183 if (FAILED(hr)) {
184 TRACE("Cannot render file (hr = %x)\n", hr);
185 goto err;
188 wma->opened = TRUE;
190 return 0;
192 err:
193 if (wma->pgraph)
194 IGraphBuilder_Release(wma->pgraph);
195 wma->pgraph = NULL;
196 if (wma->pmctrl)
197 IMediaControl_Release(wma->pmctrl);
198 wma->pmctrl = NULL;
200 CoUninitialize();
202 return MCIERR_INTERNAL;
205 /***************************************************************************
206 * MCIQTZ_mciClose [internal]
208 static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
210 WINE_MCIQTZ* wma;
212 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
214 wma = MCIQTZ_mciGetOpenDev(wDevID);
215 if (!wma)
216 return MCIERR_INVALID_DEVICE_ID;
218 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
220 if (wma->opened) {
221 IGraphBuilder_Release(wma->pgraph);
222 IMediaControl_Release(wma->pmctrl);
223 CoUninitialize();
224 wma->opened = FALSE;
227 return 0;
230 /***************************************************************************
231 * MCIQTZ_mciPlay [internal]
233 static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
235 WINE_MCIQTZ* wma;
236 HRESULT hr;
238 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
240 if (!lpParms)
241 return MCIERR_NULL_PARAMETER_BLOCK;
243 wma = MCIQTZ_mciGetOpenDev(wDevID);
244 if (!wma)
245 return MCIERR_INVALID_DEVICE_ID;
247 hr = IMediaControl_Run(wma->pmctrl);
248 if (FAILED(hr)) {
249 TRACE("Cannot run filtergraph (hr = %x)\n", hr);
250 return MCIERR_INTERNAL;
253 wma->started = TRUE;
255 return 0;
258 /***************************************************************************
259 * MCIQTZ_mciSeek [internal]
261 static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
263 WINE_MCIQTZ* wma;
264 HRESULT hr;
265 IMediaPosition* pmpos;
266 LONGLONG newpos;
268 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
270 if (!lpParms)
271 return MCIERR_NULL_PARAMETER_BLOCK;
273 wma = MCIQTZ_mciGetOpenDev(wDevID);
274 if (!wma)
275 return MCIERR_INVALID_DEVICE_ID;
277 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
279 if (dwFlags & MCI_SEEK_TO_START) {
280 newpos = 0;
281 } else if (dwFlags & MCI_SEEK_TO_END) {
282 FIXME("MCI_SEEK_TO_END not implemented yet\n");
283 return MCIERR_INTERNAL;
284 } else if (dwFlags & MCI_TO) {
285 FIXME("MCI_TO not implemented yet\n");
286 return MCIERR_INTERNAL;
287 } else {
288 WARN("dwFlag doesn't tell where to seek to...\n");
289 return MCIERR_MISSING_PARAMETER;
292 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos);
293 if (FAILED(hr)) {
294 FIXME("Cannot get IMediaPostion interface (hr = %x)\n", hr);
295 return MCIERR_INTERNAL;
298 hr = IMediaPosition_put_CurrentPosition(pmpos, newpos);
299 if (FAILED(hr)) {
300 FIXME("Cannot set position (hr = %x)\n", hr);
301 IMediaPosition_Release(pmpos);
302 return MCIERR_INTERNAL;
305 IMediaPosition_Release(pmpos);
307 if (dwFlags & MCI_NOTIFY)
308 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);
310 return 0;
313 /***************************************************************************
314 * MCIQTZ_mciStop [internal]
316 static DWORD MCIQTZ_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
318 WINE_MCIQTZ* wma;
319 HRESULT hr;
321 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
323 wma = MCIQTZ_mciGetOpenDev(wDevID);
324 if (!wma)
325 return MCIERR_INVALID_DEVICE_ID;
327 if (!wma->started)
328 return 0;
330 hr = IMediaControl_Stop(wma->pmctrl);
331 if (FAILED(hr)) {
332 TRACE("Cannot stop filtergraph (hr = %x)\n", hr);
333 return MCIERR_INTERNAL;
336 wma->started = FALSE;
338 return 0;
341 /***************************************************************************
342 * MCIQTZ_mciGetDevCaps [internal]
344 static DWORD MCIQTZ_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
346 WINE_MCIQTZ* wma;
348 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
350 if (!lpParms)
351 return MCIERR_NULL_PARAMETER_BLOCK;
353 wma = MCIQTZ_mciGetOpenDev(wDevID);
354 if (!wma)
355 return MCIERR_INVALID_DEVICE_ID;
357 if (!(dwFlags & MCI_STATUS_ITEM)) {
358 WARN("No capability item specified\n");
359 return MCIERR_UNRECOGNIZED_COMMAND;
362 switch (lpParms->dwItem) {
363 case MCI_GETDEVCAPS_CAN_RECORD:
364 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
365 TRACE("MCI_GETDEVCAPS_CAN_RECORD = %08x\n", lpParms->dwReturn);
366 break;
367 case MCI_GETDEVCAPS_HAS_AUDIO:
368 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
369 TRACE("MCI_GETDEVCAPS_HAS_AUDIO = %08x\n", lpParms->dwReturn);
370 break;
371 case MCI_GETDEVCAPS_HAS_VIDEO:
372 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
373 TRACE("MCI_GETDEVCAPS_HAS_VIDEO = %08x\n", lpParms->dwReturn);
374 break;
375 case MCI_GETDEVCAPS_DEVICE_TYPE:
376 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
377 TRACE("MCI_GETDEVCAPS_DEVICE_TYPE = %08x\n", lpParms->dwReturn);
378 break;
379 case MCI_GETDEVCAPS_USES_FILES:
380 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
381 TRACE("MCI_GETDEVCAPS_USES_FILES = %08x\n", lpParms->dwReturn);
382 break;
383 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
384 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
385 TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE = %08x\n", lpParms->dwReturn);
386 break;
387 case MCI_GETDEVCAPS_CAN_EJECT:
388 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
389 TRACE("MCI_GETDEVCAPS_EJECT = %08x\n", lpParms->dwReturn);
390 break;
391 case MCI_GETDEVCAPS_CAN_PLAY:
392 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
393 TRACE("MCI_GETDEVCAPS_CAN_PLAY = %08x\n", lpParms->dwReturn);
394 break;
395 case MCI_GETDEVCAPS_CAN_SAVE:
396 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
397 TRACE("MCI_GETDEVCAPS_CAN_SAVE = %08x\n", lpParms->dwReturn);
398 break;
399 default:
400 ERR("Unknown capability %08x\n", lpParms->dwItem);
401 return MCIERR_UNRECOGNIZED_COMMAND;
404 return MCI_RESOURCE_RETURNED;
407 /***************************************************************************
408 * MCIQTZ_mciSet [internal]
410 static DWORD MCIQTZ_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
412 WINE_MCIQTZ* wma;
414 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
416 if (!lpParms)
417 return MCIERR_NULL_PARAMETER_BLOCK;
419 wma = MCIQTZ_mciGetOpenDev(wDevID);
420 if (!wma)
421 return MCIERR_INVALID_DEVICE_ID;
423 if (dwFlags & MCI_SET_TIME_FORMAT) {
424 switch (lpParms->dwTimeFormat) {
425 case MCI_FORMAT_MILLISECONDS:
426 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_MILLISECONDS\n");
427 wma->time_format = MCI_FORMAT_MILLISECONDS;
428 break;
429 case MCI_FORMAT_FRAMES:
430 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_FRAMES\n");
431 wma->time_format = MCI_FORMAT_FRAMES;
432 break;
433 default:
434 WARN("Bad time format %u\n", lpParms->dwTimeFormat);
435 return MCIERR_BAD_TIME_FORMAT;
439 if (dwFlags & ~MCI_SET_TIME_FORMAT)
440 FIXME("Flags not supported yet %08lX\n", dwFlags & ~MCI_SET_TIME_FORMAT);
442 return 0;
445 /***************************************************************************
446 * MCIQTZ_mciStatus [internal]
448 static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
450 WINE_MCIQTZ* wma;
452 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
454 if (!lpParms)
455 return MCIERR_NULL_PARAMETER_BLOCK;
457 wma = MCIQTZ_mciGetOpenDev(wDevID);
458 if (!wma)
459 return MCIERR_INVALID_DEVICE_ID;
461 if (!(dwFlags & MCI_STATUS_ITEM)) {
462 WARN("No status item specified\n");
463 return MCIERR_UNRECOGNIZED_COMMAND;
466 switch (lpParms->dwItem) {
467 case MCI_STATUS_LENGTH:
468 FIXME("MCI_STATUS_LENGTH not implemented yet\n");
469 return MCIERR_UNRECOGNIZED_COMMAND;
470 case MCI_STATUS_POSITION:
472 HRESULT hr;
473 REFTIME curpos;
474 IMediaPosition* pmpos;
476 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos);
477 if (FAILED(hr)) {
478 FIXME("Cannot get IMediaPostion interface (hr = %x)\n", hr);
479 return MCIERR_INTERNAL;
482 hr = IMediaPosition_get_CurrentPosition(pmpos, &curpos);
483 if (FAILED(hr)) {
484 FIXME("Cannot get position (hr = %x)\n", hr);
485 IMediaPosition_Release(pmpos);
486 return MCIERR_INTERNAL;
489 IMediaPosition_Release(pmpos);
490 lpParms->dwReturn = curpos / 10000;
492 break;
494 case MCI_STATUS_NUMBER_OF_TRACKS:
495 FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
496 return MCIERR_UNRECOGNIZED_COMMAND;
497 case MCI_STATUS_MODE:
498 FIXME("MCI_STATUS_MODE not implemented yet\n");
499 return MCIERR_UNRECOGNIZED_COMMAND;
500 case MCI_STATUS_MEDIA_PRESENT:
501 FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
502 return MCIERR_UNRECOGNIZED_COMMAND;
503 case MCI_STATUS_TIME_FORMAT:
504 FIXME("MCI_STATUS_TIME_FORMAT not implemented yet\n");
505 return MCIERR_UNRECOGNIZED_COMMAND;
506 case MCI_STATUS_READY:
507 FIXME("MCI_STATUS_READY not implemented yet\n");
508 return MCIERR_UNRECOGNIZED_COMMAND;
509 case MCI_STATUS_CURRENT_TRACK:
510 FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
511 return MCIERR_UNRECOGNIZED_COMMAND;
512 default:
513 FIXME("Unknown command %08X\n", lpParms->dwItem);
514 return MCIERR_UNRECOGNIZED_COMMAND;
517 if (dwFlags & MCI_NOTIFY)
518 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);
520 return 0;
523 /***************************************************************************
524 * MCIQTZ_mciWhere [internal]
526 static DWORD MCIQTZ_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
528 WINE_MCIQTZ* wma;
529 IVideoWindow* pVideoWindow;
530 HRESULT hr;
531 HWND hWnd;
532 RECT rc;
534 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
536 if (!lpParms)
537 return MCIERR_NULL_PARAMETER_BLOCK;
539 wma = MCIQTZ_mciGetOpenDev(wDevID);
540 if (!wma)
541 return MCIERR_INVALID_DEVICE_ID;
543 /* Find if there is a video stream and get the display window */
544 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
545 if (FAILED(hr)) {
546 ERR("Cannot get IVideoWindow interface (hr = %x)\n", hr);
547 return MCIERR_INTERNAL;
550 hr = IVideoWindow_get_Owner(pVideoWindow, (OAHWND*)&hWnd);
551 IVideoWindow_Release(pVideoWindow);
552 if (FAILED(hr)) {
553 TRACE("No video stream, returning no window error\n");
554 return MCIERR_NO_WINDOW;
557 if (dwFlags & MCI_DGV_WHERE_SOURCE) {
558 if (dwFlags & MCI_DGV_WHERE_MAX)
559 FIXME("MCI_DGV_WHERE_SOURCE_MAX not supported yet\n");
560 else
561 FIXME("MCI_DGV_WHERE_SOURCE not supported yet\n");
562 return MCIERR_UNRECOGNIZED_COMMAND;
564 if (dwFlags & MCI_DGV_WHERE_DESTINATION) {
565 if (dwFlags & MCI_DGV_WHERE_MAX) {
566 GetClientRect(hWnd, &rc);
567 TRACE("MCI_DGV_WHERE_DESTINATION_MAX %s\n", wine_dbgstr_rect(&rc));
568 } else {
569 FIXME("MCI_DGV_WHERE_DESTINATION not supported yet\n");
570 return MCIERR_UNRECOGNIZED_COMMAND;
573 if (dwFlags & MCI_DGV_WHERE_FRAME) {
574 if (dwFlags & MCI_DGV_WHERE_MAX)
575 FIXME("MCI_DGV_WHERE_FRAME_MAX not supported yet\n");
576 else
577 FIXME("MCI_DGV_WHERE_FRAME not supported yet\n");
578 return MCIERR_UNRECOGNIZED_COMMAND;
580 if (dwFlags & MCI_DGV_WHERE_VIDEO) {
581 if (dwFlags & MCI_DGV_WHERE_MAX)
582 FIXME("MCI_DGV_WHERE_VIDEO_MAX not supported yet\n");
583 else
584 FIXME("MCI_DGV_WHERE_VIDEO not supported yet\n");
585 return MCIERR_UNRECOGNIZED_COMMAND;
587 if (dwFlags & MCI_DGV_WHERE_WINDOW) {
588 if (dwFlags & MCI_DGV_WHERE_MAX) {
589 GetWindowRect(GetDesktopWindow(), &rc);
590 TRACE("MCI_DGV_WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc));
591 } else {
592 GetWindowRect(hWnd, &rc);
593 TRACE("MCI_DGV_WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc));
597 /* In MCI, RECT structure is used differently: rc.right = width & rc.bottom = height
598 * So convert the normal RECT into a MCI RECT before returning */
599 lpParms->rc.left = rc.left;
600 lpParms->rc.top = rc.right;
601 lpParms->rc.right = rc.right - rc.left;
602 lpParms->rc.bottom = rc.bottom - rc.top;
604 return 0;
607 /*======================================================================*
608 * MCI QTZ entry points *
609 *======================================================================*/
611 /**************************************************************************
612 * DriverProc (MCIQTZ.@)
614 LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
615 LPARAM dwParam1, LPARAM dwParam2)
617 TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
618 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
620 switch (wMsg) {
621 case DRV_LOAD: return 1;
622 case DRV_FREE: return 1;
623 case DRV_OPEN: return MCIQTZ_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
624 case DRV_CLOSE: return MCIQTZ_drvClose(dwDevID);
625 case DRV_ENABLE: return 1;
626 case DRV_DISABLE: return 1;
627 case DRV_QUERYCONFIGURE: return 1;
628 case DRV_CONFIGURE: return MCIQTZ_drvConfigure(dwDevID);
629 case DRV_INSTALL: return DRVCNF_RESTART;
630 case DRV_REMOVE: return DRVCNF_RESTART;
633 /* session instance */
634 if (dwDevID == 0xFFFFFFFF)
635 return 1;
637 switch (wMsg) {
638 case MCI_OPEN_DRIVER: return MCIQTZ_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
639 case MCI_CLOSE_DRIVER: return MCIQTZ_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
640 case MCI_PLAY: return MCIQTZ_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
641 case MCI_SEEK: return MCIQTZ_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
642 case MCI_STOP: return MCIQTZ_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
643 case MCI_GETDEVCAPS: return MCIQTZ_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
644 case MCI_SET: return MCIQTZ_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
645 case MCI_STATUS: return MCIQTZ_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
646 case MCI_WHERE: return MCIQTZ_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
647 case MCI_RECORD:
648 case MCI_PAUSE:
649 case MCI_RESUME:
650 case MCI_INFO:
651 case MCI_PUT:
652 case MCI_WINDOW:
653 case MCI_LOAD:
654 case MCI_SAVE:
655 case MCI_FREEZE:
656 case MCI_REALIZE:
657 case MCI_UNFREEZE:
658 case MCI_UPDATE:
659 case MCI_STEP:
660 case MCI_COPY:
661 case MCI_CUT:
662 case MCI_DELETE:
663 case MCI_PASTE:
664 case MCI_CUE:
665 /* Digital Video specific */
666 case MCI_CAPTURE:
667 case MCI_MONITOR:
668 case MCI_RESERVE:
669 case MCI_SETAUDIO:
670 case MCI_SIGNAL:
671 case MCI_SETVIDEO:
672 case MCI_QUALITY:
673 case MCI_LIST:
674 case MCI_UNDO:
675 case MCI_CONFIGURE:
676 case MCI_RESTORE:
677 FIXME("Unimplemented command [%08X]\n", wMsg);
678 break;
679 case MCI_SPIN:
680 case MCI_ESCAPE:
681 WARN("Unsupported command [%08X]\n", wMsg);
682 break;
683 case MCI_OPEN:
684 case MCI_CLOSE:
685 FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
686 break;
687 default:
688 TRACE("Sending msg [%08X] to default driver proc\n", wMsg);
689 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
692 return MCIERR_UNRECOGNIZED_COMMAND;