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"
29 #include "stackframe.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(void)
155 hic
= VA_ARG16(valist
, HIC16
);
156 msg
= VA_ARG16(valist
, UINT16
);
157 cb
= VA_ARG16(valist
, UINT16
);
159 lpData
= HeapAlloc(GetProcessHeap(), 0, cb
);
161 TRACE("0x%08lx, %u, %u, ...)\n", (DWORD
) hic
, msg
, cb
);
163 for (i
= 0; i
< cb
/ sizeof(WORD
); i
++)
165 lpData
[i
] = VA_ARG16(valist
, WORD
);
169 segData
= MapLS(lpData
);
170 ret
= ICSendMessage16(hic
, msg
, segData
, (DWORD
) cb
);
172 HeapFree(GetProcessHeap(), 0, lpData
);
176 /***********************************************************************
177 * ICGetInfo [MSVIDEO.212]
179 LRESULT VFWAPI
ICGetInfo16(HIC16 hic
, ICINFO16
* picinfo
, DWORD cb
)
183 TRACE("(0x%08lx,%p,%ld)\n", (DWORD
) hic
, picinfo
, cb
);
184 ret
= ICSendMessage16(hic
, ICM_GETINFO
, (DWORD
) picinfo
, cb
);
185 TRACE(" -> 0x%08lx\n", ret
);
189 /***********************************************************************
190 * ICLocate [MSVIDEO.213]
192 HIC16 VFWAPI
ICLocate16(DWORD fccType
, DWORD fccHandler
,
193 LPBITMAPINFOHEADER lpbiIn
, LPBITMAPINFOHEADER lpbiOut
,
196 return HIC_16(ICLocate(fccType
, fccHandler
, lpbiIn
, lpbiOut
, wFlags
));
199 /***********************************************************************
200 * _ICCompress [MSVIDEO.224]
202 DWORD VFWAPIV
ICCompress16(HIC16 hic
, DWORD dwFlags
,
203 LPBITMAPINFOHEADER lpbiOutput
, LPVOID lpData
,
204 LPBITMAPINFOHEADER lpbiInput
, LPVOID lpBits
,
205 LPDWORD lpckid
, LPDWORD lpdwFlags
,
206 LONG lFrameNum
, DWORD dwFrameSize
,
207 DWORD dwQuality
, LPBITMAPINFOHEADER lpbiPrev
,
214 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n", (DWORD
) hic
, dwFlags
,
215 lpbiOutput
, lpData
, lpbiInput
, lpBits
);
217 iccmp
.dwFlags
= dwFlags
;
219 iccmp
.lpbiOutput
= lpbiOutput
;
220 iccmp
.lpOutput
= lpData
;
221 iccmp
.lpbiInput
= lpbiInput
;
222 iccmp
.lpInput
= lpBits
;
224 iccmp
.lpckid
= lpckid
;
225 iccmp
.lpdwFlags
= lpdwFlags
;
226 iccmp
.lFrameNum
= lFrameNum
;
227 iccmp
.dwFrameSize
= dwFrameSize
;
228 iccmp
.dwQuality
= dwQuality
;
229 iccmp
.lpbiPrev
= lpbiPrev
;
230 iccmp
.lpPrev
= lpPrev
;
231 seg_iccmp
= MapLS(&iccmp
);
232 ret
= ICSendMessage16(hic
, ICM_COMPRESS
, seg_iccmp
, sizeof(ICCOMPRESS
));
237 /***********************************************************************
238 * _ICDecompress [MSVIDEO.230]
240 DWORD VFWAPIV
ICDecompress16(HIC16 hic
, DWORD dwFlags
,
241 LPBITMAPINFOHEADER lpbiFormat
, LPVOID lpData
,
242 LPBITMAPINFOHEADER lpbi
, LPVOID lpBits
)
248 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n", (DWORD
) hic
, dwFlags
, lpbiFormat
,
249 lpData
, lpbi
, lpBits
);
251 icd
.dwFlags
= dwFlags
;
252 icd
.lpbiInput
= lpbiFormat
;
253 icd
.lpInput
= lpData
;
254 icd
.lpbiOutput
= lpbi
;
255 icd
.lpOutput
= lpBits
;
257 segptr
= MapLS(&icd
);
258 ret
= ICSendMessage16(hic
, ICM_DECOMPRESS
, segptr
, sizeof(ICDECOMPRESS
));
263 /***********************************************************************
264 * _ICDrawBegin [MSVIDEO.232]
266 DWORD VFWAPIV
ICDrawBegin16(HIC16 hic
, /* [in] */
267 DWORD dwFlags
, /* [in] flags */
268 HPALETTE16 hpal
, /* [in] palette to draw with */
269 HWND16 hwnd
, /* [in] window to draw to */
270 HDC16 hdc
, /* [in] HDC to draw to */
271 INT16 xDst
, /* [in] destination rectangle */
272 INT16 yDst
, /* [in] */
273 INT16 dxDst
, /* [in] */
274 INT16 dyDst
, /* [in] */
275 LPBITMAPINFOHEADER lpbi
, /* [in] format of frame to draw NOTE: SEGPTR */
276 INT16 xSrc
, /* [in] source rectangle */
277 INT16 ySrc
, /* [in] */
278 INT16 dxSrc
, /* [in] */
279 INT16 dySrc
, /* [in] */
280 DWORD dwRate
, /* [in] frames/second = (dwRate/dwScale) */
281 DWORD dwScale
) /* [in] */
287 TRACE ("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
288 (DWORD
) hic
, dwFlags
, (DWORD
) hpal
, (DWORD
) hwnd
, (DWORD
) hdc
,
289 xDst
, yDst
, dxDst
, dyDst
, lpbi
, xSrc
, ySrc
, dxSrc
, dySrc
, dwRate
,
292 icdb
.dwFlags
= dwFlags
;
300 icdb
.lpbi
= lpbi
; /* Keep this as SEGPTR for the mapping code to deal with */
305 icdb
.dwRate
= dwRate
;
306 icdb
.dwScale
= dwScale
;
307 seg_icdb
= MapLS(&icdb
);
308 ret
= (DWORD
) ICSendMessage16(hic
, ICM_DRAW_BEGIN
, seg_icdb
,
309 sizeof(ICDRAWBEGIN16
));
314 /***********************************************************************
315 * _ICDraw [MSVIDEO.234]
317 DWORD VFWAPIV
ICDraw16(HIC16 hic
, DWORD dwFlags
,
318 LPVOID lpFormat
, /* [???] NOTE: SEGPTR */
319 LPVOID lpData
, /* [???] NOTE: SEGPTR */
320 DWORD cbData
, LONG lTime
)
326 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n", (DWORD
) hic
, dwFlags
,
327 lpFormat
, lpData
, cbData
, lTime
);
328 icd
.dwFlags
= dwFlags
;
329 icd
.lpFormat
= lpFormat
;
333 seg_icd
= MapLS(&icd
);
334 ret
= ICSendMessage16(hic
, ICM_DRAW
, seg_icd
, sizeof(ICDRAW
));
339 /***********************************************************************
340 * ICGetDisplayFormat [MSVIDEO.239]
342 HIC16 VFWAPI
ICGetDisplayFormat16(HIC16 hic
, LPBITMAPINFOHEADER lpbiIn
,
343 LPBITMAPINFOHEADER lpbiOut
, INT16 depth
,
346 return HIC_16(ICGetDisplayFormat(HIC_32(hic
), lpbiIn
, lpbiOut
, depth
,
350 #define COPY(x,y) (x->y = x##16->y);
351 #define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y));
353 /******************************************************************
354 * MSVIDEO_MapICDEX16To32
358 static LPVOID
MSVIDEO_MapICDEX16To32(LPDWORD lParam
)
362 ICDECOMPRESSEX
*icdx
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESSEX
));
363 ICDECOMPRESSEX16
*icdx16
= MapSL(*lParam
);
367 COPYPTR(icdx
, lpbiSrc
);
368 COPYPTR(icdx
, lpSrc
);
369 COPYPTR(icdx
, lpbiDst
);
370 COPYPTR(icdx
, lpDst
);
380 *lParam
= (DWORD
)(icdx
);
384 /******************************************************************
385 * MSVIDEO_MapMsg16To32
389 static LPVOID
MSVIDEO_MapMsg16To32(UINT msg
, LPDWORD lParam1
, LPDWORD lParam2
)
393 TRACE("Mapping %d\n", msg
);
404 case ICM_COMPRESS_END
:
405 case ICM_DECOMPRESS_END
:
406 case ICM_DECOMPRESSEX_END
:
408 case ICM_DRAW_START_PLAY
:
409 case ICM_DRAW_STOP_PLAY
:
410 case ICM_DRAW_REALIZE
:
411 case ICM_DRAW_RENDERBUFFER
:
415 case ICM_GETDEFAULTQUALITY
:
418 case ICM_DRAW_WINDOW
:
419 case ICM_GETBUFFERSWANTED
:
420 *lParam1
= (DWORD
)MapSL(*lParam1
);
424 ICINFO
*ici
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO
));
427 ici16
= MapSL(*lParam1
);
430 ici
->dwSize
= sizeof(ICINFO
);
432 COPY(ici
, fccHandler
);
434 COPY(ici
, dwVersion
);
435 COPY(ici
, dwVersionICM
);
436 MultiByteToWideChar( CP_ACP
, 0, ici16
->szName
, -1, ici
->szName
, 16 );
437 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDescription
, -1, ici
->szDescription
, 128 );
438 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDriver
, -1, ici
->szDriver
, 128 );
439 *lParam1
= (DWORD
)(ici
);
440 *lParam2
= sizeof(ICINFO
);
445 ICCOMPRESS
*icc
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS
));
448 icc16
= MapSL(*lParam1
);
452 COPYPTR(icc
, lpbiOutput
);
453 COPYPTR(icc
, lpOutput
);
454 COPYPTR(icc
, lpbiInput
);
455 COPYPTR(icc
, lpInput
);
456 COPYPTR(icc
, lpckid
);
457 COPYPTR(icc
, lpdwFlags
);
458 COPY(icc
, lFrameNum
);
459 COPY(icc
, dwFrameSize
);
460 COPY(icc
, dwQuality
);
461 COPYPTR(icc
, lpbiPrev
);
462 COPYPTR(icc
, lpPrev
);
464 *lParam1
= (DWORD
)(icc
);
465 *lParam2
= sizeof(ICCOMPRESS
);
470 ICDECOMPRESS
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESS
));
471 ICDECOMPRESS
*icd16
; /* Same structure except for the pointers */
473 icd16
= MapSL(*lParam1
);
477 COPYPTR(icd
, lpbiInput
);
478 COPYPTR(icd
, lpInput
);
479 COPYPTR(icd
, lpbiOutput
);
480 COPYPTR(icd
, lpOutput
);
483 *lParam1
= (DWORD
)(icd
);
484 *lParam2
= sizeof(ICDECOMPRESS
);
487 case ICM_COMPRESS_BEGIN
:
488 case ICM_COMPRESS_GET_FORMAT
:
489 case ICM_COMPRESS_GET_SIZE
:
490 case ICM_COMPRESS_QUERY
:
491 case ICM_DECOMPRESS_GET_FORMAT
:
492 case ICM_DECOMPRESS_QUERY
:
493 case ICM_DECOMPRESS_BEGIN
:
494 case ICM_DECOMPRESS_SET_PALETTE
:
495 case ICM_DECOMPRESS_GET_PALETTE
:
496 *lParam1
= (DWORD
)MapSL(*lParam1
);
497 *lParam2
= (DWORD
)MapSL(*lParam2
);
499 case ICM_DECOMPRESSEX_QUERY
:
500 if ((*lParam2
!= sizeof(ICDECOMPRESSEX16
)) && (*lParam2
!= 0))
501 WARN("*lParam2 has unknown value %p\n", (ICDECOMPRESSEX16
*)*lParam2
);
502 /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)
503 * This is because of ICMessage(). Special case it?
505 LPVOID* addr = HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPVOID));
506 addr[0] = MSVIDEO_MapICDEX16To32(lParam1);
508 addr[1] = MSVIDEO_MapICDEX16To32(lParam2);
515 case ICM_DECOMPRESSEX_BEGIN
:
516 case ICM_DECOMPRESSEX
:
517 ret
= MSVIDEO_MapICDEX16To32(lParam1
);
518 *lParam2
= sizeof(ICDECOMPRESSEX
);
522 ICDRAWBEGIN
*icdb
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWBEGIN
));
523 ICDRAWBEGIN16
*icdb16
= MapSL(*lParam1
);
527 icdb
->hpal
= HPALETTE_32(icdb16
->hpal
);
528 icdb
->hwnd
= HWND_32(icdb16
->hwnd
);
529 icdb
->hdc
= HDC_32(icdb16
->hdc
);
542 *lParam1
= (DWORD
)(icdb
);
543 *lParam2
= sizeof(ICDRAWBEGIN
);
546 case ICM_DRAW_SUGGESTFORMAT
:
548 ICDRAWSUGGEST
*icds
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWSUGGEST
));
549 ICDRAWSUGGEST16
*icds16
= MapSL(*lParam1
);
554 COPYPTR(icds
, lpbiIn
);
555 COPYPTR(icds
, lpbiSuggest
);
560 icds
->hicDecompressor
= HIC_32(icds16
->hicDecompressor
);
562 *lParam1
= (DWORD
)(icds
);
563 *lParam2
= sizeof(ICDRAWSUGGEST
);
568 ICDRAW
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAW
));
569 ICDRAW
*icd16
= MapSL(*lParam1
);
573 COPYPTR(icd
, lpFormat
);
574 COPYPTR(icd
, lpData
);
578 *lParam1
= (DWORD
)(icd
);
579 *lParam2
= sizeof(ICDRAW
);
586 FIXME("%d is not yet handled. Expect a crash.\n", msg
);
594 /******************************************************************
595 * MSVIDEO_UnmapMsg16To32
599 static void MSVIDEO_UnmapMsg16To32(UINT msg
, LPVOID data16
, LPDWORD lParam1
, LPDWORD lParam2
)
601 TRACE("Unmapping %d\n", msg
);
603 #define UNCOPY(x, y) (x##16->y = x->y);
609 ICINFO
*ici
= (ICINFO
*)(*lParam1
);
610 ICINFO16
*ici16
= (ICINFO16
*)data16
;
612 UNCOPY(ici
, fccType
);
613 UNCOPY(ici
, fccHandler
);
614 UNCOPY(ici
, dwFlags
);
615 UNCOPY(ici
, dwVersion
);
616 UNCOPY(ici
, dwVersionICM
);
617 WideCharToMultiByte( CP_ACP
, 0, ici
->szName
, -1, ici16
->szName
,
618 sizeof(ici16
->szName
), NULL
, NULL
);
619 ici16
->szName
[sizeof(ici16
->szName
)-1] = 0;
620 WideCharToMultiByte( CP_ACP
, 0, ici
->szDescription
, -1, ici16
->szDescription
,
621 sizeof(ici16
->szDescription
), NULL
, NULL
);
622 ici16
->szDescription
[sizeof(ici16
->szDescription
)-1] = 0;
623 /* This just gives garbage for some reason - BB
624 lstrcpynWtoA(ici16->szDriver, ici->szDriver, 128);*/
626 HeapFree(GetProcessHeap(), 0, ici
);
629 case ICM_DECOMPRESS_QUERY
:
632 HeapFree(GetProcessHeap(), 0, x[0]);
634 HeapFree(GetProcessHeap(), 0, x[1]);
639 case ICM_DECOMPRESSEX_QUERY
:
640 case ICM_DECOMPRESSEX_BEGIN
:
641 case ICM_DECOMPRESSEX
:
643 case ICM_DRAW_SUGGESTFORMAT
:
645 HeapFree(GetProcessHeap(), 0, data16
);
648 ERR("Unmapping unmapped msg %d\n", msg
);
653 /***********************************************************************
654 * ICInfo [MSVIDEO.200]
656 BOOL16 VFWAPI
ICInfo16(DWORD fccType
, DWORD fccHandler
, ICINFO16
*lpicinfo
)
660 DWORD lParam
= (DWORD
)lpicinfo
;
661 DWORD size
= ((ICINFO
*)(MapSL((SEGPTR
)lpicinfo
)))->dwSize
;
663 /* Use the mapping functions to map the ICINFO structure */
664 lpv
= MSVIDEO_MapMsg16To32(ICM_GETINFO
, &lParam
, &size
);
666 ret
= ICInfo(fccType
, fccHandler
, (ICINFO
*)lParam
);
668 MSVIDEO_UnmapMsg16To32(ICM_GETINFO
, lpv
, &lParam
, &size
);
673 /******************************************************************
678 static LRESULT CALLBACK
IC_Callback3216(HIC hic
, HDRVR hdrv
, UINT msg
, DWORD lp1
, DWORD lp2
)
684 whic
= MSVIDEO_GetHicPtr(hic
);
690 lp2
= (DWORD
)MapLS((void*)lp2
);
693 args
[7] = HIWORD(hic
);
694 args
[6] = LOWORD(hic
);
695 args
[5] = HDRVR_16(whic
->hdrv
);
697 args
[3] = HIWORD(lp1
);
698 args
[2] = LOWORD(lp1
);
699 args
[1] = HIWORD(lp2
);
700 args
[0] = LOWORD(lp2
);
701 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
710 else ret
= ICERR_BADHANDLE
;
714 /***********************************************************************
715 * ICOpenFunction [MSVIDEO.206]
717 HIC16 VFWAPI
ICOpenFunction16(DWORD fccType
, DWORD fccHandler
, UINT16 wMode
, FARPROC16 lpfnHandler
)
721 hic32
= MSVIDEO_OpenFunction(fccType
, fccHandler
, wMode
,
722 (DRIVERPROC
)IC_Callback3216
, (DWORD
)lpfnHandler
);
723 return HIC_16(hic32
);
726 /***********************************************************************
727 * ICSendMessage [MSVIDEO.205]
729 LRESULT VFWAPI
ICSendMessage16(HIC16 hic
, UINT16 msg
, DWORD lParam1
, DWORD lParam2
)
731 LRESULT ret
= ICERR_BADHANDLE
;
734 whic
= MSVIDEO_GetHicPtr(HIC_32(hic
));
737 /* we've got a 16 bit driver proc... call it directly */
738 if (whic
->driverproc16
)
742 /* FIXME: original code was passing hdrv first and hic second */
743 /* but this doesn't match what IC_Callback3216 does */
744 args
[7] = HIWORD(hic
);
745 args
[6] = LOWORD(hic
);
746 args
[5] = HDRVR_16(whic
->hdrv
);
748 args
[3] = HIWORD(lParam1
);
749 args
[2] = LOWORD(lParam1
);
750 args
[1] = HIWORD(lParam2
);
751 args
[0] = LOWORD(lParam2
);
752 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
756 /* map the message for a 32 bit infrastructure, and pass it along */
757 void* data16
= MSVIDEO_MapMsg16To32(msg
, &lParam1
, &lParam2
);
759 ret
= MSVIDEO_SendMessage(whic
, msg
, lParam1
, lParam2
);
761 MSVIDEO_UnmapMsg16To32(msg
, data16
, &lParam1
, &lParam2
);
767 /***********************************************************************
768 * VideoCapDriverDescAndVer [MSVIDEO.22]
770 DWORD WINAPI
VideoCapDriverDescAndVer16(WORD nr
, LPSTR buf1
, WORD buf1len
,
771 LPSTR buf2
, WORD buf2len
)
777 char *s
, buf
[2000], fn
[260];
781 TRACE("(%d,%p,%d,%p,%d)\n", nr
, buf1
, buf1len
, buf2
, buf2len
);
782 if (GetPrivateProfileStringA("drivers32", NULL
, NULL
, buf
, sizeof(buf
), "system.ini"))
787 if (!strncasecmp(s
, "vid", 3))
792 s
= s
+ strlen(s
) + 1; /* either next char or \0 */
796 return 20; /* hmm, out of entries even if we don't have any */
799 FIXME("No more VID* entries found\n");
802 GetPrivateProfileStringA("drivers32", s
, NULL
, fn
, sizeof(fn
), "system.ini");
803 infosize
= GetFileVersionInfoSizeA(fn
, &verhandle
);
806 TRACE("%s has no fileversioninfo.\n", fn
);
809 infobuf
= HeapAlloc(GetProcessHeap(), 0, infosize
);
810 if (GetFileVersionInfoA(fn
, verhandle
, infosize
, infobuf
))
813 /* Yes, two space behind : */
814 /* FIXME: test for buflen */
815 sprintf(vbuf
, "Version: %d.%d.%d.%d\n",
816 ((WORD
*)infobuf
)[0x0f],
817 ((WORD
*)infobuf
)[0x0e],
818 ((WORD
*)infobuf
)[0x11],
819 ((WORD
*)infobuf
)[0x10]
821 TRACE("version of %s is %s\n", fn
, vbuf
);
822 strncpy(buf2
, vbuf
, buf2len
);
826 TRACE("GetFileVersionInfoA failed for %s.\n", fn
);
827 strncpy(buf2
, fn
, buf2len
); /* msvideo.dll appears to copy fn*/
829 /* FIXME: language problem? */
830 if (VerQueryValueA( infobuf
,
831 "\\StringFileInfo\\040904E4\\FileDescription",
836 TRACE("VQA returned %s\n", (LPCSTR
)subblock
);
837 strncpy(buf1
, subblock
, buf1len
);
841 TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");
842 strncpy(buf1
, fn
, buf1len
); /* msvideo.dll appears to copy fn*/
844 HeapFree(GetProcessHeap(), 0, infobuf
);
848 /******************************************************************
853 static LRESULT CALLBACK
IC_CallTo16(HDRVR hdrv
, HIC hic
, UINT msg
, LPARAM lp1
, LPARAM lp2
)
856 WINE_HIC
* whic
= IC_GetPtr(hic
);
860 if (whic
->driverproc
)
862 ret
= whic
->driverproc(hic
, whic
->hdrv
, msg
, lParam1
, lParam2
);
866 ret
= SendDriverMessage(whic
->hdrv
, msg
, lParam1
, lParam2
);
869 FIXME("No 32=>16 conversion yet\n");
874 /**************************************************************************
875 * DllEntryPoint (MSVIDEO.300)
877 * MSVIDEO DLL entry point
880 BOOL WINAPI
VIDEO_LibMain(DWORD fdwReason
, HINSTANCE hinstDLL
, WORD ds
,
881 WORD wHeapSize
, DWORD dwReserved1
, WORD wReserved2
)
885 case DLL_PROCESS_ATTACH
:
886 /* hook in our 16 bit management functions */
887 pFnCallTo16
= IC_CallTo16
;
889 case DLL_PROCESS_DETACH
:
890 /* remove our 16 bit management functions */
893 case DLL_THREAD_ATTACH
:
894 case DLL_THREAD_DETACH
: