Leave IID check to the OleCreateFontIndirect, so that SFCF will handle
[wine] / dlls / msrle32 / msrle32.c
1 /*
2  *      MSRLE32 Driver
3  *
4  *      Copyright 2001 TAKESHIMA Hidenori <hidenori@a2.ctktv.ne.jp>
5  *
6  *      FIXME - encoding
7  *      FIXME - RLE4
8  *
9  */
10
11 #include "config.h"
12
13 #include "windef.h"
14 #include "winbase.h"
15 #include "wingdi.h"
16 #include "winuser.h"
17 #include "mmsystem.h"
18 #include "vfw.h"
19
20 #include "debugtools.h"
21 DEFAULT_DEBUG_CHANNEL(msrle32);
22
23
24
25
26 typedef struct CodecImpl
27 {
28         BOOL    bInCompress;
29         BOOL    bInDecompress;
30         BOOL    bInDecompressEx;
31 } CodecImpl;
32
33 /***********************************************************************/
34
35 static LONG MSRLE32_DecompressRLE4(
36         BYTE* pDst, LONG pitch,
37         const BYTE* pSrc,
38         LONG width, LONG height )
39 {
40         FIXME( "RLE4 - not implemented yet\n" );
41         return ICERR_UNSUPPORTED;
42 }
43
44 static LONG MSRLE32_DecompressRLE8(
45         BYTE* pDst, LONG pitch,
46         const BYTE* pSrc,
47         LONG width, LONG height )
48 {
49         LONG    x,y;
50         int             len;
51         UINT    data;
52
53         x = 0; y = 0;
54         while ( y < height )
55         {
56                 len = *pSrc++; data = *pSrc++;
57                 if ( len > 0 )
58                 {
59                         /* run length encoding */
60                         while ( len-- > 0 && x < width )
61                                 pDst[x++] = (BYTE)data;
62                 }
63                 else
64                 {
65                         switch ( data )
66                         {
67                         case 0: /* EOL */
68                                 x = 0; y++; pDst += pitch;
69                                 break;
70                         case 1: /* END */
71                                 return ICERR_OK;
72                         case 2: /* DELTA */
73                                 x += (LONG)*pSrc++; y += (LONG)*pSrc++;
74                                 break;
75                         default: /* RAW */
76                                 len = data;
77                                 if ( (len+x) > width )
78                                         len = width-x;
79                                 memcpy( &pDst[x], pSrc, len );
80                                 x += len;
81                                 pSrc += (data+1)&(~1);
82                                 break;
83                         }
84                 }
85         }
86
87         return ICERR_OK;
88 }
89
90 /***********************************************************************/
91
92 static BOOL MSRLE32_IsValidInfoHeader( const BITMAPINFO* pbiIn )
93 {
94         if ( pbiIn->bmiHeader.biSize < sizeof(BITMAPINFOHEADER) ||
95                  pbiIn->bmiHeader.biWidth <= 0 ||
96                  pbiIn->bmiHeader.biHeight == 0 ||
97                  pbiIn->bmiHeader.biPlanes != 1 )
98                 return FALSE;
99
100         return TRUE;
101 }
102
103 static DWORD MSRLE32_GetClrUsed( const BITMAPINFO* pbiIn )
104 {
105         if ( pbiIn->bmiHeader.biBitCount > 8 )
106                 return 0;
107         return (pbiIn->bmiHeader.biClrUsed == 0) ? (1<<pbiIn->bmiHeader.biBitCount) : pbiIn->bmiHeader.biClrUsed;
108 }
109
110 static DWORD MSRLE32_GetUncompressedPitch( const BITMAPINFOHEADER* pbiIn )
111 {
112         return ((((pbiIn->biWidth*pbiIn->biBitCount)+7)>>3)+3)&(~3);
113 }
114
115 static DWORD MSRLE32_GetUncompressedSize( const BITMAPINFOHEADER* pbiIn )
116 {
117         return MSRLE32_GetUncompressedPitch( pbiIn ) * abs(pbiIn->biHeight);
118 }
119
120
121 static BOOL MSRLE32_IsValidRGB( const BITMAPINFO* pbiIn )
122 {
123         if ( !MSRLE32_IsValidInfoHeader( pbiIn ) )
124                 return FALSE;
125
126         if ( pbiIn->bmiHeader.biSizeImage != 0 &&
127                  pbiIn->bmiHeader.biSizeImage < MSRLE32_GetUncompressedSize( &pbiIn->bmiHeader ) )
128                 return FALSE;
129
130
131         switch ( pbiIn->bmiHeader.biCompression )
132         {
133         case 0:
134         case mmioFOURCC('R','G','B',' '):
135                 if ( pbiIn->bmiHeader.biBitCount == 1 ||
136                          pbiIn->bmiHeader.biBitCount == 4 ||
137                          pbiIn->bmiHeader.biBitCount == 8 ||
138                          pbiIn->bmiHeader.biBitCount == 16 ||
139                          pbiIn->bmiHeader.biBitCount == 24 ||
140                          pbiIn->bmiHeader.biBitCount == 32 )
141                         return TRUE;
142                 break;
143         default:
144                 break;
145         }
146
147         return FALSE;
148 }
149
150 static BOOL MSRLE32_IsValidRLE( const BITMAPINFO* pbiIn )
151 {
152         if ( !MSRLE32_IsValidInfoHeader( pbiIn ) )
153                 return FALSE;
154
155         switch ( pbiIn->bmiHeader.biCompression )
156         {
157         case 1:
158         case 2:
159         case mmioFOURCC('R','L','E',' '):
160         case mmioFOURCC('R','L','E','8'):
161         case mmioFOURCC('R','L','E','4'):
162         case mmioFOURCC('M','R','L','E'):
163                 if ( pbiIn->bmiHeader.biBitCount == 8 ||
164                          pbiIn->bmiHeader.biBitCount == 4 )
165                         return TRUE;
166                 break;
167         default:
168                 break;
169         }
170
171         return FALSE;
172 }
173
174 static BOOL MSRLE32_CompareInfoHeader( const BITMAPINFO* pbiIn, const BITMAPINFO* pbiOut )
175 {
176         if ( !MSRLE32_IsValidInfoHeader( pbiIn ) ||
177                  !MSRLE32_IsValidInfoHeader( pbiOut ) )
178                 return FALSE;
179
180         if ( pbiIn->bmiHeader.biWidth != pbiOut->bmiHeader.biWidth ||
181                  pbiIn->bmiHeader.biHeight != pbiOut->bmiHeader.biHeight ||
182                  pbiIn->bmiHeader.biPlanes != pbiOut->bmiHeader.biPlanes ||
183                  pbiIn->bmiHeader.biBitCount != pbiOut->bmiHeader.biBitCount )
184                 return FALSE;
185
186         return TRUE;
187 }
188
189
190 /***********************************************************************/
191
192 static LONG Codec_DrvQueryConfigure( CodecImpl* This )
193 {
194         return ICERR_UNSUPPORTED;
195 }
196
197 static LONG Codec_DrvConfigure( CodecImpl* This, HWND hwnd, DRVCONFIGINFO* pinfo )
198 {
199         return ICERR_UNSUPPORTED;
200 }
201
202 static LONG Codec_QueryAbout( void )
203 {
204         return ICERR_UNSUPPORTED;
205 }
206
207 static LONG Codec_About( HWND hwnd )
208 {
209         return ICERR_UNSUPPORTED;
210 }
211
212 static LONG Codec_CompressQuery( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
213 {
214         FIXME( "compression is not implemented!\n" );
215         return ICERR_UNSUPPORTED;
216 }
217
218 static LONG Codec_CompressBegin( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
219 {
220         return ICERR_UNSUPPORTED;
221 }
222
223 static LONG Codec_Compress( CodecImpl* This, ICCOMPRESS* picc, DWORD dwSize )
224 {
225         FIXME( "compression is not implemented!\n" );
226         return ICERR_UNSUPPORTED;
227 }
228
229 static LONG Codec_CompressEnd( CodecImpl* This )
230 {
231         This->bInCompress = FALSE;
232         return ICERR_UNSUPPORTED;
233 }
234
235 static LONG Codec_CompressFramesInfo( CodecImpl* This, ICCOMPRESSFRAMES* piccf, DWORD dwSize )
236 {
237         return ICERR_UNSUPPORTED;
238 }
239
240 static LONG Codec_CompressGetFormat( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
241 {
242         return ICERR_UNSUPPORTED;
243 }
244
245 static LONG Codec_CompressGetSize( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
246 {
247         return ICERR_UNSUPPORTED;
248 }
249
250 static LONG Codec_ICQueryConfigure( CodecImpl* This )
251 {
252         return ICERR_OK;
253 }
254 static LONG Codec_ICConfigure( CodecImpl* This, HWND hwnd )
255 {
256         MessageBoxA( hwnd, "Wine RLE Driver", "MSRLE32", MB_OK );
257         return ICERR_OK;
258 }
259
260 static LONG Codec_DecompressQuery( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
261 {
262         if ( pbiIn == NULL )
263                 return ICERR_BADPARAM;
264         if ( !MSRLE32_IsValidRLE( pbiIn ) )
265                 return ICERR_UNSUPPORTED;
266
267         if ( pbiOut != NULL )
268         {
269                 if ( !MSRLE32_IsValidRGB( pbiOut ) )
270                         return ICERR_UNSUPPORTED;
271                 if ( !MSRLE32_CompareInfoHeader( pbiIn, pbiOut ) )
272                         return ICERR_UNSUPPORTED;
273         }
274
275         return ICERR_OK;
276 }
277
278 static LONG Codec_DecompressBegin( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
279 {
280         LONG    lr;
281
282         if ( pbiIn == NULL || pbiOut == NULL )
283                 return ICERR_BADPARAM;
284         lr = Codec_DecompressQuery( This, pbiIn, pbiOut );
285         if ( lr != ICERR_OK )
286                 return lr;
287
288         This->bInDecompress = TRUE;
289
290         return ICERR_OK;
291 }
292
293 static LONG Codec_Decompress( CodecImpl* This, ICDECOMPRESS* picd, DWORD dwSize )
294 {
295         LONG    lr;
296
297         if ( !This->bInDecompress )
298                 return ICERR_BADHANDLE; /* FIXME? */
299
300         if ( ( picd->dwFlags & ICDECOMPRESS_NOTKEYFRAME ) &&
301                  ( picd->dwFlags & ICDECOMPRESS_UPDATE ) )
302                 return ICERR_CANTUPDATE; /* FIXME? */
303
304         if ( picd->lpbiInput == NULL ||
305                  picd->lpInput == NULL ||
306                  picd->lpbiOutput == NULL ||
307                  picd->lpOutput == NULL )
308                 return ICERR_BADPARAM;
309
310         switch ( picd->lpbiInput->biBitCount )
311         {
312         case 4: /* RLE4 */
313                 lr = MSRLE32_DecompressRLE4(
314                         (BYTE*)picd->lpOutput,
315                         MSRLE32_GetUncompressedPitch( picd->lpbiInput ),
316                         (const BYTE*)picd->lpInput,
317                         picd->lpbiInput->biWidth,
318                         picd->lpbiInput->biHeight );
319                 break;
320         case 8: /* RLE8 */
321                 lr = MSRLE32_DecompressRLE8(
322                         (BYTE*)picd->lpOutput,
323                         MSRLE32_GetUncompressedPitch( picd->lpbiInput ),
324                         (const BYTE*)picd->lpInput,
325                         picd->lpbiInput->biWidth,
326                         picd->lpbiInput->biHeight );
327                 break;
328         default:
329                 lr = ICERR_BADBITDEPTH;
330                 break;
331         }
332
333         return lr;
334 }
335
336 static LONG Codec_DecompressEnd( CodecImpl* This )
337 {
338         This->bInDecompress = FALSE;
339         return ICERR_OK;
340 }
341
342 static LONG Codec_DecompressGetFormat( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
343 {
344         DWORD   biClrUsed;
345         LONG    lr;
346
347         if ( pbiIn == NULL )
348                 return ICERR_BADPARAM;
349
350         lr = Codec_DecompressQuery( This, pbiIn, NULL );
351         if ( lr != ICERR_OK )
352                 return ( pbiOut == NULL ) ? 0 : lr;
353
354         biClrUsed = MSRLE32_GetClrUsed(pbiIn);
355         if ( pbiOut == NULL )
356                 return sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * biClrUsed;
357
358         ZeroMemory( pbiOut, sizeof(BITMAPINFOHEADER) );
359         memcpy( &pbiOut->bmiHeader, &pbiIn->bmiHeader, sizeof(BITMAPINFOHEADER) );
360         memcpy( &pbiOut->bmiColors, &pbiIn->bmiColors, sizeof(RGBQUAD) * biClrUsed );
361         pbiOut->bmiHeader.biCompression = 0;
362         pbiOut->bmiHeader.biSizeImage = MSRLE32_GetUncompressedSize( &pbiOut->bmiHeader );
363
364         return ICERR_OK;
365 }
366
367 static LONG Codec_DecompressGetPalette( CodecImpl* This, BITMAPINFO* pbiIn, BITMAPINFO* pbiOut )
368 {
369         if ( pbiIn == NULL )
370                 return ICERR_BADPARAM;
371
372         return (pbiOut == NULL) ? 0 : ICERR_UNSUPPORTED;
373 }
374
375 static LONG Codec_DecompressSetPalette( CodecImpl* This, BITMAPINFO* pbiIn )
376 {
377         return ICERR_UNSUPPORTED;
378 }
379
380 static LONG Codec_DecompressExQuery( CodecImpl* This, ICDECOMPRESSEX* picdex, DWORD dwSize )
381 {
382         FIXME( "DecompressEx is not implemented!\n" );
383         return ICERR_UNSUPPORTED;
384 }
385
386 static LONG Codec_DecompressExBegin( CodecImpl* This, ICDECOMPRESSEX* picdex, DWORD dwSize )
387 {
388         FIXME( "DecompressEx is not implemented!\n" );
389         return ICERR_UNSUPPORTED;
390 }
391
392 static LONG Codec_DecompressEx( CodecImpl* This, ICDECOMPRESSEX* picdex, DWORD dwSize )
393 {
394         return ICERR_UNSUPPORTED;
395 }
396
397 static LONG Codec_DecompressExEnd( CodecImpl* This )
398 {
399         This->bInDecompressEx = FALSE;
400         return ICERR_UNSUPPORTED;
401 }
402
403 static LONG Codec_GetInfo( CodecImpl* This, ICINFO* pici, DWORD dwSize )
404 {
405         return ICERR_UNSUPPORTED;
406 }
407
408 static LONG Codec_GetQuality( CodecImpl* This, DWORD* pdwQuality )
409 {
410         return ICERR_UNSUPPORTED;
411 }
412
413 static LONG Codec_GetState( CodecImpl* This, LPVOID pvState, DWORD dwSize )
414 {
415         if ( pvState == NULL )
416                 return 0;
417
418         /* no driver-specific state */
419
420         return 0;
421 }
422
423 static LONG Codec_SetQuality( CodecImpl* This, DWORD* pdwQuality )
424 {
425         return ICERR_UNSUPPORTED;
426 }
427
428 static LONG Codec_SetStatusProc(CodecImpl* This, ICSETSTATUSPROC* picssp, DWORD dwSize )
429 {
430         if ( picssp == NULL )
431                 return 0;
432
433         /* no driver-specific state */
434
435         return 0;
436 }
437
438 static LONG Codec_SetState( CodecImpl* This, LPVOID pvState, DWORD dwSize )
439 {
440         return ICERR_UNSUPPORTED;
441 }
442
443 static CodecImpl* Codec_AllocDriver( void )
444 {
445         CodecImpl*      This;
446
447         This = HeapAlloc( GetProcessHeap(), 0, sizeof(CodecImpl) );
448         if ( This == NULL )
449                 return NULL;
450         ZeroMemory( This, sizeof(CodecImpl) );
451         This->bInCompress = FALSE;
452         This->bInDecompress = FALSE;
453         This->bInDecompressEx = FALSE;
454
455         return This;
456 }
457
458 static void Codec_Close( CodecImpl* This )
459 {
460         if ( This->bInCompress )
461                 Codec_CompressEnd(This);
462         if ( This->bInDecompress )
463                 Codec_DecompressEnd(This);
464         if ( This->bInDecompressEx )
465                 Codec_DecompressExEnd(This);
466
467         HeapFree( GetProcessHeap(), 0, This );
468 }
469
470
471
472
473
474
475 LONG WINAPI MSRLE32_DriverProc(
476         DWORD dwDriverId, HDRVR hdrvr, UINT msg, LONG lParam1, LONG lParam2 )
477 {
478         TRACE( "DriverProc(%08lx,%08x,%08x,%08lx,%08lx)\n",
479                          dwDriverId, hdrvr, msg, lParam1, lParam2 );
480
481         switch ( msg )
482         {
483         case DRV_LOAD:
484                 TRACE("DRV_LOAD\n");
485                 return TRUE;
486         case DRV_FREE:
487                 TRACE("DRV_FREE\n");
488                 return TRUE;
489         case DRV_OPEN:
490                 TRACE("DRV_OPEN\n");
491                 return (LONG)Codec_AllocDriver();
492         case DRV_CLOSE:
493                 TRACE("DRV_CLOSE\n");
494                 Codec_Close( (CodecImpl*)dwDriverId );
495                 return TRUE;
496         case DRV_ENABLE:
497                 TRACE("DRV_ENABLE\n");
498                 return TRUE;
499         case DRV_DISABLE:
500                 TRACE("DRV_DISABLE\n");
501                 return TRUE;
502         case DRV_QUERYCONFIGURE:
503                 TRACE("DRV_QUERYCONFIGURE\n");
504                 return Codec_DrvQueryConfigure( (CodecImpl*)dwDriverId );
505         case DRV_CONFIGURE:
506                 TRACE("DRV_CONFIGURE\n");
507                 return Codec_DrvConfigure( (CodecImpl*)dwDriverId,
508                                         (HWND)lParam1, (DRVCONFIGINFO*)lParam2 );
509         case DRV_INSTALL:
510                 TRACE("DRV_INSTALL\n");
511                 return DRVCNF_OK;
512         case DRV_REMOVE:
513                 TRACE("DRV_REMOVE\n");
514                 return 0;
515         case DRV_POWER:
516                 TRACE("DRV_POWER\n");
517                 return TRUE;
518
519         case ICM_ABOUT:
520                 TRACE("ICM_ABOUT\n");
521                 return (lParam1 == -1) ? Codec_QueryAbout() : Codec_About( (HWND)lParam1 );
522         case ICM_COMPRESS:
523                 TRACE("ICM_COMPRESS\n");
524                 return Codec_Compress((CodecImpl*)dwDriverId,(ICCOMPRESS*)lParam1,(DWORD)lParam2);
525         case ICM_COMPRESS_BEGIN:
526                 TRACE("ICM_COMPRESS_BEGIN\n");
527                 return Codec_CompressBegin((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
528         case ICM_COMPRESS_END:
529                 TRACE("ICM_COMPRESS_END\n");
530                 return Codec_CompressEnd((CodecImpl*)dwDriverId);
531         case ICM_COMPRESS_FRAMES_INFO:
532                 TRACE("ICM_COMPRESS_FRAMES_INFO\n");
533                 return Codec_CompressFramesInfo((CodecImpl*)dwDriverId,(ICCOMPRESSFRAMES*)lParam1,(DWORD)lParam2);
534         case ICM_COMPRESS_GET_FORMAT:
535                 TRACE("ICM_COMPRESS_GET_FORMAT\n");
536                 return Codec_CompressGetFormat((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
537         case ICM_COMPRESS_GET_SIZE:
538                 TRACE("ICM_COMPRESS_GET_SIZE\n");
539                 return Codec_CompressGetSize((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
540         case ICM_COMPRESS_QUERY:
541                 TRACE("ICM_COMPRESS_GET_SIZE\n");
542                 return Codec_CompressQuery((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
543
544         case ICM_CONFIGURE:
545                 TRACE("ICM_CONFIGURE\n");
546                 return ( lParam1 == -1 ) ? Codec_ICQueryConfigure( (CodecImpl*)dwDriverId ) : Codec_ICConfigure( (CodecImpl*)dwDriverId, (HWND)lParam1 );
547
548         case ICM_DECOMPRESS:
549                 TRACE( "ICM_DECOMPRESS\n" );
550                 return Codec_Decompress((CodecImpl*)dwDriverId,(ICDECOMPRESS*)lParam1,(DWORD)lParam2);
551         case ICM_DECOMPRESS_BEGIN:
552                 TRACE( "ICM_DECOMPRESS_BEGIN\n" );
553                 return Codec_DecompressBegin((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
554         case ICM_DECOMPRESS_END:
555                 TRACE( "ICM_DECOMPRESS_END\n" );
556                 return Codec_DecompressEnd((CodecImpl*)dwDriverId);
557         case ICM_DECOMPRESS_GET_FORMAT:
558                 TRACE( "ICM_DECOMPRESS_GET_FORMAT\n" );
559                 return Codec_DecompressGetFormat((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
560         case ICM_DECOMPRESS_GET_PALETTE:
561                 TRACE( "ICM_DECOMPRESS_GET_PALETTE\n" );
562                 return Codec_DecompressGetPalette((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
563         case ICM_DECOMPRESS_QUERY:
564                 TRACE( "ICM_DECOMPRESS_QUERY\n" );
565                 return Codec_DecompressQuery((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1,(BITMAPINFO*)lParam2);
566         case ICM_DECOMPRESS_SET_PALETTE:
567                 TRACE( "ICM_DECOMPRESS_SET_PALETTE\n" );
568                 return Codec_DecompressSetPalette((CodecImpl*)dwDriverId,(BITMAPINFO*)lParam1);
569
570         case ICM_DECOMPRESSEX_BEGIN:
571                 TRACE( "ICM_DECOMPRESSEX_BEGIN\n" );
572                 return Codec_DecompressExBegin((CodecImpl*)dwDriverId,(ICDECOMPRESSEX*)lParam1,(DWORD)lParam2);
573         case ICM_DECOMPRESSEX:
574                 TRACE( "ICM_DECOMPRESSEX\n" );
575                 return Codec_DecompressEx((CodecImpl*)dwDriverId,(ICDECOMPRESSEX*)lParam1,(DWORD)lParam2);
576         case ICM_DECOMPRESSEX_END:
577                 TRACE( "ICM_DECOMPRESSEX_END\n" );
578                 return Codec_DecompressExEnd((CodecImpl*)dwDriverId);
579         case ICM_DECOMPRESSEX_QUERY:
580                 TRACE( "ICM_DECOMPRESSEX_QUERY\n" );
581                 return Codec_DecompressExQuery((CodecImpl*)dwDriverId,(ICDECOMPRESSEX*)lParam1,(DWORD)lParam2);
582
583         case ICM_GETINFO:
584                 TRACE( "ICM_GETINFO\n" );
585                 return Codec_GetInfo((CodecImpl*)dwDriverId,(ICINFO*)lParam1,(DWORD)lParam2);
586         case ICM_GETQUALITY:
587                 TRACE( "ICM_SETQUALITY\n");
588                 return Codec_GetQuality((CodecImpl*)dwDriverId,(DWORD*)lParam1);
589         case ICM_GETSTATE:
590                 TRACE( "ICM_GETSTATE\n" );
591                 return Codec_GetState((CodecImpl*)dwDriverId,(LPVOID)lParam1,(DWORD)lParam2);
592         case ICM_SETQUALITY:
593                 TRACE( "ICM_SETQUALITY\n");
594                 return Codec_SetQuality((CodecImpl*)dwDriverId,(DWORD*)lParam1);
595         case ICM_SET_STATUS_PROC:
596                 TRACE( "ICM_SET_STATUS_PROC\n" );
597                 return Codec_SetStatusProc((CodecImpl*)dwDriverId,(ICSETSTATUSPROC*)lParam1,(DWORD)lParam2);
598         case ICM_SETSTATE:
599                 TRACE( "ICM_SETSTATE\n" );
600                 return Codec_SetState((CodecImpl*)dwDriverId,(LPVOID)lParam1,(DWORD)lParam2);
601
602         }
603
604         return DefDriverProc( dwDriverId, hdrvr, msg, lParam1, lParam2 );
605 }
606
607 BOOL WINAPI MSRLE32_DllMain( HINSTANCE hInst, DWORD dwReason, LPVOID lpvReserved )
608 {
609         TRACE( "(%08x,%08lx,%p)\n",hInst,dwReason,lpvReserved );
610
611         return TRUE;
612 }