winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2013
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
531 discussions
Start a n
N
ew thread
Michael Stefaniuc : avifil32/tests: Add COM tests for AVIFile.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: e86619413ecb50ad224b0d1705dc17c5afb085ba URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e86619413ecb50ad224b0d170…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 7 00:46:17 2013 +0100 avifil32/tests: Add COM tests for AVIFile. --- dlls/avifil32/tests/Makefile.in | 2 +- dlls/avifil32/tests/api.c | 119 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 7 deletions(-) diff --git a/dlls/avifil32/tests/Makefile.in b/dlls/avifil32/tests/Makefile.in index 658b096..abe1ad4 100644 --- a/dlls/avifil32/tests/Makefile.in +++ b/dlls/avifil32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = avifil32.dll -IMPORTS = avifil32 +IMPORTS = avifil32 ole32 C_SRCS = \ api.c diff --git a/dlls/avifil32/tests/api.c b/dlls/avifil32/tests/api.c index 4b87806..22c15c5 100644 --- a/dlls/avifil32/tests/api.c +++ b/dlls/avifil32/tests/api.c @@ -19,14 +19,13 @@ * */ -#include <stdarg.h> +#define COBJMACROS +#define CONST_VTABLE -#include "windef.h" -#include "winbase.h" -#include "winerror.h" +#include "wine/test.h" +#include "initguid.h" #include "wingdi.h" #include "vfw.h" -#include "wine/test.h" /* ########################### */ @@ -541,7 +540,114 @@ static void test_ash1_corruption2(void) ok(DeleteFile(filename) !=0, "Deleting file %s failed\n", filename); } -/* ########################### */ +/* Outer IUnknown for COM aggregation tests */ +struct unk_impl { + IUnknown IUnknown_iface; + LONG ref; + IUnknown *inner_unk; +}; + +static inline struct unk_impl *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct unk_impl, IUnknown_iface); +} + +static HRESULT WINAPI unk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) +{ + struct unk_impl *This = impl_from_IUnknown(iface); + LONG ref = This->ref; + HRESULT hr; + + if (IsEqualGUID(riid, &IID_IUnknown)) + { + *ppv = iface; + IUnknown_AddRef(iface); + return S_OK; + } + + hr = IUnknown_QueryInterface(This->inner_unk, riid, ppv); + if (hr == S_OK) + { + trace("Working around COM aggregation ref counting bug\n"); + ok(ref == This->ref, "Outer ref count expected %d got %d\n", ref, This->ref); + IUnknown_AddRef((IUnknown*)*ppv); + ref = IUnknown_Release(This->inner_unk); + ok(ref == 1, "Inner ref count expected 1 got %d\n", ref); + } + + return hr; +} + +static ULONG WINAPI unk_AddRef(IUnknown *iface) +{ + struct unk_impl *This = impl_from_IUnknown(iface); + + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI unk_Release(IUnknown *iface) +{ + struct unk_impl *This = impl_from_IUnknown(iface); + + return InterlockedDecrement(&This->ref); +} + +static const IUnknownVtbl unk_vtbl = +{ + unk_QueryInterface, + unk_AddRef, + unk_Release +}; + +static void test_COM(void) +{ + struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL}; + IAVIFile *avif = NULL; + IPersistFile *pf; + IUnknown *unk; + LONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_AVIFile, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&unk_obj.inner_unk); + ok(hr == S_OK, "COM aggregation failed: %08x, expected S_OK\n", hr); + hr = IUnknown_QueryInterface(&unk_obj.IUnknown_iface, &IID_IAVIFile, (void**)&avif); + ok(hr == S_OK, "QueryInterface for IID_IAVIFile failed: %08x\n", hr); + refcount = IAVIFile_AddRef(avif); + ok(refcount == unk_obj.ref, "AVIFile just pretends to support COM aggregation\n"); + refcount = IAVIFile_Release(avif); + ok(refcount == unk_obj.ref, "AVIFile just pretends to support COM aggregation\n"); + hr = IAVIFile_QueryInterface(avif, &IID_IPersistFile, (void**)&pf); + ok(hr == S_OK, "QueryInterface for IID_IPersistFile failed: %08x\n", hr); + refcount = IPersistFile_Release(pf); + ok(refcount == unk_obj.ref, "AVIFile just pretends to support COM aggregation\n"); + refcount = IAVIFile_Release(avif); + ok(refcount == 19, "Outer ref count should be back at 19 but is %d\n", refcount); + refcount = IUnknown_Release(unk_obj.inner_unk); + ok(refcount == 0, "Inner ref count should be 0 but is %u\n", refcount); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_AVIFile, NULL, CLSCTX_INPROC_SERVER, &IID_IAVIStream, + (void**)&avif); + ok(hr == E_NOINTERFACE, "AVIFile create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount */ + hr = CoCreateInstance(&CLSID_AVIFile, NULL, CLSCTX_INPROC_SERVER, &IID_IAVIFile, (void**)&avif); + ok(hr == S_OK, "AVIFile create failed: %08x, expected S_OK\n", hr); + refcount = IAVIFile_AddRef(avif); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + hr = IAVIFile_QueryInterface(avif, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + hr = IAVIFile_QueryInterface(avif, &IID_IPersistFile, (void**)&pf); + ok(hr == S_OK, "QueryInterface for IID_IPersistFile failed: %08x\n", hr); + refcount = IPersistFile_AddRef(pf); + ok(refcount == 6, "refcount == %u, expected 6\n", refcount); + + while (IAVIFile_Release(avif)); +} START_TEST(api) { @@ -553,6 +659,7 @@ START_TEST(api) test_amh_corruption(); test_ash1_corruption(); test_ash1_corruption2(); + test_COM(); AVIFileExit(); }
1
0
0
0
Michael Stefaniuc : avifil32: Support COM aggregation for AVIFile.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: 7854cce7575735cd06d0ef340015ef95831d47f2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7854cce7575735cd06d0ef340…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 7 00:45:08 2013 +0100 avifil32: Support COM aggregation for AVIFile. Ref counting bug in QueryInterface comes free of charge! --- dlls/avifil32/avifile.c | 118 ++++++++++++++++++++++++++------------- dlls/avifil32/avifile_private.h | 2 +- dlls/avifil32/factory.c | 13 +++- 3 files changed, 91 insertions(+), 42 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 408808c..ab60c3a 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -30,6 +30,7 @@ * When index is missing it works, but index seems to be okay. */ +#define COBJMACROS #include <assert.h> #include <stdarg.h> @@ -118,8 +119,10 @@ typedef struct _IAVIStreamImpl { } IAVIStreamImpl; struct _IAVIFileImpl { + IUnknown IUnknown_inner; IAVIFile IAVIFile_iface; IPersistFile IPersistFile_iface; + IUnknown *outer_unk; LONG ref; AVIFILEINFOW fInfo; @@ -144,6 +147,11 @@ struct _IAVIFileImpl { 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); @@ -180,32 +188,37 @@ static HRESULT AVIFILE_WriteBlock(IAVIStreamImpl *This, DWORD block, FOURCC ckid, DWORD flags, LPCVOID buffer, LONG size); -static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, - LPVOID *obj) +static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, void **ppv) { - IAVIFileImpl *This = impl_from_IAVIFile(iface); - - TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj); + IAVIFileImpl *This = impl_from_IUnknown(iface); - if (IsEqualGUID(&IID_IUnknown, refiid) || - IsEqualGUID(&IID_IAVIFile, refiid)) { - *obj = iface; - IAVIFile_AddRef(iface); + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv); - return S_OK; - } else if (IsEqualGUID(&IID_IPersistFile, refiid)) { - *obj = &This->IPersistFile_iface; - IAVIFile_AddRef(iface); + if (!ppv) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + *ppv = NULL; - return S_OK; + 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; } - return E_NOINTERFACE; + /* Violation of the COM aggregation ref counting rule */ + IUnknown_AddRef(&This->IUnknown_inner); + return S_OK; } -static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) +static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface) { - IAVIFileImpl *This = impl_from_IAVIFile(iface); + IAVIFileImpl *This = impl_from_IUnknown(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -213,29 +226,26 @@ static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) return ref; } -static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) +static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface) { - IAVIFileImpl *This = impl_from_IAVIFile(iface); + IAVIFileImpl *This = impl_from_IUnknown(iface); ULONG ref = InterlockedDecrement(&This->ref); UINT i; 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; } } @@ -264,6 +274,34 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) return ref; } +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); @@ -485,25 +523,25 @@ static const struct IAVIFileVtbl avif_vt = { }; -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID refiid, void **ppv) +static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID riid, void **ppv) { IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_QueryInterface(&This->IAVIFile_iface, refiid, ppv); + return IUnknown_QueryInterface(This->outer_unk, riid, ppv); } static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface) { IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_AddRef(&This->IAVIFile_iface); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface) { IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_Release(&This->IAVIFile_iface); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, LPCLSID pClassID) @@ -634,7 +672,7 @@ static const struct IPersistFileVtbl pf_vt = { IPersistFile_fnGetCurFile }; -HRESULT AVIFILE_CreateAVIFile(REFIID riid, void **ppv) +HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, void **ppv) { IAVIFileImpl *obj; HRESULT hr; @@ -644,13 +682,17 @@ HRESULT AVIFILE_CreateAVIFile(REFIID riid, void **ppv) 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 = 0; - - hr = IAVIFile_QueryInterface(&obj->IAVIFile_iface, riid, ppv); - if (FAILED(hr)) - HeapFree(GetProcessHeap(), 0, obj); + 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; } diff --git a/dlls/avifil32/avifile_private.h b/dlls/avifil32/avifile_private.h index b9390c6..01f0ae6 100644 --- a/dlls/avifil32/avifile_private.h +++ b/dlls/avifil32/avifile_private.h @@ -58,7 +58,7 @@ DEFINE_AVIGUID(CLSID_ACMStream, 0x0002000F, 0, 0); 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; diff --git a/dlls/avifil32/factory.c b/dlls/avifil32/factory.c index 295f11f..330022c 100644 --- a/dlls/avifil32/factory.c +++ b/dlls/avifil32/factory.c @@ -140,12 +140,19 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface, 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))
1
0
0
0
Michael Stefaniuc : avifil32: Avoid forward declaration of IAVIFile/ IPersistFile methods.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: 39127a0700855f5dd8db695cdfb2066ece708b85 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=39127a0700855f5dd8db695cd…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 7 00:43:14 2013 +0100 avifil32: Avoid forward declaration of IAVIFile/IPersistFile methods. --- dlls/avifil32/avifile.c | 119 ++++++++++++++++++----------------------------- 1 files changed, 46 insertions(+), 73 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 8ea6127..408808c 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -54,54 +54,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(avifile); #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); static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface); @@ -228,30 +180,6 @@ static HRESULT AVIFILE_WriteBlock(IAVIStreamImpl *This, DWORD block, FOURCC ckid, DWORD flags, LPCVOID buffer, LONG size); -HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv) -{ - IAVIFileImpl *pfile; - HRESULT hr; - - assert(riid != NULL && ppv != NULL); - - *ppv = NULL; - - pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl)); - if (pfile == NULL) - return AVIERR_MEMORY; - - pfile->IAVIFile_iface.lpVtbl = &iavift; - pfile->IPersistFile_iface.lpVtbl = &ipersistft; - pfile->ref = 0; - - hr = IAVIFile_QueryInterface(&pfile->IAVIFile_iface, riid, ppv); - if (FAILED(hr)) - HeapFree(GetProcessHeap(), 0, pfile); - - return hr; -} - static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, LPVOID *obj) { @@ -543,6 +471,19 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO return AVIERR_NODATA; } +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 refiid, void **ppv) { @@ -681,7 +622,39 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *p 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(REFIID riid, void **ppv) +{ + IAVIFileImpl *obj; + HRESULT hr; + + *ppv = NULL; + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl)); + if (!obj) + return AVIERR_MEMORY; + + obj->IAVIFile_iface.lpVtbl = &avif_vt; + obj->IPersistFile_iface.lpVtbl = &pf_vt; + obj->ref = 0; + + hr = IAVIFile_QueryInterface(&obj->IAVIFile_iface, riid, ppv); + if (FAILED(hr)) + HeapFree(GetProcessHeap(), 0, obj); + + return hr; +} + static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID refiid, LPVOID *obj)
1
0
0
0
Michael Stefaniuc : avifil32: Merge and cleanup the IPersistFile iface.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: c52d915e2b6ee0cdfb96c4bbf5d99724fd54d7c5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c52d915e2b6ee0cdfb96c4bbf…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 7 00:42:27 2013 +0100 avifil32: Merge and cleanup the IPersistFile iface. --- dlls/avifil32/avifile.c | 115 ++++++++++++++++++----------------------------- 1 files changed, 44 insertions(+), 71 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index b8811fd..8ea6127 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -136,14 +136,6 @@ static const struct IAVIStreamVtbl iavist = { 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; @@ -175,11 +167,9 @@ typedef struct _IAVIStreamImpl { struct _IAVIFileImpl { IAVIFile IAVIFile_iface; + IPersistFile IPersistFile_iface; LONG ref; - /* IAVIFile stuff... */ - IPersistFileImpl iPersistFile; - AVIFILEINFOW fInfo; IAVIStreamImpl *ppStreams[MAX_AVISTREAMS]; @@ -207,6 +197,11 @@ 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); +} + /***********************************************************************/ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, @@ -247,9 +242,8 @@ HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv) return AVIERR_MEMORY; pfile->IAVIFile_iface.lpVtbl = &iavift; + pfile->IPersistFile_iface.lpVtbl = &ipersistft; pfile->ref = 0; - pfile->iPersistFile.lpVtbl = &ipersistft; - pfile->iPersistFile.paf = pfile; hr = IAVIFile_QueryInterface(&pfile->IAVIFile_iface, riid, ppv); if (FAILED(hr)) @@ -272,7 +266,7 @@ static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, return S_OK; } else if (IsEqualGUID(&IID_IPersistFile, refiid)) { - *obj = &This->iPersistFile; + *obj = &This->IPersistFile_iface; IAVIFile_AddRef(iface); return S_OK; @@ -549,38 +543,29 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO return AVIERR_NODATA; } -/***********************************************************************/ -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, - REFIID refiid, LPVOID *obj) +static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID refiid, void **ppv) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; - - assert(This->paf != NULL); + IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj); + return IAVIFile_QueryInterface(&This->IAVIFile_iface, refiid, ppv); } -static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface) +static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); - - return IAVIFile_AddRef((PAVIFILE)This->paf); + return IAVIFile_AddRef(&This->IAVIFile_iface); } -static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface) +static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); - - return IAVIFile_Release((PAVIFILE)This->paf); + return IAVIFile_Release(&This->IAVIFile_iface); } -static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, - LPCLSID pClassID) +static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, LPCLSID pClassID) { TRACE("(%p,%p)\n", iface, pClassID); @@ -594,20 +579,16 @@ static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, 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); + return (This->fDirty ? S_OK : S_FALSE); } -static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, - LPCOLESTR pszFileName, DWORD dwMode) +static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; - + IAVIFileImpl *This = impl_from_IPersistFile(iface); int len; TRACE("(%p,%s,0x%08X)\n", iface, debugstr_w(pszFileName), dwMode); @@ -616,53 +597,49 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, 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); + WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1, szFileName, len, NULL, NULL); - This->paf->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode); + 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); + return AVIFILE_LoadFile(This); } -static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, - LPCOLESTR pszFileName,BOOL fRemember) +static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, LPCOLESTR pszFileName, + BOOL fRemember) { TRACE("(%p,%s,%d)\n", iface, debugstr_w(pszFileName), fRemember); @@ -671,8 +648,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile *iface, 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)); @@ -681,10 +657,9 @@ static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile *iface, return AVIERR_OK; } -static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, - LPOLESTR *ppszFileName) +static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *ppszFileName) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); TRACE("(%p,%p)\n", iface, ppszFileName); @@ -693,16 +668,14 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, *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;
1
0
0
0
Michael Stefaniuc : avifil32: COM cleanup for the IAVIFile iface.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: 8e6c79b3ccac1660fc36fc7f52e897265388b92c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8e6c79b3ccac1660fc36fc7f5…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Thu Mar 7 00:39:26 2013 +0100 avifil32: COM cleanup for the IAVIFile iface. --- dlls/avifil32/avifile.c | 69 ++++++++++++++++++++++------------------------ 1 files changed, 33 insertions(+), 36 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 885d239..b8811fd 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -174,9 +174,8 @@ typedef struct _IAVIStreamImpl { } IAVIStreamImpl; struct _IAVIFileImpl { - /* IUnknown stuff */ - const IAVIFileVtbl *lpVtbl; - LONG ref; + IAVIFile IAVIFile_iface; + LONG ref; /* IAVIFile stuff... */ IPersistFileImpl iPersistFile; @@ -203,6 +202,11 @@ struct _IAVIFileImpl { BOOL fDirty; }; +static inline IAVIFileImpl *impl_from_IAVIFile(IAVIFile *iface) +{ + return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIFile_iface); +} + /***********************************************************************/ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, @@ -242,12 +246,12 @@ HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv) if (pfile == NULL) return AVIERR_MEMORY; - pfile->lpVtbl = &iavift; + pfile->IAVIFile_iface.lpVtbl = &iavift; pfile->ref = 0; pfile->iPersistFile.lpVtbl = &ipersistft; pfile->iPersistFile.paf = pfile; - hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv); + hr = IAVIFile_QueryInterface(&pfile->IAVIFile_iface, riid, ppv); if (FAILED(hr)) HeapFree(GetProcessHeap(), 0, pfile); @@ -257,7 +261,7 @@ HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv) static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, LPVOID *obj) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj); @@ -274,26 +278,26 @@ static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, return S_OK; } - return OLE_E_ENUM_NOMORE; + return E_NOINTERFACE; } static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(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; - UINT i; + IAVIFileImpl *This = impl_from_IAVIFile(iface); ULONG ref = InterlockedDecrement(&This->ref); + UINT i; - TRACE("(%p) -> %d\n", iface, ref); + TRACE("(%p) ref=%d\n", This, ref); if (!ref) { if (This->fDirty) { @@ -338,10 +342,9 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) return ref; } -static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi, - LONG size) +static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%d)\n",iface,afi,size); @@ -359,11 +362,10 @@ static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi, return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis, - DWORD fccType, LONG lParam) +static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, + LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - + IAVIFileImpl *This = impl_from_IAVIFile(iface); ULONG nStream; TRACE("(%p,%p,0x%08X,%d)\n", iface, avis, fccType, lParam); @@ -386,11 +388,10 @@ static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis, return AVIERR_NODATA; } -static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis, - LPAVISTREAMINFOW asi) +static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, + AVISTREAMINFOW *asi) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - + IAVIFileImpl *This = impl_from_IAVIFile(iface); DWORD n; TRACE("(%p,%p,%p)\n", iface, avis, asi); @@ -440,10 +441,9 @@ static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis, return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG size) +static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void *lpData, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%d)\n", iface, ckid, lpData, size); @@ -462,10 +462,9 @@ static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, return WriteExtraChunk(&This->fileextra, ckid, lpData, size); } -static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG *size) +static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void *lpData, LONG *size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%p)\n", iface, ckid, lpData, size); @@ -474,7 +473,7 @@ static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p)\n",iface); @@ -513,11 +512,9 @@ static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile *iface) return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, - LONG lParam) +static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - + IAVIFileImpl *This = impl_from_IAVIFile(iface); ULONG nStream; TRACE("(%p,0x%08X,%d)\n", iface, fccType, lParam); @@ -741,7 +738,7 @@ static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface) /* 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; } @@ -754,7 +751,7 @@ static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) TRACE("(%p) -> %d\n", iface, ref); if (This->paf != NULL) - IAVIFile_Release((PAVIFILE)This->paf); + IAVIFile_Release(&This->paf->IAVIFile_iface); return ref; }
1
0
0
0
Alistair Leslie-Hughes : msxml3: Implement IXMLParser Get/Set Factory.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: 850d077a4bf65a3c4f0682589eff2692ba8d2f63 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=850d077a4bf65a3c4f0682589…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Wed Mar 6 16:01:45 2013 +1100 msxml3: Implement IXMLParser Get/Set Factory. --- dlls/msxml3/tests/xmlparser.c | 88 +++++++++++++++++++++++++++++++++++++++++ dlls/msxml3/xmlparser.c | 28 +++++++++++-- 2 files changed, 112 insertions(+), 4 deletions(-) diff --git a/dlls/msxml3/tests/xmlparser.c b/dlls/msxml3/tests/xmlparser.c index 4bf80bb..46812c8 100644 --- a/dlls/msxml3/tests/xmlparser.c +++ b/dlls/msxml3/tests/xmlparser.c @@ -28,10 +28,81 @@ #include "xmlparser.h" #include "wine/test.h" + +static HRESULT WINAPI nodefact_QueryInterface(IXMLNodeFactory *iface, + REFIID riid, void **ppvObject) +{ + *ppvObject = NULL; + + if (IsEqualGUID(riid, &IID_IXMLNodeFactory) || + IsEqualGUID(riid, &IID_IUnknown)) + *ppvObject = iface; + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI nodefact_AddRef(IXMLNodeFactory *iface) +{ + return 2; +} + +static ULONG WINAPI nodefact_Release(IXMLNodeFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI nodefact_NotifyEvent(IXMLNodeFactory *iface, + IXMLNodeSource *pSource, XML_NODEFACTORY_EVENT iEvt) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI nodefact_BeginChildren(IXMLNodeFactory *iface, + IXMLNodeSource *pSource, XML_NODE_INFO *pNodeInfo) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI nodefact_EndChildren(IXMLNodeFactory *iface, + IXMLNodeSource *pSource, BOOL fEmpty, XML_NODE_INFO *pNodeInfo) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI nodefact_Error(IXMLNodeFactory *iface, + IXMLNodeSource *pSource, HRESULT hrErrorCode, USHORT cNumRecs, + XML_NODE_INFO **ppNodeInfo) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI nodefact_CreateNode(IXMLNodeFactory *iface, IXMLNodeSource *pSource, + PVOID pNodeParent, USHORT cNumRecs, XML_NODE_INFO **ppNodeInfo) +{ + return E_NOTIMPL; +} + +static const IXMLNodeFactoryVtbl nodefactoryVtbl = +{ + nodefact_QueryInterface, + nodefact_AddRef, + nodefact_Release, + nodefact_NotifyEvent, + nodefact_BeginChildren, + nodefact_EndChildren, + nodefact_Error, + nodefact_CreateNode +}; + +static IXMLNodeFactory thenodefactory = { &nodefactoryVtbl }; + static void create_test(void) { HRESULT hr; IXMLParser *parser; + IXMLNodeFactory *nodefactory; DWORD flags; hr = CoCreateInstance(&CLSID_XMLParser30, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLParser, (void**)&parser); @@ -50,6 +121,23 @@ static void create_test(void) flags = IXMLParser_GetFlags(parser); ok(flags == XMLFLAG_SAX, "Expected 0 got %d\n", flags); + hr = IXMLParser_GetFactory(parser, NULL); + ok(hr == E_INVALIDARG, "Expected S_OK got 0x%08x\n", hr); + + hr = IXMLParser_GetFactory(parser, &nodefactory); + ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); + ok(nodefactory == NULL, "expected NULL\n"); + + hr = IXMLParser_SetFactory(parser, &thenodefactory); + ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); + + hr = IXMLParser_GetFactory(parser, &nodefactory); + ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); + ok(nodefactory == &thenodefactory, "expected NULL\n"); + + hr = IXMLParser_SetFactory(parser, NULL); + ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); + hr = IXMLParser_SetFlags(parser, 0); ok(hr == S_OK, "Expected S_OK got 0x%08x\n", hr); diff --git a/dlls/msxml3/xmlparser.c b/dlls/msxml3/xmlparser.c index f18f454..154e439 100644 --- a/dlls/msxml3/xmlparser.c +++ b/dlls/msxml3/xmlparser.c @@ -46,6 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); typedef struct _xmlparser { IXMLParser IXMLParser_iface; + IXMLNodeFactory *nodefactory; LONG ref; int flags; @@ -95,6 +96,9 @@ static ULONG WINAPI xmlparser_Release(IXMLParser* iface) TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) { + if(This->nodefactory) + IXMLNodeFactory_Release(This->nodefactory); + heap_free( This ); } @@ -106,18 +110,33 @@ static HRESULT WINAPI xmlparser_SetFactory(IXMLParser *iface, IXMLNodeFactory *p { xmlparser *This = impl_from_IXMLParser( iface ); - FIXME("(%p %p)\n", This, pNodeFactory); + TRACE("(%p %p)\n", This, pNodeFactory); - return E_NOTIMPL; + if(This->nodefactory) + IXMLNodeFactory_Release(This->nodefactory); + + This->nodefactory = pNodeFactory; + if(This->nodefactory) + IXMLNodeFactory_AddRef(This->nodefactory); + + return S_OK; } static HRESULT WINAPI xmlparser_GetFactory(IXMLParser *iface, IXMLNodeFactory **ppNodeFactory) { xmlparser *This = impl_from_IXMLParser( iface ); - FIXME("(%p, %p)\n", This, ppNodeFactory); + TRACE("(%p, %p)\n", This, ppNodeFactory); - return E_NOTIMPL; + if(!ppNodeFactory) + return E_INVALIDARG; + + *ppNodeFactory = This->nodefactory; + + if(*ppNodeFactory) + IXMLNodeFactory_AddRef(*ppNodeFactory); + + return S_OK; } static HRESULT WINAPI xmlparser_Abort(IXMLParser *iface, BSTR bstrErrorInfo) @@ -415,6 +434,7 @@ HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj) return E_OUTOFMEMORY; This->IXMLParser_iface.lpVtbl = &xmlparser_vtbl; + This->nodefactory = NULL; This->flags = 0; This->ref = 1;
1
0
0
0
Alistair Leslie-Hughes : msxml3: Add xmlns attribute test.
by Alexandre Julliard
07 Mar '13
07 Mar '13
Module: wine Branch: master Commit: 461951e3d4427cfa702a9cfea199d777fa9dcd49 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=461951e3d4427cfa702a9cfea…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Tue Mar 5 09:21:03 2013 +1100 msxml3: Add xmlns attribute test. --- dlls/msxml3/tests/domdoc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index d69547f..8775312 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -10754,6 +10754,61 @@ static void test_nodeValue(void) IXMLDOMDocument_Release(doc); } +void test_xmlns_attribute(void) +{ + BSTR str; + IXMLDOMDocument *doc; + IXMLDOMElement *root; + IXMLDOMAttribute *pAttribute; + IXMLDOMElement *elem; + HRESULT hr; + + doc = create_document(&IID_IXMLDOMDocument); + if (!doc) return; + + hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &root); + EXPECT_HR(hr, S_OK); + + hr = IXMLDOMDocument_appendChild(doc, (IXMLDOMNode*)root, NULL); + EXPECT_HR(hr, S_OK); + + str = SysAllocString(szAttribute); + hr = IXMLDOMDocument_createAttribute(doc, _bstr_("xmlns:dt"), &pAttribute); + ok( hr == S_OK, "returns %08x\n", hr ); + if(hr == S_OK) + { + VARIANT v; + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = _bstr_("urn:schemas-microsoft-com:datatypes"); + hr = IXMLDOMAttribute_put_nodeValue(pAttribute, v); + + hr = IXMLDOMElement_setAttributeNode(root, pAttribute, NULL); + ok(hr == S_OK, "ret %08x\n", hr ); + + hr = IXMLDOMNode_put_dataType((IXMLDOMNode*)root, _bstr_("bin.base64")); + ok(hr == S_OK, "ret %08x\n", hr ); + + hr = IXMLDOMDocument_get_documentElement(doc, &elem); + EXPECT_HR(hr, S_OK); + + hr = IXMLDOMElement_get_xml(elem, &str); + ok( hr == S_OK, "got 0x%08x\n", hr); + todo_wine ok( lstrcmpW(str, _bstr_("<Testing xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"bin.base64\"/>")) == 0, + "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + IXMLDOMElement_Release(elem); + IXMLDOMAttribute_Release( pAttribute); + } + + SysFreeString(str); + + IXMLDOMDocument_Release(doc); + + free_bstrs(); +} + static const char namespacesA[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" " <ns1:elem1 xmlns:ns1=\"
http://blah.org\
" b='1' >" @@ -11461,6 +11516,7 @@ START_TEST(domdoc) test_put_data(); test_putref_schemas(); test_namedmap_newenum(); + test_xmlns_attribute(); test_xsltemplate(); test_xsltext();
1
0
0
0
Francois Gouget : qcap: Fix compilation on systems that have v4l1 but not VIDIOCMCAPTURE & co.
by Alexandre Julliard
06 Mar '13
06 Mar '13
Module: wine Branch: master Commit: e920d1a661de133e941eb07bf0ad8ead0b0f38d9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e920d1a661de133e941eb07bf…
Author: Francois Gouget <fgouget(a)free.fr> Date: Wed Mar 6 15:11:40 2013 +0100 qcap: Fix compilation on systems that have v4l1 but not VIDIOCMCAPTURE & co. --- dlls/qcap/v4l.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index 41cc752..0880499 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -71,7 +71,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap_v4l); -#if defined(HAVE_LINUX_VIDEODEV_H) || defined(HAVE_LIBV4L1_H) +#ifdef VIDIOCMCAPTURE static typeof(open) *video_open = open; static typeof(close) *video_close = close; @@ -973,4 +973,4 @@ HRESULT qcap_driver_stop(Capture *capBox, FILTER_STATE *state) FAIL_WITH_ERR; } -#endif /* HAVE_LINUX_VIDEODEV_H || HAVE_LINUX_LIBV4L1_H */ +#endif /* defined(VIDIOCMCAPTURE) */
1
0
0
0
Francois Gouget : msvcrt: Remove WINAPI on static functions where not needed.
by Alexandre Julliard
06 Mar '13
06 Mar '13
Module: wine Branch: master Commit: c3913adb9bd5f2ad31cdf6387f315608ca0487b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c3913adb9bd5f2ad31cdf6387…
Author: Francois Gouget <fgouget(a)free.fr> Date: Wed Mar 6 15:07:51 2013 +0100 msvcrt: Remove WINAPI on static functions where not needed. --- dlls/msvcrt/except.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index 32cf3b0..b77daa1 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -86,7 +86,7 @@ static const struct { EXCEPTION_FLT_UNDERFLOW, MSVCRT__FPE_UNDERFLOW }, }; -static LONG WINAPI msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except) +static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except) { LONG ret = EXCEPTION_CONTINUE_SEARCH; MSVCRT___sighandler_t handler;
1
0
0
0
Hans Leidekker : wininet: Port resolution doesn't depend on the secure flag .
by Alexandre Julliard
06 Mar '13
06 Mar '13
Module: wine Branch: master Commit: 6a609c21bbee8287b2ee6d027013855843106a43 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6a609c21bbee8287b2ee6d027…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Mar 6 13:30:49 2013 +0100 wininet: Port resolution doesn't depend on the secure flag. --- dlls/wininet/http.c | 19 +++++++++++-------- dlls/wininet/tests/http.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 468fee6..8fec2a4 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -283,7 +283,7 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL server_t *iter, *server = NULL; if(port == INTERNET_INVALID_PORT_NUMBER) - port = is_https ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT; + port = INTERNET_DEFAULT_HTTP_PORT; EnterCriticalSection(&connection_pool_cs); @@ -1706,6 +1706,9 @@ static WCHAR *build_proxy_path_url(http_request_t *req) */ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_request_t *request) { + static const WCHAR protoHttp[] = { 'h','t','t','p',0 }; + static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }; + static const WCHAR szFormat[] = { 'h','t','t','p',':','/','/','%','s',0 }; WCHAR buf[INTERNET_MAX_HOST_NAME_LENGTH]; WCHAR protoProxy[INTERNET_MAX_URL_LENGTH]; DWORD protoProxyLen = INTERNET_MAX_URL_LENGTH; @@ -1713,9 +1716,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req static WCHAR szNul[] = { 0 }; URL_COMPONENTSW UrlComponents; server_t *new_server; - static const WCHAR protoHttp[] = { 'h','t','t','p',0 }; - static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }; - static const WCHAR szFormat[] = { 'h','t','t','p',':','/','/','%','s',0 }; + BOOL is_https; memset( &UrlComponents, 0, sizeof UrlComponents ); UrlComponents.dwStructSize = sizeof UrlComponents; @@ -1737,7 +1738,11 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req if( !request->path ) request->path = szNul; - new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, UrlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE); + is_https = (UrlComponents.nScheme == INTERNET_SCHEME_HTTPS); + if (is_https && UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER) + UrlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT; + + new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, is_https, TRUE); if(!new_server) return FALSE; @@ -3160,9 +3165,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, HTTP_ProcessHeader(request, hostW, request->server->canon_host_port, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); if (session->hostPort == INTERNET_INVALID_PORT_NUMBER) - session->hostPort = (dwFlags & INTERNET_FLAG_SECURE ? - INTERNET_DEFAULT_HTTPS_PORT : - INTERNET_DEFAULT_HTTP_PORT); + session->hostPort = INTERNET_DEFAULT_HTTP_PORT; if (hIC->proxy && hIC->proxy[0]) HTTP_DealWithProxy( hIC, session, request ); diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 5f7a961..c682930 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -4013,6 +4013,34 @@ static void test_connection_failure(void) InternetCloseHandle(session); } +static void test_default_service_port(void) +{ + HINTERNET session, connect, request; + DWORD error; + BOOL ret; + + session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(session != NULL, "InternetOpen failed\n"); + + connect = InternetConnect(session, "
test.winehq.org
", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, + INTERNET_SERVICE_HTTP, 0, 0); + ok(connect != NULL, "InternetConnect failed\n"); + + request = HttpOpenRequest(connect, NULL, "/", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0); + ok(request != NULL, "HttpOpenRequest failed\n"); + + SetLastError(0xdeadbeef); + ret = HttpSendRequest(request, NULL, 0, NULL, 0); + error = GetLastError(); + ok(!ret, "HttpSendRequest succeeded\n"); + ok(error == ERROR_INTERNET_SECURITY_CHANNEL_ERROR || error == ERROR_INTERNET_CANNOT_CONNECT, + "got %u\n", error); + + InternetCloseHandle(request); + InternetCloseHandle(connect); + InternetCloseHandle(session); +} + static void init_status_tests(void) { memset(expect, 0, sizeof(expect)); @@ -4091,4 +4119,5 @@ START_TEST(http) HttpSendRequestEx_test(); InternetReadFile_test(INTERNET_FLAG_ASYNC, &test_data[3]); test_connection_failure(); + test_default_service_port(); }
1
0
0
0
← Newer
1
...
38
39
40
41
42
43
44
...
54
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Results per page:
10
25
50
100
200