splitting msvideo/msvfw32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this patch shall split the 16 bit code out of msvfw32
A+
Name:          vfw1632
ChangeLog:     split between 16 / 32 bit code
License:       X11
GenDate:       2002/10/30 20:08:12 UTC
ModifiedFiles: include/vfw.h dlls/msvideo/Makefile.in dlls/msvideo/drawdib.c dlls/msvideo/msvideo16.c dlls/msvideo/msvideo_main.c dlls/msvideo/msvideo.spec dlls/msvideo/vfw16.h
AddedFiles:    dlls/msvideo/msvideo_private.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/include/vfw.h,v
retrieving revision 1.30
diff -u -u -r1.30 vfw.h
--- include/vfw.h	21 Oct 2002 23:39:20 -0000	1.30
+++ include/vfw.h	29 Oct 2002 17:31:18 -0000
@@ -47,23 +47,6 @@
 
 DECLARE_HANDLE(HIC);
 
-#ifdef __WINE__
-/* HIC struct (same layout as Win95 one) */
-typedef struct tagWINE_HIC {
-	DWORD		magic;		/* 00: 'Smag' */
-	HANDLE		curthread;	/* 04: */
-	DWORD		type;		/* 08: */
-	DWORD		handler;	/* 0C: */
-	HDRVR		hdrv;		/* 10: */
-	DWORD		private;	/* 14:(handled by SendDriverMessage)*/
-	FARPROC		driverproc;	/* 18:(handled by SendDriverMessage)*/
-	DWORD		x1;		/* 1c: name? */
-	WORD		x2;		/* 20: */
-	DWORD		x3;		/* 22: */
-					/* 26: */
-} WINE_HIC;
-#endif
-
 /* error return codes */
 #define	ICERR_OK		0
 #define	ICERR_DONTDRAW		1
Index: dlls/msvideo/Makefile.in
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/Makefile.in,v
retrieving revision 1.22
diff -u -u -r1.22 Makefile.in
--- dlls/msvideo/Makefile.in	23 Oct 2002 23:33:21 -0000	1.22
+++ dlls/msvideo/Makefile.in	30 Oct 2002 17:58:12 -0000
@@ -17,7 +17,7 @@
 C_SRCS16 = \
 	msvideo16.c
 
-EXTRA_OBJS = $(MODULE).glue.o
+EXTRA_OBJS16 = $(MODULE).glue.o
 
 @MAKE_DLL_RULES@
 
Index: dlls/msvideo/drawdib.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/drawdib.c,v
retrieving revision 1.16
diff -u -u -r1.16 drawdib.c
--- dlls/msvideo/drawdib.c	23 Oct 2002 23:33:21 -0000	1.16
+++ dlls/msvideo/drawdib.c	29 Oct 2002 17:46:10 -0000
@@ -28,7 +28,7 @@
 #include "wine/winbase16.h"
 #include "wine/debug.h"
 #include "vfw.h"
-#include "vfw16.h"
+#include "msvideo_private.h"
 #include "windef.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
Index: dlls/msvideo/msvideo16.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/msvideo16.c,v
retrieving revision 1.4
diff -u -u -r1.4 msvideo16.c
--- dlls/msvideo/msvideo16.c	23 Oct 2002 23:33:21 -0000	1.4
+++ dlls/msvideo/msvideo16.c	30 Oct 2002 17:41:33 -0000
@@ -19,15 +19,24 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <stdio.h>
+#include <string.h>
+
 #include "winbase.h"
 #include "windef.h"
+#include "winver.h"
 #include "vfw.h"
 #include "vfw16.h"
+#include "msvideo_private.h"
 #include "stackframe.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
 
+/* ### start build ### */
+extern LONG CALLBACK MSVIDEO_CallTo16_long_lwwll(FARPROC16, LONG, WORD, WORD, LONG, LONG);
+/* ### stop build ### */
+
 /***********************************************************************
  *		DrawDibOpen		[MSVIDEO.102]
  */
@@ -156,7 +165,8 @@
 
     TRACE("0x%08lx, %u, %u, ...)\n", (DWORD) hic, msg, cb);
 
-    for (i = 0; i < cb / sizeof(WORD); i++) {
+    for (i = 0; i < cb / sizeof(WORD); i++) 
+    {
 	lpData[i] = VA_ARG16(valist, WORD);
     }
 
@@ -202,11 +212,10 @@
 			   DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev,
 			   LPVOID lpPrev)
 {
-
     DWORD ret;
     ICCOMPRESS iccmp;
     SEGPTR seg_iccmp;
-
+    
     TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n", (DWORD) hic, dwFlags,
 	  lpbiOutput, lpData, lpbiInput, lpBits);
 
@@ -341,4 +350,541 @@
 {
     return HIC_16(ICGetDisplayFormat(HIC_32(hic), lpbiIn, lpbiOut, depth,
 				     dx, dy));
+}
+
+#define COPY(x,y) (x->y = x##16->y);
+#define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y));
+
+/******************************************************************
+ *		MSVIDEO_MapICDEX16To32
+ *
+ *
+ */
+static LPVOID MSVIDEO_MapICDEX16To32(LPDWORD lParam) 
+{
+    LPVOID ret;
+
+    ICDECOMPRESSEX *icdx = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESSEX));
+    ICDECOMPRESSEX16 *icdx16 = MapSL(*lParam);
+    ret = icdx16;
+
+    COPY(icdx, dwFlags);
+    COPYPTR(icdx, lpbiSrc);
+    COPYPTR(icdx, lpSrc);
+    COPYPTR(icdx, lpbiDst);
+    COPYPTR(icdx, lpDst);
+    COPY(icdx, xDst);
+    COPY(icdx, yDst);
+    COPY(icdx, dxDst);
+    COPY(icdx, dyDst);
+    COPY(icdx, xSrc);
+    COPY(icdx, ySrc);
+    COPY(icdx, dxSrc);
+    COPY(icdx, dySrc);
+
+    *lParam = (DWORD)(icdx);
+    return ret;
+}
+
+/******************************************************************
+ *		MSVIDEO_MapMsg16To32
+ *
+ *
+ */
+static LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2)
+{
+    LPVOID ret = 0;
+
+    TRACE("Mapping %d\n", msg);
+
+    switch (msg) 
+    {
+    case DRV_LOAD:
+    case DRV_ENABLE:
+    case DRV_CLOSE:
+    case DRV_DISABLE:
+    case DRV_FREE:
+    case ICM_ABOUT:
+    case ICM_CONFIGURE:
+    case ICM_COMPRESS_END:
+    case ICM_DECOMPRESS_END:
+    case ICM_DECOMPRESSEX_END:
+    case ICM_SETQUALITY:
+    case ICM_DRAW_START_PLAY:
+    case ICM_DRAW_STOP_PLAY:
+    case ICM_DRAW_REALIZE:
+    case ICM_DRAW_RENDERBUFFER:
+    case ICM_DRAW_END:
+        break;
+    case DRV_OPEN:
+    case ICM_GETDEFAULTQUALITY:
+    case ICM_GETQUALITY:
+    case ICM_SETSTATE:
+    case ICM_DRAW_WINDOW:
+    case ICM_GETBUFFERSWANTED:
+        *lParam1 = (DWORD)MapSL(*lParam1);
+        break;
+    case ICM_GETINFO:
+        {
+            ICINFO *ici = HeapAlloc(GetProcessHeap(), 0, sizeof(ICINFO));
+            ICINFO16 *ici16;
+            
+            ici16 = MapSL(*lParam1);
+            ret = ici16;
+            
+            ici->dwSize = sizeof(ICINFO);
+            COPY(ici, fccType);
+            COPY(ici, fccHandler);
+            COPY(ici, dwFlags);
+            COPY(ici, dwVersion);
+            COPY(ici, dwVersionICM);
+            MultiByteToWideChar( CP_ACP, 0, ici16->szName, -1, ici->szName, 16 );
+            MultiByteToWideChar( CP_ACP, 0, ici16->szDescription, -1, ici->szDescription, 128 );
+            MultiByteToWideChar( CP_ACP, 0, ici16->szDriver, -1, ici->szDriver, 128 );
+            *lParam1 = (DWORD)(ici);
+            *lParam2 = sizeof(ICINFO);
+        }
+        break;
+    case ICM_COMPRESS:
+        {
+            ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(), 0, sizeof(ICCOMPRESS));
+            ICCOMPRESS *icc16;
+
+            icc16 = MapSL(*lParam1);
+            ret = icc16;
+
+            COPY(icc, dwFlags);
+            COPYPTR(icc, lpbiOutput);
+            COPYPTR(icc, lpOutput);
+            COPYPTR(icc, lpbiInput);
+            COPYPTR(icc, lpInput);
+            COPYPTR(icc, lpckid);
+            COPYPTR(icc, lpdwFlags);
+            COPY(icc, lFrameNum);
+            COPY(icc, dwFrameSize);
+            COPY(icc, dwQuality);
+            COPYPTR(icc, lpbiPrev);
+            COPYPTR(icc, lpPrev);
+
+            *lParam1 = (DWORD)(icc);
+            *lParam2 = sizeof(ICCOMPRESS);
+        }
+        break;
+    case ICM_DECOMPRESS:
+        {
+            ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDECOMPRESS));
+            ICDECOMPRESS *icd16; /* Same structure except for the pointers */
+
+            icd16 = MapSL(*lParam1);
+            ret = icd16;
+
+            COPY(icd, dwFlags);
+            COPYPTR(icd, lpbiInput);
+            COPYPTR(icd, lpInput);
+            COPYPTR(icd, lpbiOutput);
+            COPYPTR(icd, lpOutput);
+            COPY(icd, ckid);
+
+            *lParam1 = (DWORD)(icd);
+            *lParam2 = sizeof(ICDECOMPRESS);
+        }
+        break;
+    case ICM_COMPRESS_BEGIN:
+    case ICM_COMPRESS_GET_FORMAT:
+    case ICM_COMPRESS_GET_SIZE:
+    case ICM_COMPRESS_QUERY:
+    case ICM_DECOMPRESS_GET_FORMAT:
+    case ICM_DECOMPRESS_QUERY:
+    case ICM_DECOMPRESS_BEGIN:
+    case ICM_DECOMPRESS_SET_PALETTE:
+    case ICM_DECOMPRESS_GET_PALETTE:
+        *lParam1 = (DWORD)MapSL(*lParam1);
+        *lParam2 = (DWORD)MapSL(*lParam2);
+        break;
+    case ICM_DECOMPRESSEX_QUERY:
+        if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0))
+            WARN("*lParam2 has unknown value %p\n", (ICDECOMPRESSEX16*)*lParam2);
+        /* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)
+         * This is because of ICMessage(). Special case it?
+         {
+         LPVOID* addr = HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPVOID));
+         addr[0] = MSVIDEO_MapICDEX16To32(lParam1);
+         if (*lParam2)
+         addr[1] = MSVIDEO_MapICDEX16To32(lParam2);
+         else
+         addr[1] = 0;
+         
+         ret = addr;
+         }
+         break;*/
+    case ICM_DECOMPRESSEX_BEGIN:
+    case ICM_DECOMPRESSEX:
+        ret = MSVIDEO_MapICDEX16To32(lParam1);
+        *lParam2 = sizeof(ICDECOMPRESSEX);
+        break;
+    case ICM_DRAW_BEGIN:
+        {
+            ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWBEGIN));
+            ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1);
+            ret = icdb16;
+
+            COPY(icdb, dwFlags);
+            icdb->hpal = HPALETTE_32(icdb16->hpal);
+            icdb->hwnd = HWND_32(icdb16->hwnd);
+            icdb->hdc = HDC_32(icdb16->hdc);
+            COPY(icdb, xDst);
+            COPY(icdb, yDst);
+            COPY(icdb, dxDst);
+            COPY(icdb, dyDst);
+            COPYPTR(icdb, lpbi);
+            COPY(icdb, xSrc);
+            COPY(icdb, ySrc);
+            COPY(icdb, dxSrc);
+            COPY(icdb, dySrc);
+            COPY(icdb, dwRate);
+            COPY(icdb, dwScale);
+
+            *lParam1 = (DWORD)(icdb);
+            *lParam2 = sizeof(ICDRAWBEGIN);
+        }
+        break;
+    case ICM_DRAW_SUGGESTFORMAT:
+        {
+            ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAWSUGGEST));
+            ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1);
+
+            ret = icds16;
+
+            COPY(icds, dwFlags);
+            COPYPTR(icds, lpbiIn);
+            COPYPTR(icds, lpbiSuggest);
+            COPY(icds, dxSrc);
+            COPY(icds, dySrc);
+            COPY(icds, dxDst);
+            COPY(icds, dyDst);
+            icds->hicDecompressor = HIC_32(icds16->hicDecompressor);
+
+            *lParam1 = (DWORD)(icds);
+            *lParam2 = sizeof(ICDRAWSUGGEST);
+        }
+        break;
+    case ICM_DRAW:
+        {
+            ICDRAW *icd = HeapAlloc(GetProcessHeap(), 0, sizeof(ICDRAW));
+            ICDRAW *icd16 = MapSL(*lParam1);
+            ret = icd16;
+
+            COPY(icd, dwFlags);
+            COPYPTR(icd, lpFormat);
+            COPYPTR(icd, lpData);
+            COPY(icd, cbData);
+            COPY(icd, lTime);
+
+            *lParam1 = (DWORD)(icd);
+            *lParam2 = sizeof(ICDRAW);
+        }
+        break;
+    case ICM_DRAW_START:
+    case ICM_DRAW_STOP:
+        break;
+    default:
+        FIXME("%d is not yet handled. Expect a crash.\n", msg);
+    }
+    return ret;
+}
+
+#undef COPY
+#undef COPYPTR
+
+/******************************************************************
+ *		MSVIDEO_UnmapMsg16To32
+ *
+ *
+ */
+static void MSVIDEO_UnmapMsg16To32(UINT msg, LPVOID data16, LPDWORD lParam1, LPDWORD lParam2)
+{
+    TRACE("Unmapping %d\n", msg);
+
+#define UNCOPY(x, y) (x##16->y = x->y);
+
+    switch (msg) 
+    {
+    case ICM_GETINFO:
+        {
+            ICINFO *ici = (ICINFO*)(*lParam1);
+            ICINFO16 *ici16 = (ICINFO16*)data16;
+
+            UNCOPY(ici, fccType);
+            UNCOPY(ici, fccHandler);
+            UNCOPY(ici, dwFlags);
+            UNCOPY(ici, dwVersion);
+            UNCOPY(ici, dwVersionICM);
+            WideCharToMultiByte( CP_ACP, 0, ici->szName, -1, ici16->szName, 
+                                 sizeof(ici16->szName), NULL, NULL );
+            ici16->szName[sizeof(ici16->szName)-1] = 0;
+            WideCharToMultiByte( CP_ACP, 0, ici->szDescription, -1, ici16->szDescription, 
+                                 sizeof(ici16->szDescription), NULL, NULL );
+            ici16->szDescription[sizeof(ici16->szDescription)-1] = 0;
+            /* This just gives garbage for some reason - BB
+               lstrcpynWtoA(ici16->szDriver, ici->szDriver, 128);*/
+
+            HeapFree(GetProcessHeap(), 0, ici);
+        }
+        break;
+    case ICM_DECOMPRESS_QUERY:
+        /*{
+          LPVOID* x = data16;
+          HeapFree(GetProcessHeap(), 0, x[0]);
+          if (x[1])
+          HeapFree(GetProcessHeap(), 0, x[1]);
+          }
+          break;*/
+    case ICM_COMPRESS:
+    case ICM_DECOMPRESS:
+    case ICM_DECOMPRESSEX_QUERY:
+    case ICM_DECOMPRESSEX_BEGIN:
+    case ICM_DECOMPRESSEX:
+    case ICM_DRAW_BEGIN:
+    case ICM_DRAW_SUGGESTFORMAT:
+    case ICM_DRAW:
+        HeapFree(GetProcessHeap(), 0, data16);
+        break;
+    default:
+        ERR("Unmapping unmapped msg %d\n", msg);
+    }
+#undef UNCOPY
+}
+
+/***********************************************************************
+ *		ICInfo				[MSVIDEO.200]
+ */
+BOOL16 VFWAPI ICInfo16(DWORD fccType, DWORD fccHandler, ICINFO16 *lpicinfo)
+{
+    BOOL16 ret;
+    LPVOID lpv;
+    DWORD lParam = (DWORD)lpicinfo;
+    DWORD size = ((ICINFO*)(MapSL((SEGPTR)lpicinfo)))->dwSize;
+    
+    /* Use the mapping functions to map the ICINFO structure */
+    lpv = MSVIDEO_MapMsg16To32(ICM_GETINFO, &lParam, &size);
+
+    ret = ICInfo(fccType, fccHandler, (ICINFO*)lParam);
+
+    MSVIDEO_UnmapMsg16To32(ICM_GETINFO, lpv, &lParam, &size);
+
+    return ret;
+}
+
+/******************************************************************
+ *		IC_Callback3216
+ *
+ *
+ */
+static  LRESULT CALLBACK  IC_Callback3216(HIC hic, HDRVR hdrv, UINT msg, DWORD lp1, DWORD lp2)
+{
+    WINE_HIC*   whic;
+    LRESULT     ret = 0;
+
+    whic = GlobalLock16(HIC_16(hic));
+    if (whic)
+    {
+        switch (msg)
+        {
+        case DRV_OPEN:
+            lp2 = (DWORD)MapLS((void*)lp2);
+            break;
+        }
+
+        ret = MSVIDEO_CallTo16_long_lwwll((FARPROC16)whic->driverproc16, 
+                                          HIC_16(hic), HDRVR_16(whic->hdrv), msg, lp1, lp2);
+        switch (msg)
+        {
+        case DRV_OPEN:
+            UnMapLS(lp2);
+            break;
+        }
+        GlobalUnlock16(HIC_16(hic));
+    }
+    else ret = MMSYSERR_ERROR;
+    return ret;
+}
+
+/***********************************************************************
+ *		ICOpenFunction			[MSVIDEO.206]
+ */
+HIC16 VFWAPI ICOpenFunction16(DWORD fccType, DWORD fccHandler, UINT16 wMode, FARPROC16 lpfnHandler)
+{
+    HIC         hic32;
+
+    hic32 = MSVIDEO_OpenFunction(fccType, fccHandler, wMode, 
+                                 (DRIVERPROC)IC_Callback3216, (DRIVERPROC16)lpfnHandler);
+    return HIC_16(hic32);
+}
+
+/***********************************************************************
+ *		ICSendMessage			[MSVIDEO.205]
+ */
+LRESULT VFWAPI ICSendMessage16(HIC16 hic, UINT16 msg, DWORD lParam1, DWORD lParam2) 
+{
+    LRESULT     ret = MMSYSERR_ERROR;
+    WINE_HIC*   whic;
+
+    whic = GlobalLock16(hic);
+    if (whic)
+    {
+        /* we've got a 16 bit driver proc... call it directly */
+        if (whic->driverproc16)
+        {
+            ret = MSVIDEO_CallTo16_long_lwwll((FARPROC16)whic->driverproc16, 
+                                              (LONG)whic->hdrv, HIC_16(hic), msg, lParam1, lParam2);
+        }
+        else
+        {
+            /* map the message for a 32 bit infrastructure, and pass it along */
+            void*       data16 = MSVIDEO_MapMsg16To32(msg, &lParam1, &lParam2);
+    
+            ret = MSVIDEO_SendMessage(HIC_32(hic), msg, lParam1, lParam2);
+            if (data16)
+                MSVIDEO_UnmapMsg16To32(msg, data16, &lParam1, &lParam2);
+        }
+        GlobalUnlock16(hic);
+    }
+    return ret;
+}
+
+/***********************************************************************
+ *		VideoCapDriverDescAndVer	[MSVIDEO.22]
+ */
+DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len,
+                                        LPSTR buf2, WORD buf2len)
+{
+    DWORD	verhandle;
+    WORD	xnr = nr;
+    DWORD	infosize;
+    UINT	subblocklen;
+    char	*s,  buf[2000],  fn[260];
+    LPBYTE	infobuf;
+    LPVOID	subblock;
+
+    TRACE("(%d,%p,%d,%p,%d)\n", nr, buf1, buf1len, buf2, buf2len);
+    if (GetPrivateProfileStringA("drivers32", NULL, NULL, buf, sizeof(buf), "system.ini")) 
+    {
+        s = buf;
+        while (*s) 
+        {
+            if (!strncasecmp(s, "vid", 3)) 
+            {
+                if (!xnr) break;
+                xnr--;
+            }
+            s = s + strlen(s) + 1; /* either next char or \0 */
+        }
+    }
+    else
+        return 20; /* hmm, out of entries even if we don't have any */
+    if (xnr) 
+    {
+        FIXME("No more VID* entries found\n");
+        return 20;
+    }
+    GetPrivateProfileStringA("drivers32", s, NULL, fn, sizeof(fn), "system.ini");
+    infosize = GetFileVersionInfoSizeA(fn, &verhandle);
+    if (!infosize) 
+    {
+        TRACE("%s has no fileversioninfo.\n", fn);
+        return 18;
+    }
+    infobuf = HeapAlloc(GetProcessHeap(), 0, infosize);
+    if (GetFileVersionInfoA(fn, verhandle, infosize, infobuf)) 
+    {
+        char	vbuf[200];
+        /* Yes, two space behind : */
+        /* FIXME: test for buflen */
+        sprintf(vbuf, "Version:  %d.%d.%d.%d\n", 
+                ((WORD*)infobuf)[0x0f],
+                ((WORD*)infobuf)[0x0e],
+                ((WORD*)infobuf)[0x11],
+                ((WORD*)infobuf)[0x10]
+	    );
+        TRACE("version of %s is %s\n", fn, vbuf);
+        strncpy(buf2, vbuf, buf2len);
+    }
+    else 
+    {
+        TRACE("GetFileVersionInfoA failed for %s.\n", fn);
+        strncpy(buf2, fn, buf2len); /* msvideo.dll appears to copy fn*/
+    }
+    /* FIXME: language problem? */
+    if (VerQueryValueA(	infobuf,
+                        "\\StringFileInfo\\040904E4\\FileDescription",
+                        &subblock,
+                        &subblocklen
+            )) 
+    {
+        TRACE("VQA returned %s\n", (LPCSTR)subblock);
+        strncpy(buf1, subblock, buf1len);
+    }
+    else 
+    {
+        TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");
+        strncpy(buf1, fn, buf1len); /* msvideo.dll appears to copy fn*/
+    }
+    HeapFree(GetProcessHeap(), 0, infobuf);
+    return 0;
+}
+
+/******************************************************************
+ *		IC_CallTo16
+ *
+ *
+ */
+static  LRESULT CALLBACK IC_CallTo16(HDRVR hdrv, HIC hic, UINT msg, LPARAM lp1, LPARAM lp2)
+{
+#if 0
+    WINE_HIC*   whic = GlobalLock16(HIC_16(hic));
+    LRESULT     ret = 0;
+    
+    
+    if (whic->driverproc) 
+    {
+        ret = whic->driverproc(hic, whic->hdrv, msg, lParam1, lParam2);
+    }
+    else
+    {
+        ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
+    }
+#else
+    FIXME("No 32=>16 conversion yet\n");
+#endif
+    return 0;
+}
+
+/**************************************************************************
+ *                      DllEntryPoint (MSVIDEO.2046)
+ *
+ * MSVIDEO DLL entry point
+ *
+ */
+BOOL WINAPI VIDEO_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
+                          WORD wHeapSize, DWORD dwReserved1, WORD wReserved2)
+{
+    switch (fdwReason) 
+    {
+    case DLL_PROCESS_ATTACH:
+        if (!GetModuleHandleA("MSVFW32.DLL") && !LoadLibraryA("MSVFW32.DLL"))
+        {
+            ERR("Could not load sibling MSVfW32.dll\n");
+            return FALSE;
+        }
+        /* hook in our 16 bit management functions */
+        pFnCallTo16 = IC_CallTo16;
+        break;
+    case DLL_PROCESS_DETACH:
+        /* remove our 16 bit management functions */
+        break;
+    case DLL_THREAD_ATTACH:
+    case DLL_THREAD_DETACH:
+        break;
+    }
+    return TRUE;
 }
Index: dlls/msvideo/msvideo_main.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/msvideo_main.c,v
retrieving revision 1.40
diff -u -u -r1.40 msvideo_main.c
--- dlls/msvideo/msvideo_main.c	23 Oct 2002 23:33:21 -0000	1.40
+++ dlls/msvideo/msvideo_main.c	30 Oct 2002 17:40:06 -0000
@@ -26,28 +26,16 @@
 
 #include "winbase.h"
 #include "windef.h"
-#include "winnls.h"
 #include "wingdi.h"
 #include "winuser.h"
-#include "winver.h"
 #include "vfw.h"
-#include "vfw16.h"
 #include "wine/winbase16.h"
 #include "wine/debug.h"
-#include "stackframe.h"
+#include "msvideo_private.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
 
-/* ### start build ### */
-extern LONG CALLBACK MSVIDEO_CallTo16_long_lwwll(FARPROC16,LONG,WORD,WORD,LONG,LONG);
-/* ### stop build ### */
-
-LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2);
-void MSVIDEO_UnmapMsg16To32(UINT msg, LPVOID lpv, LPDWORD lParam1, LPDWORD lParam2);
-LRESULT MSVIDEO_SendMessage(HIC hic, UINT msg, DWORD lParam1, DWORD lParam2, BOOL bFrom32);
-
-#define HDRVR_16(h32)		(LOWORD(h32))
-
+LRESULT  (CALLBACK *pFnCallTo16)(HDRVR, HIC, UINT, LPARAM, LPARAM) /* = NULL */;
 
 /***********************************************************************
  *		VideoForWindowsVersion		[MSVFW32.2]
@@ -55,78 +43,9 @@
  * Returns the version in major.minor form.
  * In Windows95 this returns 0x040003b6 (4.950)
  */
