1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 * Wine Wave mapper driver
5 * Copyright 1999 Eric Pouech
9 * + implement wavein as waveout has been implemented
10 * + better protection against evilish dwUser parameters
11 * + use asynchronous ACM conversion
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(msacm)
22 typedef struct tagWAVEMAPDATA {
23 struct tagWAVEMAPDATA* self;
25 HACMSTREAM hAcmStream;
26 /* needed data to filter callbacks. Only needed when hAcmStream is not 0 */
28 DWORD dwClientInstance;
30 MMRESULT (WINAPI *acmStreamOpen)(LPHACMSTREAM, HACMDRIVER, LPWAVEFORMATEX, LPWAVEFORMATEX, LPWAVEFILTER, DWORD, DWORD, DWORD);
31 MMRESULT (WINAPI *acmStreamClose)(HACMSTREAM, DWORD);
32 MMRESULT (WINAPI *acmStreamSize)(HACMSTREAM, DWORD, LPDWORD, DWORD);
33 MMRESULT (WINAPI *acmStreamConvert)(HACMSTREAM, PACMSTREAMHEADER, DWORD);
34 MMRESULT (WINAPI *acmStreamPrepareHeader)(HACMSTREAM, PACMSTREAMHEADER, DWORD);
35 MMRESULT (WINAPI *acmStreamUnprepareHeader)(HACMSTREAM, PACMSTREAMHEADER, DWORD);
38 static BOOL WAVEMAP_IsData(WAVEMAPDATA* wm)
40 return (!IsBadReadPtr(wm, sizeof(WAVEMAPDATA)) && wm->self == wm);
43 /*======================================================================*
45 *======================================================================*/
47 static void CALLBACK WAVEMAP_DstCallback(HDRVR hDev, UINT uMsg, DWORD dwInstance,
48 DWORD dwParam1, DWORD dwParam2)
50 WAVEMAPDATA* wom = (WAVEMAPDATA*)dwInstance;
52 TRACE("(0x%x %u %ld %ld %ld);\n", hDev, uMsg, dwInstance, dwParam1, dwParam2);
57 /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
61 LPWAVEHDR lpWaveHdrDst = (LPWAVEHDR)dwParam1;
62 PACMSTREAMHEADER ash = (PACMSTREAMHEADER)((LPSTR)lpWaveHdrDst - sizeof(ACMSTREAMHEADER));
63 LPWAVEHDR lpWaveHdrSrc = (LPWAVEHDR)ash->dwUser;
65 lpWaveHdrSrc->dwFlags &= ~WHDR_INQUEUE;
66 lpWaveHdrSrc->dwFlags |= WHDR_DONE;
67 dwParam1 = (DWORD)lpWaveHdrSrc;
71 ERR("Unknown msg %u\n", uMsg);
74 DriverCallback(wom->dwCallback, HIWORD(wom->dwFlags), hDev, uMsg,
75 wom->dwClientInstance, dwParam1, dwParam2);
78 static DWORD wodOpenHelper(WAVEMAPDATA* wom, UINT idx,
79 LPWAVEOPENDESC lpDesc, LPWAVEFORMATEX lpwfx,
84 /* destination is always PCM, so the formulas below apply */
85 lpwfx->nBlockAlign = (lpwfx->nChannels * lpwfx->wBitsPerSample) / 8;
86 lpwfx->nAvgBytesPerSec = lpwfx->nSamplesPerSec * lpwfx->nBlockAlign;
87 ret = wom->acmStreamOpen(&wom->hAcmStream, 0, lpDesc->lpFormat, lpwfx, NULL, 0L, 0L,
88 (dwFlags & WAVE_FORMAT_QUERY) ? ACM_STREAMOPENF_QUERY : 0L);
89 if (ret != MMSYSERR_NOERROR)
91 return waveOutOpen(&wom->hWave, idx, lpwfx, (DWORD)WAVEMAP_DstCallback,
92 (DWORD)wom, (dwFlags & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION);
95 static DWORD wodOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
97 UINT nd = waveOutGetNumDevs();
99 WAVEMAPDATA* wom = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
102 TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags);
105 return MMSYSERR_NOMEM;
109 for (i = 0; i < nd; i++) {
110 /* if no ACM stuff is involved, no need to handle callbacks at this
111 * level, this will be done transparently
113 if (waveOutOpen(&wom->hWave, i, lpDesc->lpFormat, lpDesc->dwCallback,
114 lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) {
120 /* temporary hack until real builtin dll loading is available */
122 HMODULE hModule = LoadLibraryA("msacm32.dll");
124 wom->acmStreamOpen = (void*)GetProcAddress(hModule, "acmStreamOpen");
125 wom->acmStreamClose = (void*)GetProcAddress(hModule, "acmStreamClose");
126 wom->acmStreamSize = (void*)GetProcAddress(hModule, "acmStreamSize");
127 wom->acmStreamConvert = (void*)GetProcAddress(hModule, "acmStreamConvert");
128 wom->acmStreamPrepareHeader = (void*)GetProcAddress(hModule, "acmStreamPrepareHeader");
129 wom->acmStreamUnprepareHeader = (void*)GetProcAddress(hModule, "acmStreamUnprepareHeader");
132 wfx.wFormatTag = WAVE_FORMAT_PCM;
133 wfx.cbSize = 0; /* normally, this field is not used for PCM format, just in case */
134 /* try some ACM stuff */
136 wom->dwCallback = lpDesc->dwCallback;
137 wom->dwFlags = dwFlags;
138 wom->dwClientInstance = lpDesc->dwInstance;
140 #define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
141 if (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags) == MMSYSERR_NOERROR) goto found;
143 for (i = 0; i < nd; i++) {
144 /* first try with same stereo/mono option as source */
145 wfx.nChannels = lpDesc->lpFormat->nChannels;
150 /* 2^3 => 1, 1^3 => 2, so if stereo, try mono (and the other way around) */
158 HeapFree(GetProcessHeap(), 0, wom);
159 return MMSYSERR_ALLOCATED;
161 if (dwFlags & WAVE_FORMAT_QUERY) {
164 HeapFree(GetProcessHeap(), 0, wom);
166 lpDesc->hWave = wom->hWave;
167 *lpdwUser = (DWORD)wom;
169 return MMSYSERR_NOERROR;
172 static DWORD wodClose(WAVEMAPDATA* wom)
174 DWORD ret = waveOutClose(wom->hWave);
176 if (ret == MMSYSERR_NOERROR) {
177 if (wom->hAcmStream) {
178 ret = wom->acmStreamClose(wom->hAcmStream, 0);
180 if (ret == MMSYSERR_NOERROR) {
181 HeapFree(GetProcessHeap(), 0, wom);
187 static DWORD wodWrite(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
189 PACMSTREAMHEADER ash;
190 LPWAVEHDR lpWaveHdrDst;
192 if (!wom->hAcmStream) {
193 return waveOutWrite(wom->hWave, lpWaveHdrSrc, dwParam2);
196 lpWaveHdrSrc->dwFlags |= WHDR_INQUEUE;
197 ash = (PACMSTREAMHEADER)lpWaveHdrSrc->reserved;
198 if (wom->acmStreamConvert(wom->hAcmStream, ash, 0L) != MMSYSERR_NOERROR)
199 return MMSYSERR_ERROR;
201 lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
202 lpWaveHdrDst->dwBufferLength = ash->cbDstLengthUsed;
203 return waveOutWrite(wom->hWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
206 static DWORD wodPrepare(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
208 PACMSTREAMHEADER ash;
211 LPWAVEHDR lpWaveHdrDst;
213 if (!wom->hAcmStream) {
214 return waveOutPrepareHeader(wom->hWave, lpWaveHdrSrc, dwParam2);
216 if (wom->acmStreamSize(wom->hAcmStream, lpWaveHdrSrc->dwBufferLength, &size, ACM_STREAMSIZEF_SOURCE) != MMSYSERR_NOERROR)
217 return MMSYSERR_ERROR;
219 ash = HeapAlloc(GetProcessHeap(), 0, sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR) + size);
221 return MMSYSERR_NOMEM;
223 ash->cbStruct = sizeof(*ash);
225 ash->dwUser = (DWORD)lpWaveHdrSrc;
226 ash->pbSrc = lpWaveHdrSrc->lpData;
227 ash->cbSrcLength = lpWaveHdrSrc->dwBufferLength;
228 /* ash->cbSrcLengthUsed */
229 ash->dwSrcUser = lpWaveHdrSrc->dwUser; /* FIXME ? */
230 ash->pbDst = (LPSTR)ash + sizeof(ACMSTREAMHEADER) + sizeof(WAVEHDR);
231 ash->cbDstLength = size;
232 /* ash->cbDstLengthUsed */
233 ash->dwDstUser = 0; /* FIXME ? */
234 dwRet = wom->acmStreamPrepareHeader(wom->hAcmStream, ash, 0L);
235 if (dwRet != MMSYSERR_NOERROR)
238 lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
239 lpWaveHdrDst->lpData = ash->pbDst;
240 lpWaveHdrDst->dwBufferLength = size; /* conversion is not done yet */
241 lpWaveHdrDst->dwFlags = 0;
242 lpWaveHdrDst->dwLoops = 0;
243 dwRet = waveOutPrepareHeader(wom->hWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
244 if (dwRet != MMSYSERR_NOERROR)
247 lpWaveHdrSrc->reserved = (DWORD)ash;
248 lpWaveHdrSrc->dwFlags = WHDR_PREPARED;
250 return MMSYSERR_NOERROR;
252 TRACE("=> (%ld)\n", dwRet);
253 HeapFree(GetProcessHeap(), 0, ash);
257 static DWORD wodUnprepare(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwParam2)
259 PACMSTREAMHEADER ash;
260 LPWAVEHDR lpWaveHdrDst;
261 DWORD dwRet1, dwRet2;
263 if (!wom->hAcmStream) {
264 return waveOutUnprepareHeader(wom->hWave, lpWaveHdrSrc, dwParam2);
266 ash = (PACMSTREAMHEADER)lpWaveHdrSrc->reserved;
267 dwRet1 = wom->acmStreamUnprepareHeader(wom->hAcmStream, ash, 0L);
269 lpWaveHdrDst = (LPWAVEHDR)((LPSTR)ash + sizeof(ACMSTREAMHEADER));
270 dwRet2 = waveOutUnprepareHeader(wom->hWave, lpWaveHdrDst, sizeof(*lpWaveHdrDst));
272 HeapFree(GetProcessHeap(), 0, ash);
274 lpWaveHdrSrc->dwFlags &= ~WHDR_PREPARED;
275 return (dwRet1 == MMSYSERR_NOERROR) ? dwRet2 : dwRet1;
278 static DWORD wodGetPosition(WAVEMAPDATA* wom, LPMMTIME lpTime, DWORD dwParam2)
280 return waveOutGetPosition(wom->hWave, lpTime, dwParam2);
283 static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom, LPWAVEOUTCAPSA lpWaveCaps, DWORD dwParam2)
285 /* if opened low driver, forward message */
286 if (WAVEMAP_IsData(wom))
287 return waveOutGetDevCapsA(wom->hWave, lpWaveCaps, dwParam2);
288 /* otherwise, return caps of mapper itself */
289 if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
290 lpWaveCaps->wMid = 0x00FF;
291 lpWaveCaps->wPid = 0x0001;
292 lpWaveCaps->vDriverVersion = 0x0100;
293 strcpy(lpWaveCaps->szPname, "Wine wave out mapper");
294 lpWaveCaps->dwFormats =
295 WAVE_FORMAT_4M08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4S16 |
296 WAVE_FORMAT_2M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2S16 |
297 WAVE_FORMAT_1M08 | WAVE_FORMAT_1S08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_1S16;
298 lpWaveCaps->wChannels = 2;
299 lpWaveCaps->dwSupport = WAVECAPS_VOLUME | WAVECAPS_LRVOLUME;
301 return MMSYSERR_NOERROR;
303 ERR("This shouldn't happen\n");
304 return MMSYSERR_ERROR;
307 static DWORD wodGetVolume(UINT wDevID, WAVEMAPDATA* wom, LPDWORD lpVol)
309 if (WAVEMAP_IsData(wom))
310 return waveOutGetVolume(wom->hWave, lpVol);
311 return MMSYSERR_NOERROR;
314 static DWORD wodSetVolume(UINT wDevID, WAVEMAPDATA* wom, DWORD vol)
316 if (WAVEMAP_IsData(wom))
317 return waveOutSetVolume(wom->hWave, vol);
318 return MMSYSERR_NOERROR;
321 static DWORD wodPause(WAVEMAPDATA* wom)
323 return waveOutPause(wom->hWave);
326 static DWORD wodRestart(WAVEMAPDATA* wom)
328 return waveOutRestart(wom->hWave);
331 static DWORD wodReset(WAVEMAPDATA* wom)
333 return waveOutReset(wom->hWave);
336 /**************************************************************************
337 * WAVEMAP_wodMessage [sample driver]
339 DWORD WINAPI WAVEMAP_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
340 DWORD dwParam1, DWORD dwParam2)
342 TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
343 wDevID, wMsg, dwUser, dwParam1, dwParam2);
350 /* FIXME: Pretend this is supported */
352 case WODM_OPEN: return wodOpen ((LPDWORD)dwUser, (LPWAVEOPENDESC)dwParam1,dwParam2);
353 case WODM_CLOSE: return wodClose ((WAVEMAPDATA*)dwUser);
354 case WODM_WRITE: return wodWrite ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
355 case WODM_PAUSE: return wodPause ((WAVEMAPDATA*)dwUser);
356 case WODM_GETPOS: return wodGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
357 case WODM_BREAKLOOP: return MMSYSERR_NOTSUPPORTED;
358 case WODM_PREPARE: return wodPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
359 case WODM_UNPREPARE: return wodUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
360 case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSA)dwParam1,dwParam2);
361 case WODM_GETNUMDEVS: return 1;
362 case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
363 case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
364 case WODM_GETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
365 case WODM_SETPLAYBACKRATE: return MMSYSERR_NOTSUPPORTED;
366 case WODM_GETVOLUME: return wodGetVolume (wDevID, (WAVEMAPDATA*)dwUser, (LPDWORD)dwParam1);
367 case WODM_SETVOLUME: return wodSetVolume (wDevID, (WAVEMAPDATA*)dwUser, dwParam1);
368 case WODM_RESTART: return wodRestart ((WAVEMAPDATA*)dwUser);
369 case WODM_RESET: return wodReset ((WAVEMAPDATA*)dwUser);
371 FIXME("unknown message %d!\n", wMsg);
373 return MMSYSERR_NOTSUPPORTED;
376 /*======================================================================*
378 *======================================================================*/
380 static DWORD widOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
382 UINT nd = waveInGetNumDevs();
384 WAVEMAPDATA* wim = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
386 TRACE("(%p %p %08lx\n", lpdwUser, lpDesc, dwFlags);
390 for (i = 0; i < nd; i++) {
391 if (waveInOpen(&wim->hWave, i, lpDesc->lpFormat, lpDesc->dwCallback,
392 lpDesc->dwInstance, dwFlags) == MMSYSERR_NOERROR) {
393 lpDesc->hWave = wim->hWave;
394 *lpdwUser = (DWORD)wim;
395 return MMSYSERR_NOERROR;
398 HeapFree(GetProcessHeap(), 0, wim);
399 return MMSYSERR_ALLOCATED;
402 static DWORD widClose(WAVEMAPDATA* wim)
404 DWORD ret = waveInClose(wim->hWave);
405 if (ret == MMSYSERR_NOERROR)
406 HeapFree(GetProcessHeap(), 0, wim);
410 static DWORD widAddBuffer(WAVEMAPDATA* wim, LPWAVEHDR lpWaveHdr, DWORD dwParam2)
412 return waveInAddBuffer(wim->hWave, lpWaveHdr, dwParam2);
415 static DWORD widPrepare(WAVEMAPDATA* wim, LPWAVEHDR lpWaveHdr, DWORD dwParam2)
417 return waveInPrepareHeader(wim->hWave, lpWaveHdr, dwParam2);
420 static DWORD widUnprepare(WAVEMAPDATA* wim, LPWAVEHDR lpWaveHdr, DWORD dwParam2)
422 return waveInUnprepareHeader(wim->hWave, lpWaveHdr, dwParam2);
425 static DWORD widGetPosition(WAVEMAPDATA* wim, LPMMTIME lpTime, DWORD dwParam2)
427 return waveInGetPosition(wim->hWave, lpTime, dwParam2);
430 static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim, LPWAVEINCAPSA lpWaveCaps, DWORD dwParam2)
432 /* if opened low driver, forward message */
433 if (WAVEMAP_IsData(wim))
434 return waveInGetDevCapsA(wim->hWave, lpWaveCaps, dwParam2);
435 /* otherwise, return caps of mapper itself */
436 if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
437 lpWaveCaps->wMid = 0x00FF;
438 lpWaveCaps->wPid = 0x0001;
439 lpWaveCaps->vDriverVersion = 0x0001;
440 strcpy(lpWaveCaps->szPname, "Wine wave in mapper");
441 lpWaveCaps->dwFormats =
442 WAVE_FORMAT_4M08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4S16 |
443 WAVE_FORMAT_2M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2S16 |
444 WAVE_FORMAT_1M08 | WAVE_FORMAT_1S08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_1S16;
445 lpWaveCaps->wChannels = 2;
446 return MMSYSERR_NOERROR;
448 ERR("This shouldn't happen\n");
449 return MMSYSERR_ERROR;
452 static DWORD widStop(WAVEMAPDATA* wim)
454 return waveInStop(wim->hWave);
457 static DWORD widStart(WAVEMAPDATA* wim)
459 return waveInStart(wim->hWave);
462 static DWORD widReset(WAVEMAPDATA* wim)
464 return waveInReset(wim->hWave);
467 /**************************************************************************
468 * WAVEMAP_widMessage [sample driver]
470 DWORD WINAPI WAVEMAP_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
471 DWORD dwParam1, DWORD dwParam2)
473 TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
474 wDevID, wMsg, dwUser, dwParam1, dwParam2);
481 /* FIXME: Pretend this is supported */
484 case WIDM_OPEN: return widOpen ((LPDWORD)dwUser, (LPWAVEOPENDESC)dwParam1, dwParam2);
485 case WIDM_CLOSE: return widClose ((WAVEMAPDATA*)dwUser);
487 case WIDM_ADDBUFFER: return widAddBuffer ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
488 case WIDM_PREPARE: return widPrepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
489 case WIDM_UNPREPARE: return widUnprepare ((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
490 case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID, (WAVEMAPDATA*)dwUser, (LPWAVEINCAPSA)dwParam1, dwParam2);
491 case WIDM_GETNUMDEVS: return 1;
492 case WIDM_GETPOS: return widGetPosition ((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
493 case WIDM_RESET: return widReset ((WAVEMAPDATA*)dwUser);
494 case WIDM_START: return widStart ((WAVEMAPDATA*)dwUser);
495 case WIDM_STOP: return widStop ((WAVEMAPDATA*)dwUser);
497 FIXME("unknown message %u!\n", wMsg);
499 return MMSYSERR_NOTSUPPORTED;
502 /*======================================================================*
504 *======================================================================*/
506 static struct WINE_WAVEMAP* oss = NULL;
508 /**************************************************************************
509 * WAVEMAP_drvOpen [internal]
511 static DWORD WAVEMAP_drvOpen(LPSTR str)
516 /* I know, this is ugly, but who cares... */
517 oss = (struct WINE_WAVEMAP*)1;
521 /**************************************************************************
522 * WAVEMAP_drvClose [internal]
524 static DWORD WAVEMAP_drvClose(DWORD dwDevID)
533 /**************************************************************************
534 * WAVEMAP_DriverProc [internal]
536 LONG CALLBACK WAVEMAP_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
537 DWORD dwParam1, DWORD dwParam2)
539 /* EPP TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", */
540 /* EPP dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
543 case DRV_LOAD: return 1;
544 case DRV_FREE: return 1;
545 case DRV_OPEN: return WAVEMAP_drvOpen((LPSTR)dwParam1);
546 case DRV_CLOSE: return WAVEMAP_drvClose(dwDevID);
547 case DRV_ENABLE: return 1;
548 case DRV_DISABLE: return 1;
549 case DRV_QUERYCONFIGURE: return 1;
550 case DRV_CONFIGURE: MessageBoxA(0, "WAVEMAP MultiMedia Driver !", "OSS Driver", MB_OK); return 1;
551 case DRV_INSTALL: return DRVCNF_RESTART;
552 case DRV_REMOVE: return DRVCNF_RESTART;
554 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);