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
26 #include "wine/debug.h"
27 #include "mciqtz_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(mciqtz
);
31 static DWORD
MCIQTZ_mciClose(UINT
, DWORD
, LPMCI_GENERIC_PARMS
);
32 static DWORD
MCIQTZ_mciStop(UINT
, DWORD
, LPMCI_GENERIC_PARMS
);
34 /*======================================================================*
35 * MCI QTZ implementation *
36 *======================================================================*/
38 HINSTANCE MCIQTZ_hInstance
= 0;
40 /***********************************************************************
43 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
46 case DLL_PROCESS_ATTACH
:
47 DisableThreadLibraryCalls(hInstDLL
);
48 MCIQTZ_hInstance
= hInstDLL
;
54 /**************************************************************************
55 * MCIQTZ_drvOpen [internal]
57 static DWORD
MCIQTZ_drvOpen(LPCWSTR str
, LPMCI_OPEN_DRIVER_PARMSW modp
)
61 TRACE("%s, %p\n", debugstr_w(str
), modp
);
63 /* session instance */
67 wma
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINE_MCIQTZ
));
71 wma
->wDevID
= modp
->wDeviceID
;
72 mciSetDriverData(wma
->wDevID
, (DWORD_PTR
)wma
);
74 return modp
->wDeviceID
;
77 /**************************************************************************
78 * MCIQTZ_drvClose [internal]
80 static DWORD
MCIQTZ_drvClose(DWORD dwDevID
)
84 TRACE("%04x\n", dwDevID
);
86 /* finish all outstanding things */
87 MCIQTZ_mciClose(dwDevID
, MCI_WAIT
, NULL
);
89 wma
= (WINE_MCIQTZ
*)mciGetDriverData(dwDevID
);
92 HeapFree(GetProcessHeap(), 0, wma
);
96 return (dwDevID
== 0xFFFFFFFF) ? 1 : 0;
99 /**************************************************************************
100 * MCIQTZ_drvConfigure [internal]
102 static DWORD
MCIQTZ_drvConfigure(DWORD dwDevID
)
106 TRACE("%04x\n", dwDevID
);
108 MCIQTZ_mciStop(dwDevID
, MCI_WAIT
, NULL
);
110 wma
= (WINE_MCIQTZ
*)mciGetDriverData(dwDevID
);
113 MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK
);
120 /**************************************************************************
121 * MCIQTZ_mciGetOpenDev [internal]
123 static WINE_MCIQTZ
* MCIQTZ_mciGetOpenDev(UINT wDevID
)
125 WINE_MCIQTZ
* wma
= (WINE_MCIQTZ
*)mciGetDriverData(wDevID
);
128 WARN("Invalid wDevID=%u\n", wDevID
);
134 /***************************************************************************
135 * MCIQTZ_mciClose [internal]
137 static DWORD
MCIQTZ_mciClose(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
141 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
143 MCIQTZ_mciStop(wDevID
, MCI_WAIT
, NULL
);
145 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
147 return MCIERR_INVALID_DEVICE_ID
;
152 /***************************************************************************
153 * MCIQTZ_mciStop [internal]
155 static DWORD
MCIQTZ_mciStop(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
159 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
161 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
163 return MCIERR_INVALID_DEVICE_ID
;
168 /*======================================================================*
169 * MCI QTZ entry points *
170 *======================================================================*/
172 /**************************************************************************
173 * DriverProc (MCIQTZ.@)
175 LRESULT CALLBACK
MCIQTZ_DriverProc(DWORD_PTR dwDevID
, HDRVR hDriv
, UINT wMsg
,
176 LPARAM dwParam1
, LPARAM dwParam2
)
178 TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
179 dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
182 case DRV_LOAD
: return 1;
183 case DRV_FREE
: return 1;
184 case DRV_OPEN
: return MCIQTZ_drvOpen((LPCWSTR
)dwParam1
, (LPMCI_OPEN_DRIVER_PARMSW
)dwParam2
);
185 case DRV_CLOSE
: return MCIQTZ_drvClose(dwDevID
);
186 case DRV_ENABLE
: return 1;
187 case DRV_DISABLE
: return 1;
188 case DRV_QUERYCONFIGURE
: return 1;
189 case DRV_CONFIGURE
: return MCIQTZ_drvConfigure(dwDevID
);
190 case DRV_INSTALL
: return DRVCNF_RESTART
;
191 case DRV_REMOVE
: return DRVCNF_RESTART
;
194 /* session instance */
195 if (dwDevID
== 0xFFFFFFFF)
198 FIXME("Unsupported command [%u]\n", wMsg
);
200 return MCIERR_UNRECOGNIZED_COMMAND
;