-DWORD WINAPI VideoForWindowsVersion(void) {
-	return 0x040003B6; /* 4.950 */
-}
-
-/***********************************************************************
- *		VideoCapDriverDescAndVer	[MSVIDEO.22]
- */
-DWORD WINAPI VideoCapDriverDescAndVer(
-	WORD nr,LPSTR buf1,WORD buf1len,LPSTR buf2,WORD buf2len
-) {
-	DWORD	verhandle;
-	WORD	xnr = nr;
-	DWORD	infosize;
-	UINT	subblocklen;
-	char	*s,buf[2000],fn[260];
-	LPBYTE	infobuf;
-	LPVOID	subblock;
-
-	TRACE("(%d,%p,%d,%p,%d)\n",nr,buf1,buf1len,buf2,buf2len);
-	if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,sizeof(buf),"system.ini")) {
-		s = buf;
-		while (*s) {
-		        if (!strncasecmp(s,"vid",3)) {
-			    if (!xnr)
-				break;
-			    xnr--;
-			}
-			s=s+strlen(s)+1; /* either next char or \0 */
-		}
-	} else
-	    return 20; /* hmm, out of entries even if we don't have any */
-	if (xnr) {
-		FIXME("No more VID* entries found\n");
-		return 20;
-	}
-	GetPrivateProfileStringA("drivers32",s,NULL,fn,sizeof(fn),"system.ini");
-	infosize = GetFileVersionInfoSizeA(fn,&verhandle);
-	if (!infosize) {
-	    TRACE("%s has no fileversioninfo.\n",fn);
-	    return 18;
-	}
-	infobuf = HeapAlloc(GetProcessHeap(),0,infosize);
-	if (GetFileVersionInfoA(fn,verhandle,infosize,infobuf)) {
-	    char	vbuf[200];
-	    /* Yes, two space behind : */
-	    /* FIXME: test for buflen */
-	    sprintf(vbuf,"Version:  %d.%d.%d.%d\n",
-		    ((WORD*)infobuf)[0x0f],
-		    ((WORD*)infobuf)[0x0e],
-		    ((WORD*)infobuf)[0x11],
-		    ((WORD*)infobuf)[0x10]
-	    );
-	    TRACE("version of %s is %s\n",fn,vbuf);
-	    strncpy(buf2,vbuf,buf2len);
-	} else {
-	    TRACE("GetFileVersionInfoA failed for %s.\n",fn);
-	    strncpy(buf2,fn,buf2len); /* msvideo.dll appears to copy fn*/
-	}
-	/* FIXME: language problem? */
-	if (VerQueryValueA(	infobuf,
-				"\\StringFileInfo\\040904E4\\FileDescription",
-				&subblock,
-				&subblocklen
-	)) {
-	    TRACE("VQA returned %s\n",(LPCSTR)subblock);
-	    strncpy(buf1,subblock,buf1len);
-	} else {
-	    TRACE("VQA did not return on query \\StringFileInfo\\040904E4\\FileDescription?\n");
-	    strncpy(buf1,fn,buf1len); /* msvideo.dll appears to copy fn*/
-	}
-	HeapFree(GetProcessHeap(),0,infobuf);
-	return 0;
+DWORD WINAPI VideoForWindowsVersion(void) 
+{
+    return 0x040003B6; /* 4.950 */
 }
 
 /* system.ini: [drivers] */
@@ -165,29 +84,6 @@
 }
 
 /***********************************************************************
- *		ICInfo				[MSVIDEO.200]
- */
-BOOL16 VFWAPI ICInfo16(
-	DWORD     fccType,    /* [in] */
-	DWORD     fccHandler, /* [in] */
-	ICINFO16 *lpicinfo)   /* [in/out] NOTE: SEGPTR */
-{
-	BOOL16 ret;
-	LPVOID lpv;
-	DWORD lParam = (DWORD)lpicinfo;
-	DWORD size = ((ICINFO*)(MapSL((SEGPTR)lpicinfo)))->dwSize;
-
-	/* Use the mapping functions to map the ICINFO structure */
-	lpv = MSVIDEO_MapMsg16To32(ICM_GETINFO,&lParam,&size);
-
-	ret = ICInfo(fccType,fccHandler,(ICINFO*)lParam);
-
-	MSVIDEO_UnmapMsg16To32(ICM_GETINFO,lpv,&lParam,&size);
-
-	return ret;
-}
-
-/***********************************************************************
  *		ICOpen				[MSVFW32.@]
  * Opens an installable compressor. Return special handle.
  */
@@ -197,6 +93,7 @@
 	HDRVR		hdrv;
 	HIC		hic;
 	WINE_HIC	*whic;
+        BOOL            bIs16;
 
 	memcpy(type,&fccType,4);type[4]=0;
 	memcpy(handler,&fccHandler,4);handler[4]=0;
@@ -207,11 +104,16 @@
 	/* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
 	 * same layout as ICOPEN
 	 */
+	icopen.dwSize		= sizeof(ICOPEN);
 	icopen.fccType		= fccType;
 	icopen.fccHandler	= fccHandler;
-	icopen.dwSize		= sizeof(ICOPEN);
+        icopen.dwVersion        = 0x00001000; /* FIXME */
 	icopen.dwFlags		= wMode;
-	/* FIXME: do we need to fill out the rest too? */
+        icopen.dwError          = 0;
+        icopen.pV1Reserved      = NULL;
+        icopen.pV2Reserved      = NULL;
+        icopen.dnDevNode        = 0; /* FIXME */
+        
 	hdrv=OpenDriverA(codecname,"drivers32",(LPARAM)&icopen);
 	if (!hdrv) {
 	    if (!strcasecmp(type,"vids")) {
@@ -222,27 +124,40 @@
 	    if (!hdrv)
 		    return 0;
 	}
+        bIs16 = GetDriverFlags(hdrv) & WINE_GDF_16BIT;
+
+        if (bIs16 && !pFnCallTo16)
+        {
+            FIXME("Got a 16 bit driver, but no 16 bit support in msvfw\n");
+            return 0;
+        }
 	/* The handle should be a valid 16-bit handle as well */
 	hic = HIC_32(GlobalAlloc16(GHND,sizeof(WINE_HIC)));
 	whic = (WINE_HIC*)GlobalLock16(HIC_16(hic));
-	whic->hdrv	= hdrv;
-	whic->driverproc= NULL;
-	whic->private	= 0;
+	whic->hdrv	   = hdrv;
+        /* FIXME: is the signature the real one ? */
+	whic->driverproc   = bIs16 ? (DRIVERPROC)pFnCallTo16 : NULL;
+        whic->driverproc16 = NULL;
+
 	GlobalUnlock16(HIC_16(hic));
 	TRACE("=> %p\n",hic);
 	return HIC_32(hic);
 }
 
-HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler, BOOL bFrom32) {
+/***********************************************************************
+ *		MSVIDEO_OpenFunction
+ */
+HIC MSVIDEO_OpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, 
+                         DRIVERPROC lpfnHandler, DRIVERPROC16 lpfnHandler16) 
+{
 	char	type[5],handler[5],codecname[20];
 	HIC	hic;
         ICOPEN icopen;
-        SEGPTR seg_icopen;
 	WINE_HIC	*whic;
 
 	memcpy(type,&fccType,4);type[4]=0;
 	memcpy(handler,&fccHandler,4);handler[4]=0;
-	TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16);
+	TRACE("(%s,%s,%d,%p,%p)\n",type,handler,wMode,lpfnHandler,lpfnHandler16);
 
         icopen.fccType    = fccType;
         icopen.fccHandler = fccHandler;
@@ -255,24 +170,22 @@
 	if (!hic)
 		return 0;
 	whic = GlobalLock16(HIC_16(hic));
-	whic->driverproc = lpfnHandler;
-
-	whic->private = bFrom32;
+	whic->driverproc   = lpfnHandler;
+	whic->driverproc16 = lpfnHandler16;
 
 	/* Now try opening/loading the driver. Taken from DRIVER_AddToList */
 	/* What if the function is used more than once? */
 
-	if (MSVIDEO_SendMessage(hic,DRV_LOAD,0L,0L,bFrom32) != DRV_SUCCESS) {
+	if (MSVIDEO_SendMessage(hic,DRV_LOAD,0L,0L) != DRV_SUCCESS) {
 		WARN("DRV_LOAD failed for hic %p\n", hic);
 		GlobalFree16(HIC_16(hic));
 		return 0;
 	}
 	/* return value is not checked */
-	MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L,bFrom32);
+	MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L);
+
+        whic->hdrv = (HDRVR)MSVIDEO_SendMessage(hic,DRV_OPEN,0,(DWORD)&icopen);
 
-        seg_icopen = MapLS( &icopen );
-        whic->hdrv = (HDRVR)MSVIDEO_SendMessage(hic,DRV_OPEN,0,seg_icopen,FALSE);
-        UnMapLS( seg_icopen );
 	if (whic->hdrv == 0) {
 		WARN("DRV_OPEN failed for hic %p\n",hic);
 		GlobalFree16(HIC_16(hic));
@@ -287,16 +200,9 @@
 /***********************************************************************
  *		ICOpenFunction			[MSVFW32.@]
  */
-HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler) {
-	return MSVIDEO_OpenFunc(fccType,fccHandler,wMode,lpfnHandler,TRUE);
-}
-
-/***********************************************************************
- *		ICOpenFunction			[MSVIDEO.206]
- */
-HIC16 VFWAPI ICOpenFunction16(DWORD fccType, DWORD fccHandler, UINT16 wMode, FARPROC16 lpfnHandler)
+HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler) 
 {
-	return HIC_16(MSVIDEO_OpenFunc(fccType, fccHandler, wMode, (FARPROC)lpfnHandler,FALSE));
+    return MSVIDEO_OpenFunction(fccType, fccHandler, wMode, (DRIVERPROC)lpfnHandler, NULL);
 }
 
 /***********************************************************************
@@ -508,412 +414,101 @@
 	return ret;
 }
 
-#define COPY(x,y) (x->y = x##16->y);
-#define COPYPTR(x,y) (x->y = MapSL((SEGPTR)x##16->y));
-
-LPVOID MSVIDEO_MapICDEX16To32(LPDWORD lParam) {
-	LPVOID ret;
-
-	ICDECOMPRESSEX *icdx = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESSEX));
-	ICDECOMPRESSEX16 *icdx16 = MapSL(*lParam);
-	ret = icdx16;
-
-	COPY(icdx,dwFlags);
-	COPYPTR(icdx,lpbiSrc);
-	COPYPTR(icdx,lpSrc);
-	COPYPTR(icdx,lpbiDst);
-	COPYPTR(icdx,lpDst);
-	COPY(icdx,xDst);
-	COPY(icdx,yDst);
-	COPY(icdx,dxDst);
-	COPY(icdx,dyDst);
-	COPY(icdx,xSrc);
-	COPY(icdx,ySrc);
-	COPY(icdx,dxSrc);
-	COPY(icdx,dySrc);
-
-	*lParam = (DWORD)(icdx);
-	return ret;
-}
-
-LPVOID MSVIDEO_MapMsg16To32(UINT msg, LPDWORD lParam1, LPDWORD lParam2) {
-	LPVOID ret = 0;
-
-	TRACE("Mapping %d\n",msg);
-
-	switch (msg) {
-	case DRV_LOAD:
-	case DRV_ENABLE:
-	case DRV_CLOSE:
-	case DRV_DISABLE:
-	case DRV_FREE:
-	case ICM_ABOUT:
-	case ICM_CONFIGURE:
-	case ICM_COMPRESS_END:
-	case ICM_DECOMPRESS_END:
-	case ICM_DECOMPRESSEX_END:
-	case ICM_SETQUALITY:
-	case ICM_DRAW_START_PLAY:
-	case ICM_DRAW_STOP_PLAY:
-	case ICM_DRAW_REALIZE:
-	case ICM_DRAW_RENDERBUFFER:
-	case ICM_DRAW_END:
-		break;
-	case DRV_OPEN:
-	case ICM_GETDEFAULTQUALITY:
-	case ICM_GETQUALITY:
-	case ICM_SETSTATE:
-	case ICM_DRAW_WINDOW:
-	case ICM_GETBUFFERSWANTED:
-		*lParam1 = (DWORD)MapSL(*lParam1);
-		break;
-	case ICM_GETINFO:
-		{
-			ICINFO *ici = HeapAlloc(GetProcessHeap(),0,sizeof(ICINFO));
-			ICINFO16 *ici16;
-
-			ici16 = MapSL(*lParam1);
-			ret = ici16;
-
-			ici->dwSize = sizeof(ICINFO);
-			COPY(ici,fccType);
-			COPY(ici,fccHandler);
-			COPY(ici,dwFlags);
-			COPY(ici,dwVersion);
-			COPY(ici,dwVersionICM);
-                        MultiByteToWideChar( CP_ACP, 0, ici16->szName, -1, ici->szName, 16 );
-                        MultiByteToWideChar( CP_ACP, 0, ici16->szDescription, -1, ici->szDescription, 128 );
-                        MultiByteToWideChar( CP_ACP, 0, ici16->szDriver, -1, ici->szDriver, 128 );
-			*lParam1 = (DWORD)(ici);
-			*lParam2 = sizeof(ICINFO);
-		}
-		break;
-	case ICM_COMPRESS:
-		{
-			ICCOMPRESS *icc = HeapAlloc(GetProcessHeap(),0,sizeof(ICCOMPRESS));
-			ICCOMPRESS *icc16;
-
-			icc16 = MapSL(*lParam1);
-			ret = icc16;
-
-			COPY(icc,dwFlags);
-			COPYPTR(icc,lpbiOutput);
-			COPYPTR(icc,lpOutput);
-			COPYPTR(icc,lpbiInput);
-			COPYPTR(icc,lpInput);
-			COPYPTR(icc,lpckid);
-			COPYPTR(icc,lpdwFlags);
-			COPY(icc,lFrameNum);
-			COPY(icc,dwFrameSize);
-			COPY(icc,dwQuality);
-			COPYPTR(icc,lpbiPrev);
-			COPYPTR(icc,lpPrev);
-
-			*lParam1 = (DWORD)(icc);
-			*lParam2 = sizeof(ICCOMPRESS);
-		}
-		break;
-	case ICM_DECOMPRESS:
-		{
-			ICDECOMPRESS *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDECOMPRESS));
-			ICDECOMPRESS *icd16; /* Same structure except for the pointers */
-
-			icd16 = MapSL(*lParam1);
-			ret = icd16;
-
-			COPY(icd,dwFlags);
-			COPYPTR(icd,lpbiInput);
-			COPYPTR(icd,lpInput);
-			COPYPTR(icd,lpbiOutput);
-			COPYPTR(icd,lpOutput);
-			COPY(icd,ckid);
-
-			*lParam1 = (DWORD)(icd);
-			*lParam2 = sizeof(ICDECOMPRESS);
-		}
-		break;
-	case ICM_COMPRESS_BEGIN:
-	case ICM_COMPRESS_GET_FORMAT:
-	case ICM_COMPRESS_GET_SIZE:
-	case ICM_COMPRESS_QUERY:
-	case ICM_DECOMPRESS_GET_FORMAT:
-	case ICM_DECOMPRESS_QUERY:
-	case ICM_DECOMPRESS_BEGIN:
-	case ICM_DECOMPRESS_SET_PALETTE:
-	case ICM_DECOMPRESS_GET_PALETTE:
-		*lParam1 = (DWORD)MapSL(*lParam1);
-		*lParam2 = (DWORD)MapSL(*lParam2);
-		break;
-	case ICM_DECOMPRESSEX_QUERY:
-		if ((*lParam2 != sizeof(ICDECOMPRESSEX16)) && (*lParam2 != 0))
-			WARN("*lParam2 has unknown value %p\n",(ICDECOMPRESSEX16*)*lParam2);
-		/* FIXME: *lParm2 is meant to be 0 or an ICDECOMPRESSEX16*, but is sizeof(ICDECOMRPESSEX16)
-		 * This is because of ICMessage(). Special case it?
-		 {
-		 LPVOID* addr = HeapAlloc(GetProcessHeap(),0,2*sizeof(LPVOID));
-		 addr[0] = MSVIDEO_MapICDEX16To32(lParam1);
-		 if (*lParam2)
-		 addr[1] = MSVIDEO_MapICDEX16To32(lParam2);
-		 else
-		 addr[1] = 0;
-
-		 ret = addr;
-		 }
-		 break;*/
-	case ICM_DECOMPRESSEX_BEGIN:
-	case ICM_DECOMPRESSEX:
-		ret = MSVIDEO_MapICDEX16To32(lParam1);
-		*lParam2 = sizeof(ICDECOMPRESSEX);
-		break;
-	case ICM_DRAW_BEGIN:
-		{
-			ICDRAWBEGIN *icdb = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWBEGIN));
-			ICDRAWBEGIN16 *icdb16 = MapSL(*lParam1);
-			ret = icdb16;
-
-			COPY(icdb,dwFlags);
-			icdb->hpal = HPALETTE_32(icdb16->hpal);
-			icdb->hwnd = HWND_32(icdb16->hwnd);
-			icdb->hdc = HDC_32(icdb16->hdc);
-			COPY(icdb,xDst);
-			COPY(icdb,yDst);
-			COPY(icdb,dxDst);
-			COPY(icdb,dyDst);
-			COPYPTR(icdb,lpbi);
-			COPY(icdb,xSrc);
-			COPY(icdb,ySrc);
-			COPY(icdb,dxSrc);
-			COPY(icdb,dySrc);
-			COPY(icdb,dwRate);
-			COPY(icdb,dwScale);
-
-			*lParam1 = (DWORD)(icdb);
-			*lParam2 = sizeof(ICDRAWBEGIN);
-		}
-		break;
-	case ICM_DRAW_SUGGESTFORMAT:
-		{
-			ICDRAWSUGGEST *icds = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAWSUGGEST));
-			ICDRAWSUGGEST16 *icds16 = MapSL(*lParam1);
-
-			ret = icds16;
-
-			COPY(icds,dwFlags);
-			COPYPTR(icds,lpbiIn);
-			COPYPTR(icds,lpbiSuggest);
-			COPY(icds,dxSrc);
-			COPY(icds,dySrc);
-			COPY(icds,dxDst);
-			COPY(icds,dyDst);
-			icds->hicDecompressor = HIC_32(icds16->hicDecompressor);
-
-			*lParam1 = (DWORD)(icds);
-			*lParam2 = sizeof(ICDRAWSUGGEST);
-		}
-		break;
-	case ICM_DRAW:
-		{
-			ICDRAW *icd = HeapAlloc(GetProcessHeap(),0,sizeof(ICDRAW));
-			ICDRAW *icd16 = MapSL(*lParam1);
-			ret = icd16;
-
-			COPY(icd,dwFlags);
-			COPYPTR(icd,lpFormat);
-			COPYPTR(icd,lpData);
-			COPY(icd,cbData);
-			COPY(icd,lTime);
-
-			*lParam1 = (DWORD)(icd);
-			*lParam2 = sizeof(ICDRAW);
-		}
-		break;
-	case ICM_DRAW_START:
-	case ICM_DRAW_STOP:
-		break;
-	default:
-		FIXME("%d is not yet handled. Expect a crash.\n",msg);
-	}
-	return ret;
-}
-
-#undef COPY
-#undef COPYPTR
-
-void MSVIDEO_UnmapMsg16To32(UINT msg, LPVOID data16, LPDWORD lParam1, LPDWORD lParam2) {
-	TRACE("Unmapping %d\n",msg);
-
-#define UNCOPY(x,y) (x##16->y = x->y);
-
-	switch (msg) {
-	case ICM_GETINFO:
-		{
-			ICINFO *ici = (ICINFO*)(*lParam1);
-			ICINFO16 *ici16 = (ICINFO16*)data16;
-
-			UNCOPY(ici,fccType);
-			UNCOPY(ici,fccHandler);
-			UNCOPY(ici,dwFlags);
-			UNCOPY(ici,dwVersion);
-			UNCOPY(ici,dwVersionICM);
-                        WideCharToMultiByte( CP_ACP, 0, ici->szName, -1, ici16->szName,
-                                             sizeof(ici16->szName), NULL, NULL );
-                        ici16->szName[sizeof(ici16->szName)-1] = 0;
-                        WideCharToMultiByte( CP_ACP, 0, ici->szDescription, -1, ici16->szDescription,
-                                             sizeof(ici16->szDescription), NULL, NULL );
-                        ici16->szDescription[sizeof(ici16->szDescription)-1] = 0;
-			/* This just gives garbage for some reason - BB
-			   lstrcpynWtoA(ici16->szDriver,ici->szDriver,128);*/
-
-			HeapFree(GetProcessHeap(),0,ici);
-		}
-		break;
-	case ICM_DECOMPRESS_QUERY:
-		/*{
-		  LPVOID* x = data16;
-		  HeapFree(GetProcessHeap(),0,x[0]);
-		  if (x[1])
-		  HeapFree(GetProcessHeap(),0,x[1]);
-		  }
-		  break;*/
-	case ICM_COMPRESS:
-	case ICM_DECOMPRESS:
-	case ICM_DECOMPRESSEX_QUERY:
-	case ICM_DECOMPRESSEX_BEGIN:
-	case ICM_DECOMPRESSEX:
-	case ICM_DRAW_BEGIN:
-	case ICM_DRAW_SUGGESTFORMAT:
-	case ICM_DRAW:
-		HeapFree(GetProcessHeap(),0,data16);
-		break;
-	default:
-		ERR("Unmapping unmapped msg %d\n",msg);
-	}
-#undef UNCOPY
-}
-
-LRESULT MSVIDEO_SendMessage(HIC hic,UINT msg,DWORD lParam1,DWORD lParam2, BOOL bFrom32) {
-	LRESULT		ret;
-	WINE_HIC	*whic = GlobalLock16(HIC_16(hic));
-	LPVOID data16 = 0;
-	BOOL bDrv32;
-
-#define XX(x) case x: TRACE("(%p,"#x",0x%08lx,0x%08lx,%d)\n",hic,lParam1,lParam2,bFrom32?32:16);break;
-
-	switch (msg) {
-		/* DRV_* */
-		XX(DRV_LOAD);
-		XX(DRV_ENABLE);
-		XX(DRV_OPEN);
-		XX(DRV_CLOSE);
-		XX(DRV_DISABLE);
-		XX(DRV_FREE);
-		/* ICM_RESERVED+X */
-		XX(ICM_ABOUT);
-		XX(ICM_CONFIGURE);
-		XX(ICM_GET);
-		XX(ICM_GETINFO);
-		XX(ICM_GETDEFAULTQUALITY);
-		XX(ICM_GETQUALITY);
-		XX(ICM_GETSTATE);
-		XX(ICM_SETQUALITY);
-		XX(ICM_SET);
-		XX(ICM_SETSTATE);
-		/* ICM_USER+X */
-		XX(ICM_COMPRESS_FRAMES_INFO);
-		XX(ICM_COMPRESS_GET_FORMAT);
-		XX(ICM_COMPRESS_GET_SIZE);
-		XX(ICM_COMPRESS_QUERY);
-		XX(ICM_COMPRESS_BEGIN);
-		XX(ICM_COMPRESS);
-		XX(ICM_COMPRESS_END);
-		XX(ICM_DECOMPRESS_GET_FORMAT);
-		XX(ICM_DECOMPRESS_QUERY);
-		XX(ICM_DECOMPRESS_BEGIN);
-		XX(ICM_DECOMPRESS);
-		XX(ICM_DECOMPRESS_END);
-		XX(ICM_DECOMPRESS_SET_PALETTE);
-		XX(ICM_DECOMPRESS_GET_PALETTE);
-		XX(ICM_DRAW_QUERY);
-		XX(ICM_DRAW_BEGIN);
-		XX(ICM_DRAW_GET_PALETTE);
-		XX(ICM_DRAW_START);
-		XX(ICM_DRAW_STOP);
-		XX(ICM_DRAW_END);
-		XX(ICM_DRAW_GETTIME);
-		XX(ICM_DRAW);
-		XX(ICM_DRAW_WINDOW);
-		XX(ICM_DRAW_SETTIME);
-		XX(ICM_DRAW_REALIZE);
-		XX(ICM_DRAW_FLUSH);
-		XX(ICM_DRAW_RENDERBUFFER);
-		XX(ICM_DRAW_START_PLAY);
-		XX(ICM_DRAW_STOP_PLAY);
-		XX(ICM_DRAW_SUGGESTFORMAT);
-		XX(ICM_DRAW_CHANGEPALETTE);
-		XX(ICM_GETBUFFERSWANTED);
-		XX(ICM_GETDEFAULTKEYFRAMERATE);
-		XX(ICM_DECOMPRESSEX_BEGIN);
-		XX(ICM_DECOMPRESSEX_QUERY);
-		XX(ICM_DECOMPRESSEX);
-		XX(ICM_DECOMPRESSEX_END);
-		XX(ICM_SET_STATUS_PROC);
-	default:
-		FIXME("(%p,0x%08lx,0x%08lx,0x%08lx,%i) unknown message\n",hic,(DWORD)msg,lParam1,lParam2,bFrom32?32:16);
-	}
-
+/******************************************************************
+ *		MSVIDEO_SendMessage
+ *
+ *
+ */
+LRESULT MSVIDEO_SendMessage(HIC hic,UINT msg,DWORD lParam1,DWORD lParam2)
+{
+    LRESULT     ret;
+    WINE_HIC*   whic = GlobalLock16(HIC_16(hic));
+    
+#define XX(x) case x: TRACE("(%p,"#x",0x%08lx,0x%08lx)\n",hic,lParam1,lParam2);break;
+    
+    switch (msg) {
+        /* DRV_* */
+        XX(DRV_LOAD);
+        XX(DRV_ENABLE);
+        XX(DRV_OPEN);
+        XX(DRV_CLOSE);
+        XX(DRV_DISABLE);
+        XX(DRV_FREE);
+        /* ICM_RESERVED+X */
+        XX(ICM_ABOUT);
+        XX(ICM_CONFIGURE);
+        XX(ICM_GET);
+        XX(ICM_GETINFO);
+        XX(ICM_GETDEFAULTQUALITY);
+        XX(ICM_GETQUALITY);
+        XX(ICM_GETSTATE);
+        XX(ICM_SETQUALITY);
+        XX(ICM_SET);
+        XX(ICM_SETSTATE);
+        /* ICM_USER+X */
+        XX(ICM_COMPRESS_FRAMES_INFO);
+        XX(ICM_COMPRESS_GET_FORMAT);
+        XX(ICM_COMPRESS_GET_SIZE);
+        XX(ICM_COMPRESS_QUERY);
+        XX(ICM_COMPRESS_BEGIN);
+        XX(ICM_COMPRESS);
+        XX(ICM_COMPRESS_END);
+        XX(ICM_DECOMPRESS_GET_FORMAT);
+        XX(ICM_DECOMPRESS_QUERY);
+        XX(ICM_DECOMPRESS_BEGIN);
+        XX(ICM_DECOMPRESS);
+        XX(ICM_DECOMPRESS_END);
+        XX(ICM_DECOMPRESS_SET_PALETTE);
+        XX(ICM_DECOMPRESS_GET_PALETTE);
+        XX(ICM_DRAW_QUERY);
+        XX(ICM_DRAW_BEGIN);
+        XX(ICM_DRAW_GET_PALETTE);
+        XX(ICM_DRAW_START);
+        XX(ICM_DRAW_STOP);
+        XX(ICM_DRAW_END);
+        XX(ICM_DRAW_GETTIME);
+        XX(ICM_DRAW);
+        XX(ICM_DRAW_WINDOW);
+        XX(ICM_DRAW_SETTIME);
+        XX(ICM_DRAW_REALIZE);
+        XX(ICM_DRAW_FLUSH);
+        XX(ICM_DRAW_RENDERBUFFER);
+        XX(ICM_DRAW_START_PLAY);
+        XX(ICM_DRAW_STOP_PLAY);
+        XX(ICM_DRAW_SUGGESTFORMAT);
+        XX(ICM_DRAW_CHANGEPALETTE);
+        XX(ICM_GETBUFFERSWANTED);
+        XX(ICM_GETDEFAULTKEYFRAMERATE);
+        XX(ICM_DECOMPRESSEX_BEGIN);
+        XX(ICM_DECOMPRESSEX_QUERY);
+        XX(ICM_DECOMPRESSEX);
+        XX(ICM_DECOMPRESSEX_END);
+        XX(ICM_SET_STATUS_PROC);
+    default:
+        FIXME("(%p,0x%08lx,0x%08lx,0x%08lx) unknown message\n",hic,(DWORD)msg,lParam1,lParam2);
+    }
+    
 #undef XX
-
-	if (!whic) return ICERR_BADHANDLE;
-
-	if (whic->driverproc) { /* IC is a function */
-		bDrv32 = whic->private;
-	} else {
-		bDrv32 = ((GetDriverFlags(whic->hdrv) & (WINE_GDF_EXIST|WINE_GDF_16BIT)) == WINE_GDF_EXIST);
-	}
-
-	if (!bFrom32) {
-		if (bDrv32)
-			data16 = MSVIDEO_MapMsg16To32(msg,&lParam1,&lParam2);
-	} else {
-		if (!bDrv32) {
-			ERR("Can't do 32->16 mappings\n");
-			ret = -1;
-			goto out;
-		}
-	}
-
-	if (whic->driverproc) {
-		if (bDrv32) {
-			ret = whic->driverproc(whic->hdrv,hic,msg,lParam1,lParam2);
-		} else {
-			ret = MSVIDEO_CallTo16_long_lwwll((FARPROC16)whic->driverproc,(LONG)whic->hdrv,HIC_16(hic),msg,lParam1,lParam2);
-		}
-	} else {
-		ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2);
-	}
-
-	if (data16)
-		MSVIDEO_UnmapMsg16To32(msg,data16,&lParam1,&lParam2);
-
- out:
-	GlobalUnlock16(HIC_16(hic));
-
-	TRACE("	-> 0x%08lx\n",ret);
-	return ret;
+    
+    if (!whic) return ICERR_BADHANDLE;
+    
+    if (whic->driverproc) {
+        ret = whic->driverproc((DWORD)hic, whic->hdrv, msg, lParam1, lParam2);
+    } else {
+        ret = SendDriverMessage(whic->hdrv, msg, lParam1, lParam2);
+    }
+
+    GlobalUnlock16(HIC_16(hic));
+    
+    TRACE("	-> 0x%08lx\n",ret);
+    return ret;
 }
 
 /***********************************************************************
  *		ICSendMessage			[MSVFW32.@]
  */
 LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD lParam1, DWORD lParam2) {
-	return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2,TRUE);
-}
-
-/***********************************************************************
- *		ICSendMessage			[MSVIDEO.205]
- */
-LRESULT VFWAPI ICSendMessage16(HIC16 hic, UINT16 msg, DWORD lParam1, DWORD lParam2) {
-	return MSVIDEO_SendMessage(HIC_32(hic),msg,lParam1,lParam2,FALSE);
+	return MSVIDEO_SendMessage(hic,msg,lParam1,lParam2);
 }
 
 /***********************************************************************
Index: dlls/msvideo/msvideo.spec
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/msvideo.spec,v
retrieving revision 1.6
diff -u -u -r1.6 msvideo.spec
--- dlls/msvideo/msvideo.spec	21 Jun 2002 19:15:48 -0000	1.6
+++ dlls/msvideo/msvideo.spec	29 Oct 2002 17:35:10 -0000
@@ -1,7 +1,7 @@
 2 pascal VideoForWindowsVersion() VideoForWindowsVersion
 20 stub VIDEOGETNUMDEVS
 21 stub VIDEOGETERRORTEXT
-22 pascal VideoCapDriverDescAndVer(word ptr word ptr word) VideoCapDriverDescAndVer
+22 pascal VideoCapDriverDescAndVer(word ptr word ptr word) VideoCapDriverDescAndVer16
 28 stub VIDEOOPEN
 29 stub VIDEOCLOSE
 30 stub VIDEODIALOG
@@ -64,3 +64,6 @@
 251 stub _MCIWNDREGISTERCLASS
 252 stub GETOPENFILENAMEPREVIEW
 253 stub GETSAVEFILENAMEPREVIEW
+
+2000 pascal DllEntryPoint(long word word word long word) VIDEO_LibMain
+
Index: dlls/msvideo/vfw16.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/msvideo/vfw16.h,v
retrieving revision 1.6
diff -u -u -r1.6 vfw16.h
--- dlls/msvideo/vfw16.h	23 Oct 2002 23:33:21 -0000	1.6
+++ dlls/msvideo/vfw16.h	29 Oct 2002 17:45:01 -0000
@@ -118,14 +118,6 @@
 HIC16   VFWAPI  ICOpenFunction16(DWORD,DWORD,UINT16,FARPROC16);
 LRESULT VFWAPI  ICSendMessage16(HIC16,UINT16,DWORD,DWORD);
 
-/* handle16 --> handle conversions */
-#define HDRAWDIB_32(h16)	((HDRAWDIB)(ULONG_PTR)(h16))
-#define HIC_32(h16)		((HIC)(ULONG_PTR)(h16))
-
-/* handle --> handle16 conversions */
-#define HDRAWDIB_16(h32)	(LOWORD(h32))
-#define HIC_16(h32)		(LOWORD(h32))
-
 #ifdef __cplusplus
 }
 #endif  /* __cplusplus */
--- /dev/null	Thu Jan  1 01:00:00 1970
+++ dlls/msvideo/msvideo_private.h	Wed Oct 30 18:39:24 2002
@@ -0,0 +1,31 @@
+/* HIC struct (same layout as Win95 one) */
+typedef struct tagWINE_HIC {
+	DWORD		magic;		/* 00: 'Smag' */
+	HANDLE		curthread;	/* 04: */
+	DWORD		type;		/* 08: */
+	DWORD		handler;	/* 0C: */
+	HDRVR		hdrv;		/* 10: */
+	DWORD		private;	/* 14:(handled by SendDriverMessage)*/
+	DRIVERPROC	driverproc;	/* 18:(handled by SendDriverMessage)*/
+	DWORD		x1;		/* 1c: name? */
+	WORD		x2;		/* 20: */
+	DWORD		x3;		/* 22: */
+					/* 26: */
+        DRIVERPROC16    driverproc16;   /* Wine specific flags */
+} WINE_HIC;
+
+HIC     MSVIDEO_OpenFunction(DWORD, DWORD, UINT, DRIVERPROC, DRIVERPROC16);
+LRESULT MSVIDEO_SendMessage(HIC, UINT, DWORD, DWORD);
+
+extern LRESULT  (CALLBACK *pFnCallTo16)(HDRVR, HIC, UINT, LPARAM, LPARAM);
+
+#define HDRVR_16(h32)		(LOWORD(h32))
+
+/* handle16 --> handle conversions */
+#define HDRAWDIB_32(h16)	((HDRAWDIB)(ULONG_PTR)(h16))
+#define HIC_32(h16)		((HIC)(ULONG_PTR)(h16))
+
+/* handle --> handle16 conversions */
+#define HDRAWDIB_16(h32)	(LOWORD(h32))
+#define HIC_16(h32)		(LOWORD(h32))
+

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux