Author: akhaldi
Date: Fri May 31 16:38:30 2013
New Revision: 59125

URL: http://svn.reactos.org/svn/reactos?rev=59125&view=rev
Log:
[AVIFIL32]
* Sync with Wine 1.5.26.

Added:
    trunk/reactos/dll/win32/avifil32/avifil32.idl   (with props)
    trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs   (with props)
Modified:
    trunk/reactos/dll/win32/avifil32/CMakeLists.txt
    trunk/reactos/dll/win32/avifil32/acmstream.c
    trunk/reactos/dll/win32/avifil32/api.c
    trunk/reactos/dll/win32/avifil32/avifile.c
    trunk/reactos/dll/win32/avifil32/avifile.rgs
    trunk/reactos/dll/win32/avifil32/avifile_private.h
    trunk/reactos/dll/win32/avifil32/extrachunk.c
    trunk/reactos/dll/win32/avifil32/extrachunk.h
    trunk/reactos/dll/win32/avifil32/factory.c
    trunk/reactos/dll/win32/avifil32/getframe.c
    trunk/reactos/dll/win32/avifil32/rsrc.rc
    trunk/reactos/dll/win32/avifil32/tmpfile.c
    trunk/reactos/media/doc/README.WINE

Modified: trunk/reactos/dll/win32/avifil32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/CMakeLists.txt?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/CMakeLists.txt     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/CMakeLists.txt     [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -22,16 +22,5 @@
 
 set_module_type(avifil32 win32dll)
 target_link_libraries(avifil32 uuid wine)
-
-add_importlibs(avifil32
-    msvcrt
-    msacm32
-    msvfw32
-    winmm
-    ole32
-    user32
-    advapi32
-    kernel32
-    ntdll)
-
+add_importlibs(avifil32 msacm32 msvfw32 winmm ole32 user32 advapi32 msvcrt 
kernel32 ntdll)
 add_cd_file(TARGET avifil32 DESTINATION reactos/system32 FOR all)

Modified: trunk/reactos/dll/win32/avifil32/acmstream.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/acmstream.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/acmstream.c        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/acmstream.c        [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -228,7 +228,7 @@
   /* check for swapped parameters */
   if ((LPVOID)lParam1 != NULL &&
       ((LPAVICOMPRESSOPTIONS)lParam1)->fccType == streamtypeAUDIO) {
-    register LPARAM tmp = lParam1;
+    LPARAM tmp = lParam1;
 
     lParam1 = lParam2;
     lParam2 = tmp;

Modified: trunk/reactos/dll/win32/avifil32/api.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/api.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/api.c      [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/api.c      [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -1248,7 +1248,7 @@
       pOptions->dwFlags |= AVICOMPRESSF_VALID;
 
     HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
-    return (ret == S_OK ? TRUE : FALSE);
+    return ret == S_OK;
   } else {
     ERR(": unknown streamtype 0x%08X\n", sInfo.fccType);
     return FALSE;

Added: trunk/reactos/dll/win32/avifil32/avifil32.idl
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifil32.idl?rev=59125&view=auto
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifil32.idl       (added)
+++ trunk/reactos/dll/win32/avifil32/avifil32.idl       [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -0,0 +1,54 @@
+/*
+ * COM Classes for avifil32
+ *
+ * Copyright 2010 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+[
+    helpstring("Microsoft AVI Files"),
+    threading(apartment),
+    uuid(00020000-0000-0000-C000-000000000046)
+]
+coclass AVIFile { interface IAVIFile; }
+
+[
+    helpstring("AVI Compressed Stream"),
+    threading(apartment),
+    uuid(00020001-0000-0000-c000-000000000046)
+]
+coclass ICMStream { interface IAVIStream; }
+
+[
+    helpstring("Microsoft Wave File"),
+    threading(apartment),
+    uuid(00020003-0000-0000-c000-000000000046)
+]
+coclass WAVFile { interface IAVIFile; }
+
+[
+    helpstring("IAVIStream & IAVIFile Proxy"),
+    threading(apartment),
+    uuid(0002000d-0000-0000-c000-000000000046)
+]
+coclass AVIProxy { }
+
+[
+    helpstring("ACM Compressed Audio Stream"),
+    threading(apartment),
+    uuid(0002000f-0000-0000-c000-000000000046)
+]
+coclass ACMStream { interface IAVIStream; }

Propchange: trunk/reactos/dll/win32/avifil32/avifil32.idl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs?rev=59125&view=auto
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs   (added)
+++ trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs   [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -0,0 +1,29 @@
+HKCR
+{
+    NoRemove Interface
+    {
+    }
+    NoRemove CLSID
+    {
+        '{00020000-0000-0000-C000-000000000046}' = s 'Microsoft AVI Files'
+        {
+            InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' 
}
+        }
+        '{00020001-0000-0000-C000-000000000046}' = s 'AVI Compressed Stream'
+        {
+            InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' 
}
+        }
+        '{00020003-0000-0000-C000-000000000046}' = s 'Microsoft Wave File'
+        {
+            InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' 
}
+        }
+        '{0002000D-0000-0000-C000-000000000046}' = s 'IAVIStream & IAVIFile 
Proxy'
+        {
+            InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' 
}
+        }
+        '{0002000F-0000-0000-C000-000000000046}' = s 'ACM Compressed Audio 
Stream'
+        {
+            InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' 
}
+        }
+    }
+}

Propchange: trunk/reactos/dll/win32/avifil32/avifil32_idl.rgs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/win32/avifil32/avifile.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifile.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifile.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/avifile.c  [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -34,6 +34,7 @@
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
 
+#define COBJMACROS
 #include <assert.h>
 #include <stdarg.h>
 
@@ -57,54 +58,6 @@
 #ifndef IDX_PER_BLOCK
 #define IDX_PER_BLOCK 2730
 #endif
-
-/***********************************************************************/
-
-static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID 
refiid,LPVOID *obj);
-static ULONG   WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
-static ULONG   WINAPI IAVIFile_fnRelease(IAVIFile* iface);
-static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG 
size);
-static HRESULT WINAPI 
IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
-static HRESULT WINAPI 
IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
-static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID 
lpData,LONG size);
-static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID 
lpData,LONG *size);
-static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
-static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD 
fccType,LONG lParam);
-
-static const struct IAVIFileVtbl iavift = {
-  IAVIFile_fnQueryInterface,
-  IAVIFile_fnAddRef,
-  IAVIFile_fnRelease,
-  IAVIFile_fnInfo,
-  IAVIFile_fnGetStream,
-  IAVIFile_fnCreateStream,
-  IAVIFile_fnWriteData,
-  IAVIFile_fnReadData,
-  IAVIFile_fnEndRecord,
-  IAVIFile_fnDeleteStream
-};
-
-static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile*iface,REFIID 
refiid,LPVOID*obj);
-static ULONG   WINAPI IPersistFile_fnAddRef(IPersistFile*iface);
-static ULONG   WINAPI IPersistFile_fnRelease(IPersistFile*iface);
-static HRESULT WINAPI 
IPersistFile_fnGetClassID(IPersistFile*iface,CLSID*pClassID);
-static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile*iface);
-static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile*iface,LPCOLESTR 
pszFileName,DWORD dwMode);
-static HRESULT WINAPI IPersistFile_fnSave(IPersistFile*iface,LPCOLESTR 
pszFileName,BOOL fRemember);
-static HRESULT WINAPI 
IPersistFile_fnSaveCompleted(IPersistFile*iface,LPCOLESTR pszFileName);
-static HRESULT WINAPI 
IPersistFile_fnGetCurFile(IPersistFile*iface,LPOLESTR*ppszFileName);
-
-static const struct IPersistFileVtbl ipersistft = {
-  IPersistFile_fnQueryInterface,
-  IPersistFile_fnAddRef,
-  IPersistFile_fnRelease,
-  IPersistFile_fnGetClassID,
-  IPersistFile_fnIsDirty,
-  IPersistFile_fnLoad,
-  IPersistFile_fnSave,
-  IPersistFile_fnSaveCompleted,
-  IPersistFile_fnGetCurFile
-};
 
 static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID 
refiid,LPVOID *obj);
 static ULONG   WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
@@ -140,14 +93,6 @@
 
 typedef struct _IAVIFileImpl IAVIFileImpl;
 
-typedef struct _IPersistFileImpl {
-  /* IUnknown stuff */
-  const IPersistFileVtbl *lpVtbl;
-
-  /* IPersistFile stuff */
-  IAVIFileImpl     *paf;
-} IPersistFileImpl;
-
 typedef struct _IAVIStreamImpl {
   /* IUnknown stuff */
   const IAVIStreamVtbl *lpVtbl;
@@ -178,12 +123,11 @@
 } IAVIStreamImpl;
 
 struct _IAVIFileImpl {
-  /* IUnknown stuff */
-  const IAVIFileVtbl     *lpVtbl;
-  LONG             ref;
-
-  /* IAVIFile stuff... */
-  IPersistFileImpl  iPersistFile;
+  IUnknown          IUnknown_inner;
+  IAVIFile          IAVIFile_iface;
+  IPersistFile      IPersistFile_iface;
+  IUnknown         *outer_unk;
+  LONG              ref;
 
   AVIFILEINFOW      fInfo;
   IAVIStreamImpl   *ppStreams[MAX_AVISTREAMS];
@@ -206,6 +150,21 @@
   UINT              uMode;
   BOOL              fDirty;
 };
