2 * MPEG Layer 3 handling
4 * Copyright (C) 2002 Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "../msacmdrv.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mpeg3
);
41 /***********************************************************************
44 static DWORD
MPEG3_drvOpen(LPCSTR str
)
49 /***********************************************************************
52 static DWORD
MPEG3_drvClose(DWORD dwDevID
)
57 typedef struct tagAcmMpeg3Data
59 void (*convert
)(PACMDRVSTREAMINSTANCE adsi
,
60 const unsigned char*, LPDWORD
, unsigned char*, LPDWORD
);
64 /* table to list all supported formats... those are the basic ones. this
65 * also helps given a unique index to each of the supported formats
74 static Format PCM_Formats
[] =
76 {1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
77 {1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
78 {1, 8, 22050}, {2, 8, 22050}, {1, 16, 22050}, {2, 16, 22050},
79 {1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
82 static Format MPEG3_Formats
[] =
84 {1, 0, 8000}, {2, 0, 8000}, {1, 0, 11025}, {2, 0, 11025},
85 {1, 0, 22050}, {2, 0, 22050}, {1, 0, 44100}, {2, 0, 44100},
88 #define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
89 #define NUM_MPEG3_FORMATS (sizeof(MPEG3_Formats) / sizeof(MPEG3_Formats[0]))
91 /***********************************************************************
92 * MPEG3_GetFormatIndex
94 static DWORD
MPEG3_GetFormatIndex(LPWAVEFORMATEX wfx
)
99 switch (wfx
->wFormatTag
)
101 case WAVE_FORMAT_PCM
:
102 hi
= NUM_PCM_FORMATS
;
105 case WAVE_FORMAT_MPEGLAYER3
:
106 hi
= NUM_MPEG3_FORMATS
;
107 fmts
= MPEG3_Formats
;
113 for (i
= 0; i
< hi
; i
++)
115 if (wfx
->nChannels
== fmts
[i
].nChannels
&&
116 wfx
->nSamplesPerSec
== fmts
[i
].rate
&&
117 wfx
->wBitsPerSample
== fmts
[i
].nBits
)
124 /***********************************************************************
127 * Read a 16 bit sample (correctly handles endianess)
129 static inline short R16(const unsigned char* src
)
131 return (short)((unsigned short)src
[0] | ((unsigned short)src
[1] << 8));
134 /***********************************************************************
137 * Write a 16 bit sample (correctly handles endianess)
139 static inline void W16(unsigned char* dst
, short s
)
145 static void mp3_horse(PACMDRVSTREAMINSTANCE adsi
,
146 const unsigned char* src
, LPDWORD nsrc
,
147 unsigned char* dst
, LPDWORD ndst
)
149 AcmMpeg3Data
* amd
= (AcmMpeg3Data
*)adsi
->dwDriver
;
153 ret
= decodeMP3(&amd
->mp
, (unsigned char*)src
, *nsrc
, dst
, *ndst
, &size
);
161 if (*ndst
- dpos
< 4608) break;
162 ret
= decodeMP3(&amd
->mp
, NULL
, 0,
163 dst
+ dpos
, *ndst
- dpos
, &size
);
164 } while (ret
== MP3_OK
);
168 /***********************************************************************
169 * MPEG3_DriverDetails
172 static LRESULT
MPEG3_DriverDetails(PACMDRIVERDETAILSW add
)
174 add
->fccType
= ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC
;
175 add
->fccComp
= ACMDRIVERDETAILS_FCCCOMP_UNDEFINED
;
178 add
->vdwACM
= 0x01000000;
179 add
->vdwDriver
= 0x01000000;
180 add
->fdwSupport
= ACMDRIVERDETAILS_SUPPORTF_CODEC
;
181 add
->cFormatTags
= 2; /* PCM, MPEG3 */
182 add
->cFilterTags
= 0;
184 MultiByteToWideChar( CP_ACP
, 0, "WINE-MPEG3", -1,
185 add
->szShortName
, sizeof(add
->szShortName
)/sizeof(WCHAR
) );
186 MultiByteToWideChar( CP_ACP
, 0, "Wine MPEG3 decoder", -1,
187 add
->szLongName
, sizeof(add
->szLongName
)/sizeof(WCHAR
) );
188 MultiByteToWideChar( CP_ACP
, 0, "Brought to you by the Wine team (based on mpglib by Michael Hipp)...", -1,
189 add
->szCopyright
, sizeof(add
->szCopyright
)/sizeof(WCHAR
) );
190 MultiByteToWideChar( CP_ACP
, 0, "Refer to LICENSE file", -1,
191 add
->szLicensing
, sizeof(add
->szLicensing
)/sizeof(WCHAR
) );
192 add
->szFeatures
[0] = 0;
194 return MMSYSERR_NOERROR
;
197 /***********************************************************************
198 * MPEG3_FormatTagDetails
201 static LRESULT
MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd
, DWORD dwQuery
)
203 static WCHAR szPcm
[]={'P','C','M',0};
204 static WCHAR szMpeg3
[]={'M','P','e','g','3',0};
208 case ACM_FORMATTAGDETAILSF_INDEX
:
209 if (aftd
->dwFormatTagIndex
>= 2) return ACMERR_NOTPOSSIBLE
;
211 case ACM_FORMATTAGDETAILSF_LARGESTSIZE
:
212 if (aftd
->dwFormatTag
== WAVE_FORMAT_UNKNOWN
)
214 aftd
->dwFormatTagIndex
= 1; /* WAVE_FORMAT_MPEGLAYER3 is bigger than PCM */
218 case ACM_FORMATTAGDETAILSF_FORMATTAG
:
219 switch (aftd
->dwFormatTag
)
221 case WAVE_FORMAT_PCM
: aftd
->dwFormatTagIndex
= 0; break;
222 case WAVE_FORMAT_MPEGLAYER3
: aftd
->dwFormatTagIndex
= 1; break;
223 default: return ACMERR_NOTPOSSIBLE
;
227 WARN("Unsupported query %08lx\n", dwQuery
);
228 return MMSYSERR_NOTSUPPORTED
;
231 aftd
->fdwSupport
= ACMDRIVERDETAILS_SUPPORTF_CODEC
;
232 switch (aftd
->dwFormatTagIndex
)
235 aftd
->dwFormatTag
= WAVE_FORMAT_PCM
;
236 aftd
->cbFormatSize
= sizeof(PCMWAVEFORMAT
);
237 aftd
->cStandardFormats
= NUM_PCM_FORMATS
;
238 lstrcpyW(aftd
->szFormatTag
, szPcm
);
241 aftd
->dwFormatTag
= WAVE_FORMAT_MPEGLAYER3
;
242 aftd
->cbFormatSize
= sizeof(MPEGLAYER3WAVEFORMAT
);
243 aftd
->cStandardFormats
= NUM_MPEG3_FORMATS
;
244 lstrcpyW(aftd
->szFormatTag
, szMpeg3
);
247 return MMSYSERR_NOERROR
;
250 static void fill_in_wfx(unsigned cbwfx
, WAVEFORMATEX
* wfx
, unsigned bit_rate
)
252 MPEGLAYER3WAVEFORMAT
* mp3wfx
= (MPEGLAYER3WAVEFORMAT
*)wfx
;
254 wfx
->nAvgBytesPerSec
= bit_rate
/ 8;
255 if (cbwfx
>= sizeof(WAVEFORMATEX
))
256 wfx
->cbSize
= sizeof(MPEGLAYER3WAVEFORMAT
) - sizeof(WAVEFORMATEX
);
257 if (cbwfx
>= sizeof(MPEGLAYER3WAVEFORMAT
))
259 mp3wfx
->wID
= MPEGLAYER3_ID_MPEG
;
260 mp3wfx
->fdwFlags
= MPEGLAYER3_FLAG_PADDING_OFF
;
261 mp3wfx
->nBlockSize
= (bit_rate
* 144) / wfx
->nSamplesPerSec
;
262 mp3wfx
->nFramesPerBlock
= 1;
263 mp3wfx
->nCodecDelay
= 0x0571;
267 /***********************************************************************
268 * MPEG3_FormatDetails
271 static LRESULT
MPEG3_FormatDetails(PACMFORMATDETAILSW afd
, DWORD dwQuery
)
275 case ACM_FORMATDETAILSF_FORMAT
:
276 if (MPEG3_GetFormatIndex(afd
->pwfx
) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE
;
278 case ACM_FORMATDETAILSF_INDEX
:
279 afd
->pwfx
->wFormatTag
= afd
->dwFormatTag
;
280 switch (afd
->dwFormatTag
)
282 case WAVE_FORMAT_PCM
:
283 if (afd
->dwFormatIndex
>= NUM_PCM_FORMATS
) return ACMERR_NOTPOSSIBLE
;
284 afd
->pwfx
->nChannels
= PCM_Formats
[afd
->dwFormatIndex
].nChannels
;
285 afd
->pwfx
->nSamplesPerSec
= PCM_Formats
[afd
->dwFormatIndex
].rate
;
286 afd
->pwfx
->wBitsPerSample
= PCM_Formats
[afd
->dwFormatIndex
].nBits
;
287 /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
288 * afd->pwfx->cbSize = 0;
290 afd
->pwfx
->nBlockAlign
=
291 (afd
->pwfx
->nChannels
* afd
->pwfx
->wBitsPerSample
) / 8;
292 afd
->pwfx
->nAvgBytesPerSec
=
293 afd
->pwfx
->nSamplesPerSec
* afd
->pwfx
->nBlockAlign
;
295 case WAVE_FORMAT_MPEGLAYER3
:
296 if (afd
->dwFormatIndex
>= NUM_MPEG3_FORMATS
) return ACMERR_NOTPOSSIBLE
;
297 afd
->pwfx
->nChannels
= MPEG3_Formats
[afd
->dwFormatIndex
].nChannels
;
298 afd
->pwfx
->nSamplesPerSec
= MPEG3_Formats
[afd
->dwFormatIndex
].rate
;
299 afd
->pwfx
->wBitsPerSample
= MPEG3_Formats
[afd
->dwFormatIndex
].nBits
;
300 afd
->pwfx
->nBlockAlign
= 1;
301 fill_in_wfx(afd
->cbwfx
, afd
->pwfx
, 192000);
304 WARN("Unsupported tag %08lx\n", afd
->dwFormatTag
);
305 return MMSYSERR_INVALPARAM
;
309 WARN("Unsupported query %08lx\n", dwQuery
);
310 return MMSYSERR_NOTSUPPORTED
;
312 afd
->fdwSupport
= ACMDRIVERDETAILS_SUPPORTF_CODEC
;
313 afd
->szFormat
[0] = 0; /* let MSACM format this for us... */
315 return MMSYSERR_NOERROR
;
318 /***********************************************************************
319 * MPEG3_FormatSuggest
322 static LRESULT
MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs
)
325 if (adfs
->cbwfxSrc
< sizeof(PCMWAVEFORMAT
) ||
326 adfs
->cbwfxDst
< sizeof(PCMWAVEFORMAT
) ||
327 MPEG3_GetFormatIndex(adfs
->pwfxSrc
) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE
;
328 /* FIXME: should do those tests against the real size (according to format tag */
330 /* If no suggestion for destination, then copy source value */
331 if (!(adfs
->fdwSuggest
& ACM_FORMATSUGGESTF_NCHANNELS
))
332 adfs
->pwfxDst
->nChannels
= adfs
->pwfxSrc
->nChannels
;
333 if (!(adfs
->fdwSuggest
& ACM_FORMATSUGGESTF_NSAMPLESPERSEC
))
334 adfs
->pwfxDst
->nSamplesPerSec
= adfs
->pwfxSrc
->nSamplesPerSec
;
336 if (!(adfs
->fdwSuggest
& ACM_FORMATSUGGESTF_WBITSPERSAMPLE
))
338 if (adfs
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
)
339 adfs
->pwfxDst
->wBitsPerSample
= 4;
341 adfs
->pwfxDst
->wBitsPerSample
= 16;
343 if (!(adfs
->fdwSuggest
& ACM_FORMATSUGGESTF_WFORMATTAG
))
345 if (adfs
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
)
346 adfs
->pwfxDst
->wFormatTag
= WAVE_FORMAT_MPEGLAYER3
;
348 adfs
->pwfxDst
->wFormatTag
= WAVE_FORMAT_PCM
;
351 /* check if result is ok */
352 if (MPEG3_GetFormatIndex(adfs
->pwfxDst
) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE
;
354 /* recompute other values */
355 switch (adfs
->pwfxDst
->wFormatTag
)
357 case WAVE_FORMAT_PCM
:
358 adfs
->pwfxDst
->nBlockAlign
= (adfs
->pwfxDst
->nChannels
* adfs
->pwfxDst
->wBitsPerSample
) / 8;
359 adfs
->pwfxDst
->nAvgBytesPerSec
= adfs
->pwfxDst
->nSamplesPerSec
* adfs
->pwfxDst
->nBlockAlign
;
361 case WAVE_FORMAT_MPEGLAYER3
:
362 adfs
->pwfxDst
->nBlockAlign
= 1;
363 fill_in_wfx(adfs
->cbwfxDst
, adfs
->pwfxDst
, 192000);
370 return MMSYSERR_NOERROR
;
373 /***********************************************************************
377 static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi
, AcmMpeg3Data
* aad
)
381 /***********************************************************************
385 static LRESULT
MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi
)
389 assert(!(adsi
->fdwOpen
& ACM_STREAMOPENF_ASYNC
));
391 if (MPEG3_GetFormatIndex(adsi
->pwfxSrc
) == 0xFFFFFFFF ||
392 MPEG3_GetFormatIndex(adsi
->pwfxDst
) == 0xFFFFFFFF)
393 return ACMERR_NOTPOSSIBLE
;
395 aad
= HeapAlloc(GetProcessHeap(), 0, sizeof(AcmMpeg3Data
));
396 if (aad
== 0) return MMSYSERR_NOMEM
;
398 adsi
->dwDriver
= (DWORD
)aad
;
400 if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
&&
401 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_PCM
)
405 else if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_MPEGLAYER3
&&
406 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_PCM
)
408 /* resampling or mono <=> stereo not available
409 * MPEG3 algo only define 16 bit per sample output
411 if (adsi
->pwfxSrc
->nSamplesPerSec
!= adsi
->pwfxDst
->nSamplesPerSec
||
412 adsi
->pwfxSrc
->nChannels
!= adsi
->pwfxDst
->nChannels
||
413 adsi
->pwfxDst
->wBitsPerSample
!= 16)
415 aad
->convert
= mp3_horse
;
419 else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
420 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
423 MPEG3_Reset(adsi
, aad
);
425 return MMSYSERR_NOERROR
;
428 HeapFree(GetProcessHeap(), 0, aad
);
430 return MMSYSERR_NOTSUPPORTED
;
433 /***********************************************************************
437 static LRESULT
MPEG3_StreamClose(PACMDRVSTREAMINSTANCE adsi
)
439 ExitMP3(&((AcmMpeg3Data
*)adsi
->dwDriver
)->mp
);
440 HeapFree(GetProcessHeap(), 0, (void*)adsi
->dwDriver
);
441 return MMSYSERR_NOERROR
;
444 /***********************************************************************
448 static inline DWORD
MPEG3_round(DWORD a
, DWORD b
, DWORD c
)
451 /* to be sure, always return an entire number of c... */
452 return ((double)a
* (double)b
+ (double)c
- 1) / (double)c
;
455 /***********************************************************************
459 static LRESULT
MPEG3_StreamSize(PACMDRVSTREAMINSTANCE adsi
, PACMDRVSTREAMSIZE adss
)
461 switch (adss
->fdwSize
)
463 case ACM_STREAMSIZEF_DESTINATION
:
464 /* cbDstLength => cbSrcLength */
465 if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
&&
466 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_MPEGLAYER3
)
468 /* don't take block overhead into account, doesn't matter too much */
469 adss
->cbSrcLength
= adss
->cbDstLength
* 4;
471 else if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_MPEGLAYER3
&&
472 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_PCM
)
474 FIXME("misses the block header overhead\n");
475 adss
->cbSrcLength
= 256 + adss
->cbDstLength
/ 4;
479 return MMSYSERR_NOTSUPPORTED
;
482 case ACM_STREAMSIZEF_SOURCE
:
483 /* cbSrcLength => cbDstLength */
484 if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_PCM
&&
485 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_MPEGLAYER3
)
487 FIXME("misses the block header overhead\n");
488 adss
->cbDstLength
= 256 + adss
->cbSrcLength
/ 4;
490 else if (adsi
->pwfxSrc
->wFormatTag
== WAVE_FORMAT_MPEGLAYER3
&&
491 adsi
->pwfxDst
->wFormatTag
== WAVE_FORMAT_PCM
)
493 /* don't take block overhead into account, doesn't matter too much */
494 adss
->cbDstLength
= adss
->cbSrcLength
* 4;
498 return MMSYSERR_NOTSUPPORTED
;
502 WARN("Unsupported query %08lx\n", adss
->fdwSize
);
503 return MMSYSERR_NOTSUPPORTED
;
505 return MMSYSERR_NOERROR
;
508 /***********************************************************************
509 * MPEG3_StreamConvert
512 static LRESULT
MPEG3_StreamConvert(PACMDRVSTREAMINSTANCE adsi
, PACMDRVSTREAMHEADER adsh
)
514 AcmMpeg3Data
* aad
= (AcmMpeg3Data
*)adsi
->dwDriver
;
515 DWORD nsrc
= adsh
->cbSrcLength
;
516 DWORD ndst
= adsh
->cbDstLength
;
518 if (adsh
->fdwConvert
&
519 ~(ACM_STREAMCONVERTF_BLOCKALIGN
|
520 ACM_STREAMCONVERTF_END
|
521 ACM_STREAMCONVERTF_START
))
523 FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh
->fdwConvert
);
525 /* ACM_STREAMCONVERTF_BLOCKALIGN
526 * currently all conversions are block aligned, so do nothing for this flag
527 * ACM_STREAMCONVERTF_END
528 * no pending data, so do nothing for this flag
530 if ((adsh
->fdwConvert
& ACM_STREAMCONVERTF_START
))
532 MPEG3_Reset(adsi
, aad
);
535 aad
->convert(adsi
, adsh
->pbSrc
, &nsrc
, adsh
->pbDst
, &ndst
);
536 adsh
->cbSrcLengthUsed
= nsrc
;
537 adsh
->cbDstLengthUsed
= ndst
;
539 return MMSYSERR_NOERROR
;
542 /**************************************************************************
543 * MPEG3_DriverProc [exported]
545 LRESULT CALLBACK
MPEG3_DriverProc(DWORD dwDevID
, HDRVR hDriv
, UINT wMsg
,
546 LPARAM dwParam1
, LPARAM dwParam2
)
548 TRACE("(%08lx %08lx %04x %08lx %08lx);\n",
549 dwDevID
, (DWORD
)hDriv
, wMsg
, dwParam1
, dwParam2
);
553 case DRV_LOAD
: return 1;
554 case DRV_FREE
: return 1;
555 case DRV_OPEN
: return MPEG3_drvOpen((LPSTR
)dwParam1
);
556 case DRV_CLOSE
: return MPEG3_drvClose(dwDevID
);
557 case DRV_ENABLE
: return 1;
558 case DRV_DISABLE
: return 1;
559 case DRV_QUERYCONFIGURE
: return 1;
560 case DRV_CONFIGURE
: MessageBoxA(0, "MPEG3 filter !", "Wine Driver", MB_OK
); return 1;
561 case DRV_INSTALL
: return DRVCNF_RESTART
;
562 case DRV_REMOVE
: return DRVCNF_RESTART
;
564 case ACMDM_DRIVER_NOTIFY
:
565 /* no caching from other ACM drivers is done so far */
566 return MMSYSERR_NOERROR
;
568 case ACMDM_DRIVER_DETAILS
:
569 return MPEG3_DriverDetails((PACMDRIVERDETAILSW
)dwParam1
);
571 case ACMDM_FORMATTAG_DETAILS
:
572 return MPEG3_FormatTagDetails((PACMFORMATTAGDETAILSW
)dwParam1
, dwParam2
);
574 case ACMDM_FORMAT_DETAILS
:
575 return MPEG3_FormatDetails((PACMFORMATDETAILSW
)dwParam1
, dwParam2
);
577 case ACMDM_FORMAT_SUGGEST
:
578 return MPEG3_FormatSuggest((PACMDRVFORMATSUGGEST
)dwParam1
);
580 case ACMDM_STREAM_OPEN
:
581 return MPEG3_StreamOpen((PACMDRVSTREAMINSTANCE
)dwParam1
);
583 case ACMDM_STREAM_CLOSE
:
584 return MPEG3_StreamClose((PACMDRVSTREAMINSTANCE
)dwParam1
);
586 case ACMDM_STREAM_SIZE
:
587 return MPEG3_StreamSize((PACMDRVSTREAMINSTANCE
)dwParam1
, (PACMDRVSTREAMSIZE
)dwParam2
);
589 case ACMDM_STREAM_CONVERT
:
590 return MPEG3_StreamConvert((PACMDRVSTREAMINSTANCE
)dwParam1
, (PACMDRVSTREAMHEADER
)dwParam2
);
592 case ACMDM_HARDWARE_WAVE_CAPS_INPUT
:
593 case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT
:
594 /* this converter is not a hardware driver */
595 case ACMDM_FILTERTAG_DETAILS
:
596 case ACMDM_FILTER_DETAILS
:
597 /* this converter is not a filter */
598 case ACMDM_STREAM_RESET
:
599 /* only needed for asynchronous driver... we aren't, so just say it */
600 return MMSYSERR_NOTSUPPORTED
;
601 case ACMDM_STREAM_PREPARE
:
602 case ACMDM_STREAM_UNPREPARE
:
603 /* nothing special to do here... so don't do anything */
604 return MMSYSERR_NOERROR
;
607 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);