MSN Webcam patch

Vladdy Impaler vladdy at utchat.com
Mon Mar 14 18:00:16 CST 2005


RIght now I'm working on a patch so I can use my webcam under wine 
without having to switch to unix or use non-working solutions..

Right now there are 2 patches needed to get MSN to connect to the 
internet: first is to disable SSL, second strcpy's a value at urlmon 
getuseragent or something

To get this to work, a few modifications to existing files are needed:
First of all, if the catagory exists, let devenum return all from 
videoinput catagory:
diff -Nru /root/wine-20050211/dlls/devenum/createdevenum.c 
wine-20050211/dlls/devenum/createdevenum.c
--- /root/wine-20050211/dlls/devenum/createdevenum.c    2005-01-25 
11:56:39.000000000 +0100
+++ wine-20050211/dlls/devenum/createdevenum.c  2005-03-15 
00:15:47.000000000 +0100
@@ -117,7 +117,8 @@

     if (IsEqualGUID(clsidDeviceClass, &CLSID_AudioRendererCategory) ||
         IsEqualGUID(clsidDeviceClass, &CLSID_AudioInputDeviceCategory) ||
-        IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory))
+        IsEqualGUID(clsidDeviceClass, &CLSID_MidiRendererCategory) ||
+        IsEqualGUID(clsidDeviceClass, &CLSID_VideoInputDeviceCategory))
     {
         hbasekey = HKEY_CURRENT_USER;
         strcpyW(wszRegKey, wszActiveMovieKey);

and a few other patches to devenum main (Not sure if those are needed)
diff -Nru /root/wine-20050211/dlls/devenum/devenum_main.c 
wine-20050211/dlls/devenum/devenum_main.c
--- /root/wine-20050211/dlls/devenum/devenum_main.c     2004-12-07 
15:37:11.000000000 +0100
+++ wine-20050211/dlls/devenum/devenum_main.c   2005-03-15 
00:15:47.000000000 +0100
@@ -122,7 +122,7 @@
        {&CLSID_AudioCompressorCategory, acmcat, TRUE},
        {&CLSID_VideoCompressorCategory, vidcat, TRUE},
        {&CLSID_LegacyAmFilterCategory, filtcat, TRUE},
-       {&CLSID_VideoInputDeviceCategory, vfwcat, FALSE},
+       {&CLSID_VideoInputDeviceCategory, vfwcat, TRUE},
        {&CLSID_AudioInputDeviceCategory, wavein, FALSE},
        {&CLSID_AudioRendererCategory, waveout, FALSE},
        {&CLSID_MidiRendererCategory, midiout, FALSE},
@@ -156,7 +156,7 @@

         pMapper = (IFilterMapper2*)mapvptr;

-        IFilterMapper2_CreateCategory(pMapper, 
&CLSID_VideoInputDeviceCategory, MERIT_DO_NOT_USE, friendlyvidcap);
+        IFilterMapper2_CreateCategory(pMapper, 
&CLSID_VideoInputDeviceCategory, MERIT_NORMAL, friendlyvidcap);
         IFilterMapper2_CreateCategory(pMapper, 
&CLSID_LegacyAmFilterCategory, MERIT_NORMAL, friendlydshow);
         IFilterMapper2_CreateCategory(pMapper, 
&CLSID_VideoCompressorCategory, MERIT_DO_NOT_USE, friendlyvidcomp);
         IFilterMapper2_CreateCategory(pMapper, 
&CLSID_AudioInputDeviceCategory, MERIT_DO_NOT_USE, friendlyaudcap);

I wanted to put all custom code into qcap, but because of the pins 
that's not possible.
I wrote a basic stub for CaptureGraphBuilder and added it and regsvr 
calls to qcap.
There s no current implementation of qcap, so therefore I added my 
gzipped qcap.tgz as an attachment (To keep things simple)

My current implementation of the actual interface was based on 
filesource.c, so i made some functions and struct defs global in quartz:

diff -Nru /root/wine-20050211/dlls/quartz/filesource.c 
wine-20050211/dlls/quartz/filesource.c
--- /root/wine-20050211/dlls/quartz/filesource.c        2005-01-06 
20:36:47.000000000 +0100
+++ wine-20050211/dlls/quartz/filesource.c      2005-03-15 
00:15:47.000000000 +0100
@@ -663,17 +663,6 @@
     FileSource_GetCurFile
 };
 
-
-/* the dwUserData passed back to user */
-typedef struct DATAREQUEST
-{
-    IMediaSample * pSample; /* sample passed to us by user */
-    DWORD_PTR dwUserData; /* user data passed to us */
-    OVERLAPPED ovl; /* our overlapped structure */
-
-    struct DATAREQUEST * pNext; /* next data request in list */
-} DATAREQUEST;
-
 void queue(DATAREQUEST * pHead, DATAREQUEST * pItem)
 {
     DATAREQUEST * pCurrent;

diff -Nru /root/wine-20050211/dlls/quartz/quartz_private.h 
wine-20050211/dlls/quartz/quartz_private.h
--- /root/wine-20050211/dlls/quartz/quartz_private.h    2005-02-10 
18:13:18.000000000 +0100
+++ wine-20050211/dlls/quartz/quartz_private.h  2005-03-15 
00:15:47.000000000 +0100
@@ -52,8 +52,8 @@
 HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv);
 HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv);
 HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv);
-
 HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG 
nMonikerCount, IEnumMoniker ** ppEnum);
+HRESULT VfwCapture_create(IUnknown * pUnkOuter, LPVOID * ppv);

 typedef struct tagENUMPINDETAILS
 {
@@ -80,4 +80,14 @@
 BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE 
* pmt2, BOOL bWildcards);
 void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);

+typedef struct DATAREQUEST
+{
+    IMediaSample * pSample; /* sample passed to us by user */
+    DWORD_PTR dwUserData; /* user data passed to us */
+    OVERLAPPED ovl; /* our overlapped structure */
+
+    struct DATAREQUEST * pNext; /* next data request in list */
+} DATAREQUEST;
+
+void queue(DATAREQUEST * pHead, DATAREQUEST * pItem);
 #endif /* __QUARTZ_PRIVATE_INCLUDED__ */

As you can see here, a VfwCapture class is being created
to use it, we must register it and qcap with regsvr32

diff -Nru /root/wine-20050211/dlls/quartz/regsvr.c 
wine-20050211/dlls/quartz/regsvr.c
--- /root/wine-20050211/dlls/quartz/regsvr.c    2005-02-10 
18:13:18.000000000 +0100
+++ wine-20050211/dlls/quartz/regsvr.c  2005-03-15 00:15:47.000000000 +0100
@@ -922,6 +922,12 @@
        "quartz.dll",
        "Both"
     },
+    {   &CLSID_VfwCapture,
+        "Video for wine capture interface",
+        NULL,
+        "quartz.dll",
+        "Both"
+    },
     { NULL }                   /* list terminator */
 };

@@ -1112,6 +1118,18 @@
            { 0xFFFFFFFF },
        }
     },
+    {   &CLSID_VfwCapture,
+        &CLSID_VideoInputDeviceCategory,
+        {'V','i','d','e','o',' ','F','o','r',' ','W','i','n','e',' 
','(','V','4','W',')', 0},
+        0x800000,
+        {   {   REG_PINFLAG_B_OUTPUT,
+                {   { &MEDIATYPE_Stream, &GUID_NULL },
+                    { NULL }
+                },
+            },
+            { 0xFFFFFFFF },
+        }
+    }, /* This creates a fake device for us with an ugly name */
     { NULL }           /* list terminator */
 };

Also, main.c needs to be informed of a new class:
diff -Nru /root/wine-20050211/dlls/quartz/main.c 
wine-20050211/dlls/quartz/main.c
--- /root/wine-20050211/dlls/quartz/main.c      2005-03-14 
23:47:05.000000000 +0100
+++ wine-20050211/dlls/quartz/main.c    2005-03-15 00:15:47.000000000 +0100
@@ -71,7 +71,8 @@
     { &CLSID_AVIDec, AVIDec_create },
     { &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
     { &CLSID_ACMWrapper, &ACMWrapper_create },
-    { &CLSID_WAVEParser, &WAVEParser_create }
+    { &CLSID_WAVEParser, &WAVEParser_create },
+    { &CLSID_VfwCapture, &VfwCapture_create }
 };
       
 static HRESULT WINAPI


And at last, we need the interface of course:
diff -Nru /root/wine-20050211/dlls/quartz/Makefile.in 
wine-20050211/dlls/quartz/Makefile.in
--- /root/wine-20050211/dlls/quartz/Makefile.in 2005-02-10 
18:13:18.000000000 +0100
+++ wine-20050211/dlls/quartz/Makefile.in       2005-03-15 
00:15:47.000000000 +0100
@@ -28,7 +28,8 @@
        systemclock.c \
        transform.c \
        videorenderer.c \
-       waveparser.c
+       waveparser.c \
+       v4wsource.c

(v4wsource.c added as attachment)

Before you think 'yey i can use a webcam now', I have to warn you, you won't
What  did is made from figuring out what MSN did at every step, for this 
to work and keeping it debuggable I ONLY used builtin dlls

minimum required overrides in wine config:
"quartz"       = "builtin";FUCKING WORK!!!!
"amstream"     = "builtin"
"qcap"         = "builtin";You go girl.....
"ole32"        = "builtin";Not really needed, but makes debugging easier

Currently this is NOT working, and MSN crashes for a reason I do not 
understand,
Iif you want to help me continue working on webcam support i would 
greatly appreciate it if you could help me pinpoint the source of the 
crash..
WINEDEBUG=+quartz,+qcap is recommended.. and for now I'm only
Currently the code mostly exists out of ugly hacks, what I was working 
on before msn crashed were the video formats (IKSPropertySet and 
IAMStreamConfig capabilities), if someone can help me figure out why and 
were it crashes, I could continue on my webcam project :=). You could 
try to get it to work through 'Extra' 'Configure webcam' (Or something 
like that, since I'm using Dutch version), and it crashes for a reason 
unknown to me..

PS: I accidentally deleted my first patch file, you need to add 
IAMStreamConfig and perhaps some other class into the include/*.idl 
files, I'll release a patch when I'm at least 1% awake again :/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qcap.tgz
Type: application/x-compressed-tar
Size: 11998 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050315/3fea1559/qcap.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4wsource.c
Type: text/x-csrc
Size: 18934 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050315/3fea1559/v4wsource.c


More information about the wine-devel mailing list