+
+static inline IAVIFileImpl *impl_from_IUnknown(IUnknown *iface)
+{
+  return CONTAINING_RECORD(iface, IAVIFileImpl, IUnknown_inner);
+}
+
+static inline IAVIFileImpl *impl_from_IAVIFile(IAVIFile *iface)
+{
+  return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIFile_iface);
+}
+
+static inline IAVIFileImpl *impl_from_IPersistFile(IPersistFile *iface)
+{
+  return CONTAINING_RECORD(iface, IAVIFileImpl, IPersistFile_iface);
+}
 
 /***********************************************************************/
 
@@ -233,87 +192,64 @@
                                  FOURCC ckid, DWORD flags, LPCVOID buffer,
                                  LONG size);
 
-HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv)
-{
-  IAVIFileImpl *pfile;
-  HRESULT       hr;
-
-  assert(riid != NULL && ppv != NULL);
-
+static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, 
void **ppv)
+{
+  IAVIFileImpl *This = impl_from_IUnknown(iface);
+
+  TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
+
+  if (!ppv) {
+    WARN("invalid parameter\n");
+    return E_INVALIDARG;
+  }
   *ppv = NULL;
 
-  pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl));
-  if (pfile == NULL)
-    return AVIERR_MEMORY;
-
-  pfile->lpVtbl = &iavift;
-  pfile->ref = 0;
-  pfile->iPersistFile.lpVtbl = &ipersistft;
-  pfile->iPersistFile.paf = pfile;
-
-  hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv);
-  if (FAILED(hr))
-    HeapFree(GetProcessHeap(), 0, pfile);
-
-  return hr;
-}
-
-static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid,
-                                               LPVOID *obj)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
-
-  TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj);
-
-  if (IsEqualGUID(&IID_IUnknown, refiid) ||
-      IsEqualGUID(&IID_IAVIFile, refiid)) {
-    *obj = iface;
-    IAVIFile_AddRef(iface);
-
-    return S_OK;
-  } else if (IsEqualGUID(&IID_IPersistFile, refiid)) {
-    *obj = &This->iPersistFile;
-    IAVIFile_AddRef(iface);
-
-    return S_OK;
-  }
-
-  return OLE_E_ENUM_NOMORE;
-}
-
-static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+  if (IsEqualIID(riid, &IID_IUnknown))
+    *ppv = &This->IUnknown_inner;
+  else if (IsEqualIID(riid, &IID_IAVIFile))
+    *ppv = &This->IAVIFile_iface;
+  else if (IsEqualGUID(riid, &IID_IPersistFile))
+    *ppv = &This->IPersistFile_iface;
+  else {
+    WARN("unknown IID %s\n", debugstr_guid(riid));
+    return E_NOINTERFACE;
+  }
+
+  /* Violation of the COM aggregation ref counting rule */
+  IUnknown_AddRef(&This->IUnknown_inner);
+  return S_OK;
+}
+
+static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface)
+{
+  IAVIFileImpl *This = impl_from_IUnknown(iface);
   ULONG ref = InterlockedIncrement(&This->ref);
 
-  TRACE("(%p) -> %d\n", iface, ref);
+  TRACE("(%p) ref=%d\n", This, ref);
 
   return ref;
 }
 
-static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface)
+{
+  IAVIFileImpl *This = impl_from_IUnknown(iface);
+  ULONG ref = InterlockedDecrement(&This->ref);
   UINT i;
-  ULONG ref = InterlockedDecrement(&This->ref);
-
-  TRACE("(%p) -> %d\n", iface, ref);
+
+  TRACE("(%p) ref=%d\n", This, ref);
 
   if (!ref) {
-    if (This->fDirty) {
-      /* need to write headers to file */
+    if (This->fDirty)
       AVIFILE_SaveFile(This);
-    }
 
     for (i = 0; i < This->fInfo.dwStreams; i++) {
       if (This->ppStreams[i] != NULL) {
-       if (This->ppStreams[i]->ref != 0) {
+        if (This->ppStreams[i]->ref != 0)
           ERR(": someone has still %u reference to stream %u (%p)!\n",
-              This->ppStreams[i]->ref, i, This->ppStreams[i]);
-       }
-       AVIFILE_DestructAVIStream(This->ppStreams[i]);
-       HeapFree(GetProcessHeap(), 0, This->ppStreams[i]);
-       This->ppStreams[i] = NULL;
+              This->ppStreams[i]->ref, i, This->ppStreams[i]);
+        AVIFILE_DestructAVIStream(This->ppStreams[i]);
+        HeapFree(GetProcessHeap(), 0, This->ppStreams[i]);
+        This->ppStreams[i] = NULL;
       }
     }
 
@@ -342,10 +278,37 @@
   return ref;
 }
 
-static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi,
-                                     LONG size)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+static const IUnknownVtbl unk_vtbl =
+{
+  IUnknown_fnQueryInterface,
+  IUnknown_fnAddRef,
+  IUnknown_fnRelease
+};
+
+static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID riid, 
void **ppv)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
+
+  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
+}
+
+static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
+
+  return IUnknown_AddRef(This->outer_unk);
+}
+
+static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
+
+  return IUnknown_Release(This->outer_unk);
+}
+
+static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG 
size)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
 
   TRACE("(%p,%p,%d)\n",iface,afi,size);
 
@@ -363,11 +326,10 @@
   return AVIERR_OK;
 }
 
-static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis,
-                                          DWORD fccType, LONG lParam)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
-
+static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, 
DWORD fccType,
+    LONG lParam)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
   ULONG nStream;
 
   TRACE("(%p,%p,0x%08X,%d)\n", iface, avis, fccType, lParam);
@@ -390,11 +352,10 @@
   return AVIERR_NODATA;
 }
 
-static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis,
-                                             LPAVISTREAMINFOW asi)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
-
+static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream 
**avis,
+    AVISTREAMINFOW *asi)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
   DWORD n;
 
   TRACE("(%p,%p,%p)\n", iface, avis, asi);
@@ -444,10 +405,9 @@
   return AVIERR_OK;
 }
 
-static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid,
-                                          LPVOID lpData, LONG size)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void 
*lpData, LONG size)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
 
   TRACE("(%p,0x%08X,%p,%d)\n", iface, ckid, lpData, size);
 
@@ -466,10 +426,9 @@
   return WriteExtraChunk(&This->fileextra, ckid, lpData, size);
 }
 
-static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid,
-                                         LPVOID lpData, LONG *size)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void 
*lpData, LONG *size)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
 
   TRACE("(%p,0x%08X,%p,%p)\n", iface, ckid, lpData, size);
 
@@ -478,7 +437,7 @@
 
 static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface)
 {
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
 
   TRACE("(%p)\n",iface);
 
@@ -517,11 +476,9 @@
   return AVIERR_OK;
 }
 
-static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType,
-                                             LONG lParam)
-{
-  IAVIFileImpl *This = (IAVIFileImpl *)iface;
-
+static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, 
LONG lParam)
+{
+  IAVIFileImpl *This = impl_from_IAVIFile(iface);
   ULONG nStream;
 
   TRACE("(%p,0x%08X,%d)\n", iface, fccType, lParam);
@@ -556,38 +513,42 @@
     return AVIERR_NODATA;
 }
 
-/***********************************************************************/
-
-static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface,
-                                                   REFIID refiid, LPVOID *obj)
-{
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
-
-  assert(This->paf != NULL);
-
-  return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj);
-}
-
-static ULONG   WINAPI IPersistFile_fnAddRef(IPersistFile *iface)
-{
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
-
-  assert(This->paf != NULL);
-
-  return IAVIFile_AddRef((PAVIFILE)This->paf);
-}
-
-static ULONG   WINAPI IPersistFile_fnRelease(IPersistFile *iface)
-{
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
-
-  assert(This->paf != NULL);
-
-  return IAVIFile_Release((PAVIFILE)This->paf);
-}
-
-static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface,
-                                               LPCLSID pClassID)
+static const struct IAVIFileVtbl avif_vt = {
+  IAVIFile_fnQueryInterface,
+  IAVIFile_fnAddRef,
+  IAVIFile_fnRelease,
+  IAVIFile_fnInfo,
+  IAVIFile_fnGetStream,
+  IAVIFile_fnCreateStream,
+  IAVIFile_fnWriteData,
+  IAVIFile_fnReadData,
+  IAVIFile_fnEndRecord,
+  IAVIFile_fnDeleteStream
+};
+
+
+static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, 
REFIID riid, void **ppv)
+{
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
+
+  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
+}
+
+static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface)
+{
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
+
+  return IUnknown_AddRef(This->outer_unk);
+}
+
+static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface)
+{
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
+
+  return IUnknown_Release(This->outer_unk);
+}
+
+static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, LPCLSID 
pClassID)
 {
   TRACE("(%p,%p)\n", iface, pClassID);
 
@@ -601,20 +562,16 @@
 
 static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile *iface)
 {
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
 
   TRACE("(%p)\n", iface);
 
-  assert(This->paf != NULL);
-
-  return (This->paf->fDirty ? S_OK : S_FALSE);
-}
-
-static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
-                                         LPCOLESTR pszFileName, DWORD dwMode)
-{
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
-
+  return (This->fDirty ? S_OK : S_FALSE);
+}
+
+static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR 
pszFileName, DWORD dwMode)
+{
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
   int len;
 
   TRACE("(%p,%s,0x%08X)\n", iface, debugstr_w(pszFileName), dwMode);
@@ -623,53 +580,49 @@
   if (pszFileName == NULL)
     return AVIERR_BADPARAM;
 
-  assert(This->paf != NULL);
-  if (This->paf->hmmio != NULL)
+  if (This->hmmio != NULL)
     return AVIERR_ERROR; /* No reuse of this object for another file! */
 
   /* remember mode and name */
-  This->paf->uMode = dwMode;
+  This->uMode = dwMode;
 
   len = lstrlenW(pszFileName) + 1;
-  This->paf->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-  if (This->paf->szFileName == NULL)
+  This->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+  if (This->szFileName == NULL)
     return AVIERR_MEMORY;
-  lstrcpyW(This->paf->szFileName, pszFileName);
+  lstrcpyW(This->szFileName, pszFileName);
 
   /* try to open the file */
-  This->paf->hmmio = mmioOpenW(This->paf->szFileName, NULL,
-                              MMIO_ALLOCBUF | dwMode);
-  if (This->paf->hmmio == NULL) {
+  This->hmmio = mmioOpenW(This->szFileName, NULL, MMIO_ALLOCBUF | dwMode);
+  if (This->hmmio == NULL) {
     /* mmioOpenW not in native DLLs of Win9x -- try mmioOpenA */
     LPSTR szFileName;
 
-    len = WideCharToMultiByte(CP_ACP, 0, This->paf->szFileName, -1,
-                               NULL, 0, NULL, NULL);
+    len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1, NULL, 0, NULL, 
NULL);
     szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR));
     if (szFileName == NULL)
       return AVIERR_MEMORY;
 
-    WideCharToMultiByte(CP_ACP, 0, This->paf->szFileName, -1, szFileName,
-                       len, NULL, NULL);
-
-    This->paf->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
+    WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1, szFileName, len, 
NULL, NULL);
+
+    This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
     HeapFree(GetProcessHeap(), 0, szFileName);
-    if (This->paf->hmmio == NULL)
+    if (This->hmmio == NULL)
       return AVIERR_FILEOPEN;
   }
 
   /* should we create a new file? */
   if (dwMode & OF_CREATE) {
-    memset(& This->paf->fInfo, 0, sizeof(This->paf->fInfo));
-    This->paf->fInfo.dwFlags = AVIFILEINFO_HASINDEX | AVIFILEINFO_TRUSTCKTYPE;
+    memset(& This->fInfo, 0, sizeof(This->fInfo));
+    This->fInfo.dwFlags = AVIFILEINFO_HASINDEX | AVIFILEINFO_TRUSTCKTYPE;
 
     return AVIERR_OK;
   } else
-    return AVIFILE_LoadFile(This->paf);
-}
-
-static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface,
-                                         LPCOLESTR pszFileName,BOOL fRemember)
+    return AVIFILE_LoadFile(This);
+}
+
+static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, LPCOLESTR 
pszFileName,
+    BOOL fRemember)
 {
   TRACE("(%p,%s,%d)\n", iface, debugstr_w(pszFileName), fRemember);
 
@@ -678,8 +631,7 @@
   return AVIERR_OK;
 }
 
-static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface,
-                                                  LPCOLESTR pszFileName)
+static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface, 
LPCOLESTR pszFileName)
 {
   TRACE("(%p,%s)\n", iface, debugstr_w(pszFileName));
 
@@ -688,10 +640,9 @@
   return AVIERR_OK;
 }
 
-static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface,
-                                               LPOLESTR *ppszFileName)
-{
-  IPersistFileImpl *This = (IPersistFileImpl *)iface;
+static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR 
*ppszFileName)
+{
+  IAVIFileImpl *This = impl_from_IPersistFile(iface);
 
   TRACE("(%p,%p)\n", iface, ppszFileName);
 
@@ -700,22 +651,56 @@
 
   *ppszFileName = NULL;
 
-  assert(This->paf != NULL);
-
-  if (This->paf->szFileName != NULL) {
-    int len = lstrlenW(This->paf->szFileName) + 1;
+  if (This->szFileName != NULL) {
+    int len = lstrlenW(This->szFileName) + 1;
 
     *ppszFileName = CoTaskMemAlloc(len * sizeof(WCHAR));
     if (*ppszFileName == NULL)
       return AVIERR_MEMORY;
 
-    strcpyW(*ppszFileName, This->paf->szFileName);
+    strcpyW(*ppszFileName, This->szFileName);
   }
 
   return AVIERR_OK;
 }
 
-/***********************************************************************/
+static const struct IPersistFileVtbl pf_vt = {
+  IPersistFile_fnQueryInterface,
+  IPersistFile_fnAddRef,
+  IPersistFile_fnRelease,
+  IPersistFile_fnGetClassID,
+  IPersistFile_fnIsDirty,
+  IPersistFile_fnLoad,
+  IPersistFile_fnSave,
+  IPersistFile_fnSaveCompleted,
+  IPersistFile_fnGetCurFile
+};
+
+HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, void **ppv)
+{
+  IAVIFileImpl *obj;
+  HRESULT hr;
+
+  *ppv = NULL;
+  obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl));
+  if (!obj)
+    return AVIERR_MEMORY;
+
+  obj->IUnknown_inner.lpVtbl = &unk_vtbl;
+  obj->IAVIFile_iface.lpVtbl = &avif_vt;
+  obj->IPersistFile_iface.lpVtbl = &pf_vt;
+  obj->ref = 1;
+  if (pUnkOuter)
+    obj->outer_unk = pUnkOuter;
+  else
+    obj->outer_unk = &obj->IUnknown_inner;
+
+  hr = IUnknown_QueryInterface(&obj->IUnknown_inner, riid, ppv);
+  IUnknown_Release(&obj->IUnknown_inner);
+
+  return hr;
+}
+
 
 static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface,
                                                  REFIID refiid, LPVOID *obj)
@@ -745,7 +730,7 @@
 
   /* also add ref to parent, so that it doesn't kill us */
   if (This->paf != NULL)
-    IAVIFile_AddRef((PAVIFILE)This->paf);
+    IAVIFile_AddRef(&This->paf->IAVIFile_iface);
 
   return ref;
 }
@@ -758,7 +743,7 @@
   TRACE("(%p) -> %d\n", iface, ref);
 
   if (This->paf != NULL)
-    IAVIFile_Release((PAVIFILE)This->paf);
+    IAVIFile_Release(&This->paf->IAVIFile_iface);
 
   return ref;
 }

Modified: trunk/reactos/dll/win32/avifil32/avifile.rgs
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifile.rgs?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifile.rgs        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/avifile.rgs        [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -2,26 +2,11 @@
 {
     NoRemove CLSID
     {
-        '{00020000-0000-0000-C000-000000000046}' = s 'Microsoft AVI Files'
-               {
-                       InprocServer32 = s '%MODULE%' { val ThreadingModel = s 
'Apartment' }
-               }
-        '{00020001-0000-0000-C000-000000000046}' = s 'AVI Compressed Stream'
-               {
-                       InprocServer32 = s '%MODULE%' { val ThreadingModel = s 
'Apartment' }
-               }
-        '{00020003-0000-0000-C000-000000000046}' = s 'Microsoft Wave File'
-               {
-                       InprocServer32 = s '%MODULE%' { val ThreadingModel = s 
'Apartment' }
-               }
-        '{0002000d-0000-0000-C000-000000000046}' = s 'IAVIStream & IAVIFile 
Proxy'
-               {
-                       InprocServer32 = s '%MODULE%' { val ThreadingModel = s 
'Apartment' }
-               }
-        '{0002000f-0000-0000-C000-000000000046}' = s 'ACM Compressed Audio 
Stream'
-               {
-                       InprocServer32 = s '%MODULE%' { val ThreadingModel = s 
'Apartment' }
-               }
+        '{00020000-0000-0000-C000-000000000046}' { InprocServer = s 
'avifile.dll' }
+        '{00020001-0000-0000-C000-000000000046}' { InprocServer = s 
'avifile.dll' }
+        '{00020003-0000-0000-C000-000000000046}' { InprocServer = s 
'avifile.dll' }
+        '{0002000d-0000-0000-C000-000000000046}' { InprocServer = s 
'avifile.dll' }
+        '{0002000f-0000-0000-C000-000000000046}' { InprocServer = s 
'avifile.dll' }
     }
     NoRemove AVIFile
     {

Modified: trunk/reactos/dll/win32/avifil32/avifile_private.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/avifile_private.h?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/avifile_private.h  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/avifile_private.h  [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -58,7 +58,7 @@
 
 extern HMODULE AVIFILE_hModule DECLSPEC_HIDDEN;
 
-extern HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;
+extern HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, LPVOID 
*ppobj) DECLSPEC_HIDDEN;
 extern HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;
 extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;
 extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj) 
DECLSPEC_HIDDEN;

Modified: trunk/reactos/dll/win32/avifil32/extrachunk.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/extrachunk.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/extrachunk.c       [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/extrachunk.c       [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -32,7 +32,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(avifile);
 
-/* reads a chunk outof the extrachunk-structure */
+/* reads a chunk out of the extrachunk-structure */
 HRESULT ReadExtraChunk(const EXTRACHUNKS *extra,FOURCC ckid,LPVOID 
lpData,LPLONG size)
 {
   LPBYTE lp;
@@ -102,7 +102,7 @@
   return AVIERR_OK;
 }
 
-/* reads a chunk fomr the HMMIO into the extrachunk-structure */
+/* reads a chunk from the HMMIO into the extrachunk-structure */
 HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO 
*lpck)
 {
   LPDWORD lp;

Modified: trunk/reactos/dll/win32/avifil32/extrachunk.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/extrachunk.h?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/extrachunk.h       [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/extrachunk.h       [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -42,7 +42,7 @@
 /* writes a chunk into the extrachunk-structure */
 HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPCVOID lp,LONG size) 
DECLSPEC_HIDDEN;
 
-/* reads a chunk fomr the HMMIO into the extrachunk-structure */
+/* reads a chunk from the HMMIO into the extrachunk-structure */
 HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO 
*lpck) DECLSPEC_HIDDEN;
 
 /* reads all non-junk chunks into the extrachunk-structure until it finds

Modified: trunk/reactos/dll/win32/avifil32/factory.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/factory.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/factory.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/factory.c  [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -144,12 +144,19 @@
   TRACE("(%p,%p,%s,%p)\n", iface, pOuter, debugstr_guid(riid),
        ppobj);
 
-  if (ppobj == NULL || pOuter != NULL)
-    return E_FAIL;
+  if (!ppobj)
+    return E_INVALIDARG;
   *ppobj = NULL;
 
+  if (pOuter && !IsEqualGUID(&IID_IUnknown, riid))
+    return E_INVALIDARG;
+
   if (IsEqualGUID(&CLSID_AVIFile, &This->clsid))
-    return AVIFILE_CreateAVIFile(riid,ppobj);
+    return AVIFILE_CreateAVIFile(pOuter, riid, ppobj);
+
+  if (pOuter)
+    return CLASS_E_NOAGGREGATION;
+
   if (IsEqualGUID(&CLSID_ICMStream, &This->clsid))
     return AVIFILE_CreateICMStream(riid,ppobj);
   if (IsEqualGUID(&CLSID_WAVFile, &This->clsid))

Modified: trunk/reactos/dll/win32/avifil32/getframe.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/getframe.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/getframe.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/getframe.c [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -311,8 +311,7 @@
   if (sInfo.fccType != streamtypeVIDEO)
     return AVIERR_UNSUPPORTED;
 
-  This->bFormatChanges =
-    (sInfo.dwFlags & AVISTREAMINFO_FORMATCHANGES ? TRUE : FALSE );
+  This->bFormatChanges = (sInfo.dwFlags & AVISTREAMINFO_FORMATCHANGES) != 0;
   This->dwFormatChangeCount = sInfo.dwFormatChangeCount;
   This->dwEditCount         = sInfo.dwEditCount;
   This->lCurrentFrame       = -1;
@@ -434,7 +433,7 @@
     }
 
     if (lpBits == NULL) {
-      register DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
+      DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
 
       size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
       This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, 
size);

Modified: trunk/reactos/dll/win32/avifil32/rsrc.rc
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/rsrc.rc?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/rsrc.rc    [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/rsrc.rc    [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -27,6 +27,8 @@
 
 /* @makedep: avifile.rgs */
 1 WINE_REGISTRY avifile.rgs
+
+2 WINE_REGISTRY avifil32_idl.rgs
 
 #define WINE_FILEDESCRIPTION_STR "Wine AVI file support library"
 #define WINE_FILENAME_STR "avifil32.dll"

Modified: trunk/reactos/dll/win32/avifil32/tmpfile.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avifil32/tmpfile.c?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/dll/win32/avifil32/tmpfile.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avifil32/tmpfile.c  [iso-8859-1] Fri May 31 
16:38:30 2013
@@ -262,7 +262,7 @@
       tmpFile->fInfo.dwSuggestedBufferSize = sInfo.dwSuggestedBufferSize;
 
     {
-      register DWORD tmp;
+      DWORD tmp;
 
       tmp = MulDiv(AVIStreamSampleToTime(ppStreams[i], sInfo.dwLength),
                    tmpFile->fInfo.dwScale, tmpFile->fInfo.dwRate * 1000);

Modified: trunk/reactos/media/doc/README.WINE
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=59125&r1=59124&r2=59125&view=diff
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri May 31 16:38:30 2013
@@ -43,7 +43,7 @@
 reactos/dll/win32/advpack         # Synced to Wine-1.5.26
 reactos/dll/win32/atl             # Synced to Wine-1.5.19
 reactos/dll/win32/atl100          # Synced to Wine-1.5.19
-reactos/dll/win32/avifil32        # Synced to Wine-1.3.37
+reactos/dll/win32/avifil32        # Synced to Wine-1.5.26
 reactos/dll/win32/bcrypt          # Synced to Wine-1.5.19
 reactos/dll/win32/browseui        # Out of sync
 reactos/dll/win32/cabinet         # Synced to Wine-1.5.19


Reply via email to