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"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(msvideo
);
35 /* Drivers32 settings */
36 #define HKLM_DRIVERS32 "Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"
38 /***********************************************************************
39 * DrawDibOpen [MSVIDEO.102]
41 HDRAWDIB16 VFWAPI
DrawDibOpen16(void)
43 return HDRAWDIB_16(DrawDibOpen());
46 /***********************************************************************
47 * DrawDibClose [MSVIDEO.103]
49 BOOL16 VFWAPI
DrawDibClose16(HDRAWDIB16 hdd
)
51 return DrawDibClose(HDRAWDIB_32(hdd
));
54 /************************************************************************
55 * DrawDibBegin [MSVIDEO.104]
57 BOOL16 VFWAPI
DrawDibBegin16(HDRAWDIB16 hdd
, HDC16 hdc
, INT16 dxDst
,
58 INT16 dyDst
, LPBITMAPINFOHEADER lpbi
, INT16 dxSrc
,
59 INT16 dySrc
, UINT16 wFlags
)
61 return DrawDibBegin(HDRAWDIB_32(hdd
), HDC_32(hdc
), dxDst
, dyDst
, lpbi
,
62 dxSrc
, dySrc
, wFlags
);
65 /***********************************************************************
66 * DrawDibEnd [MSVIDEO.105]
68 BOOL16 VFWAPI
DrawDibEnd16(HDRAWDIB16 hdd
)
70 return DrawDibEnd(HDRAWDIB_32(hdd
));
73 /**********************************************************************
74 * DrawDibDraw [MSVIDEO.106]
76 BOOL16 VFWAPI
DrawDibDraw16(HDRAWDIB16 hdd
, HDC16 hdc
, INT16 xDst
, INT16 yDst
,
77 INT16 dxDst
, INT16 dyDst
, LPBITMAPINFOHEADER lpbi
,
78 LPVOID lpBits
, INT16 xSrc
, INT16 ySrc
, INT16 dxSrc
,
79 INT16 dySrc
, UINT16 wFlags
)
81 return DrawDibDraw(HDRAWDIB_32(hdd
), HDC_32(hdc
), xDst
, yDst
, dxDst
,
82 dyDst
, lpbi
, lpBits
, xSrc
, ySrc
, dxSrc
, dySrc
, wFlags
);
85 /***********************************************************************
86 * DrawDibGetPalette [MSVIDEO.108]
88 HPALETTE16 VFWAPI
DrawDibGetPalette16(HDRAWDIB16 hdd
)
90 return HPALETTE_16(DrawDibGetPalette(HDRAWDIB_32(hdd
)));
93 /***********************************************************************
94 * DrawDibSetPalette [MSVIDEO.110]
96 BOOL16 VFWAPI
DrawDibSetPalette16(HDRAWDIB16 hdd
, HPALETTE16 hpal
)
98 return DrawDibSetPalette(HDRAWDIB_32(hdd
), HPALETTE_32(hpal
));
101 /***********************************************************************
102 * DrawDibRealize [MSVIDEO.112]
104 UINT16 VFWAPI
DrawDibRealize16(HDRAWDIB16 hdd
, HDC16 hdc
,
107 return (UINT16
)DrawDibRealize(HDRAWDIB_32(hdd
), HDC_32(hdc
), fBackground
);
110 /*************************************************************************
111 * DrawDibStart [MSVIDEO.118]
113 BOOL16 VFWAPI
DrawDibStart16(HDRAWDIB16 hdd
, DWORD rate
)
115 return DrawDibStart(HDRAWDIB_32(hdd
), rate
);
118 /*************************************************************************
119 * DrawDibStop [MSVIDEO.119]
121 BOOL16
DrawDibStop16(HDRAWDIB16 hdd
)
123 return DrawDibStop(HDRAWDIB_32(hdd
));
126 /***********************************************************************
127 * ICOpen [MSVIDEO.203]
129 HIC16 VFWAPI
ICOpen16(DWORD fccType
, DWORD fccHandler
, UINT16 wMode
)
131 return HIC_16(ICOpen(fccType
, fccHandler
, wMode
));
134 /***********************************************************************
135 * ICClose [MSVIDEO.204]
137 LRESULT WINAPI
ICClose16(HIC16 hic
)
139 return ICClose(HIC_32(hic
));
142 /***********************************************************************
143 * _ICMessage [MSVIDEO.207]
145 LRESULT VFWAPIV
ICMessage16( HIC16 hic
, UINT16 msg
, UINT16 cb
, VA_LIST16 valist
)
152 lpData
= HeapAlloc(GetProcessHeap(), 0, cb
);
154 TRACE("0x%08lx, %u, %u, ...)\n", (DWORD
) hic
, msg
, cb
);
156 for (i
= 0; i
< cb
/ sizeof(WORD
); i
++)
158 lpData
[i
] = VA_ARG16(valist
, WORD
);
161 segData
= MapLS(lpData
);
162 ret
= ICSendMessage16(hic
, msg
, segData
, (DWORD
) cb
);
164 HeapFree(GetProcessHeap(), 0, lpData
);
168 /***********************************************************************
169 * ICGetInfo [MSVIDEO.212]
171 LRESULT VFWAPI
ICGetInfo16(HIC16 hic
, ICINFO16
* picinfo
, DWORD cb
)
175 TRACE("(0x%08lx,%p,%ld)\n", (DWORD
) hic
, picinfo
, cb
);
176 ret
= ICSendMessage16(hic
, ICM_GETINFO
, (DWORD
) picinfo
, cb
);
177 TRACE(" -> 0x%08lx\n", ret
);
181 /***********************************************************************
182 * ICLocate [MSVIDEO.213]
184 HIC16 VFWAPI
ICLocate16(DWORD fccType
, DWORD fccHandler
,
185 LPBITMAPINFOHEADER lpbiIn
, LPBITMAPINFOHEADER lpbiOut
,
188 return HIC_16(ICLocate(fccType
, fccHandler
, lpbiIn
, lpbiOut
, wFlags
));
191 /***********************************************************************
192 * _ICCompress [MSVIDEO.224]
194 DWORD VFWAPIV
ICCompress16(HIC16 hic
, DWORD dwFlags
,
195 LPBITMAPINFOHEADER lpbiOutput
, LPVOID lpData
,
196 LPBITMAPINFOHEADER lpbiInput
, LPVOID lpBits
,
197 LPDWORD lpckid
, LPDWORD lpdwFlags
,
198 LONG lFrameNum
, DWORD dwFrameSize
,
199 DWORD dwQuality
, LPBITMAPINFOHEADER lpbiPrev
,
206 TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n", (DWORD
) hic
, dwFlags
,
207 lpbiOutput
, lpData
, lpbiInput
, lpBits
);
209 iccmp
.dwFlags
= dwFlags
;
211 iccmp
.lpbiOutput
= lpbiOutput
;
212 iccmp
.lpOutput
= lpData
;
213 iccmp
.lpbiInput
= lpbiInput
;
214 iccmp
.lpInput
= lpBits
;
216 iccmp
.lpckid
= lpckid
;
217 iccmp
.lpdwFlags
= lpdwFlags
;
218 iccmp
.lFrameNum
= lFrameNum
;
219 iccmp
.dwFrameSize
= dwFrameSize
;
220 iccmp
.dwQuality
= dwQuality
;
221 iccmp
.lpbiPrev
= lpbiPrev
;
222 iccmp
.lpPrev
= lpPrev
;
223 seg_iccmp
= MapLS(&iccmp
);
224 ret
= ICSendMessage16(hic
, ICM_COMPRESS
, seg_iccmp
, sizeof(ICCOMPRESS
));
229 /***********************************************************************
230 * _ICDecompress [MSVIDEO.230]
232 DWORD VFWAPIV
ICDecompress16(HIC16 hic
, DWORD dwFlags
,
233 LPBITMAPINFOHEADER lpbiFormat
, LPVOID lpData
,
234 LPBITMAPINFOHEADER lpbi
, LPVOID lpBits
)
240 TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n", (DWORD
) hic
, dwFlags
, lpbiFormat
,
241 lpData
, lpbi
, lpBits
);
243 icd
.dwFlags
= dwFlags
;
244 icd
.lpbiInput
= lpbiFormat
;
245 icd
.lpInput
= lpData
;
246 icd
.lpbiOutput
= lpbi
;
247 icd
.lpOutput
= lpBits
;
249 segptr
= MapLS(&icd
);
250 ret
= ICSendMessage16(hic
, ICM_DECOMPRESS
, segptr
, sizeof(ICDECOMPRESS
));
255 /***********************************************************************
256 * _ICDrawBegin [MSVIDEO.232]
258 DWORD VFWAPIV
ICDrawBegin16(HIC16 hic
, /* [in] */
259 DWORD dwFlags
, /* [in] flags */
260 HPALETTE16 hpal
, /* [in] palette to draw with */
261 HWND16 hwnd
, /* [in] window to draw to */
262 HDC16 hdc
, /* [in] HDC to draw to */
263 INT16 xDst
, /* [in] destination rectangle */
264 INT16 yDst
, /* [in] */
265 INT16 dxDst
, /* [in] */
266 INT16 dyDst
, /* [in] */
267 LPBITMAPINFOHEADER lpbi
, /* [in] format of frame to draw NOTE: SEGPTR */
268 INT16 xSrc
, /* [in] source rectangle */
269 INT16 ySrc
, /* [in] */
270 INT16 dxSrc
, /* [in] */
271 INT16 dySrc
, /* [in] */
272 DWORD dwRate
, /* [in] frames/second = (dwRate/dwScale) */
273 DWORD dwScale
) /* [in] */
279 TRACE ("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
280 (DWORD
) hic
, dwFlags
, (DWORD
) hpal
, (DWORD
) hwnd
, (DWORD
) hdc
,
281 xDst
, yDst
, dxDst
, dyDst
, lpbi
, xSrc
, ySrc
, dxSrc
, dySrc
, dwRate
,
284 icdb
.dwFlags
= dwFlags
;
292 icdb
.lpbi
= lpbi
; /* Keep this as SEGPTR for the mapping code to deal with */
297 icdb
.dwRate
= dwRate
;
298 icdb
.dwScale
= dwScale
;
299 seg_icdb
= MapLS(&icdb
);
300 ret
= (DWORD
) ICSendMessage16(hic
, ICM_DRAW_BEGIN
, seg_icdb
,
301 sizeof(ICDRAWBEGIN16
));
306 /***********************************************************************
307 * _ICDraw [MSVIDEO.234]
309 DWORD VFWAPIV
ICDraw16(HIC16 hic
, DWORD dwFlags
,
310 LPVOID lpFormat
, /* [???] NOTE: SEGPTR */
311 LPVOID lpData
, /* [???] NOTE: SEGPTR */
312 DWORD cbData
, LONG lTime
)
318 TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n", (DWORD
) hic
, dwFlags
,
319 lpFormat
, lpData
, cbData
, lTime
);
320 icd
.dwFlags
= dwFlags
;
321 icd
.lpFormat
= lpFormat
;
325 seg_icd
= MapLS(&icd
);
326 ret
= ICSendMessage16(hic
, ICM_DRAW
, seg_icd
, sizeof(ICDRAW
));
331 /***********************************************************************
332 * ICGetDisplayFormat [MSVIDEO.239]
334 HIC16 VFWAPI
ICGetDisplayFormat16(HIC16 hic
, LPBITMAPINFOHEADER lpbiIn
,
335 LPBITMAPINFOHEADER lpbiOut
, INT16 depth
,
338 return HIC_16(ICGetDisplayFormat(HIC_32(hic
), lpbiIn
, lpbiOut
, depth
,
342 #define COPY(x,y) (x->y = x##16->y);
343 #define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y));
345 /******************************************************************
346 * MSVIDEO_MapICDEX16To32
350 static LPVOID
MSVIDEO_MapICDEX16To32(LPDWORD lParam
)
354 ICDECOMPRESSEX
*icdx
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESSEX
));
355 ICDECOMPRESSEX16
*icdx16
= MapSL(*lParam
);
359 COPYPTR(icdx
, lpbiSrc
);
360 COPYPTR(icdx
, lpSrc
);
361 COPYPTR(icdx
, lpbiDst
);
362 COPYPTR(icdx
, lpDst
);
372 *lParam
= (DWORD
)(icdx
);
376 /******************************************************************
377 * MSVIDEO_MapMsg16To32
381 static LPVOID
MSVIDEO_MapMsg16To32(UINT msg
, LPDWORD lParam1
, LPDWORD lParam2
)
385 TRACE("Mapping %d\n", msg
);
396 case ICM_COMPRESS_END
:
397 case ICM_DECOMPRESS_END
:
398 case ICM_DECOMPRESSEX_END
:
400 case ICM_DRAW_START_PLAY
:
401 case ICM_DRAW_STOP_PLAY
:
402 case ICM_DRAW_REALIZE
:
403 case ICM_DRAW_RENDERBUFFER
:
407 case ICM_GETDEFAULTQUALITY
:
410 case ICM_DRAW_WINDOW
:
411 case ICM_GETBUFFERSWANTED
:
412 *lParam1
= (DWORD
)MapSL(*lParam1
);
416 ICINFO
*ici
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO
));
419 ici16
= MapSL(*lParam1
);
422 ici
->dwSize
= sizeof(ICINFO
);
424 COPY(ici
, fccHandler
);
426 COPY(ici
, dwVersion
);
427 COPY(ici
, dwVersionICM
);
428 MultiByteToWideChar( CP_ACP
, 0, ici16
->szName
, -1, ici
->szName
, 16 );
429 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDescription
, -1, ici
->szDescription
, 128 );
430 MultiByteToWideChar( CP_ACP
, 0, ici16
->szDriver
, -1, ici
->szDriver
, 128 );
431 *lParam1
= (DWORD
)(ici
);
432 *lParam2
= sizeof(ICINFO
);
437 ICCOMPRESS
*icc
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS
));
440 icc16
= MapSL(*lParam1
);
444 COPYPTR(icc
, lpbiOutput
);
445 COPYPTR(icc
, lpOutput
);
446 COPYPTR(icc
, lpbiInput
);
447 COPYPTR(icc
, lpInput
);
448 COPYPTR(icc
, lpckid
);
449 COPYPTR(icc
, lpdwFlags
);
450 COPY(icc
, lFrameNum
);
451 COPY(icc
, dwFrameSize
);
452 COPY(icc
, dwQuality
);
453 COPYPTR(icc
, lpbiPrev
);
454 COPYPTR(icc
, lpPrev
);
456 *lParam1
= (DWORD
)(icc
);
457 *lParam2
= sizeof(ICCOMPRESS
);
462 ICDECOMPRESS
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESS
));
463 ICDECOMPRESS
*icd16
; /* Same structure except for the pointers */
465 icd16
= MapSL(*lParam1
);
469 COPYPTR(icd
, lpbiInput
);
470 COPYPTR(icd
, lpInput
);
471 COPYPTR(icd
, lpbiOutput
);
472 COPYPTR(icd
, lpOutput
);
475 *lParam1
= (DWORD
)(icd
);
476 *lParam2
= sizeof(ICDECOMPRESS
);
479 case ICM_COMPRESS_BEGIN
:
480 case ICM_COMPRESS_GET_FORMAT
:
481 case ICM_COMPRESS_GET_SIZE
:
482 case ICM_COMPRESS_QUERY
:
483 case ICM_DECOMPRESS_GET_FORMAT
:
484 case ICM_DECOMPRESS_QUERY
:
485 case ICM_DECOMPRESS_BEGIN
:
486 case ICM_DECOMPRESS_SET_PALETTE
:
487 case ICM_DECOMPRESS_GET_PALETTE
:
488 *lParam1
= (DWORD
)MapSL(*lParam1
);
489 *lParam2
= (DWORD
)MapSL(*lParam2
);
491 case ICM_DECOMPRESSEX_QUERY
:
492 if ((*lParam2
!= sizeof(ICDECOMPRESSEX16
)) && (*lParam2
!= 0))
493 WARN("*lParam2 has unknown value %p\n", (ICDECOMPRESSEX16
*)*lParam2
);
494 /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)
495 * This is because of ICMessage(). Special case it?
497 LPVOID* addr = HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPVOID));
498 addr[0] = MSVIDEO_MapICDEX16To32(lParam1);
500 addr[1] = MSVIDEO_MapICDEX16To32(lParam2);
507 case ICM_DECOMPRESSEX_BEGIN
:
508 case ICM_DECOMPRESSEX
:
509 ret
= MSVIDEO_MapICDEX16To32(lParam1
);
510 *lParam2
= sizeof(ICDECOMPRESSEX
);
514 ICDRAWBEGIN
*icdb
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWBEGIN
));
515 ICDRAWBEGIN16
*icdb16
= MapSL(*lParam1
);
519 icdb
->hpal
= HPALETTE_32(icdb16
->hpal
);
520 icdb
->hwnd
= HWND_32(icdb16
->hwnd
);
521 icdb
->hdc
= HDC_32(icdb16
->hdc
);
534 *lParam1
= (DWORD
)(icdb
);
535 *lParam2
= sizeof(ICDRAWBEGIN
);
538 case ICM_DRAW_SUGGESTFORMAT
:
540 ICDRAWSUGGEST
*icds
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWSUGGEST
));
541 ICDRAWSUGGEST16
*icds16
= MapSL(*lParam1
);
546 COPYPTR(icds
, lpbiIn
);
547 COPYPTR(icds
, lpbiSuggest
);
552 icds
->hicDecompressor
= HIC_32(icds16
->hicDecompressor
);
554 *lParam1
= (DWORD
)(icds
);
555 *lParam2
= sizeof(ICDRAWSUGGEST
);
560 ICDRAW
*icd
= HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAW
));
561 ICDRAW
*icd16
= MapSL(*lParam1
);
565 COPYPTR(icd
, lpFormat
);
566 COPYPTR(icd
, lpData
);
570 *lParam1
= (DWORD
)(icd
);
571 *lParam2
= sizeof(ICDRAW
);
578 FIXME("%d is not yet handled. Expect a crash.\n", msg
);
586 /******************************************************************
587 * MSVIDEO_UnmapMsg16To32
591 static void MSVIDEO_UnmapMsg16To32(UINT msg
, LPVOID data16
, LPDWORD lParam1
, LPDWORD lParam2
)
593 TRACE("Unmapping %d\n", msg
);
595 #define UNCOPY(x, y) (x##16->y = x->y);
601 ICINFO
*ici
= (ICINFO
*)(*lParam1
);
602 ICINFO16
*ici16
= (ICINFO16
*)data16
;
604 UNCOPY(ici
, fccType
);
605 UNCOPY(ici
, fccHandler
);
606 UNCOPY(ici
, dwFlags
);
607 UNCOPY(ici
, dwVersion
);
608 UNCOPY(ici
, dwVersionICM
);
609 WideCharToMultiByte( CP_ACP
, 0, ici
->szName
, -1, ici16
->szName
,
610 sizeof(ici16
->szName
), NULL
, NULL
);
611 ici16
->szName
[sizeof(ici16
->szName
)-1] = 0;
612 WideCharToMultiByte( CP_ACP
, 0, ici
->szDescription
, -1, ici16
->szDescription
,
613 sizeof(ici16
->szDescription
), NULL
, NULL
);
614 ici16
->szDescription
[sizeof(ici16
->szDescription
)-1] = 0;
615 /* This just gives garbage for some reason - BB
616 lstrcpynWtoA(ici16->szDriver, ici->szDriver, 128);*/
618 HeapFree(GetProcessHeap(), 0, ici
);
621 case ICM_DECOMPRESS_QUERY
:
624 HeapFree(GetProcessHeap(), 0, x[0]);
626 HeapFree(GetProcessHeap(), 0, x[1]);
631 case ICM_DECOMPRESSEX_QUERY
:
632 case ICM_DECOMPRESSEX_BEGIN
:
633 case ICM_DECOMPRESSEX
:
635 case ICM_DRAW_SUGGESTFORMAT
:
637 HeapFree(GetProcessHeap(), 0, data16
);
640 ERR("Unmapping unmapped msg %d\n", msg
);
645 /***********************************************************************
646 * ICInfo [MSVIDEO.200]
648 BOOL16 VFWAPI
ICInfo16(DWORD fccType
, DWORD fccHandler
, ICINFO16
*lpicinfo
)
652 DWORD lParam
= (DWORD
)lpicinfo
;
653 DWORD size
= ((ICINFO
*)(MapSL((SEGPTR
)lpicinfo
)))->dwSize
;
655 /* Use the mapping functions to map the ICINFO structure */
656 lpv
= MSVIDEO_MapMsg16To32(ICM_GETINFO
, &lParam
, &size
);
658 ret
= ICInfo(fccType
, fccHandler
, (ICINFO
*)lParam
);
660 MSVIDEO_UnmapMsg16To32(ICM_GETINFO
, lpv
, &lParam
, &size
);
665 /******************************************************************
670 static LRESULT CALLBACK
IC_Callback3216(HIC hic
, HDRVR hdrv
, UINT msg
, DWORD lp1
, DWORD lp2
)
676 whic
= MSVIDEO_GetHicPtr(hic
);
682 lp2
= (DWORD
)MapLS((void*)lp2
);
685 args
[7] = HIWORD(hic
);
686 args
[6] = LOWORD(hic
);
687 args
[5] = HDRVR_16(whic
->hdrv
);
689 args
[3] = HIWORD(lp1
);
690 args
[2] = LOWORD(lp1
);
691 args
[1] = HIWORD(lp2
);
692 args
[0] = LOWORD(lp2
);
693 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
702 else ret
= ICERR_BADHANDLE
;
706 /***********************************************************************
707 * ICOpenFunction [MSVIDEO.206]
709 HIC16 VFWAPI
ICOpenFunction16(DWORD fccType
, DWORD fccHandler
, UINT16 wMode
, FARPROC16 lpfnHandler
)
713 hic32
= MSVIDEO_OpenFunction(fccType
, fccHandler
, wMode
,
714 (DRIVERPROC
)IC_Callback3216
, (DWORD
)lpfnHandler
);
715 return HIC_16(hic32
);
718 /***********************************************************************
719 * ICSendMessage [MSVIDEO.205]
721 LRESULT VFWAPI
ICSendMessage16(HIC16 hic
, UINT16 msg
, DWORD lParam1
, DWORD lParam2
)
723 LRESULT ret
= ICERR_BADHANDLE
;
726 whic
= MSVIDEO_GetHicPtr(HIC_32(hic
));
729 /* we've got a 16 bit driver proc... call it directly */
730 if (whic
->driverproc16
)
734 /* FIXME: original code was passing hdrv first and hic second */
735 /* but this doesn't match what IC_Callback3216 does */
736 args
[7] = HIWORD(hic
);
737 args
[6] = LOWORD(hic
);
738 args
[5] = HDRVR_16(whic
->hdrv
);
740 args
[3] = HIWORD(lParam1
);
741 args
[2] = LOWORD(lParam1
);
742 args
[1] = HIWORD(lParam2
);
743 args
[0] = LOWORD(lParam2
);
744 WOWCallback16Ex( (DWORD
)whic
->driverproc16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
748 /* map the message for a 32 bit infrastructure, and pass it along */
749 void* data16
= MSVIDEO_MapMsg16To32(msg
, &lParam1
, &lParam2
);
751 ret
= MSVIDEO_SendMessage(whic
, msg
, lParam1
, lParam2
);
753 MSVIDEO_UnmapMsg16To32(msg
, data16
, &lParam1
, &lParam2
);
759 /***********************************************************************
760 * VideoCapDriverDescAndVer [MSVIDEO.22]
762 DWORD WINAPI
VideoCapDriverDescAndVer16(WORD nr
, LPSTR buf1
, WORD buf1len
,
763 LPSTR buf2
, WORD buf2len
)
768 char *s
, buf
[2048], fn
[260];
771 DWORD i
, cnt
= 0, lRet
;
777 TRACE("(%d,%p,%d,%p,%d)\n", nr
, buf1
, buf1len
, buf2
, buf2len
);
778 lRet
= RegOpenKeyExA(HKEY_LOCAL_MACHINE
, HKLM_DRIVERS32
, 0, KEY_QUERY_VALUE
, &hKey
);
779 if (lRet
== ERROR_SUCCESS
)
781 RegQueryInfoKeyA( hKey
, 0, 0, 0, &cnt
, 0, 0, 0, 0, 0, 0, 0);
782 for (i
= 0; i
< cnt
; i
++)
784 bufLen
= sizeof(buf
) / sizeof(buf
[0]);
785 lRet
= RegEnumKeyExA(hKey
, i
, buf
, &bufLen
, 0, 0, 0, &lastWrite
);
786 if (lRet
!= ERROR_SUCCESS
) continue;
787 if (strncasecmp(buf
, "vid", 3)) continue;
790 lRet
= RegQueryValueExA(hKey
, buf
, 0, 0, (LPBYTE
)fn
, &fnLen
);
791 if (lRet
== ERROR_SUCCESS
) found
= TRUE
;
797 /* search system.ini if not found in the registry */
798 if (!found
&& GetPrivateProfileStringA("drivers32", NULL
, NULL
, buf
, sizeof(buf
), "system.ini"))
800 for (s
= buf
; *s
; s
+= strlen(s
) + 1)
802 if (strncasecmp(s
, "vid", 3)) continue;
804 if (GetPrivateProfileStringA("drivers32", s
, NULL
, fn
, sizeof(fn
), "system.ini"))
812 TRACE("No more VID* entries found nr=%d\n", nr
);
815 infosize
= GetFileVersionInfoSizeA(fn
, &verhandle
);
818 TRACE("%s has no fileversioninfo.\n", fn
);
821 infobuf
= HeapAlloc(GetProcessHeap(), 0, infosize
);
822 if (GetFileVersionInfoA(fn
, verhandle
, infosize
, infobuf
))
824 /* Yes, two space behind : */
825 /* FIXME: test for buflen */
826 snprintf(buf2
, buf2len
, "Version: %d.%d.%d.%d\n",
827 ((WORD
*)infobuf
)[0x0f],
828 ((WORD
*)infobuf
)[0x0e],
829 ((WORD
*)infobuf
)[0x11],
830 ((WORD
*)infobuf
)[0x10]
832 TRACE("version of %s is %s\n", fn
, buf2
);
836 TRACE("GetFileVersionInfoA failed for %s.\n", fn
);
837 lstrcpynA(buf2
, fn
, buf2len
); /* msvideo.dll appears to copy fn*/
839 /* FIXME: language problem? */
840 if (VerQueryValueA( infobuf
,
841 "\\StringFileInfo\\040904E4\\FileDescription",
846 UINT copylen
= min(subblocklen
,buf1len
-1);
847 memcpy(buf1
, subblock
, copylen
);
848 buf1
[copylen
] = '\0';
849 TRACE("VQA returned %s\n", (LPCSTR
)subblock
);
853 TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");
854 lstrcpynA(buf1
, fn
, buf1len
); /* msvideo.dll appears to copy fn*/
856 HeapFree(GetProcessHeap(), 0, infobuf
);
860 /******************************************************************
865 static LRESULT CALLBACK
IC_CallTo16(HDRVR hdrv
, HIC hic
, UINT msg
, LPARAM lp1
, LPARAM lp2
)
868 WINE_HIC
* whic
= IC_GetPtr(hic
);
872 if (whic
->driverproc
)
874 ret
= whic
->driverproc(hic
, whic
->hdrv
, msg
, lParam1
, lParam2
);
878 ret
= SendDriverMessage(whic
->hdrv
, msg
, lParam1
, lParam2
);
881 FIXME("No 32=>16 conversion yet\n");
886 /**************************************************************************
887 * DllEntryPoint (MSVIDEO.3)
889 * MSVIDEO DLL entry point
892 BOOL WINAPI
VIDEO_LibMain(DWORD fdwReason
, HINSTANCE hinstDLL
, WORD ds
,
893 WORD wHeapSize
, DWORD dwReserved1
, WORD wReserved2
)
897 case DLL_PROCESS_ATTACH
:
898 /* hook in our 16 bit management functions */
899 pFnCallTo16
= IC_CallTo16
;
901 case DLL_PROCESS_DETACH
:
902 /* remove our 16 bit management functions */
905 case DLL_THREAD_ATTACH
:
906 case DLL_THREAD_DETACH
: