2 * msvideo 16-bit functions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 2000 Bradley Baetz
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
22 #define COM_NO_WINDOWS_H
26 #include "msvideo_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(msvideo
);
35 /***********************************************************************
36 * DrawDibOpen [MSVIDEO.102]
38 HDRAWDIB16 VFWAPI
DrawDibOpen16(void)
40 return HDRAWDIB_16(DrawDibOpen());
43 /***********************************************************************
44 * DrawDibClose [MSVIDEO.103]
46 BOOL16 VFWAPI
DrawDibClose16(HDRAWDIB16 hdd
)
48 return DrawDibClose(HDRAWDIB_32(hdd
));
51 /************************************************************************
52 * DrawDibBegin [MSVIDEO.104]
54 BOOL16 VFWAPI
DrawDibBegin16(HDRAWDIB16 hdd
, HDC16 hdc
, INT16 dxDst
,
55 INT16 dyDst
, LPBITMAPINFOHEADER lpbi
, INT16 dxSrc
,
56 INT16 dySrc
, UINT16 wFlags
)
58 return DrawDibBegin(HDRAWDIB_32(hdd
), HDC_32(hdc
), dxDst
, dyDst
, lpbi
,
59 dxSrc
, dySrc
, wFlags
);
62 /***********************************************************************
63 * DrawDibEnd [MSVIDEO.105]
65 BOOL16 VFWAPI
DrawDibEnd16(HDRAWDIB16 hdd
)
67 return DrawDibEnd(HDRAWDIB_32(hdd
));
70 /**********************************************************************
71 * DrawDibDraw [MSVIDEO.106]
73 BOOL16 VFWAPI
DrawDibDraw16(HDRAWDIB16 hdd
, HDC16 hdc
, INT16 xDst
, INT16 yDst
,
74 INT16 dxDst
, INT16 dyDst
, LPBITMAPINFOHEADER lpbi
,
75 LPVOID lpBits
, INT16 xSrc
, INT16 ySrc
, INT16 dxSrc
,
76 INT16 dySrc
, UINT16 wFlags
)
78 return DrawDibDraw(HDRAWDIB_32(hdd
), HDC_32(hdc
), xDst
, yDst
, dxDst
,
79 dyDst
, lpbi
, lpBits
, xSrc
, ySrc
, dxSrc
, dySrc
, wFlags
);
82 /***********************************************************************
83 * DrawDibGetPalette [MSVIDEO.108]
85 HPALETTE16 VFWAPI
DrawDibGetPalette16(HDRAWDIB16 hdd
)
87 return HPALETTE_16(DrawDibGetPalette(HDRAWDIB_32(hdd
)));
90 /***********************************************************************
91 * DrawDibSetPalette [MSVIDEO.110]
93 BOOL16 VFWAPI
DrawDibSetPalette16(HDRAWDIB16 hdd
, HPALETTE16 hpal
)
95 return DrawDibSetPalette(HDRAWDIB_32(hdd
), HPALETTE_32(hpal
));
98 /***********************************************************************
99 * DrawDibRealize [MSVIDEO.112]
101 UINT16 VFWAPI
DrawDibRealize16(HDRAWDIB16 hdd
, HDC16 hdc
,
104 return (UINT16
)DrawDibRealize(HDRAWDIB_32(hdd
), HDC_32(hdc
), fBackground
);
107 /*************************************************************************
108 * DrawDibStart [MSVIDEO.118]
110 BOOL16 VFWAPI
DrawDibStart16(HDRAWDIB16 hdd
, DWORD rate
)
112 return DrawDibStart(HDRAWDIB_32(hdd
), rate
);
115 /*************************************************************************
116 * DrawDibStop [MSVIDEO.119]
118 BOOL16
DrawDibStop16(HDRAWDIB16 hdd
)
120 return DrawDibStop(HDRAWDIB_32(hdd
));
123 /***********************************************************************
124 * ICOpen [MSVIDEO.203]
126 HIC16 VFWAPI
ICOpen16(DWORD fccType
, DWORD fccHandler
, UINT16 wMode
)
128 return HIC_16(ICOpen(fccType
, fccHandler
, wMode
));
131 /***********************************************************************
132 * ICClose [MSVIDEO.204]
134 LRESULT WINAPI
ICClose16(HIC16 hic
)
136 return ICClose(HIC_32(hic
));
139 /***********************************************************************
140 * _ICMessage [MSVIDEO.207]
142 LRESULT VFWAPIV
ICMessage16( HIC16 hic
, UINT16 msg
, UINT16 cb
, VA_LIST16 valist
)
149 lpData
= HeapAlloc(GetProcessHeap(), 0, cb
);
151 TRACE("0x%08lx, %u, %u, ...)\n", (DWORD
) hic
, msg
, cb
);
153 for (i
= 0; i
< cb
/ sizeof(WORD
); i
++)
155 lpData
[i
] = VA_ARG16(valist
, WORD
);
158 segData
= MapLS(lpData
);
159 ret
= ICSendMessage16(hic
, msg
, segData
, (DWORD
) cb
);
161 HeapFree(GetProcessHeap(), 0, lpData
);
165 /***********************************************************************
166 * ICGetInfo [MSVIDEO.212]
168 LRESULT VFWAPI
ICGetInfo16(HIC16 hic
, ICINFO16
* picinfo
, DWORD cb
)
172 TRACE("(0x%08lx,%p,%ld)\n", (DWORD
) hic
, picinfo
, cb
);
173 ret
= ICSendMessage16(hic
, ICM_GETINFO
, (DWORD
) picinfo
, cb
);
174 TRACE(" -> 0x%08lx\n", ret
);
178 /***********************************************************************
179 * ICLocate [MSVIDEO.213]
181 HIC16 VFWAPI
ICLocate16(DWORD fccType
, DWORD fccHandler
,
182 LPBITMAPINFOHEADER lpbiIn
, LPBITMAPINFOHEADER lpbiOut
,
185 return HIC_16(ICLocate(fccType
, fccHandler
, lpbiIn
, lpbiOut
, wFlags
));
188 /***********************************************************************
189 * _ICCompress [MSVIDEO.224]
191 DWORD VFWAPIV
ICCompress16(HIC16 hic
, DWORD dwFlags
,
192 LPBITMAPINFOHEADER lpbiOutput
, LPVOID lpData
,
193 LPBITMAPINFOHEADER lpbiInput
, LPVOID lpBits
,
194 LPDWORD lpckid
, LPDWORD lpdwFlags
,
195 LONG lFrameNum
, DWORD dwFrameSize
,
196 DWORD dwQuality
, LPBITMAPINFOHEADER lpbiPrev
,
203 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n", (DWORD
) hic
, dwFlags
,
204 lpbiOutput
, lpData
, lpbiInput
, lpBits
);
206 iccmp
.dwFlags
= dwFlags
;
208 iccmp
.lpbiOutput
= lpbiOutput
;
209 iccmp
.lpOutput
= lpData
;
210 iccmp
.lpbiInput
= lpbiInput
;
211 iccmp
.lpInput
= lpBits
;
213 iccmp
.lpckid
= lpckid
;
214 iccmp
.lpdwFlags
= lpdwFlags
;
215 iccmp
.lFrameNum
= lFrameNum
;
216 iccmp
.dwFrameSize
= dwFrameSize
;
217 iccmp
.dwQuality
= dwQuality
;
218 iccmp
.lpbiPrev
= lpbiPrev
;
219 iccmp
.lpPrev
= lpPrev
;
220 seg_iccmp
= MapLS(&iccmp
);
221 ret
= ICSendMessage16(hic
, ICM_COMPRESS
, seg_iccmp
, sizeof(ICCOMPRESS
));
226 /***********************************************************************
227 * _ICDecompress [MSVIDEO.230]
229 DWORD VFWAPIV
ICDecompress16(HIC16 hic
, DWORD dwFlags
,
230 LPBITMAPINFOHEADER lpbiFormat
, LPVOID lpData
,
231 LPBITMAPINFOHEADER lpbi
, LPVOID lpBits
)
237 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n", (DWORD
) hic
, dwFlags
, lpbiFormat
,
238 lpData
, lpbi
, lpBits
);
240 icd
.dwFlags
= dwFlags
;
241 icd
.lpbiInput
= lpbiFormat
;
242 icd
.lpInput
= lpData
;
243 icd
.lpbiOutput
= lpbi
;
244 icd
.lpOutput
= lpBits
;
246 segptr
= MapLS(&icd
);
247 ret
= ICSendMessage16(hic
, ICM_DECOMPRESS
, segptr
, sizeof(ICDECOMPRESS
));
252 /***********************************************************************
253 * _ICDrawBegin [MSVIDEO.232]
255 DWORD VFWAPIV
ICDrawBegin16(HIC16 hic
, /* [in] */
256 DWORD dwFlags
, /* [in] flags */
257 HPALETTE16 hpal
, /* [in] palette to draw with */
258 HWND16 hwnd
, /* [in] window to draw to */
259 HDC16 hdc
, /* [in] HDC to draw to */
260 INT16 xDst
, /* [in] destination rectangle */
261 INT16 yDst
, /* [in] */
262 INT16 dxDst
, /* [in] */
263 INT16 dyDst
, /* [in] */
264 LPBITMAPINFOHEADER lpbi
, /* [in] format of frame to draw NOTE: SEGPTR */
265 INT16 xSrc
, /* [in] source rectangle */
266 INT16 ySrc
, /* [in] */
267 INT16 dxSrc
, /* [in] */
268 INT16 dySrc
, /* [in] */
269 DWORD dwRate
, /* [in] frames/second = (dwRate/dwScale) */
270 DWORD dwScale
) /* [in] */
276 TRACE ("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
277 (DWORD
) hic
, dwFlags
, (DWORD
) hpal
, (DWORD
) hwnd
, (DWORD
) hdc
,
278 xDst
, yDst
, dxDst
, dyDst
, lpbi
, xSrc
, ySrc
, dxSrc
, dySrc
, dwRate
,
281 icdb
.dwFlags
= dwFlags
;
289 icdb
.lpbi
= lpbi
; /* Keep this as SEGPTR for the mapping code to deal with */
294 icdb
.dwRate
= dwRate
;
295 icdb
.dwScale
= dwScale
;
296 seg_icdb
= MapLS(&icdb
);
297 ret
= (DWORD
) ICSendMessage16(hic
, ICM_DRAW_BEGIN
, seg_icdb
,
298 sizeof(ICDRAWBEGIN16
));
303 /***********************************************************************
304 * _ICDraw [MSVIDEO.234]
306 DWORD VFWAPIV
ICDraw16(HIC16 hic
, DWORD dwFlags
,
307 LPVOID lpFormat
, /* [???] NOTE: SEGPTR */
308 LPVOID lpData
, /* [???] NOTE: SEGPTR */
309 DWORD cbData
, LONG lTime
)
315 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n", (DWORD
) hic
, dwFlags
,
316 lpFormat
, lpData
, cbData
, lTime
);
317 icd
.dwFlags
= dwFlags
;
318 icd
.lpFormat
= lpFormat
;
322 seg_icd
= MapLS(&icd
);
323 ret
= ICSendMessage16(hic
, ICM_DRAW
, seg_icd
, sizeof(ICDRAW
));
328 /***********************************************************************
329 * ICGetDisplayFormat [MSVIDEO.239]
331 HIC16 VFWAPI
ICGetDisplayFormat16(HIC16 hic
, LPBITMAPINFOHEADER lpbiIn
,
332 LPBITMAPINFOHEADER lpbiOut
, INT16 depth
,
335 return HIC_16(ICGetDisplayFormat(HIC_32(hic
), lpbiIn
, lpbiOut
, depth
,
339 #define COPY(x,y) (x->y = x##16->y);
340 #define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y));
342 /******************************************************************
343 * MSVIDEO_MapICDEX16To32
347 static LPVOID
MSVIDEO_MapICDEX16To32(LPDWORD lParam
)
351 ICDECOMPRESSEX
*icdx
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESSEX
));
352 ICDECOMPRESSEX16
*icdx16
= MapSL(*lParam
);
356 COPYPTR(icdx
, lpbiSrc
);
357 COPYPTR(icdx
, lpSrc
);
358 COPYPTR(icdx
, lpbiDst
);
359 COPYPTR(icdx
, lpDst
);
369 *lParam
= (DWORD
)(icdx
);
373 /******************************************************************
374 * MSVIDEO_MapMsg16To32
378 static LPVOID
MSVIDEO_MapMsg16To32(UINT msg
, LPDWORD lParam1
, LPDWORD lParam2
)
382 TRACE("Mapping %d\n", msg
);
393 case ICM_COMPRESS_END
:
394 case ICM_DECOMPRESS_END
:
395 case ICM_DECOMPRESSEX_END
:
397 case ICM_DRAW_START_PLAY
:
398 case ICM_DRAW_STOP_PLAY
:
399 case ICM_DRAW_REALIZE
:
400 case ICM_DRAW_RENDERBUFFER
:
404 case ICM_GETDEFAULTQUALITY
:
407 case ICM_DRAW_WINDOW
:
408 case ICM_GETBUFFERSWANTED
:
409 *lParam1
= (DWORD
)MapSL(*lParam1
);
413 ICINFO
*ici
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO
));
416 ici16
= MapSL(*lParam1
);
419 ici
->dwSize
= sizeof(ICINFO
);
421 COPY(ici
, fccHandler
);
423 COPY(ici
, dwVersion
);
424 COPY(ici
, dwVersionICM
);
425 MultiByteToWideChar( CP_ACP
, 0, ici16
->szName
, -1, ici
->szName
, 16 );
426 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDescription
, -1, ici
->szDescription
, 128 );
427 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDriver
, -1, ici
->szDriver
, 128 );
428 *lParam1
= (DWORD
)(ici
);
429 *lParam2
= sizeof(ICINFO
);
434 ICCOMPRESS
*icc
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS
));
437 icc16
= MapSL(*lParam1
);
441 COPYPTR(icc
, lpbiOutput
);
442 COPYPTR(icc
, lpOutput
);
443 COPYPTR(icc
, lpbiInput
);
444 COPYPTR(icc
, lpInput
);
445 COPYPTR(icc
, lpckid
);
446 COPYPTR(icc
, lpdwFlags
);
447 COPY(icc
, lFrameNum
);
448 COPY(icc
, dwFrameSize
);
449 COPY(icc
, dwQuality
);
450 COPYPTR(icc
, lpbiPrev
);
451 COPYPTR(icc
, lpPrev
);
453 *lParam1
= (DWORD
)(icc
);
454 *lParam2
= sizeof(ICCOMPRESS
);
459 ICDECOMPRESS
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESS
));
460 ICDECOMPRESS
*icd16
; /* Same structure except for the pointers */
462 icd16
= MapSL(*lParam1
);
466 COPYPTR(icd
, lpbiInput
);
467 COPYPTR(icd
, lpInput
);
468 COPYPTR(icd
, lpbiOutput
);
469 COPYPTR(icd
, lpOutput
);
472 *lParam1
= (DWORD
)(icd
);
473 *lParam2
= sizeof(ICDECOMPRESS
);
476 case ICM_COMPRESS_BEGIN
:
477 case ICM_COMPRESS_GET_FORMAT
:
478 case ICM_COMPRESS_GET_SIZE
:
479 case ICM_COMPRESS_QUERY
:
480 case ICM_DECOMPRESS_GET_FORMAT
:
481 case ICM_DECOMPRESS_QUERY
:
482 case ICM_DECOMPRESS_BEGIN
:
483 case ICM_DECOMPRESS_SET_PALETTE
:
484 case ICM_DECOMPRESS_GET_PALETTE
:
485 *lParam1
= (DWORD
)MapSL(*lParam1
);
486 *lParam2
= (DWORD
)MapSL(*lParam2
);
488 case ICM_DECOMPRESSEX_QUERY
:
489 if ((*lParam2
!= sizeof(ICDECOMPRESSEX16
)) && (*lParam2
!= 0))
490 WARN("*lParam2 has unknown value %p\n", (ICDECOMPRESSEX16
*)*lParam2
);
491 /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)
492 * This is because of ICMessage(). Special case it?
494 LPVOID* addr = HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPVOID));
495 addr[0] = MSVIDEO_MapICDEX16To32(lParam1);
497 addr[1] = MSVIDEO_MapICDEX16To32(lParam2);
504 case ICM_DECOMPRESSEX_BEGIN
:
505 case ICM_DECOMPRESSEX
:
506 ret
= MSVIDEO_MapICDEX16To32(lParam1
);
507 *lParam2
= sizeof(ICDECOMPRESSEX
);
511 ICDRAWBEGIN
*icdb
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWBEGIN
));
512 ICDRAWBEGIN16
*icdb16
= MapSL(*lParam1
);
516 icdb
->hpal
= HPALETTE_32(icdb16
->hpal
);
517 icdb
->hwnd
= HWND_32(icdb16
->hwnd
);
518 icdb
->hdc
= HDC_32(icdb16
->hdc
);
531 *lParam1
= (DWORD
)(icdb
);
532 *lParam2
= sizeof(ICDRAWBEGIN
);
535 case ICM_DRAW_SUGGESTFORMAT
:
537 ICDRAWSUGGEST
*icds
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWSUGGEST
));
538 ICDRAWSUGGEST16
*icds16
= MapSL(*lParam1
);
543 COPYPTR(icds
, lpbiIn
);
544 COPYPTR(icds
, lpbiSuggest
);
549 icds
->hicDecompressor
= HIC_32(icds16
->hicDecompressor
);
551 *lParam1
= (DWORD
)(icds
);
552 *lParam2
= sizeof(ICDRAWSUGGEST
);
557 ICDRAW
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAW
));
558 ICDRAW
*icd16
= MapSL(*lParam1
);
562 COPYPTR(icd
, lpFormat
);
563 COPYPTR(icd
, lpData
);
567 *lParam1
= (DWORD
)(icd
);
568 *lParam2
= sizeof(ICDRAW
);
575 FIXME("%d is not yet handled. Expect a crash.\n", msg
);
583 /******************************************************************
584 * MSVIDEO_UnmapMsg16To32
588 static void MSVIDEO_UnmapMsg16To32(UINT msg
, LPVOID data16
, LPDWORD lParam1
, LPDWORD lParam2
)
590 TRACE("Unmapping %d\n", msg
);
592 #define UNCOPY(x, y) (x##16->y = x->y);
598 ICINFO
*ici
= (ICINFO
*)(*lParam1
);
599 ICINFO16
*ici16
= (ICINFO16
*)data16
;
601 UNCOPY(ici
, fccType
);
602 UNCOPY(ici
, fccHandler
);
603 UNCOPY(ici
, dwFlags
);
604 UNCOPY(ici
, dwVersion
);
605 UNCOPY(ici
, dwVersionICM
);
606 WideCharToMultiByte( CP_ACP
, 0, ici
->szName
, -1, ici16
->szName
,
607 sizeof(ici16
->szName
), NULL
, NULL
);
608 ici16
->szName
[sizeof(ici16
->szName
)-1] = 0;
609 WideCharToMultiByte( CP_ACP
, 0, ici
->szDescription
, -1, ici16
->szDescription
,
610 sizeof(ici16
->szDescription
), NULL
, NULL
);
611 ici16
->szDescription
[sizeof(ici16
->szDescription
)-1] = 0;
612 /* This just gives garbage for some reason - BB
613 lstrcpynWtoA(ici16->szDriver, ici->szDriver, 128);*/
615 HeapFree(GetProcessHeap(), 0, ici
);
618 case ICM_DECOMPRESS_QUERY
:
621 HeapFree(GetProcessHeap(), 0, x[0]);
623 HeapFree(GetProcessHeap(), 0, x[1]);
628 case ICM_DECOMPRESSEX_QUERY
:
629 case ICM_DECOMPRESSEX_BEGIN
:
630 case ICM_DECOMPRESSEX
:
632 case ICM_DRAW_SUGGESTFORMAT
:
634 HeapFree(GetProcessHeap(), 0, data16
);
637 ERR("Unmapping unmapped msg %d\n", msg
);
642 /***********************************************************************
643 * ICInfo [MSVIDEO.200]
645 BOOL16 VFWAPI
ICInfo16(DWORD fccType
, DWORD fccHandler
, ICINFO16
*lpicinfo
)
649 DWORD lParam
= (DWORD
)lpicinfo
;
650 DWORD size
= ((ICINFO
*)(MapSL((SEGPTR
)lpicinfo
)))->dwSize
;
652 /* Use the mapping functions to map the ICINFO structure */
653 lpv
= MSVIDEO_MapMsg16To32(ICM_GETINFO
, &lParam
, &size
);
655 ret
= ICInfo(fccType
, fccHandler
, (ICINFO
*)lParam
);
657 MSVIDEO_UnmapMsg16To32(ICM_GETINFO
, lpv
, &lParam
, &size
);
662 /******************************************************************
667 static LRESULT CALLBACK
IC_Callback3216(HIC hic
, HDRVR hdrv
, UINT msg
, DWORD lp1
, DWORD lp2
)
673 whic
= MSVIDEO_GetHicPtr(hic
);
679 lp2
= (DWORD
)MapLS((void*)lp2
);
682 args
[7] = HIWORD(hic
);
683 args
[6] = LOWORD(hic
);
684 args
[5] = HDRVR_16(whic
->hdrv
);
686 args
[3] = HIWORD(lp1
);
687 args
[2] = LOWORD(lp1
);
688 args
[1] = HIWORD(lp2
);
689 args
[0] = LOWORD(lp2
);
690 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
699 else ret
= ICERR_BADHANDLE
;
703 /***********************************************************************
704 * ICOpenFunction [MSVIDEO.206]
706 HIC16 VFWAPI
ICOpenFunction16(DWORD fccType
, DWORD fccHandler
, UINT16 wMode
, FARPROC16 lpfnHandler
)
710 hic32
= MSVIDEO_OpenFunction(fccType
, fccHandler
, wMode
,
711 (DRIVERPROC
)IC_Callback3216
, (DWORD
)lpfnHandler
);
712 return HIC_16(hic32
);
715 /***********************************************************************
716 * ICSendMessage [MSVIDEO.205]
718 LRESULT VFWAPI
ICSendMessage16(HIC16 hic
, UINT16 msg
, DWORD lParam1
, DWORD lParam2
)
720 LRESULT ret
= ICERR_BADHANDLE
;
723 whic
= MSVIDEO_GetHicPtr(HIC_32(hic
));
726 /* we've got a 16 bit driver proc... call it directly */
727 if (whic
->driverproc16
)
731 /* FIXME: original code was passing hdrv first and hic second */
732 /* but this doesn't match what IC_Callback3216 does */
733 args
[7] = HIWORD(hic
);
734 args
[6] = LOWORD(hic
);
735 args
[5] = HDRVR_16(whic
->hdrv
);
737 args
[3] = HIWORD(lParam1
);
738 args
[2] = LOWORD(lParam1
);
739 args
[1] = HIWORD(lParam2
);
740 args
[0] = LOWORD(lParam2
);
741 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
745 /* map the message for a 32 bit infrastructure, and pass it along */
746 void* data16
= MSVIDEO_MapMsg16To32(msg
, &lParam1
, &lParam2
);
748 ret
= MSVIDEO_SendMessage(whic
, msg
, lParam1
, lParam2
);
750 MSVIDEO_UnmapMsg16To32(msg
, data16
, &lParam1
, &lParam2
);
756 /***********************************************************************
757 * VideoCapDriverDescAndVer [MSVIDEO.22]
759 DWORD WINAPI
VideoCapDriverDescAndVer16(WORD nr
, LPSTR buf1
, WORD buf1len
,
760 LPSTR buf2
, WORD buf2len
)
766 char *s
, buf
[2000], fn
[260];
770 TRACE("(%d,%p,%d,%p,%d)\n", nr
, buf1
, buf1len
, buf2
, buf2len
);
771 if (GetPrivateProfileStringA("drivers32", NULL
, NULL
, buf
, sizeof(buf
), "system.ini"))
776 if (!strncasecmp(s
, "vid", 3))
781 s
= s
+ strlen(s
) + 1; /* either next char or \0 */
785 return 20; /* hmm, out of entries even if we don't have any */
788 FIXME("No more VID* entries found\n");
791 GetPrivateProfileStringA("drivers32", s
, NULL
, fn
, sizeof(fn
), "system.ini");
792 infosize
= GetFileVersionInfoSizeA(fn
, &verhandle
);
795 TRACE("%s has no fileversioninfo.\n", fn
);
798 infobuf
= HeapAlloc(GetProcessHeap(), 0, infosize
);
799 if (GetFileVersionInfoA(fn
, verhandle
, infosize
, infobuf
))
802 /* Yes, two space behind : */
803 /* FIXME: test for buflen */
804 sprintf(vbuf
, "Version: %d.%d.%d.%d\n",
805 ((WORD
*)infobuf
)[0x0f],
806 ((WORD
*)infobuf
)[0x0e],
807 ((WORD
*)infobuf
)[0x11],
808 ((WORD
*)infobuf
)[0x10]
810 TRACE("version of %s is %s\n", fn
, vbuf
);
811 strncpy(buf2
, vbuf
, buf2len
);
815 TRACE("GetFileVersionInfoA failed for %s.\n", fn
);
816 strncpy(buf2
, fn
, buf2len
); /* msvideo.dll appears to copy fn*/
818 /* FIXME: language problem? */
819 if (VerQueryValueA( infobuf
,
820 "\\StringFileInfo\\040904E4\\FileDescription",
825 TRACE("VQA returned %s\n", (LPCSTR
)subblock
);
826 strncpy(buf1
, subblock
, buf1len
);
830 TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");
831 strncpy(buf1
, fn
, buf1len
); /* msvideo.dll appears to copy fn*/
833 HeapFree(GetProcessHeap(), 0, infobuf
);
837 /******************************************************************
842 static LRESULT CALLBACK
IC_CallTo16(HDRVR hdrv
, HIC hic
, UINT msg
, LPARAM lp1
, LPARAM lp2
)
845 WINE_HIC
* whic
= IC_GetPtr(hic
);
849 if (whic
->driverproc
)
851 ret
= whic
->driverproc(hic
, whic
->hdrv
, msg
, lParam1
, lParam2
);
855 ret
= SendDriverMessage(whic
->hdrv
, msg
, lParam1
, lParam2
);
858 FIXME("No 32=>16 conversion yet\n");
863 /**************************************************************************
864 * DllEntryPoint (MSVIDEO.300)
866 * MSVIDEO DLL entry point
869 BOOL WINAPI
VIDEO_LibMain(DWORD fdwReason
, HINSTANCE hinstDLL
, WORD ds
,
870 WORD wHeapSize
, DWORD dwReserved1
, WORD wReserved2
)
874 case DLL_PROCESS_ATTACH
:
875 /* hook in our 16 bit management functions */
876 pFnCallTo16
= IC_CallTo16
;
878 case DLL_PROCESS_DETACH
:
879 /* remove our 16 bit management functions */
882 case DLL_THREAD_ATTACH
:
883 case DLL_THREAD_DETACH
: