ReactOS.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
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
List overview
Download
Ros-diffs
August 2016
----- 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
ros-diffs@reactos.org
20 participants
462 discussions
Start a n
N
ew thread
[akhaldi] 72348: [OLE32] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:38:43 2016 New Revision: 72348 URL:
http://svn.reactos.org/svn/reactos?rev=72348&view=rev
Log: [OLE32] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/dll/win32/ole32/classmoniker.c trunk/reactos/dll/win32/ole32/clipboard.c trunk/reactos/dll/win32/ole32/comcat.c trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/datacache.c trunk/reactos/dll/win32/ole32/ftmarshal.c trunk/reactos/dll/win32/ole32/marshal.c trunk/reactos/dll/win32/ole32/moniker.c trunk/reactos/dll/win32/ole32/ole2.c trunk/reactos/dll/win32/ole32/ole2stubs.c trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/stg_prop.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/ole32/classmoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/classmonik…
============================================================================== --- trunk/reactos/dll/win32/ole32/classmoniker.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/classmoniker.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -218,7 +218,7 @@ IClassActivator *pActivator; HRESULT hr; - TRACE("(%p,%p,%p,%p)\n", pbc, pmkToLeft, riid, ppvResult); + TRACE("(%p, %p, %s, %p)\n", pbc, pmkToLeft, debugstr_guid(riid), ppvResult); bindopts.cbStruct = sizeof(bindopts); IBindCtx_GetBindOptions(pbc, (BIND_OPTS *)&bindopts); @@ -251,7 +251,7 @@ REFIID riid, VOID** ppvResult) { - TRACE("(%p,%p,%p,%p)\n",pbc, pmkToLeft, riid, ppvResult); + TRACE("(%p, %p, %s, %p)\n", pbc, pmkToLeft, debugstr_guid(riid), ppvResult); return IMoniker_BindToObject(iface, pbc, pmkToLeft, riid, ppvResult); } @@ -573,7 +573,7 @@ ClassMoniker *This = impl_from_IROTData(iface); - TRACE("(%p,%p,%p)\n",iface,riid,ppvObject); + TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject); return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppvObject); } Modified: trunk/reactos/dll/win32/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.…
============================================================================== --- trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/clipboard.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -1799,7 +1799,7 @@ * * Enumerate all formats supported by the source and make * those formats available using delayed rendering using SetClipboardData. - * Cache the enumeration list and make that list visibile as the + * Cache the enumeration list and make that list visible as the * 'Ole Private Data' format on the clipboard. * */ Modified: trunk/reactos/dll/win32/ole32/comcat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/comcat.c?r…
============================================================================== --- trunk/reactos/dll/win32/ole32/comcat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/comcat.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -229,11 +229,7 @@ if (res != ERROR_SUCCESS) return S_FALSE; for (string = impl_strings; *string; string += CHARS_IN_GUID) { HKEY catkey; -#ifdef __REACTOS__ res = open_classes_key(subkey, string, READ_CONTROL, &catkey); -#else - res = open_classes_key(subkey, string, 0, &catkey); -#endif if (res != ERROR_SUCCESS) { RegCloseKey(subkey); return S_FALSE; Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -4967,8 +4967,8 @@ context->IComThreadingInfo_iface.lpVtbl = &Context_Threading_Vtbl; context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl; context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl; - /* Context token does not take a reference, it's always zero until - interface is explicitely requested with CoGetObjectContext(). */ + /* Context token does not take a reference, it's always zero until the + interface is explicitly requested with CoGetObjectContext(). */ context->refs = 0; info->context_token = &context->IObjContext_iface; Modified: trunk/reactos/dll/win32/ole32/datacache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/datacache.…
============================================================================== --- trunk/reactos/dll/win32/ole32/datacache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/datacache.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -117,8 +117,8 @@ /* * List all interface here */ + IUnknown IUnknown_inner; IDataObject IDataObject_iface; - IUnknown IUnknown_iface; IPersistStorage IPersistStorage_iface; IViewObject2 IViewObject2_iface; IOleCache2 IOleCache2_iface; @@ -136,7 +136,7 @@ /* * IUnknown implementation of the outer object. */ - IUnknown* outerUnknown; + IUnknown *outer_unk; /* * The user of this object can setup ONE advise sink @@ -174,7 +174,7 @@ static inline DataCache *impl_from_IUnknown( IUnknown *iface ) { - return CONTAINING_RECORD(iface, DataCache, IUnknown_iface); + return CONTAINING_RECORD(iface, DataCache, IUnknown_inner); } static inline DataCache *impl_from_IPersistStorage( IPersistStorage *iface ) @@ -956,7 +956,7 @@ { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -967,7 +967,7 @@ { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -978,7 +978,7 @@ { DataCache *this = impl_from_IDataObject(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1136,7 +1136,7 @@ { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1147,7 +1147,7 @@ { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1158,7 +1158,7 @@ { DataCache *this = impl_from_IPersistStorage(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1497,7 +1497,7 @@ { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1508,7 +1508,7 @@ { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1519,7 +1519,7 @@ { DataCache *this = impl_from_IViewObject2(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -1921,7 +1921,7 @@ { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -1932,7 +1932,7 @@ { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -1943,7 +1943,7 @@ { DataCache *this = impl_from_IOleCache2(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /***************************************************************************** @@ -2120,7 +2120,7 @@ { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); + return IUnknown_QueryInterface(this->outer_unk, riid, ppvObject); } /************************************************************************ @@ -2131,7 +2131,7 @@ { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_AddRef(this->outerUnknown); + return IUnknown_AddRef(this->outer_unk); } /************************************************************************ @@ -2142,7 +2142,7 @@ { DataCache *this = impl_from_IOleCacheControl(iface); - return IUnknown_Release(this->outerUnknown); + return IUnknown_Release(this->outer_unk); } /************************************************************************ @@ -2364,29 +2364,14 @@ * Initialize the virtual function table. */ newObject->IDataObject_iface.lpVtbl = &DataCache_IDataObject_VTable; - newObject->IUnknown_iface.lpVtbl = &DataCache_NDIUnknown_VTable; + newObject->IUnknown_inner.lpVtbl = &DataCache_NDIUnknown_VTable; newObject->IPersistStorage_iface.lpVtbl = &DataCache_IPersistStorage_VTable; newObject->IViewObject2_iface.lpVtbl = &DataCache_IViewObject2_VTable; newObject->IOleCache2_iface.lpVtbl = &DataCache_IOleCache2_VTable; newObject->IOleCacheControl_iface.lpVtbl = &DataCache_IOleCacheControl_VTable; newObject->IAdviseSink_iface.lpVtbl = &DataCache_IAdviseSink_VTable; - - /* - * Start with one reference count. The caller of this function - * must release the interface pointer when it is done. - */ + newObject->outer_unk = pUnkOuter ? pUnkOuter : &newObject->IUnknown_inner; newObject->ref = 1; - - /* - * Initialize the outer unknown - * We don't keep a reference on the outer unknown since, the way - * aggregation works, our lifetime is at least as large as its - * lifetime. - */ - if (pUnkOuter==NULL) - pUnkOuter = &newObject->IUnknown_iface; - - newObject->outerUnknown = pUnkOuter; /* * Initialize the other members of the structure. @@ -2461,16 +2446,8 @@ if (newCache == 0) return E_OUTOFMEMORY; - /* - * Make sure it supports the interface required by the caller. - */ - hr = IUnknown_QueryInterface(&newCache->IUnknown_iface, riid, ppvObj); - - /* - * Release the reference obtained in the constructor. If - * the QueryInterface was unsuccessful, it will free the class. - */ - IUnknown_Release(&newCache->IUnknown_iface); + hr = IUnknown_QueryInterface(&newCache->IUnknown_inner, riid, ppvObj); + IUnknown_Release(&newCache->IUnknown_inner); return hr; } Modified: trunk/reactos/dll/win32/ole32/ftmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ftmarshal.…
============================================================================== --- trunk/reactos/dll/win32/ole32/ftmarshal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ftmarshal.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -23,16 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); typedef struct _FTMarshalImpl { - IUnknown IUnknown_iface; - LONG ref; + IUnknown IUnknown_inner; IMarshal IMarshal_iface; - - IUnknown *pUnkOuter; + IUnknown *outer_unk; + LONG ref; } FTMarshalImpl; static inline FTMarshalImpl *impl_from_IUnknown(IUnknown *iface) { - return CONTAINING_RECORD(iface, FTMarshalImpl, IUnknown_iface); + return CONTAINING_RECORD(iface, FTMarshalImpl, IUnknown_inner); } static inline FTMarshalImpl *impl_from_IMarshal( IMarshal *iface ) @@ -51,7 +50,7 @@ *ppv = NULL; if (IsEqualIID (&IID_IUnknown, riid)) - *ppv = &This->IUnknown_iface; + *ppv = &This->IUnknown_inner; else if (IsEqualIID (&IID_IMarshal, riid)) *ppv = &This->IMarshal_iface; else { @@ -97,7 +96,7 @@ FTMarshalImpl *This = impl_from_IMarshal(iface); TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppv); - return IUnknown_QueryInterface (This->pUnkOuter, riid, ppv); + return IUnknown_QueryInterface(This->outer_unk, riid, ppv); } static ULONG WINAPI @@ -107,7 +106,7 @@ FTMarshalImpl *This = impl_from_IMarshal(iface); TRACE ("\n"); - return IUnknown_AddRef (This->pUnkOuter); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI @@ -117,7 +116,7 @@ FTMarshalImpl *This = impl_from_IMarshal(iface); TRACE ("\n"); - return IUnknown_Release (This->pUnkOuter); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI @@ -326,12 +325,12 @@ if (!ftm) return E_OUTOFMEMORY; - ftm->IUnknown_iface.lpVtbl = &iunkvt; + ftm->IUnknown_inner.lpVtbl = &iunkvt; ftm->IMarshal_iface.lpVtbl = &ftmvtbl; ftm->ref = 1; - ftm->pUnkOuter = punkOuter ? punkOuter : &ftm->IUnknown_iface; - - *ppunkMarshal = &ftm->IUnknown_iface; + ftm->outer_unk = punkOuter ? punkOuter : &ftm->IUnknown_inner; + + *ppunkMarshal = &ftm->IUnknown_inner; return S_OK; } Modified: trunk/reactos/dll/win32/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/marshal.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/marshal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/marshal.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -57,6 +57,11 @@ void *dest_context_data; /* reserved context value (LOCK) */ }; +static inline struct proxy_manager *impl_from_IMultiQI( IMultiQI *iface ) +{ + return CONTAINING_RECORD(iface, struct proxy_manager, IMultiQI_iface); +} + static inline struct proxy_manager *impl_from_IMarshal( IMarshal *iface ) { return CONTAINING_RECORD(iface, struct proxy_manager, IMarshal_iface); @@ -215,16 +220,16 @@ return hr; } -static ULONG WINAPI ClientIdentity_AddRef(IMultiQI * iface) -{ - struct proxy_manager * This = (struct proxy_manager *)iface; +static ULONG WINAPI ClientIdentity_AddRef(IMultiQI *iface) +{ + struct proxy_manager *This = impl_from_IMultiQI(iface); TRACE("%p - before %d\n", iface, This->refs); return InterlockedIncrement(&This->refs); } -static ULONG WINAPI ClientIdentity_Release(IMultiQI * iface) -{ - struct proxy_manager * This = (struct proxy_manager *)iface; +static ULONG WINAPI ClientIdentity_Release(IMultiQI *iface) +{ + struct proxy_manager *This = impl_from_IMultiQI(iface); ULONG refs = InterlockedDecrement(&This->refs); TRACE("%p - after %d\n", iface, refs); if (!refs) @@ -234,7 +239,7 @@ static HRESULT WINAPI ClientIdentity_QueryMultipleInterfaces(IMultiQI *iface, ULONG cMQIs, MULTI_QI *pMQIs) { - struct proxy_manager * This = (struct proxy_manager *)iface; + struct proxy_manager *This = impl_from_IMultiQI(iface); REMQIRESULT *qiresults = NULL; ULONG nonlocal_mqis = 0; ULONG i; Modified: trunk/reactos/dll/win32/ole32/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/moniker.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/moniker.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/moniker.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -1247,13 +1247,17 @@ } ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId); - - /* get the progId associated to the extension */ - progId = CoTaskMemAlloc(sizeProgId); - ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId); - if (!ret) - /* return the clsid associated to the progId */ - res = CLSIDFromProgID(progId,pclsid); + if (!ret) { + /* get the progId associated to the extension */ + progId = CoTaskMemAlloc(sizeProgId); + ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId); + if (!ret) + /* return the clsid associated to the progId */ + res = CLSIDFromProgID(progId, pclsid); + else + res = HRESULT_FROM_WIN32(ret); + CoTaskMemFree(progId); + } else res = HRESULT_FROM_WIN32(ret); @@ -1261,7 +1265,6 @@ CoTaskMemFree(pathDec[i]); CoTaskMemFree(pathDec); - CoTaskMemFree(progId); return res != S_OK ? MK_E_INVALIDEXTENSION : res; } @@ -1506,7 +1509,7 @@ if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IMarshal, riid)) { *ppv = &This->IMarshal_iface; - IUnknown_AddRef((IUnknown *)&This->IMarshal_iface); + IMarshal_AddRef(&This->IMarshal_iface); return S_OK; } FIXME("No interface for %s\n", debugstr_guid(riid)); Modified: trunk/reactos/dll/win32/ole32/ole2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2.c?rev…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole2.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -2689,8 +2689,7 @@ { ULONG i; for (i = 0; i < count; i++) - if (pClipDataArray[i].pClipData) - CoTaskMemFree(pClipDataArray[i].pClipData); + CoTaskMemFree(pClipDataArray[i].pClipData); } /*********************************************************************** Modified: trunk/reactos/dll/win32/ole32/ole2stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2stubs.…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole2stubs.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -74,3 +74,12 @@ FIXME("stub!\n"); return E_NOTIMPL; } + +/*********************************************************************** + * OleGetIconOfFile [OLE32.@] + */ +HGLOBAL WINAPI OleGetIconOfFile(LPOLESTR path, BOOL use_file_as_label) +{ + FIXME("(%p, %d), stub!\n", path, use_file_as_label); + return NULL; +} Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -236,7 +236,7 @@ @ stdcall OleGetAutoConvert(ptr ptr) @ stdcall OleGetClipboard(ptr) @ stdcall OleGetIconOfClass(ptr ptr long) -@ stub OleGetIconOfFile +@ stdcall OleGetIconOfFile(ptr long) @ stdcall OleInitialize(ptr) @ stdcall OleInitializeWOW(long long) @ stdcall OleIsCurrentClipboard(ptr) @@ -292,14 +292,14 @@ @ stdcall StgCreateDocfile(wstr long long ptr) @ stdcall StgCreateDocfileOnILockBytes(ptr long long ptr) @ stdcall StgCreatePropSetStg(ptr long ptr) -# StgCreatePropStg +@ stdcall StgCreatePropStg(ptr ptr ptr long long ptr) @ stdcall StgCreateStorageEx(wstr long long long ptr ptr ptr ptr) @ stub StgGetIFillLockBytesOnFile @ stub StgGetIFillLockBytesOnILockBytes @ stdcall StgIsStorageFile(wstr) @ stdcall StgIsStorageILockBytes(ptr) @ stub StgOpenAsyncDocfileOnIFillLockBytes -# StgOpenPropStg +@ stdcall StgOpenPropStg(ptr ptr long long ptr) @ stdcall StgOpenStorage(wstr ptr long ptr long ptr) @ stdcall StgOpenStorageEx(wstr long long long ptr ptr ptr ptr) # StgOpenStorageOnHandle Modified: trunk/reactos/dll/win32/ole32/stg_prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_prop.c…
============================================================================== --- trunk/reactos/dll/win32/ole32/stg_prop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/stg_prop.c [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -2168,7 +2168,7 @@ IPropertyStorage** ppprstg) { StorageImpl *This = impl_from_IPropertySetStorage(ppstg); - WCHAR name[CCH_MAX_PROPSTG_NAME]; + WCHAR name[CCH_MAX_PROPSTG_NAME + 1]; IStream *stm = NULL; HRESULT r; @@ -2226,7 +2226,7 @@ { StorageImpl *This = impl_from_IPropertySetStorage(ppstg); IStream *stm = NULL; - WCHAR name[CCH_MAX_PROPSTG_NAME]; + WCHAR name[CCH_MAX_PROPSTG_NAME + 1]; HRESULT r; TRACE("%p %s %08x %p\n", This, debugstr_guid(rfmtid), grfMode, ppprstg); @@ -2270,7 +2270,7 @@ REFFMTID rfmtid) { StorageImpl *This = impl_from_IPropertySetStorage(ppstg); - WCHAR name[CCH_MAX_PROPSTG_NAME]; + WCHAR name[CCH_MAX_PROPSTG_NAME + 1]; HRESULT r; TRACE("%p %s\n", This, debugstr_guid(rfmtid)); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Aug 19 09:38:43 2016 @@ -142,7 +142,7 @@ reactos/dll/win32/objsel # Synced to WineStaging-1.9.11 reactos/dll/win32/odbc32 # Synced to WineStaging-1.9.11. Depends on port of Linux ODBC. reactos/dll/win32/odbccp32 # Synced to WineStaging-1.9.11 -reactos/dll/win32/ole32 # Synced to WineStaging-1.9.11 +reactos/dll/win32/ole32 # Synced to WineStaging-1.9.16 reactos/dll/win32/oleacc # Synced to WineStaging-1.9.11 reactos/dll/win32/oleaut32 # Synced to WineStaging-1.9.16 reactos/dll/win32/olecli32 # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72347: [JSCRIPT_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:37:22 2016 New Revision: 72347 URL:
http://svn.reactos.org/svn/reactos?rev=72347&view=rev
Log: [JSCRIPT_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/rostests/winetests/jscript/api.js trunk/rostests/winetests/jscript/lang.js trunk/rostests/winetests/jscript/run.c Modified: trunk/rostests/winetests/jscript/api.js URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/api.js?…
============================================================================== --- trunk/rostests/winetests/jscript/api.js [iso-8859-1] (original) +++ trunk/rostests/winetests/jscript/api.js [iso-8859-1] Fri Aug 19 09:37:22 2016 @@ -350,12 +350,27 @@ ok(Object("") instanceof String, "Object('') is not instance of String"); ok(Object(false) instanceof Boolean, "Object(false) is not instance of Boolean"); +ok(new Object(1) instanceof Number, "Object(1) is not instance of Number"); +ok(new Object("") instanceof String, "Object('') is not instance of String"); +ok(new Object(false) instanceof Boolean, "Object(false) is not instance of Boolean"); + obj = new Object(); ok(Object(obj) === obj, "Object(obj) !== obj"); ok(typeof(Object()) === "object", "typeof(Object()) !== 'object'"); ok(typeof(Object(undefined)) === "object", "typeof(Object(undefined)) !== 'object'"); ok(typeof(Object(null)) === "object", "typeof(Object(null)) !== 'object'"); +ok(typeof(Object(nullDisp)) === "object", "typeof(Object(nullDisp)) !== 'object'"); + +ok(Object(nullDisp) != nullDisp, "Object(nullDisp) == nullDisp"); +ok(new Object(nullDisp) != nullDisp, "new Object(nullDisp) == nullDisp"); + +ok(Object(testObj) === testObj, "Object(testObj) != testObj\n"); +ok(new Object(testObj) === testObj, "new Object(testObj) != testObj\n"); + +tmp = new Object(); +ok(Object(tmp) === tmp, "Object(tmp) != tmp"); +ok(new Object(tmp) === tmp, "new Object(tmp) != tmp"); var obj = new Object(); obj.toString = function (x) { Modified: trunk/rostests/winetests/jscript/lang.js URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/lang.js…
============================================================================== --- trunk/rostests/winetests/jscript/lang.js [iso-8859-1] (original) +++ trunk/rostests/winetests/jscript/lang.js [iso-8859-1] Fri Aug 19 09:37:22 2016 @@ -100,6 +100,10 @@ tmp = delete arguments; ok(tmp === false, "arguments deleted"); ok(typeof(arguments) === "object", "typeof(arguments) = " + typeof(arguments)); + + x = 2; + ok(x === 2, "x = " + x); + ok(arguments[0] === 2, "arguments[0] = " + arguments[0]); return true; } @@ -211,6 +215,38 @@ argumentsTest(); +// arguments object detached from its execution context +(function() { + var args, get_x, set_x; + + function test_args(detached) { + ok(args[0] === 1, "args[0] = " + args[0]); + set_x(2); + ok(args[0] === (detached ? 1 : 2), "args[0] = " + args[0] + " expected " + (detached ? 1 : 2)); + args[0] = 3; + ok(get_x() === (detached ? 2 : 3), "get_x() = " + get_x()); + ok(args[0] === 3, "args[0] = " + args[0]); + } + + (function(x) { + args = arguments; + get_x = function() { return x; }; + set_x = function(v) { x = v; }; + + test_args(false); + x = 1; + })(1); + + test_args(true); +})(); + +// arguments is a regular variable, it may be overwritten +(function() { + ok(typeof(arguments) === "object", "typeof(arguments) = " + typeof(arguments)); + arguments = 1; + ok(arguments === 1, "arguments = " + arguments); +})(); + (function callAsExprTest() { ok(callAsExprTest.arguments === null, "callAsExprTest.arguments = " + callAsExprTest.arguments); })(1,2); @@ -233,6 +269,24 @@ testRes() && testRes(); testNoRes(), testNoRes(); +(function() { + eval("var x=1;"); + ok(x === 1, "x = " + x); +})(); + +(function() { + var e = eval; + var r = e(1); + ok(r === 1, "r = " + r); + (function(x, a) { x(a); })(eval, "2"); +})(); + +(function(r) { + r = eval("1"); + ok(r === 1, "r = " + r); + (function(x, a) { x(a); })(eval, "2"); +})(); + tmp = (function(){ return testNoRes(), testRes();})(); var f1, f2; @@ -347,6 +401,20 @@ var obj3 = new Object; ok(typeof(obj3) === "object", "typeof(obj3) is not object"); + +(function() { + ok(typeof(func) === "function", "typeof(func) = " + typeof(func)); + function func() {} + ok(typeof(func) === "function", "typeof(func) = " + typeof(func)); + func = 0; + ok(typeof(func) === "number", "typeof(func) = " + typeof(func)); +})(); + +(function(f) { + ok(typeof(f) === "function", "typeof(f) = " + typeof(f)); + function f() {}; + ok(typeof(f) === "function", "typeof(f) = " + typeof(f)); +})(1); for(var iter in "test") ok(false, "unexpected forin call, test = " + iter); @@ -1250,6 +1318,38 @@ ok(false, "deleteTest not throwed exception?"); }catch(ex) {} +(function() { + var to_delete = 2; + var r = delete to_delete; + ok(r === false, "delete 1 returned " + r); + if(r) + return; + ok(to_delete === 2, "to_delete = " + to_delete); + + to_delete = new Object(); + r = delete to_delete; + ok(r === false, "delete 2 returned " + r); + ok(typeof(to_delete) === "object", "typeof(to_delete) = " + typeof(to_delete)); +})(); + +(function(to_delete) { + var r = delete to_delete; + ok(r === false, "delete 3 returned " + r); + ok(to_delete === 2, "to_delete = " + to_delete); + + to_delete = new Object(); + r = delete to_delete; + ok(r === false, "delete 4 returned " + r); + ok(typeof(to_delete) === "object", "typeof(to_delete) = " + typeof(to_delete)); +})(2); + +(function() { + with({to_delete: new Object()}) { + var r = delete to_delete; + ok(r === true, "delete returned " + r); + } +})(); + if (false) if (true) ok(false, "if evaluated"); @@ -1497,6 +1597,24 @@ })(); ok(tmp, "tmp = " + tmp); +(function() { + ok(typeof(func) === "function", "typeof(func) = " + typeof(func)); + with(new Object()) { + var x = false && function func() {}; + } + ok(typeof(func) === "function", "typeof(func) = " + typeof(func)); +})(); + +(function() { + ok(x === undefined, "x = " + x); // x is declared, but never initialized + with({x: 1}) { + ok(x === 1, "x = " + x); + var x = 2; + ok(x === 2, "x = " + x); + } + ok(x === undefined, "x = " + x); +})(); + /* NoNewline rule parser tests */ while(true) { if(true) break Modified: trunk/rostests/winetests/jscript/run.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/run.c?r…
============================================================================== --- trunk/rostests/winetests/jscript/run.c [iso-8859-1] (original) +++ trunk/rostests/winetests/jscript/run.c [iso-8859-1] Fri Aug 19 09:37:22 2016 @@ -490,11 +490,15 @@ ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs); ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs); ok(res != NULL, "res == NULL\n"); - ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags); ok(pei != NULL, "pei == NULL\n"); ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(pdp->rgvarg+1) = %d\n", V_VT(pdp->rgvarg+1)); - ok(!V_BOOL(pdp->rgvarg+1), "V_BOOL(pdp->rgvarg+1) = %x\n", V_BOOL(pdp->rgvarg+1)); + + if(V_BOOL(pdp->rgvarg+1)) + /* NOTE: If called by Function.apply(), native doesn't set DISPATCH_PROPERTYGET flag. */ + todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags); + else + ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags); ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); ok(V_DISPATCH(pdp->rgvarg) != NULL, "V_DISPATCH(pdp->rgvarg) == NULL\n"); @@ -574,12 +578,15 @@ ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); ok(res != NULL, "res == NULL\n"); - ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags); ok(ei != NULL, "ei == NULL\n"); ok(puArgErr != NULL, "puArgErr == NULL\n"); ok(V_VT(pdp->rgvarg) == VT_BOOL, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg)); - ok(!V_BOOL(pdp->rgvarg), "V_BOOL(pdp->rgvarg) = %x\n", V_BOOL(pdp->rgvarg)); + + if(V_BOOL(pdp->rgvarg)) + todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags); + else + ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", wFlags); if(res) V_VT(res) = VT_NULL; @@ -2508,6 +2515,14 @@ parse_script_a("var t = {func: dispexFunc}; t = t.func(false);"); CHECK_CALLED(dispexfunc_value); + SET_EXPECT(dispexfunc_value); + parse_script_a("Function.prototype.apply.call(dispexFunc, testObj, [true]);"); + CHECK_CALLED(dispexfunc_value); + + SET_EXPECT(puredisp_value); + parse_script_a("Function.prototype.apply.call(pureDisp, testObj, [true]);"); + CHECK_CALLED(puredisp_value); + parse_script_a("(function reportSuccess() {})()"); parse_script_a("ok(typeof(test) === 'object', \"typeof(test) != 'object'\");"); @@ -2521,6 +2536,8 @@ SET_EXPECT(global_propget_d); parse_script_a("eval('var testPropGet;');"); CHECK_CALLED(global_propget_d); + + parse_script_a("var testPropGet; function testPropGet() {}"); SET_EXPECT(global_notexists_d); parse_script_a("var notExists; notExists = 1;");
8 years, 4 months
1
0
0
0
[akhaldi] 72346: [JSCRIPT] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:36:35 2016 New Revision: 72346 URL:
http://svn.reactos.org/svn/reactos?rev=72346&view=rev
Log: [JSCRIPT] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/dll/win32/jscript/array.c trunk/reactos/dll/win32/jscript/compile.c trunk/reactos/dll/win32/jscript/dispex.c trunk/reactos/dll/win32/jscript/engine.c trunk/reactos/dll/win32/jscript/engine.h trunk/reactos/dll/win32/jscript/function.c trunk/reactos/dll/win32/jscript/global.c trunk/reactos/dll/win32/jscript/jscript.c trunk/reactos/dll/win32/jscript/jscript.h trunk/reactos/dll/win32/jscript/json.c trunk/reactos/dll/win32/jscript/jsregexp.c trunk/reactos/dll/win32/jscript/jsutils.c trunk/reactos/dll/win32/jscript/object.c trunk/reactos/dll/win32/jscript/parser.h trunk/reactos/dll/win32/jscript/string.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/jscript/array.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/array.c?…
============================================================================== --- trunk/reactos/dll/win32/jscript/array.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/array.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -178,7 +178,7 @@ jsdisp_t *jsobj; HRESULT hres; - jsobj = iface_to_jsdisp((IUnknown*)obj); + jsobj = iface_to_jsdisp(obj); if(jsobj) { if(is_class(jsobj, JSCLASS_ARRAY)) { hres = concat_array(array, (ArrayInstance*)jsobj, len); @@ -688,7 +688,7 @@ return E_FAIL; } - cmp_func = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + cmp_func = iface_to_jsdisp(get_object(argv[0])); if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) { WARN("cmp_func is not a function\n"); if(cmp_func) Modified: trunk/reactos/dll/win32/jscript/compile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/compile.…
============================================================================== --- trunk/reactos/dll/win32/jscript/compile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/compile.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -46,11 +46,12 @@ unsigned labels_size; unsigned labels_cnt; + local_ref_t *locals_buf; + unsigned locals_buf_size; + unsigned locals_cnt; + statement_ctx_t *stat_ctx; function_code_t *func; - - variable_declaration_t *var_head; - variable_declaration_t *var_tail; function_expression_t *func_head; function_expression_t *func_tail; @@ -399,6 +400,40 @@ return type == EXPR_IDENT || type == EXPR_MEMBER || type == EXPR_ARRAY; } +static BOOL bind_local(compiler_ctx_t *ctx, const WCHAR *identifier, int *ret_ref) +{ + statement_ctx_t *iter; + local_ref_t *ref; + + for(iter = ctx->stat_ctx; iter; iter = iter->next) { + if(iter->using_scope) + return FALSE; + } + + ref = lookup_local(ctx->func, identifier); + if(!ref) + return FALSE; + + *ret_ref = ref->ref; + return TRUE; +} + +static HRESULT emit_identifier_ref(compiler_ctx_t *ctx, const WCHAR *identifier, unsigned flags) +{ + int local_ref; + if(bind_local(ctx, identifier, &local_ref)) + return push_instr_int(ctx, OP_local_ref, local_ref); + return push_instr_bstr_uint(ctx, OP_identid, identifier, flags); +} + +static HRESULT emit_identifier(compiler_ctx_t *ctx, const WCHAR *identifier) +{ + int local_ref; + if(bind_local(ctx, identifier, &local_ref)) + return push_instr_int(ctx, OP_local, local_ref); + return push_instr_bstr(ctx, OP_ident, identifier); +} + static HRESULT compile_memberid_expression(compiler_ctx_t *ctx, expression_t *expr, unsigned flags) { HRESULT hres = S_OK; @@ -407,7 +442,7 @@ case EXPR_IDENT: { identifier_expression_t *ident_expr = (identifier_expression_t*)expr; - hres = push_instr_bstr_uint(ctx, OP_identid, ident_expr->identifier, flags); + hres = emit_identifier_ref(ctx, ident_expr->identifier, flags); break; } case EXPR_ARRAY: { @@ -866,9 +901,7 @@ static HRESULT compile_function_expression(compiler_ctx_t *ctx, function_expression_t *expr, BOOL emit_ret) { - unsigned func_id = ctx->func->func_cnt++; - ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr); - return emit_ret ? push_instr_uint(ctx, OP_func, func_id) : S_OK; + return emit_ret ? push_instr_uint(ctx, OP_func, expr->func_id) : S_OK; } static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL emit_ret) @@ -961,7 +994,7 @@ hres = compile_binary_expression(ctx, (binary_expression_t*)expr, OP_gteq); break; case EXPR_IDENT: - hres = push_instr_bstr(ctx, OP_ident, ((identifier_expression_t*)expr)->identifier); + hres = emit_identifier(ctx, ((identifier_expression_t*)expr)->identifier); break; case EXPR_IN: hres = compile_binary_expression(ctx, (binary_expression_t*)expr, OP_in); @@ -1084,25 +1117,22 @@ assert(list != NULL); - if(ctx->var_tail) - ctx->var_tail->global_next = list; - else - ctx->var_head = list; - for(iter = list; iter; iter = iter->next) { - ctx->func->var_cnt++; - iter->global_next = iter->next; - if(!iter->next) - ctx->var_tail = iter; - if(!iter->expr) continue; + hres = emit_identifier_ref(ctx, iter->identifier, 0); + if(FAILED(hres)) + return hres; + hres = compile_expression(ctx, iter->expr, TRUE); if(FAILED(hres)) return hres; - hres = push_instr_bstr(ctx, OP_var_set, iter->identifier); + if(!push_instr(ctx, OP_assign)) + return E_OUTOFMEMORY; + + hres = push_instr_uint(ctx, OP_pop, 1); if(FAILED(hres)) return hres; } @@ -1300,7 +1330,7 @@ return hres; if(stat->variable) { - hres = push_instr_bstr_uint(ctx, OP_identid, stat->variable->identifier, fdexNameEnsure); + hres = emit_identifier_ref(ctx, stat->variable->identifier, fdexNameEnsure); if(FAILED(hres)) return hres; }else if(is_memberid_expr(stat->expr->type)) { @@ -1774,6 +1804,393 @@ return hres; } +static int local_cmp(const void *key, const void *ref) +{ + return strcmpW((const WCHAR*)key, ((const local_ref_t*)ref)->name); +} + +static inline local_ref_t *find_local(compiler_ctx_t *ctx, const WCHAR *name) +{ + return bsearch(name, ctx->locals_buf, ctx->locals_cnt, sizeof(*ctx->locals_buf), local_cmp); +} + +static BOOL alloc_local(compiler_ctx_t *ctx, BSTR name, int ref) +{ + unsigned i; + + if(!ctx->locals_buf_size) { + ctx->locals_buf = heap_alloc(4 * sizeof(*ctx->locals_buf)); + if(!ctx->locals_buf) + return FALSE; + ctx->locals_buf_size = 4; + }else if(ctx->locals_buf_size == ctx->locals_cnt) { + local_ref_t *new_buf = heap_realloc(ctx->locals_buf, ctx->locals_buf_size * 2 * sizeof(*ctx->locals_buf)); + if(!new_buf) + return FALSE; + ctx->locals_buf = new_buf; + ctx->locals_buf_size *= 2; + } + + for(i = 0; i < ctx->locals_cnt; i++) { + if(strcmpW(ctx->locals_buf[i].name, name) > 0) { + memmove(ctx->locals_buf + i+1, ctx->locals_buf + i, (ctx->locals_cnt - i) * sizeof(*ctx->locals_buf)); + break; + } + } + + ctx->locals_buf[i].name = name; + ctx->locals_buf[i].ref = ref; + ctx->locals_cnt++; + return TRUE; +} + +static BOOL alloc_variable(compiler_ctx_t *ctx, const WCHAR *name) +{ + BSTR ident; + + if(find_local(ctx, name)) + return TRUE; + + ident = compiler_alloc_bstr(ctx, name); + if(!ident) + return FALSE; + + return alloc_local(ctx, ident, ctx->func->var_cnt++); +} + +static BOOL visit_function_expression(compiler_ctx_t *ctx, function_expression_t *expr) +{ + expr->func_id = ctx->func->func_cnt++; + ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr); + + return !expr->identifier || expr->event_target || alloc_variable(ctx, expr->identifier); +} + +static HRESULT visit_expression(compiler_ctx_t *ctx, expression_t *expr) +{ + HRESULT hres = S_OK; + + switch(expr->type) { + case EXPR_ADD: + case EXPR_AND: + case EXPR_ARRAY: + case EXPR_ASSIGN: + case EXPR_ASSIGNADD: + case EXPR_ASSIGNAND: + case EXPR_ASSIGNSUB: + case EXPR_ASSIGNMUL: + case EXPR_ASSIGNDIV: + case EXPR_ASSIGNMOD: + case EXPR_ASSIGNOR: + case EXPR_ASSIGNLSHIFT: + case EXPR_ASSIGNRSHIFT: + case EXPR_ASSIGNRRSHIFT: + case EXPR_ASSIGNXOR: + case EXPR_BAND: + case EXPR_BOR: + case EXPR_COMMA: + case EXPR_DIV: + case EXPR_EQ: + case EXPR_EQEQ: + case EXPR_GREATER: + case EXPR_GREATEREQ: + case EXPR_IN: + case EXPR_INSTANCEOF: + case EXPR_LESS: + case EXPR_LESSEQ: + case EXPR_LSHIFT: + case EXPR_MOD: + case EXPR_MUL: + case EXPR_NOTEQ: + case EXPR_NOTEQEQ: + case EXPR_OR: + case EXPR_RSHIFT: + case EXPR_RRSHIFT: + case EXPR_SUB: + case EXPR_BXOR: { + binary_expression_t *binary_expr = (binary_expression_t*)expr; + + hres = visit_expression(ctx, binary_expr->expression1); + if(FAILED(hres)) + return hres; + + hres = visit_expression(ctx, binary_expr->expression2); + break; + } + case EXPR_BITNEG: + case EXPR_DELETE: + case EXPR_LOGNEG: + case EXPR_MINUS: + case EXPR_PLUS: + case EXPR_POSTDEC: + case EXPR_POSTINC: + case EXPR_PREDEC: + case EXPR_PREINC: + case EXPR_TYPEOF: + case EXPR_VOID: + hres = visit_expression(ctx, ((unary_expression_t*)expr)->expression); + break; + case EXPR_IDENT: + case EXPR_LITERAL: + case EXPR_THIS: + break; + case EXPR_ARRAYLIT: { + array_literal_expression_t *array_expr = (array_literal_expression_t*)expr; + array_element_t *iter; + + for(iter = array_expr->element_list; iter; iter = iter->next) { + hres = visit_expression(ctx, iter->expr); + if(FAILED(hres)) + return hres; + } + break; + } + case EXPR_CALL: + case EXPR_NEW: { + call_expression_t *call_expr = (call_expression_t*)expr; + argument_t *arg; + + hres = visit_expression(ctx, call_expr->expression); + if(FAILED(hres)) + return hres; + + for(arg = call_expr->argument_list; arg; arg = arg->next) { + hres = visit_expression(ctx, arg->expr); + if(FAILED(hres)) + return hres; + } + break; + } + case EXPR_COND: { + conditional_expression_t *cond_expr = (conditional_expression_t*)expr; + + hres = visit_expression(ctx, cond_expr->expression); + if(FAILED(hres)) + return hres; + + hres = visit_expression(ctx, cond_expr->true_expression); + if(FAILED(hres)) + return hres; + + hres = visit_expression(ctx, cond_expr->false_expression); + break; + } + case EXPR_FUNC: + visit_function_expression(ctx, (function_expression_t*)expr); + break; + case EXPR_MEMBER: + hres = visit_expression(ctx, ((member_expression_t*)expr)->expression); + break; + case EXPR_PROPVAL: { + prop_val_t *iter; + for(iter = ((property_value_expression_t*)expr)->property_list; iter; iter = iter->next) { + hres = visit_expression(ctx, iter->value); + if(FAILED(hres)) + return hres; + } + break; + } + DEFAULT_UNREACHABLE; + } + + return hres; +} + +static HRESULT visit_variable_list(compiler_ctx_t *ctx, variable_declaration_t *list) +{ + variable_declaration_t *iter; + HRESULT hres; + + for(iter = list; iter; iter = iter->next) { + if(!alloc_variable(ctx, iter->identifier)) + return E_OUTOFMEMORY; + + if(iter->expr) { + hres = visit_expression(ctx, iter->expr); + if(FAILED(hres)) + return hres; + } + } + + return S_OK; +} + +static HRESULT visit_statement(compiler_ctx_t*,statement_t*); + +static HRESULT visit_block_statement(compiler_ctx_t *ctx, statement_t *iter) +{ + HRESULT hres; + + while(iter) { + hres = visit_statement(ctx, iter); + if(FAILED(hres)) + return hres; + + iter = iter->next; + } + + return S_OK; +} + +static HRESULT visit_statement(compiler_ctx_t *ctx, statement_t *stat) +{ + HRESULT hres = S_OK; + + switch(stat->type) { + case STAT_BLOCK: + hres = visit_block_statement(ctx, ((block_statement_t*)stat)->stat_list); + break; + case STAT_BREAK: + case STAT_CONTINUE: + case STAT_EMPTY: + break; + case STAT_EXPR: + case STAT_RETURN: + case STAT_THROW: { + expression_statement_t *expr_stat = (expression_statement_t*)stat; + if(expr_stat->expr) + hres = visit_expression(ctx, expr_stat->expr); + break; + } + case STAT_FOR: { + for_statement_t *for_stat = (for_statement_t*)stat; + + if(for_stat->variable_list) + hres = visit_variable_list(ctx, for_stat->variable_list); + else if(for_stat->begin_expr) + hres = visit_expression(ctx, for_stat->begin_expr); + if(FAILED(hres)) + break; + + if(for_stat->expr) { + hres = visit_expression(ctx, for_stat->expr); + if(FAILED(hres)) + break; + } + + hres = visit_statement(ctx, for_stat->statement); + if(FAILED(hres)) + break; + + if(for_stat->end_expr) + hres = visit_expression(ctx, for_stat->end_expr); + break; + } + case STAT_FORIN: { + forin_statement_t *forin_stat = (forin_statement_t*)stat; + + if(forin_stat->variable) { + hres = visit_variable_list(ctx, forin_stat->variable); + if(FAILED(hres)) + break; + } + + hres = visit_expression(ctx, forin_stat->in_expr); + if(FAILED(hres)) + return hres; + + if(forin_stat->expr) { + hres = visit_expression(ctx, forin_stat->expr); + if(FAILED(hres)) + return hres; + } + + hres = visit_statement(ctx, forin_stat->statement); + break; + } + case STAT_IF: { + if_statement_t *if_stat = (if_statement_t*)stat; + + hres = visit_expression(ctx, if_stat->expr); + if(FAILED(hres)) + return hres; + + hres = visit_statement(ctx, if_stat->if_stat); + if(FAILED(hres)) + return hres; + + if(if_stat->else_stat) + hres = visit_statement(ctx, if_stat->else_stat); + break; + } + case STAT_LABEL: + hres = visit_statement(ctx, ((labelled_statement_t*)stat)->statement); + break; + case STAT_SWITCH: { + switch_statement_t *switch_stat = (switch_statement_t*)stat; + statement_t *stat_iter; + case_clausule_t *iter; + + hres = visit_expression(ctx, switch_stat->expr); + if(FAILED(hres)) + return hres; + + for(iter = switch_stat->case_list; iter; iter = iter->next) { + if(!iter->expr) + continue; + hres = visit_expression(ctx, iter->expr); + if(FAILED(hres)) + return hres; + } + + for(iter = switch_stat->case_list; iter; iter = iter->next) { + while(iter->next && iter->next->stat == iter->stat) + iter = iter->next; + for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); + stat_iter = stat_iter->next) { + hres = visit_statement(ctx, stat_iter); + if(FAILED(hres)) + return hres; + } + } + break; + } + case STAT_TRY: { + try_statement_t *try_stat = (try_statement_t*)stat; + + hres = visit_statement(ctx, try_stat->try_statement); + if(FAILED(hres)) + return hres; + + if(try_stat->catch_block) { + hres = visit_statement(ctx, try_stat->catch_block->statement); + if(FAILED(hres)) + return hres; + } + + if(try_stat->finally_statement) + hres = visit_statement(ctx, try_stat->finally_statement); + break; + } + case STAT_VAR: + hres = visit_variable_list(ctx, ((var_statement_t*)stat)->variable_list); + break; + case STAT_WHILE: { + while_statement_t *while_stat = (while_statement_t*)stat; + + hres = visit_expression(ctx, while_stat->expr); + if(FAILED(hres)) + return hres; + + hres = visit_statement(ctx, while_stat->statement); + break; + } + case STAT_WITH: { + with_statement_t *with_stat = (with_statement_t*)stat; + + hres = visit_expression(ctx, with_stat->expr); + if(FAILED(hres)) + return hres; + + hres = visit_statement(ctx, with_stat->statement); + break; + } + DEFAULT_UNREACHABLE; + } + + return hres; +} + static void resolve_labels(compiler_ctx_t *ctx, unsigned off) { instr_t *instr; @@ -1838,35 +2255,20 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source, function_expression_t *func_expr, BOOL from_eval, function_code_t *func) { - variable_declaration_t *var_iter; function_expression_t *iter; - unsigned off, i; + unsigned off, i, j; HRESULT hres; TRACE("\n"); - ctx->var_head = ctx->var_tail = NULL; ctx->func_head = ctx->func_tail = NULL; ctx->from_eval = from_eval; - - off = ctx->code_off; ctx->func = func; - hres = compile_block_statement(ctx, source->statement); - if(FAILED(hres)) - return hres; - - resolve_labels(ctx, off); - - hres = push_instr_uint(ctx, OP_ret, !from_eval); - if(FAILED(hres)) - return hres; - - if(TRACE_ON(jscript_disas)) - dump_code(ctx, off); - - func->instr_off = off; + ctx->locals_cnt = 0; if(func_expr) { + parameter_t *param_iter; + if(func_expr->identifier) { func->name = compiler_alloc_bstr(ctx, func_expr->identifier); if(!func->name) @@ -1878,10 +2280,6 @@ if(!func->event_target) return E_OUTOFMEMORY; } - } - - if(func_expr) { - parameter_t *param_iter; func->source = func_expr->src_str; func->source_len = func_expr->src_len; @@ -1900,27 +2298,69 @@ } } + for(i = 0; i < func->param_cnt; i++) { + if(!find_local(ctx, func->params[i]) && !alloc_local(ctx, func->params[i], -i-1)) + return E_OUTOFMEMORY; + } + + hres = visit_block_statement(ctx, source->statement); + if(FAILED(hres)) + return hres; + + func->locals = compiler_alloc(ctx->code, ctx->locals_cnt * sizeof(*func->locals)); + if(!func->locals) + return E_OUTOFMEMORY; + func->locals_cnt = ctx->locals_cnt; + memcpy(func->locals, ctx->locals_buf, func->locals_cnt * sizeof(*func->locals)); + func->variables = compiler_alloc(ctx->code, func->var_cnt * sizeof(*func->variables)); if(!func->variables) return E_OUTOFMEMORY; - for(var_iter = ctx->var_head, i=0; var_iter; var_iter = var_iter->global_next, i++) { - func->variables[i] = compiler_alloc_bstr(ctx, var_iter->identifier); - if(!func->variables[i]) - return E_OUTOFMEMORY; - } - - assert(i == func->var_cnt); + for(i = 0, j = 0; i < func->locals_cnt; i++) { + if(func->locals[i].ref < 0) + continue; /* skip arguments */ + func->variables[func->locals[i].ref].name = func->locals[i].name; + func->variables[func->locals[i].ref].func_id = -1; + j++; + } + + assert(j == func->var_cnt); func->funcs = compiler_alloc(ctx->code, func->func_cnt * sizeof(*func->funcs)); if(!func->funcs) return E_OUTOFMEMORY; memset(func->funcs, 0, func->func_cnt * sizeof(*func->funcs)); + off = ctx->code_off; + hres = compile_block_statement(ctx, source->statement); + if(FAILED(hres)) + return hres; + + resolve_labels(ctx, off); + + hres = push_instr_uint(ctx, OP_ret, !from_eval); + if(FAILED(hres)) + return hres; + + if(TRACE_ON(jscript_disas)) + dump_code(ctx, off); + + func->instr_off = off; + for(iter = ctx->func_head, i=0; iter; iter = iter->next, i++) { hres = compile_function(ctx, iter->source_elements, iter, FALSE, func->funcs+i); if(FAILED(hres)) return hres; + + TRACE("[%d] func %s\n", i, debugstr_w(func->funcs[i].name)); + if(func->funcs[i].name && !func->funcs[i].event_target) { + local_ref_t *local_ref = lookup_local(func, func->funcs[i].name); + func->funcs[i].local_ref = local_ref->ref; + TRACE("found ref %s %d for %s\n", debugstr_w(local_ref->name), local_ref->ref, debugstr_w(func->funcs[i].name)); + if(local_ref->ref >= 0) + func->variables[local_ref->ref].func_id = i; + } } assert(i == func->func_cnt); @@ -2030,6 +2470,7 @@ hres = compile_function(&compiler, compiler.parser->source, NULL, from_eval, &compiler.code->global_code); parser_release(compiler.parser); + heap_free(compiler.locals_buf); if(FAILED(hres)) { release_bytecode(compiler.code); return hres; Modified: trunk/reactos/dll/win32/jscript/dispex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/dispex.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/dispex.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/dispex.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -18,13 +18,6 @@ #include "jscript.h" -/* - * This IID is used to get jsdisp_t objecto from interface. - * We might consider using private interface instead. - */ -static const IID IID_IDispatchJS = - {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa6}}; - #define FDEX_VERSION_MASK 0xf0000000 #define GOLDEN_RATIO 0x9E3779B9U @@ -491,10 +484,8 @@ TRACE("%s = %s\n", debugstr_w(prop->name), debugstr_jsval(val)); hres = jsval_copy(val, &prop->u.val); - if(FAILED(hres)) { - prop->u.val = jsval_undefined(); - return hres; - } + if(FAILED(hres)) + return hres; if(This->builtin_info->on_put) This->builtin_info->on_put(This, prop->name); @@ -558,11 +549,6 @@ }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv); *ppv = &This->IDispatchEx_iface; - }else if(IsEqualGUID(&IID_IDispatchJS, riid)) { - TRACE("(%p)->(IID_IDispatchJS %p)\n", This, ppv); - jsdisp_addref(This); - *ppv = This; - return S_OK; }else { WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; @@ -584,6 +570,7 @@ { jsdisp_t *This = impl_from_IDispatchEx(iface); ULONG ref = --This->ref; + TRACE("(%p) ref=%d\n", This, ref); if(!ref) jsdisp_free(This); return ref; @@ -1007,7 +994,7 @@ } if(is_object_instance(val)) - prot = iface_to_jsdisp((IUnknown*)get_object(val)); + prot = iface_to_jsdisp(get_object(val)); jsval_release(val); } @@ -1018,16 +1005,11 @@ return hres; } -jsdisp_t *iface_to_jsdisp(IUnknown *iface) -{ - jsdisp_t *ret; - HRESULT hres; - - hres = IUnknown_QueryInterface(iface, &IID_IDispatchJS, (void**)&ret); - if(FAILED(hres)) - return NULL; - - return ret; +jsdisp_t *iface_to_jsdisp(IDispatch *iface) +{ + return iface->lpVtbl == (const IDispatchVtbl*)&DispatchExVtbl + ? jsdisp_addref( impl_from_IDispatchEx((IDispatchEx*)iface)) + : NULL; } HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *id) @@ -1107,7 +1089,7 @@ unsigned i; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { if(flags & DISPATCH_PROPERTYPUT) { FIXME("disp_call(propput) on builtin object\n"); @@ -1200,7 +1182,7 @@ assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK))); - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r); jsdisp_release(jsdisp); @@ -1339,7 +1321,7 @@ jsdisp_t *jsdisp; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { dispex_prop_t *prop; @@ -1444,7 +1426,7 @@ VARIANT var; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { hres = jsdisp_propget(jsdisp, id, val); jsdisp_release(jsdisp); @@ -1495,7 +1477,7 @@ jsdisp_t *jsdisp; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { dispex_prop_t *prop; @@ -1531,7 +1513,7 @@ BSTR bstr; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { dispex_prop_t *prop; const WCHAR *ptr; Modified: trunk/reactos/dll/win32/jscript/engine.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/engine.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/engine.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/engine.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -39,6 +39,7 @@ enum { EXPRVAL_JSVAL, EXPRVAL_IDREF, + EXPRVAL_STACK_REF, EXPRVAL_INVALID } type; union { @@ -47,6 +48,8 @@ IDispatch *disp; DISPID id; } idref; + unsigned off; + HRESULT hres; } u; } exprval_t; @@ -85,27 +88,21 @@ return stack_push(ctx, jsval_string(v)); } -static HRESULT stack_push_objid(script_ctx_t *ctx, IDispatch *disp, DISPID id) -{ - HRESULT hres; - - hres = stack_push(ctx, jsval_disp(disp)); - if(FAILED(hres)) - return hres; - - return stack_push(ctx, jsval_number(id)); -} - static inline jsval_t stack_top(script_ctx_t *ctx) { assert(ctx->stack_top > ctx->call_ctx->stack_base); return ctx->stack[ctx->stack_top-1]; } +static inline jsval_t *stack_top_ref(script_ctx_t *ctx, unsigned n) +{ + assert(ctx->stack_top > ctx->call_ctx->stack_base+n); + return ctx->stack+ctx->stack_top-1-n; +} + static inline jsval_t stack_topn(script_ctx_t *ctx, unsigned n) { - assert(ctx->stack_top > ctx->call_ctx->stack_base+n); - return ctx->stack[ctx->stack_top-1-n]; + return *stack_top_ref(ctx, n); } static inline jsval_t *stack_args(script_ctx_t *ctx, unsigned n) @@ -167,32 +164,178 @@ return to_uint32(ctx, stack_pop(ctx), r); } -static inline IDispatch *stack_pop_objid(script_ctx_t *ctx, DISPID *id) -{ - assert(is_number(stack_top(ctx)) && is_object_instance(stack_topn(ctx, 1))); - - *id = get_number(stack_pop(ctx)); - return get_object(stack_pop(ctx)); -} - -static inline IDispatch *stack_topn_objid(script_ctx_t *ctx, unsigned n, DISPID *id) -{ - assert(is_number(stack_topn(ctx, n)) && is_object_instance(stack_topn(ctx, n+1))); - - *id = get_number(stack_topn(ctx, n)); - return get_object(stack_topn(ctx, n+1)); -} - -static inline jsval_t steal_ret(call_frame_t *frame) -{ - jsval_t r = frame->ret; - frame->ret = jsval_undefined(); - return r; -} - -static inline void clear_ret(call_frame_t *frame) -{ - jsval_release(steal_ret(frame)); +static inline unsigned local_off(call_frame_t *frame, int ref) +{ + return ref < 0 + ? frame->arguments_off - ref-1 + : frame->variables_off + ref; +} + +static inline BSTR local_name(call_frame_t *frame, int ref) +{ + return ref < 0 ? frame->function->params[-ref-1] : frame->function->variables[ref].name; +} + +/* Steals input reference even on failure. */ +static HRESULT stack_push_exprval(script_ctx_t *ctx, exprval_t *val) +{ + HRESULT hres; + + switch(val->type) { + case EXPRVAL_JSVAL: + assert(0); + case EXPRVAL_IDREF: + hres = stack_push(ctx, jsval_disp(val->u.idref.disp)); + if(SUCCEEDED(hres)) + hres = stack_push(ctx, jsval_number(val->u.idref.id)); + else + IDispatch_Release(val->u.idref.disp); + return hres; + case EXPRVAL_STACK_REF: + hres = stack_push(ctx, jsval_number(val->u.off)); + if(SUCCEEDED(hres)) + hres = stack_push(ctx, jsval_undefined()); + return hres; + case EXPRVAL_INVALID: + hres = stack_push(ctx, jsval_undefined()); + if(SUCCEEDED(hres)) + hres = stack_push(ctx, jsval_number(val->u.hres)); + return hres; + } + + assert(0); + return E_FAIL; +} + +static BOOL stack_topn_exprval(script_ctx_t *ctx, unsigned n, exprval_t *r) +{ + jsval_t v = stack_topn(ctx, n+1); + + switch(jsval_type(v)) { + case JSV_NUMBER: { + call_frame_t *frame = ctx->call_ctx; + unsigned off = get_number(v); + + if(!frame->base_scope->frame && off >= frame->arguments_off) { + DISPID id; + BSTR name; + HRESULT hres; + + /* Got stack reference in deoptimized code. Need to convert it back to variable object reference. */ + + assert(off < frame->variables_off + frame->function->var_cnt); + name = off >= frame->variables_off + ? frame->function->variables[off - frame->variables_off].name + : frame->function->params[off - frame->arguments_off]; + hres = jsdisp_get_id(ctx->call_ctx->base_scope->jsobj, name, 0, &id); + if(FAILED(hres)) { + r->type = EXPRVAL_INVALID; + r->u.hres = hres; + return FALSE; + } + + *stack_top_ref(ctx, n+1) = jsval_obj(jsdisp_addref(frame->base_scope->jsobj)); + *stack_top_ref(ctx, n) = jsval_number(id); + r->type = EXPRVAL_IDREF; + r->u.idref.disp = frame->base_scope->obj; + r->u.idref.id = id; + return TRUE; + } + + r->type = EXPRVAL_STACK_REF; + r->u.off = off; + return TRUE; + } + case JSV_OBJECT: + r->type = EXPRVAL_IDREF; + r->u.idref.disp = get_object(v); + assert(is_number(stack_topn(ctx, n))); + r->u.idref.id = get_number(stack_topn(ctx, n)); + return TRUE; + case JSV_UNDEFINED: + r->type = EXPRVAL_INVALID; + assert(is_number(stack_topn(ctx, n))); + r->u.hres = get_number(stack_topn(ctx, n)); + return FALSE; + default: + assert(0); + return FALSE; + } +} + +static inline BOOL stack_pop_exprval(script_ctx_t *ctx, exprval_t *r) +{ + BOOL ret = stack_topn_exprval(ctx, 0, r); + ctx->stack_top -= 2; + return ret; +} + +static HRESULT exprval_propput(script_ctx_t *ctx, exprval_t *ref, jsval_t v) +{ + switch(ref->type) { + case EXPRVAL_STACK_REF: { + jsval_t *r = ctx->stack + ref->u.off; + jsval_release(*r); + return jsval_copy(v, r); + } + case EXPRVAL_IDREF: + return disp_propput(ctx, ref->u.idref.disp, ref->u.idref.id, v); + default: + assert(0); + return E_FAIL; + } +} + +static HRESULT exprval_propget(script_ctx_t *ctx, exprval_t *ref, jsval_t *r) +{ + switch(ref->type) { + case EXPRVAL_STACK_REF: + return jsval_copy(ctx->stack[ref->u.off], r); + case EXPRVAL_IDREF: + return disp_propget(ctx, ref->u.idref.disp, ref->u.idref.id, r); + default: + assert(0); + return E_FAIL; + } +} + +static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) +{ + switch(ref->type) { + case EXPRVAL_STACK_REF: { + jsval_t v = ctx->stack[ref->u.off]; + + if(!is_object_instance(v)) { + FIXME("invoke %s\n", debugstr_jsval(v)); + return E_FAIL; + } + + return disp_call_value(ctx, get_object(v), NULL, flags, argc, argv, r); + } + case EXPRVAL_IDREF: + return disp_call(ctx, ref->u.idref.disp, ref->u.idref.id, flags, argc, argv, r); + default: + assert(0); + return E_FAIL; + } +} + +/* ECMA-262 3rd Edition 8.7.1 */ +/* Steals input reference. */ +static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *ref, jsval_t *r) +{ + HRESULT hres; + + if(ref->type == EXPRVAL_JSVAL) { + *r = ref->u.val; + return S_OK; + } + + hres = exprval_propget(ctx, ref, r); + + if(ref->type == EXPRVAL_IDREF) + IDispatch_Release(ref->u.idref.disp); + return hres; } static void exprval_release(exprval_t *val) @@ -205,42 +348,40 @@ if(val->u.idref.disp) IDispatch_Release(val->u.idref.disp); return; + case EXPRVAL_STACK_REF: case EXPRVAL_INVALID: return; } } -/* ECMA-262 3rd Edition 8.7.1 */ -static HRESULT exprval_to_value(script_ctx_t *ctx, exprval_t *val, jsval_t *ret) -{ - switch(val->type) { - case EXPRVAL_JSVAL: - *ret = val->u.val; - val->u.val = jsval_undefined(); - return S_OK; - case EXPRVAL_IDREF: - if(!val->u.idref.disp) { - FIXME("throw ReferenceError\n"); - return E_FAIL; - } - - return disp_propget(ctx, val->u.idref.disp, val->u.idref.id, ret); - case EXPRVAL_INVALID: - assert(0); - } - - ERR("type %d\n", val->type); - return E_FAIL; -} - -static void exprval_set_idref(exprval_t *val, IDispatch *disp, DISPID id) -{ - val->type = EXPRVAL_IDREF; - val->u.idref.disp = disp; - val->u.idref.id = id; - - if(disp) - IDispatch_AddRef(disp); +static inline void exprval_set_exception(exprval_t *val, HRESULT hres) +{ + val->type = EXPRVAL_INVALID; + val->u.hres = hres; +} + +static inline void exprval_set_disp_ref(exprval_t *ref, IDispatch *obj, DISPID id) +{ + ref->type = EXPRVAL_IDREF; +#ifdef __REACTOS__ /* FIXME: Inspect */ + IDispatch_AddRef(obj); + ref->u.idref.disp = obj; +#else + IDispatch_AddRef(ref->u.idref.disp = obj); +#endif + ref->u.idref.id = id; +} + +static inline jsval_t steal_ret(call_frame_t *frame) +{ + jsval_t r = frame->ret; + frame->ret = jsval_undefined(); + return r; +} + +static inline void clear_ret(call_frame_t *frame) +{ + jsval_release(steal_ret(frame)); } HRESULT scope_push(scope_chain_t *scope, jsdisp_t *jsobj, IDispatch *obj, scope_chain_t **ret) @@ -256,13 +397,8 @@ IDispatch_AddRef(obj); new_scope->jsobj = jsobj; new_scope->obj = obj; - - if(scope) { - scope_addref(scope); - new_scope->next = scope; - }else { - new_scope->next = NULL; - } + new_scope->frame = NULL; + new_scope->next = scope ? scope_addref(scope) : NULL; *ret = new_scope; return S_OK; @@ -303,7 +439,7 @@ BSTR bstr; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { hres = jsdisp_get_id(jsdisp, name, flags, id); jsdisp_release(jsdisp); @@ -416,6 +552,41 @@ return S_OK; } +/* + * Transfers local variables from stack to variable object. + * It's slow, so we want to avoid it as much as possible. + */ +static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame, BOOL from_release) +{ + unsigned i; + HRESULT hres; + + if(!frame->base_scope || !frame->base_scope->frame) + return S_OK; + + TRACE("detaching %p\n", frame); + + assert(frame == frame->base_scope->frame); + assert(frame->variable_obj == frame->base_scope->jsobj); + + if(!from_release && !frame->arguments_obj) { + hres = setup_arguments_object(ctx, frame); + if(FAILED(hres)) + return hres; + } + + frame->base_scope->frame = NULL; + + for(i = 0; i < frame->function->locals_cnt; i++) { + hres = jsdisp_propput_name(frame->variable_obj, frame->function->locals[i].name, + ctx->stack[local_off(frame, frame->function->locals[i].ref)]); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + static BOOL lookup_global_members(script_ctx_t *ctx, BSTR identifier, exprval_t *ret) { named_item_t *item; @@ -427,7 +598,7 @@ hres = disp_get_id(ctx, item->disp, identifier, identifier, 0, &id); if(SUCCEEDED(hres)) { if(ret) - exprval_set_idref(ret, item->disp, id); + exprval_set_disp_ref(ret, item->disp, id); return TRUE; } } @@ -436,6 +607,16 @@ return FALSE; } +static int local_ref_cmp(const void *key, const void *ref) +{ + return strcmpW((const WCHAR*)key, ((const local_ref_t*)ref)->name); +} + +local_ref_t *lookup_local(const function_code_t *function, const WCHAR *identifier) +{ + return bsearch(identifier, function->locals, function->locals_cnt, sizeof(*function->locals), local_ref_cmp); +} + /* ECMA-262 3rd Edition 10.1.4 */ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *ret) { @@ -448,12 +629,30 @@ if(ctx->call_ctx) { for(scope = ctx->call_ctx->scope; scope; scope = scope->next) { + if(scope->frame) { + function_code_t *func = scope->frame->function; + local_ref_t *ref = lookup_local(func, identifier); + static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; + + if(ref) { + ret->type = EXPRVAL_STACK_REF; + ret->u.off = local_off(scope->frame, ref->ref); + TRACE("returning ref %d for %d\n", ret->u.off, ref->ref); + return S_OK; + } + + if(!strcmpW(identifier, argumentsW)) { + hres = detach_variable_object(ctx, scope->frame, FALSE); + if(FAILED(hres)) + return hres; + } + } if(scope->jsobj) hres = jsdisp_get_id(scope->jsobj, identifier, fdexNameImplicit, &id); else hres = disp_get_id(ctx, scope->obj, identifier, identifier, fdexNameImplicit, &id); if(SUCCEEDED(hres)) { - exprval_set_idref(ret, scope->obj, id); + exprval_set_disp_ref(ret, scope->obj, id); return S_OK; } } @@ -461,7 +660,7 @@ hres = jsdisp_get_id(ctx->global, identifier, 0, &id); if(SUCCEEDED(hres)) { - exprval_set_idref(ret, to_disp(ctx->global), id); + exprval_set_disp_ref(ret, to_disp(ctx->global), id); return S_OK; } @@ -498,7 +697,7 @@ if(lookup_global_members(ctx, identifier, ret)) return S_OK; - ret->type = EXPRVAL_INVALID; + exprval_set_exception(ret, JS_E_UNDEFINED_VARIABLE); return S_OK; } @@ -542,28 +741,14 @@ ctx->call_ctx->ip = dst; } -/* ECMA-262 3rd Edition 12.2 */ -static HRESULT interp_var_set(script_ctx_t *ctx) -{ - const BSTR name = get_op_bstr(ctx, 0); - jsval_t val; - HRESULT hres; - - TRACE("%s\n", debugstr_w(name)); - - val = stack_pop(ctx); - hres = jsdisp_propput_name(ctx->call_ctx->variable_obj, name, val); - jsval_release(val); - return hres; -} - /* ECMA-262 3rd Edition 12.6.4 */ static HRESULT interp_forin(script_ctx_t *ctx) { const HRESULT arg = get_op_uint(ctx, 0); - IDispatch *var_obj, *obj = NULL; + IDispatch *obj = NULL; IDispatchEx *dispex; - DISPID id, var_id; + exprval_t prop_ref; + DISPID id; BSTR name = NULL; HRESULT hres; @@ -572,9 +757,8 @@ assert(is_number(stack_top(ctx))); id = get_number(stack_top(ctx)); - var_obj = stack_topn_objid(ctx, 1, &var_id); - if(!var_obj) { - FIXME("invalid ref\n"); + if(!stack_topn_exprval(ctx, 1, &prop_ref)) { + FIXME("invalid ref: %08x\n", prop_ref.u.hres); return E_FAIL; } @@ -606,7 +790,7 @@ stack_pop(ctx); stack_push(ctx, jsval_number(id)); /* safe, just after pop() */ - hres = disp_propput(ctx, var_obj, var_id, jsval_string(str)); + hres = exprval_propput(ctx, &prop_ref, jsval_string(str)); jsstr_release(str); if(FAILED(hres)) return hres; @@ -875,6 +1059,7 @@ const WCHAR *name; jsstr_t *name_str; IDispatch *obj; + exprval_t ref; DISPID id; HRESULT hres; @@ -896,35 +1081,37 @@ hres = disp_get_id(ctx, obj, name, NULL, arg, &id); jsstr_release(name_str); - if(FAILED(hres)) { + if(SUCCEEDED(hres)) { + ref.type = EXPRVAL_IDREF; + ref.u.idref.disp = obj; + ref.u.idref.id = id; + }else { IDispatch_Release(obj); if(hres == DISP_E_UNKNOWNNAME && !(arg & fdexNameEnsure)) { - obj = NULL; - id = JS_E_INVALID_PROPERTY; + exprval_set_exception(&ref, JS_E_INVALID_PROPERTY); + hres = S_OK; }else { ERR("failed %08x\n", hres); return hres; } } - return stack_push_objid(ctx, obj, id); + return stack_push_exprval(ctx, &ref); } /* ECMA-262 3rd Edition 11.2.1 */ static HRESULT interp_refval(script_ctx_t *ctx) { - IDispatch *disp; + exprval_t ref; jsval_t v; - DISPID id; - HRESULT hres; - - TRACE("\n"); - - disp = stack_topn_objid(ctx, 0, &id); - if(!disp) + HRESULT hres; + + TRACE("\n"); + + if(!stack_topn_exprval(ctx, 0, &ref)) return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); - hres = disp_propget(ctx, disp, id, &v); + hres = exprval_propget(ctx, &ref, &v); if(FAILED(hres)) return hres; @@ -981,17 +1168,15 @@ const unsigned argn = get_op_uint(ctx, 0); const int do_ret = get_op_int(ctx, 1); call_frame_t *frame = ctx->call_ctx; - IDispatch *obj; - DISPID id; + exprval_t ref; TRACE("%d %d\n", argn, do_ret); - obj = stack_topn_objid(ctx, argn, &id); - if(!obj) - return throw_type_error(ctx, id, NULL); + if(!stack_topn_exprval(ctx, argn, &ref)) + return throw_type_error(ctx, ref.u.hres, NULL); clear_ret(frame); - return disp_call(ctx, obj, id, DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, + return exprval_call(ctx, &ref, DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, argn, stack_args(ctx, argn), do_ret ? &frame->ret : NULL); } @@ -1006,29 +1191,98 @@ return stack_push(ctx, jsval_disp(frame->this_obj)); } +static HRESULT interp_identifier_ref(script_ctx_t *ctx, BSTR identifier, unsigned flags) +{ + exprval_t exprval; + HRESULT hres; + + hres = identifier_eval(ctx, identifier, &exprval); + if(FAILED(hres)) + return hres; + + if(exprval.type == EXPRVAL_INVALID && (flags & fdexNameEnsure)) { + DISPID id; + + hres = jsdisp_get_id(ctx->global, identifier, fdexNameEnsure, &id); + if(FAILED(hres)) + return hres; + + exprval_set_disp_ref(&exprval, to_disp(ctx->global), id); + } + + if(exprval.type == EXPRVAL_JSVAL || exprval.type == EXPRVAL_INVALID) { + WARN("invalid ref\n"); + exprval_release(&exprval); + exprval_set_exception(&exprval, JS_E_OBJECT_EXPECTED); + } + + return stack_push_exprval(ctx, &exprval); +} + +static HRESULT identifier_value(script_ctx_t *ctx, BSTR identifier) +{ + exprval_t exprval; + jsval_t v; + HRESULT hres; + + hres = identifier_eval(ctx, identifier, &exprval); + if(FAILED(hres)) + return hres; + + if(exprval.type == EXPRVAL_INVALID) + return throw_type_error(ctx, exprval.u.hres, identifier); + + hres = exprval_to_value(ctx, &exprval, &v); + if(FAILED(hres)) + return hres; + + return stack_push(ctx, v); +} + +static HRESULT interp_local_ref(script_ctx_t *ctx) +{ + const int arg = get_op_int(ctx, 0); + const unsigned flags = get_op_uint(ctx, 1); + call_frame_t *frame = ctx->call_ctx; + exprval_t ref; + + TRACE("%d\n", arg); + + if(!frame->base_scope || !frame->base_scope->frame) + return interp_identifier_ref(ctx, local_name(frame, arg), flags); + + ref.type = EXPRVAL_STACK_REF; + ref.u.off = local_off(frame, arg); + return stack_push_exprval(ctx, &ref); +} + +static HRESULT interp_local(script_ctx_t *ctx) +{ + const int arg = get_op_int(ctx, 0); + call_frame_t *frame = ctx->call_ctx; + jsval_t copy; + HRESULT hres; + + TRACE("%d\n", arg); + + if(!frame->base_scope || !frame->base_scope->frame) + return identifier_value(ctx, local_name(frame, arg)); + + hres = jsval_copy(ctx->stack[local_off(frame, arg)], ©); + if(FAILED(hres)) + return hres; + + return stack_push(ctx, copy); +} + /* ECMA-262 3rd Edition 10.1.4 */ static HRESULT interp_ident(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); - exprval_t exprval; - jsval_t v; - HRESULT hres; TRACE("%s\n", debugstr_w(arg)); - hres = identifier_eval(ctx, arg, &exprval); - if(FAILED(hres)) - return hres; - - if(exprval.type == EXPRVAL_INVALID) - return throw_type_error(ctx, JS_E_UNDEFINED_VARIABLE, arg); - - hres = exprval_to_value(ctx, &exprval, &v); - exprval_release(&exprval); - if(FAILED(hres)) - return hres; - - return stack_push(ctx, v); + return identifier_value(ctx, arg); } /* ECMA-262 3rd Edition 10.1.4 */ @@ -1036,32 +1290,10 @@ { const BSTR arg = get_op_bstr(ctx, 0); const unsigned flags = get_op_uint(ctx, 1); - exprval_t exprval; - HRESULT hres; TRACE("%s %x\n", debugstr_w(arg), flags); - hres = identifier_eval(ctx, arg, &exprval); - if(FAILED(hres)) - return hres; - - if(exprval.type == EXPRVAL_INVALID && (flags & fdexNameEnsure)) { - DISPID id; - - hres = jsdisp_get_id(ctx->global, arg, fdexNameEnsure, &id); - if(FAILED(hres)) - return hres; - - exprval_set_idref(&exprval, to_disp(ctx->global), id); - } - - if(exprval.type != EXPRVAL_IDREF) { - WARN("invalid ref\n"); - exprval_release(&exprval); - return stack_push_objid(ctx, NULL, JS_E_OBJECT_EXPECTED); - } - - return stack_push_objid(ctx, exprval.u.idref.disp, exprval.u.idref.id); + return interp_identifier_ref(ctx, arg, flags); } /* ECMA-262 3rd Edition 7.8.1 */ @@ -1310,7 +1542,7 @@ return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); } - obj = iface_to_jsdisp((IUnknown*)get_object(v)); + obj = iface_to_jsdisp(get_object(v)); IDispatch_Release(get_object(v)); if(!obj) { FIXME("non-jsdisp objects not supported\n"); @@ -1330,7 +1562,7 @@ if(is_object_instance(prot)) { if(is_object_instance(v)) - tmp = iface_to_jsdisp((IUnknown*)get_object(v)); + tmp = iface_to_jsdisp(get_object(v)); for(iter = tmp; !ret && iter; iter = iter->prototype) { hres = disp_cmp(get_object(prot), to_disp(iter), &ret); if(FAILED(hres)) @@ -1591,6 +1823,9 @@ return hres; switch(exprval.type) { + case EXPRVAL_STACK_REF: + ret = FALSE; + break; case EXPRVAL_IDREF: hres = disp_delete(exprval.u.idref.disp, exprval.u.idref.id, &ret); IDispatch_Release(exprval.u.idref.disp); @@ -1632,7 +1867,7 @@ case JSV_OBJECT: { jsdisp_t *dispex; - if(get_object(v) && (dispex = iface_to_jsdisp((IUnknown*)get_object(v)))) { + if(get_object(v) && (dispex = iface_to_jsdisp(get_object(v)))) { *ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW; jsdisp_release(dispex); }else { @@ -1661,19 +1896,17 @@ static HRESULT interp_typeofid(script_ctx_t *ctx) { const WCHAR *ret; - IDispatch *obj; + exprval_t ref; jsval_t v; - DISPID id; - HRESULT hres; - - TRACE("\n"); - - obj = stack_pop_objid(ctx, &id); - if(!obj) + HRESULT hres; + + TRACE("\n"); + + if(!stack_pop_exprval(ctx, &ref)) return stack_push(ctx, jsval_string(jsstr_undefined())); - hres = disp_propget(ctx, obj, id, &v); - IDispatch_Release(obj); + hres = exprval_propget(ctx, &ref, &v); + exprval_release(&ref); if(FAILED(hres)) return stack_push_string(ctx, unknownW); @@ -1700,14 +1933,10 @@ if(FAILED(hres)) return hres; - if(exprval.type == EXPRVAL_INVALID) { - hres = stack_push(ctx, jsval_string(jsstr_undefined())); - exprval_release(&exprval); - return hres; - } + if(exprval.type == EXPRVAL_INVALID) + return stack_push(ctx, jsval_string(jsstr_undefined())); hres = exprval_to_value(ctx, &exprval, &v); - exprval_release(&exprval); if(FAILED(hres)) return hres; @@ -1774,28 +2003,26 @@ static HRESULT interp_postinc(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); - IDispatch *obj; - DISPID id; + exprval_t ref; jsval_t v; HRESULT hres; TRACE("%d\n", arg); - obj = stack_pop_objid(ctx, &id); - if(!obj) + if(!stack_pop_exprval(ctx, &ref)) return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); - hres = disp_propget(ctx, obj, id, &v); + hres = exprval_propget(ctx, &ref, &v); if(SUCCEEDED(hres)) { double n; hres = to_number(ctx, v, &n); if(SUCCEEDED(hres)) - hres = disp_propput(ctx, obj, id, jsval_number(n+(double)arg)); + hres = exprval_propput(ctx, &ref, jsval_number(n+(double)arg)); if(FAILED(hres)) jsval_release(v); } - IDispatch_Release(obj); + exprval_release(&ref); if(FAILED(hres)) return hres; @@ -1806,19 +2033,17 @@ static HRESULT interp_preinc(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); - IDispatch *obj; + exprval_t ref; double ret; - DISPID id; jsval_t v; HRESULT hres; TRACE("%d\n", arg); - obj = stack_pop_objid(ctx, &id); - if(!obj) + if(!stack_pop_exprval(ctx, &ref)) return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); - hres = disp_propget(ctx, obj, id, &v); + hres = exprval_propget(ctx, &ref, &v); if(SUCCEEDED(hres)) { double n; @@ -1826,10 +2051,10 @@ jsval_release(v); if(SUCCEEDED(hres)) { ret = n+(double)arg; - hres = disp_propput(ctx, obj, id, jsval_number(ret)); + hres = exprval_propput(ctx, &ref, jsval_number(ret)); } } - IDispatch_Release(obj); + exprval_release(&ref); if(FAILED(hres)) return hres; @@ -2212,8 +2437,7 @@ /* ECMA-262 3rd Edition 11.13.1 */ static HRESULT interp_assign(script_ctx_t *ctx) { - IDispatch *disp; - DISPID id; + exprval_t ref; jsval_t v; HRESULT hres; @@ -2221,14 +2445,13 @@ v = stack_pop(ctx); - disp = stack_pop_objid(ctx, &id); - if(!disp) { + if(!stack_pop_exprval(ctx, &ref)) { jsval_release(v); return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); } - hres = disp_propput(ctx, disp, id, v); - IDispatch_Release(disp); + hres = exprval_propput(ctx, &ref, v); + exprval_release(&ref); if(FAILED(hres)) { jsval_release(v); return hres; @@ -2241,18 +2464,16 @@ static HRESULT interp_assign_call(script_ctx_t *ctx) { const unsigned argc = get_op_uint(ctx, 0); - IDispatch *disp; + exprval_t ref; jsval_t v; - DISPID id; HRESULT hres; TRACE("%u\n", argc); - disp = stack_topn_objid(ctx, argc+1, &id); - if(!disp) + if(!stack_topn_exprval(ctx, argc+1, &ref)) return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); - hres = disp_call(ctx, disp, id, DISPATCH_PROPERTYPUT, argc+1, stack_args(ctx, argc+1), NULL); + hres = exprval_call(ctx, &ref, DISPATCH_PROPERTYPUT, argc+1, stack_args(ctx, argc+1), NULL); if(FAILED(hres)) return hres; @@ -2368,23 +2589,38 @@ #undef X }; -static void release_call_frame(call_frame_t *frame) -{ - if(frame->arguments_obj) { - /* Reset arguments value to cut the reference cycle. Note that since all activation contexts have - * their own arguments property, it's impossible to use prototype's one during name lookup */ - static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; - jsdisp_propput_name(frame->variable_obj, argumentsW, jsval_undefined()); - jsdisp_release(frame->arguments_obj); - } +static void pop_call_frame(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; + + frame->stack_base -= frame->pop_locals + frame->pop_variables; + + assert(frame->scope == frame->base_scope); + + /* If current scope will be kept alive, we need to transfer local variables to its variable object. */ + if(frame->scope && frame->scope->ref > 1) { + HRESULT hres = detach_variable_object(ctx, frame, TRUE); + if(FAILED(hres)) + ERR("Failed to detach variable object: %08x\n", hres); + } + + if(frame->arguments_obj) + detach_arguments_object(frame->arguments_obj); + if(frame->scope) + scope_release(frame->scope); + + if(frame->pop_variables) + stack_popn(ctx, frame->pop_variables); + stack_popn(ctx, frame->pop_locals); + + ctx->call_ctx = frame->prev_frame; + if(frame->function_instance) jsdisp_release(frame->function_instance); if(frame->variable_obj) jsdisp_release(frame->variable_obj); if(frame->this_obj) IDispatch_Release(frame->this_obj); - if(frame->scope) - scope_release(frame->scope); jsval_release(frame->ret); release_bytecode(frame->bytecode); heap_free(frame); @@ -2406,9 +2642,8 @@ stack_popn(ctx, ctx->stack_top-frame->stack_base); - ctx->call_ctx = frame->prev_frame; flags = frame->flags; - release_call_frame(frame); + pop_call_frame(ctx); if(!(flags & EXEC_RETURN_TO_INTERP)) return exception_hres; } @@ -2481,14 +2716,13 @@ assert(ctx->stack_top == frame->stack_base); assert(frame->scope == frame->base_scope); - ctx->call_ctx = frame->prev_frame; if(return_to_interp) { - clear_ret(ctx->call_ctx); - ctx->call_ctx->ret = steal_ret(frame); + clear_ret(frame->prev_frame); + frame->prev_frame->ret = steal_ret(frame); }else if(r) { *r = steal_ret(frame); } - release_call_frame(frame); + pop_call_frame(ctx); if(!return_to_interp) break; }else { @@ -2512,7 +2746,6 @@ return hres; hres = exprval_to_value(ctx, &exprval, &v); - exprval_release(&exprval); if(FAILED(hres)) return hres; @@ -2536,8 +2769,85 @@ return hres; } +static HRESULT setup_scope(script_ctx_t *ctx, call_frame_t *frame, scope_chain_t *scope_chain, jsdisp_t *variable_object, unsigned argc, jsval_t *argv) +{ + const unsigned orig_stack = ctx->stack_top; + scope_chain_t *scope; + unsigned i; + jsval_t v; + HRESULT hres; + + /* If arguments are already on the stack, we may use them. */ + if(argv + argc == ctx->stack + ctx->stack_top) { + frame->arguments_off = argv - ctx->stack; + i = argc; + }else { + frame->arguments_off = ctx->stack_top; + for(i = 0; i < argc; i++) { + hres = jsval_copy(argv[i], &v); + if(SUCCEEDED(hres)) + hres = stack_push(ctx, v); + if(FAILED(hres)) { + stack_popn(ctx, i); + return hres; + } + } + } + + /* If fewer than declared arguments were passed, fill remaining with undefined value. */ + for(; i < frame->function->param_cnt; i++) { + hres = stack_push(ctx, jsval_undefined()); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + return hres; + } + } + + frame->pop_locals = ctx->stack_top - orig_stack; + + frame->variables_off = ctx->stack_top; + + for(i = 0; i < frame->function->var_cnt; i++) { + hres = stack_push(ctx, jsval_undefined()); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + return hres; + } + } + + frame->pop_variables = i; + + hres = scope_push(scope_chain, variable_object, to_disp(variable_object), &scope); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + return hres; + } + + for(i = 0; i < frame->function->func_cnt; i++) { + if(frame->function->funcs[i].name && !frame->function->funcs[i].event_target) { + jsdisp_t *func_obj; + unsigned off; + + hres = create_source_function(ctx, frame->bytecode, frame->function->funcs+i, scope, &func_obj); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + scope_release(scope); + return hres; + } + + off = local_off(frame, frame->function->funcs[i].local_ref); + jsval_release(ctx->stack[off]); + ctx->stack[off] = jsval_obj(func_obj); + } + } + + scope->frame = frame; + frame->base_scope = frame->scope = scope; + return S_OK; +} + HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope, - IDispatch *this_obj, jsdisp_t *function_instance, jsdisp_t *variable_obj, jsdisp_t *arguments_obj, jsval_t *r) + IDispatch *this_obj, jsdisp_t *function_instance, jsdisp_t *variable_obj, unsigned argc, jsval_t *argv, jsval_t *r) { call_frame_t *frame; unsigned i; @@ -2546,29 +2856,38 @@ for(i = 0; i < function->func_cnt; i++) { jsdisp_t *func_obj; - if(!function->funcs[i].name) + if(!function->funcs[i].event_target) continue; hres = create_source_function(ctx, bytecode, function->funcs+i, scope, &func_obj); if(FAILED(hres)) return hres; - if(function->funcs[i].event_target) - hres = bind_event_target(ctx, function->funcs+i, func_obj); - else - hres = jsdisp_propput_name(variable_obj, function->funcs[i].name, jsval_obj(func_obj)); + hres = bind_event_target(ctx, function->funcs+i, func_obj); jsdisp_release(func_obj); if(FAILED(hres)) return hres; } - for(i=0; i < function->var_cnt; i++) { - if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i], NULL)) { - DISPID id = 0; - - hres = jsdisp_get_id(variable_obj, function->variables[i], fdexNameEnsure, &id); - if(FAILED(hres)) - return hres; + if(flags & (EXEC_GLOBAL | EXEC_EVAL)) { + for(i=0; i < function->var_cnt; i++) { + TRACE("[%d] %s %d\n", i, debugstr_w(function->variables[i].name), function->variables[i].func_id); + if(function->variables[i].func_id != -1) { + jsdisp_t *func_obj; + + hres = create_source_function(ctx, bytecode, function->funcs+function->variables[i].func_id, scope, &func_obj); + if(FAILED(hres)) + return hres; + + hres = jsdisp_propput_name(variable_obj, function->variables[i].name, jsval_obj(func_obj)); + jsdisp_release(func_obj); + }else if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i].name, NULL)) { + DISPID id = 0; + + hres = jsdisp_get_id(variable_obj, function->variables[i].name, fdexNameEnsure, &id); + if(FAILED(hres)) + return hres; + } } } @@ -2576,7 +2895,7 @@ if(this_obj) { jsdisp_t *jsthis; - jsthis = iface_to_jsdisp((IUnknown*)this_obj); + jsthis = iface_to_jsdisp(this_obj); if(jsthis) { if(jsthis->builtin_info->class == JSCLASS_GLOBAL || jsthis->builtin_info->class == JSCLASS_NONE) this_obj = NULL; @@ -2584,18 +2903,34 @@ } } + if(ctx->call_ctx && (flags & EXEC_EVAL)) { + hres = detach_variable_object(ctx, ctx->call_ctx, FALSE); + if(FAILED(hres)) + return hres; + } + frame = heap_alloc_zero(sizeof(*frame)); if(!frame) return E_OUTOFMEMORY; + frame->function = function; + frame->ret = jsval_undefined(); + frame->argc = argc; frame->bytecode = bytecode_addref(bytecode); - frame->function = function; + + if(!(flags & (EXEC_GLOBAL|EXEC_EVAL))) { + hres = setup_scope(ctx, frame, scope, variable_obj, argc, argv); + if(FAILED(hres)) { + release_bytecode(frame->bytecode); + heap_free(frame); + return hres; + } + }else if(scope) { + frame->base_scope = frame->scope = scope_addref(scope); + } + frame->ip = function->instr_off; frame->stack_base = ctx->stack_top; - frame->ret = jsval_undefined(); - if(scope) - frame->base_scope = frame->scope = scope_addref(scope); - if(this_obj) frame->this_obj = this_obj; else if(ctx->host_global) @@ -2606,8 +2941,6 @@ if(function_instance) frame->function_instance = jsdisp_addref(function_instance); - if(arguments_obj) - frame->arguments_obj = jsdisp_addref(arguments_obj); frame->flags = flags; frame->variable_obj = jsdisp_addref(variable_obj); Modified: trunk/reactos/dll/win32/jscript/engine.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/engine.h…
============================================================================== --- trunk/reactos/dll/win32/jscript/engine.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/engine.h [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -50,6 +50,8 @@ X(int, 1, ARG_INT, 0) \ X(jmp, 0, ARG_ADDR, 0) \ X(jmp_z, 0, ARG_ADDR, 0) \ + X(local, 1, ARG_INT, 0) \ + X(local_ref, 1, ARG_INT, ARG_UINT) \ X(lshift, 1, 0,0) \ X(lt, 1, 0,0) \ X(lteq, 1, 0,0) \ @@ -91,7 +93,6 @@ X(setret, 1, 0,0) \ X(sub, 1, 0,0) \ X(undefined, 1, 0,0) \ - X(var_set, 1, ARG_BSTR, 0) \ X(void, 1, 0,0) \ X(xor, 1, 0,0) @@ -128,8 +129,14 @@ } u; } instr_t; +typedef struct { + BSTR name; + int ref; +} local_ref_t; + typedef struct _function_code_t { BSTR name; + int local_ref; BSTR event_target; unsigned instr_off; @@ -140,11 +147,19 @@ struct _function_code_t *funcs; unsigned var_cnt; - BSTR *variables; + struct { + BSTR name; + int func_id; /* -1 if not a function */ + } *variables; unsigned param_cnt; BSTR *params; + + unsigned locals_cnt; + local_ref_t *locals; } function_code_t; + +local_ref_t *lookup_local(const function_code_t*,const WCHAR*) DECLSPEC_HIDDEN; typedef struct _bytecode_t { LONG ref; @@ -180,6 +195,7 @@ LONG ref; jsdisp_t *jsobj; IDispatch *obj; + struct _call_frame_t *frame; struct _scope_chain_t *next; } scope_chain_t; @@ -210,6 +226,12 @@ jsdisp_t *arguments_obj; DWORD flags; + unsigned argc; + unsigned pop_locals; + unsigned arguments_off; + unsigned variables_off; + unsigned pop_variables; + bytecode_t *bytecode; function_code_t *function; @@ -219,8 +241,11 @@ #define EXEC_GLOBAL 0x0001 #define EXEC_CONSTRUCTOR 0x0002 #define EXEC_RETURN_TO_INTERP 0x0004 +#define EXEC_EVAL 0x0008 HRESULT exec_source(script_ctx_t*,DWORD,bytecode_t*,function_code_t*,scope_chain_t*,IDispatch*, - jsdisp_t*,jsdisp_t*,jsdisp_t*,jsval_t*) DECLSPEC_HIDDEN; + jsdisp_t*,jsdisp_t*,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT create_source_function(script_ctx_t*,bytecode_t*,function_code_t*,scope_chain_t*,jsdisp_t**) DECLSPEC_HIDDEN; +HRESULT setup_arguments_object(script_ctx_t*,call_frame_t*) DECLSPEC_HIDDEN; +void detach_arguments_object(jsdisp_t*) DECLSPEC_HIDDEN; Modified: trunk/reactos/dll/win32/jscript/function.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/function…
============================================================================== --- trunk/reactos/dll/win32/jscript/function.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/function.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -32,7 +32,9 @@ typedef struct { jsdisp_t jsdisp; FunctionInstance *function; - jsdisp_t *var_obj; + jsval_t *buf; + call_frame_t *frame; + unsigned argc; } ArgumentsInstance; static inline FunctionInstance *function_from_jsdisp(jsdisp_t *jsdisp) @@ -48,6 +50,11 @@ static inline FunctionInstance *function_this(vdisp_t *jsthis) { return is_vclass(jsthis, JSCLASS_FUNCTION) ? function_from_vdisp(jsthis) : NULL; +} + +static inline ArgumentsInstance *arguments_from_jsdisp(jsdisp_t *jsdisp) +{ + return CONTAINING_RECORD(jsdisp, ArgumentsInstance, jsdisp); } static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0}; @@ -58,61 +65,80 @@ static const WCHAR callW[] = {'c','a','l','l',0}; static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; -static HRESULT init_parameters(jsdisp_t *var_disp, FunctionInstance *function, unsigned argc, jsval_t *argv) -{ - DWORD i=0; - HRESULT hres; - - for(i=0; i < function->func_code->param_cnt; i++) { - hres = jsdisp_propput_name(var_disp, function->func_code->params[i], - i < argc ? argv[i] : jsval_undefined()); +static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static void Arguments_destructor(jsdisp_t *jsdisp) +{ + ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + + TRACE("(%p)\n", arguments); + + if(arguments->buf) { + unsigned i; + for(i = 0; i < arguments->argc; i++) + jsval_release(arguments->buf[i]); + heap_free(arguments->buf); + } + + jsdisp_release(&arguments->function->dispex); + heap_free(arguments); +} + +static unsigned Arguments_idx_length(jsdisp_t *jsdisp) +{ + ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + return arguments->argc; +} + +static jsval_t *get_argument_ref(ArgumentsInstance *arguments, unsigned idx) +{ + if(arguments->buf) + return arguments->buf + idx; + if(arguments->frame->base_scope->frame || idx >= arguments->frame->function->param_cnt) + return arguments->jsdisp.ctx->stack + arguments->frame->arguments_off + idx; + return NULL; +} + +static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) +{ + ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + jsval_t *ref; + + TRACE("%p[%u]\n", arguments, idx); + + if((ref = get_argument_ref(arguments, idx))) + return jsval_copy(*ref, r); + + /* FIXME: Accessing by name won't work for duplicated argument names */ + return jsdisp_propget_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], r); +} + +static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) +{ + ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + jsval_t *ref; + HRESULT hres; + + TRACE("%p[%u] = %s\n", arguments, idx, debugstr_jsval(val)); + + if((ref = get_argument_ref(arguments, idx))) { + jsval_t copy; + hres = jsval_copy(val, ©); if(FAILED(hres)) return hres; - } - - return S_OK; -} - -static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, - jsval_t *r) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static void Arguments_destructor(jsdisp_t *jsdisp) -{ - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; - - jsdisp_release(&arguments->function->dispex); - jsdisp_release(arguments->var_obj); - heap_free(arguments); -} - -static unsigned Arguments_idx_length(jsdisp_t *jsdisp) -{ - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; - return arguments->function->length; -} - -static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *res) -{ - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; - - TRACE("%p[%u]\n", arguments, idx); + + jsval_release(*ref); + *ref = copy; + return S_OK; + } /* FIXME: Accessing by name won't work for duplicated argument names */ - return jsdisp_propget_name(arguments->var_obj, arguments->function->func_code->params[idx], res); -} - -static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) -{ - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; - - TRACE("%p[%u] = %s\n", arguments, idx, debugstr_jsval(val)); - - /* FIXME: Accessing by name won't work for duplicated argument names */ - return jsdisp_propput_name(arguments->var_obj, arguments->function->func_code->params[idx], val); + return jsdisp_propput_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], val); } static const builtin_info_t Arguments_info = { @@ -126,11 +152,9 @@ Arguments_idx_put }; -static HRESULT create_arguments(script_ctx_t *ctx, FunctionInstance *calee, jsdisp_t *var_obj, - unsigned argc, jsval_t *argv, jsdisp_t **ret) +HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame) { ArgumentsInstance *args; - unsigned i; HRESULT hres; static const WCHAR caleeW[] = {'c','a','l','l','e','e',0}; @@ -145,60 +169,64 @@ return hres; } - jsdisp_addref(&calee->dispex); - args->function = calee; - args->var_obj = jsdisp_addref(var_obj); - - /* Store unnamed arguments directly in arguments object */ - for(i = calee->length; i < argc; i++) { - WCHAR buf[12]; - - static const WCHAR formatW[] = {'%','d',0}; - - sprintfW(buf, formatW, i); - hres = jsdisp_propput_dontenum(&args->jsdisp, buf, argv[i]); - if(FAILED(hres)) - break; - } - - if(SUCCEEDED(hres)) { - hres = jsdisp_propput_dontenum(&args->jsdisp, lengthW, jsval_number(argc)); - if(SUCCEEDED(hres)) - hres = jsdisp_propput_dontenum(&args->jsdisp, caleeW, jsval_disp(to_disp(&calee->dispex))); - } + args->function = function_from_jsdisp(jsdisp_addref(frame->function_instance)); + args->argc = frame->argc; + args->frame = frame; + + hres = jsdisp_propput_dontenum(&args->jsdisp, lengthW, jsval_number(args->argc)); + if(SUCCEEDED(hres)) + hres = jsdisp_propput_dontenum(&args->jsdisp, caleeW, jsval_disp(to_disp(&args->function->dispex))); + if(SUCCEEDED(hres)) + hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_DONTDELETE, jsval_obj(&args->jsdisp)); if(FAILED(hres)) { jsdisp_release(&args->jsdisp); return hres; } - *ret = &args->jsdisp; - return S_OK; -} - -static HRESULT create_var_disp(script_ctx_t *ctx, FunctionInstance *function, unsigned argc, jsval_t *argv, jsdisp_t **ret) -{ - jsdisp_t *var_disp; - HRESULT hres; - - hres = create_dispex(ctx, NULL, NULL, &var_disp); - if(FAILED(hres)) - return hres; - - hres = init_parameters(var_disp, function, argc, argv); - if(FAILED(hres)) { - jsdisp_release(var_disp); - return hres; - } - - *ret = var_disp; - return S_OK; + frame->arguments_obj = &args->jsdisp; + return S_OK; +} + +void detach_arguments_object(jsdisp_t *args_disp) +{ + ArgumentsInstance *arguments = arguments_from_jsdisp(args_disp); + call_frame_t *frame = arguments->frame; + const BOOL on_stack = frame->base_scope->frame == frame; + HRESULT hres; + + /* Reset arguments value to cut the reference cycle. Note that since all activation contexts have + * their own arguments property, it's impossible to use prototype's one during name lookup */ + jsdisp_propput_name(frame->base_scope->jsobj, argumentsW, jsval_undefined()); + arguments->frame = NULL; + + /* Don't bother coppying arguments if call frame holds the last reference. */ + if(arguments->jsdisp.ref > 1) { + arguments->buf = heap_alloc(arguments->argc * sizeof(*arguments->buf)); + if(arguments->buf) { + int i; + + for(i = 0; i < arguments->argc ; i++) { + if(on_stack || i >= frame->function->param_cnt) + hres = jsval_copy(arguments->jsdisp.ctx->stack[frame->arguments_off + i], arguments->buf+i); + else + hres = jsdisp_propget_name(frame->base_scope->jsobj, frame->function->params[i], arguments->buf+i); + if(FAILED(hres)) + arguments->buf[i] = jsval_undefined(); + } + }else { + ERR("out of memory\n"); + arguments->argc = 0; + } + } + + jsdisp_release(frame->arguments_obj); } static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, jsval_t *argv, BOOL is_constructor, BOOL caller_execs_source, jsval_t *r) { - jsdisp_t *var_disp, *arg_disp; - scope_chain_t *scope; + jsdisp_t *var_disp; + DWORD exec_flags = 0; HRESULT hres; if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) { @@ -211,38 +239,17 @@ return E_FAIL; } - hres = create_var_disp(ctx, function, argc, argv, &var_disp); - if(FAILED(hres)) - return hres; - - hres = create_arguments(ctx, function, var_disp, argc, argv, &arg_disp); - if(FAILED(hres)) { - jsdisp_release(var_disp); - return hres; - } - - hres = jsdisp_propput(var_disp, argumentsW, PROPF_DONTDELETE, jsval_obj(arg_disp)); - if(FAILED(hres)) { - jsdisp_release(arg_disp); - jsdisp_release(var_disp); - return hres; - } - - hres = scope_push(function->scope_chain, var_disp, to_disp(var_disp), &scope); - if(SUCCEEDED(hres)) { - DWORD exec_flags = 0; - - if(caller_execs_source) - exec_flags |= EXEC_RETURN_TO_INTERP; - if(is_constructor) - exec_flags |= EXEC_CONSTRUCTOR; - hres = exec_source(ctx, exec_flags, function->code, function->func_code, scope, this_obj, - &function->dispex, var_disp, arg_disp, r); - - scope_release(scope); - } - - jsdisp_release(arg_disp); + hres = create_dispex(ctx, NULL, NULL, &var_disp); + if(FAILED(hres)) + return hres; + + if(caller_execs_source) + exec_flags |= EXEC_RETURN_TO_INTERP; + if(is_constructor) + exec_flags |= EXEC_CONSTRUCTOR; + hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, + &function->dispex, var_disp, argc, argv, r); + jsdisp_release(var_disp); return hres; } @@ -419,7 +426,7 @@ TRACE("\n"); - if(!(function = function_this(jsthis))) + if(!(function = function_this(jsthis)) && (jsthis->flags & VDISP_JSDISP)) return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); if(argc) { @@ -434,7 +441,7 @@ jsdisp_t *arg_array = NULL; if(is_object_instance(argv[1])) { - arg_array = iface_to_jsdisp((IUnknown*)get_object(argv[1])); + arg_array = iface_to_jsdisp(get_object(argv[1])); if(arg_array && (!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) { jsdisp_release(arg_array); @@ -451,8 +458,20 @@ } } - if(SUCCEEDED(hres)) - hres = call_function(ctx, function, this_obj, cnt, args, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); + if(SUCCEEDED(hres)) { + if(function) { + hres = call_function(ctx, function, this_obj, cnt, args, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); + }else { + jsval_t res; + hres = disp_call_value(ctx, jsthis->u.disp, this_obj, DISPATCH_METHOD, cnt, args, &res); + if(SUCCEEDED(hres)) { + if(r) + *r = res; + else + jsval_release(res); + } + } + } if(this_obj) IDispatch_Release(this_obj); @@ -529,11 +548,17 @@ { FunctionInstance *function = function_from_jsdisp(jsthis); call_frame_t *frame; + HRESULT hres; TRACE("\n"); for(frame = ctx->call_ctx; frame; frame = frame->prev_frame) { if(frame->function_instance == &function->dispex) { + if(!frame->arguments_obj) { + hres = setup_arguments_object(ctx, frame); + if(FAILED(hres)) + return hres; + } *r = jsval_obj(jsdisp_addref(frame->arguments_obj)); return S_OK; } @@ -775,7 +800,7 @@ if(FAILED(hres)) return hres; - if(code->global_code.func_cnt != 1 || code->global_code.var_cnt) { + if(code->global_code.func_cnt != 1 || code->global_code.var_cnt != 1) { ERR("Invalid parser result!\n"); release_bytecode(code); return E_UNEXPECTED; Modified: trunk/reactos/dll/win32/jscript/global.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/global.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/global.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/global.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -179,7 +179,7 @@ jsval_t *r) { call_frame_t *frame; - DWORD exec_flags = 0; + DWORD exec_flags = EXEC_EVAL; bytecode_t *code; const WCHAR *src; HRESULT hres; @@ -219,7 +219,7 @@ if(flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) exec_flags |= EXEC_RETURN_TO_INTERP; hres = exec_source(ctx, exec_flags, code, &code->global_code, frame->scope, - frame->this_obj, NULL, frame->variable_obj, NULL, r); + frame->this_obj, NULL, frame->variable_obj, 0, NULL, r); release_bytecode(code); return hres; } Modified: trunk/reactos/dll/win32/jscript/jscript.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jscript.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jscript.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jscript.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -99,7 +99,7 @@ IActiveScriptSite_OnEnterScript(This->site); clear_ei(This->ctx); - hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, NULL, NULL); + hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, NULL); IActiveScriptSite_OnLeaveScript(This->site); return hres; @@ -765,7 +765,7 @@ IActiveScriptSite_OnEnterScript(This->site); clear_ei(This->ctx); - hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, NULL, &r); + hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, 0, NULL, &r); if(SUCCEEDED(hres)) { if(pvarResult) hres = jsval_to_variant(r, pvarResult); Modified: trunk/reactos/dll/win32/jscript/jscript.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jscript.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jscript.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jscript.h [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -142,7 +142,7 @@ JSCLASS_JSON } jsclass_t; -jsdisp_t *iface_to_jsdisp(IUnknown*) DECLSPEC_HIDDEN; +jsdisp_t *iface_to_jsdisp(IDispatch*) DECLSPEC_HIDDEN; typedef struct { union { @@ -184,7 +184,7 @@ jsdisp_t *jsdisp; HRESULT hres; - jsdisp = iface_to_jsdisp((IUnknown*)disp); + jsdisp = iface_to_jsdisp(disp); if(jsdisp) { vdisp->u.jsdisp = jsdisp; vdisp->flags = VDISP_JSDISP | VDISP_DISPEX; Modified: trunk/reactos/dll/win32/jscript/json.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/json.c?r…
============================================================================== --- trunk/reactos/dll/win32/jscript/json.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/json.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -412,7 +412,7 @@ jsdisp_t *obj; HRESULT hres; - if(!is_object_instance(val) || !get_object(val) || !(obj = iface_to_jsdisp((IUnknown*)get_object(val)))) + if(!is_object_instance(val) || !get_object(val) || !(obj = iface_to_jsdisp(get_object(val)))) return jsval_copy(val, r); if(is_class(obj, JSCLASS_NUMBER)) { @@ -663,7 +663,7 @@ jsdisp_t *obj; DISPID id; - obj = iface_to_jsdisp((IUnknown*)get_object(val)); + obj = iface_to_jsdisp(get_object(val)); if(!obj) return S_FALSE; @@ -721,7 +721,7 @@ case JSV_OBJECT: { jsdisp_t *obj; - obj = iface_to_jsdisp((IUnknown*)get_object(value)); + obj = iface_to_jsdisp(get_object(value)); if(!obj) { hres = S_FALSE; break; Modified: trunk/reactos/dll/win32/jscript/jsregexp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jsregexp…
============================================================================== --- trunk/reactos/dll/win32/jscript/jsregexp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jsregexp.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -328,6 +328,7 @@ TRACE("\n"); + jsval_release(regexp->last_index_val); hres = jsval_copy(value, ®exp->last_index_val); if(FAILED(hres)) return hres; @@ -697,7 +698,7 @@ if(is_object_instance(src_arg)) { jsdisp_t *obj; - obj = iface_to_jsdisp((IUnknown*)get_object(src_arg)); + obj = iface_to_jsdisp(get_object(src_arg)); if(obj) { if(is_class(obj, JSCLASS_REGEXP)) { RegExpInstance *regexp = (RegExpInstance*)obj; @@ -948,7 +949,7 @@ case DISPATCH_METHOD: if(argc) { if(is_object_instance(argv[0])) { - jsdisp_t *jsdisp = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + jsdisp_t *jsdisp = iface_to_jsdisp(get_object(argv[0])); if(jsdisp) { if(is_class(jsdisp, JSCLASS_REGEXP)) { if(argc > 1 && !is_undefined(argv[1])) { Modified: trunk/reactos/dll/win32/jscript/jsutils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jsutils.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jsutils.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jsutils.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -138,7 +138,7 @@ if(!heap) return; - while((tmp = list_next(&heap->custom_blocks, &heap->custom_blocks))) { + while((tmp = list_head(&heap->custom_blocks))) { list_remove(tmp); heap_free(tmp); } @@ -202,13 +202,17 @@ __JSVAL_TYPE(*val) = JSV_VARIANT; __JSVAL_VAR(*val) = v = heap_alloc(sizeof(VARIANT)); - if(!v) + if(!v) { + *val = jsval_undefined(); return E_OUTOFMEMORY; + } V_VT(v) = VT_EMPTY; hres = VariantCopy(v, var); - if(FAILED(hres)) + if(FAILED(hres)) { + *val = jsval_undefined(); heap_free(v); + } return hres; } @@ -382,7 +386,7 @@ return S_OK; } - jsdisp = iface_to_jsdisp((IUnknown*)get_object(val)); + jsdisp = iface_to_jsdisp(get_object(val)); if(!jsdisp) return disp_propget(ctx, get_object(val), DISPID_VALUE, ret); Modified: trunk/reactos/dll/win32/jscript/object.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/object.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/object.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/object.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -255,6 +255,9 @@ switch(flags) { case DISPATCH_METHOD: + case DISPATCH_CONSTRUCT: { + jsdisp_t *obj; + if(argc) { if(!is_undefined(argv[0]) && !is_null(argv[0]) && (!is_object_instance(argv[0]) || get_object(argv[0]))) { IDispatch *disp; @@ -270,9 +273,6 @@ return S_OK; } } - /* fall through */ - case DISPATCH_CONSTRUCT: { - jsdisp_t *obj; hres = create_object(ctx, NULL, &obj); if(FAILED(hres)) Modified: trunk/reactos/dll/win32/jscript/parser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/parser.h…
============================================================================== --- trunk/reactos/dll/win32/jscript/parser.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/parser.h [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -296,6 +296,7 @@ source_elements_t *source_elements; const WCHAR *src_str; DWORD src_len; + unsigned func_id; struct _function_expression_t *next; /* for compiler */ } function_expression_t; Modified: trunk/reactos/dll/win32/jscript/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/string.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/string.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/string.c [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -628,7 +628,7 @@ } if(is_object_instance(argv[0])) { - regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + regexp = iface_to_jsdisp(get_object(argv[0])); if(regexp && !is_class(regexp, JSCLASS_REGEXP)) { jsdisp_release(regexp); regexp = NULL; @@ -791,7 +791,7 @@ } if(is_object_instance(argv[0])) { - regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + regexp = iface_to_jsdisp(get_object(argv[0])); if(regexp && !is_class(regexp, JSCLASS_REGEXP)) { jsdisp_release(regexp); regexp = NULL; @@ -808,7 +808,7 @@ if(argc >= 2) { if(is_object_instance(argv[1])) { - rep_func = iface_to_jsdisp((IUnknown*)get_object(argv[1])); + rep_func = iface_to_jsdisp(get_object(argv[1])); if(rep_func && !is_class(rep_func, JSCLASS_FUNCTION)) { jsdisp_release(rep_func); rep_func = NULL; @@ -1009,7 +1009,7 @@ } if(is_object_instance(argv[0])) { - regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + regexp = iface_to_jsdisp(get_object(argv[0])); if(regexp && !is_class(regexp, JSCLASS_REGEXP)) { jsdisp_release(regexp); regexp = NULL; @@ -1153,7 +1153,7 @@ } if(is_object_instance(argv[0])) { - regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0])); + regexp = iface_to_jsdisp(get_object(argv[0])); if(regexp) { if(!is_class(regexp, JSCLASS_REGEXP)) { jsdisp_release(regexp); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Aug 19 09:36:35 2016 @@ -85,7 +85,7 @@ reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-1.9.11 reactos/dll/win32/itss # Synced to WineStaging-1.9.11 -reactos/dll/win32/jscript # Synced to WineStaging-1.9.11 +reactos/dll/win32/jscript # Synced to WineStaging-1.9.16 reactos/dll/win32/jsproxy # Synced to WineStaging-1.9.11 reactos/dll/win32/loadperf # Synced to WineStaging-1.9.11 reactos/dll/win32/localspl # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72345: [INETCOMM_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:34:00 2016 New Revision: 72345 URL:
http://svn.reactos.org/svn/reactos?rev=72345&view=rev
Log: [INETCOMM_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/rostests/winetests/inetcomm/mimeole.c Modified: trunk/rostests/winetests/inetcomm/mimeole.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/inetcomm/mimeol…
============================================================================== --- trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] Fri Aug 19 09:34:00 2016 @@ -214,12 +214,13 @@ IStream *stream; LARGE_INTEGER pos; LONG ref; - HBODY hbody; + HBODY hbody, hbody2; IMimeBody *body; BODYOFFSETS offsets; ULONG count; FINDBODY find_struct; HCHARSET hcs; + HBODY handle = NULL; char text[] = "text"; HBODY *body_list; @@ -258,6 +259,21 @@ hr = IMimeMessage_GetBody(msg, IBL_ROOT, NULL, &hbody); ok(hr == S_OK, "ret %08x\n", hr); + hr = IMimeBody_GetHandle(body, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_GetHandle(body, &handle); + ok(hr == S_OK, "ret %08x\n", hr); + ok(handle != NULL, "handle %p\n", handle); + + hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hbody2 = (HBODY)0xdeadbeef; + hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, &hbody2); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + ok(hbody2 == NULL, "hbody2 %p\n", hbody2); + PropVariantInit(&prop); hr = IMimeMessage_GetBodyProp(msg, hbody, att_pritype, 0, &prop); ok(hr == S_OK, "ret %08x\n", hr); @@ -269,6 +285,11 @@ ok(hr == S_OK, "ret %08x\n", hr); hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body); ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetHandle(body, &handle); + ok(hr == S_OK, "ret %08x\n", hr); + ok(handle == hbody, "handle %p\n", handle); + hr = IMimeBody_GetOffsets(body, &offsets); ok(hr == S_OK, "ret %08x\n", hr); ok(offsets.cbBoundaryStart == 405, "got %d\n", offsets.cbBoundaryStart); @@ -289,6 +310,11 @@ ok(hr == S_OK, "ret %08x\n", hr); hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body); ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetHandle(body, &handle); + ok(hr == S_OK, "ret %08x\n", hr); + ok(handle == hbody, "handle %p\n", handle); + hr = IMimeBody_GetOffsets(body, &offsets); ok(hr == S_OK, "ret %08x\n", hr); ok(offsets.cbBoundaryStart == 525, "got %d\n", offsets.cbBoundaryStart); @@ -335,6 +361,7 @@ static void test_MessageSetProp(void) { static const char topic[] = "wine topic"; + static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0}; HRESULT hr; IMimeMessage *msg; IMimeBody *body; @@ -370,6 +397,7 @@ hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop); ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + prop.vt = VT_LPSTR; hr = IMimeBody_GetProp(body, "Thread-Topic", 0, &prop); ok(hr == S_OK, "ret %08x\n", hr); if(hr == S_OK) @@ -378,6 +406,149 @@ ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal); PropVariantClear(&prop); } + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + prop.vt = VT_LPSTR; + hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt); + ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal); + PropVariantClear(&prop); + } + + /* Using the name or PID returns the same result. */ + prop.vt = VT_LPSTR; + hr = IMimeBody_GetProp(body, "Subject", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt); + ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal); + PropVariantClear(&prop); + } + + prop.vt = VT_LPWSTR; + hr = IMimeBody_GetProp(body, "Subject", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(prop.vt == VT_LPWSTR, "type %d\n", prop.vt); + ok(!lstrcmpW(prop.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(prop.u.pwszVal)); + PropVariantClear(&prop); + } + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_TO), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + /* Out of Range PID */ + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, PIDTOSTR(124), 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + PropVariantClear(&prop); + + IMimeBody_Release(body); + IMimeMessage_Release(msg); +} + +static void test_MessageGetPropInfo(void) +{ + static const char topic[] = "wine topic"; + static const char subject[] = "wine testing"; + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + PROPVARIANT prop; + MIMEPROPINFO info; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, "Thread-Topic", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(subject)+1); + strcpy(prop.u.pszVal, subject); + hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + memset(&info, 0, sizeof(info)); + info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID; + hr = IMimeBody_GetPropInfo(body, NULL, &info); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + memset(&info, 0, sizeof(info)); + info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID; + hr = IMimeBody_GetPropInfo(body, "Subject", NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + memset(&info, 0xfe, sizeof(info)); + info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID; + hr = IMimeBody_GetPropInfo(body, "Subject", &info); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(info.dwMask & (PIM_ENCODINGTYPE | PIM_FLAGS| PIM_PROPID), "Invalid mask 0x%08x\n", info.dwFlags); + todo_wine ok(info.dwFlags & 0x10000000, "Invalid flags 0x%08x\n", info.dwFlags); + ok(info.ietEncoding == 0, "Invalid encoding %d\n", info.ietEncoding); + ok(info.dwPropId == PID_HDR_SUBJECT, "Invalid propid %d\n", info.dwPropId); + ok(info.cValues == 0xfefefefe, "Invalid cValues %d\n", info.cValues); + } + + memset(&info, 0xfe, sizeof(info)); + info.dwMask = 0; + hr = IMimeBody_GetPropInfo(body, "Subject", &info); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags); + ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags); + ok(info.ietEncoding == -16843010, "Invalid encoding %d\n", info.ietEncoding); + ok(info.dwPropId == -16843010, "Invalid propid %d\n", info.dwPropId); + } + + memset(&info, 0xfe, sizeof(info)); + info.dwMask = 0; + info.dwPropId = 1024; + info.ietEncoding = 99; + hr = IMimeBody_GetPropInfo(body, "Subject", &info); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags); + ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags); + ok(info.ietEncoding == 99, "Invalid encoding %d\n", info.ietEncoding); + ok(info.dwPropId == 1024, "Invalid propid %d\n", info.dwPropId); + } + + memset(&info, 0, sizeof(info)); + info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID; + hr = IMimeBody_GetPropInfo(body, "Invalid Property", &info); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); IMimeBody_Release(body); IMimeMessage_Release(msg); @@ -470,6 +641,58 @@ ok(hr == S_OK, "ret %08x\n", hr); IMimeBody_Release(body); + IMimeMessage_Release(msg); +} + +static void test_BodyDeleteProp(void) +{ + static const char topic[] = "wine topic"; + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + PROPVARIANT prop; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_DeleteProp(body, "Subject"); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT)); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, "Subject", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeBody_DeleteProp(body, "Subject"); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Subject", 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT)); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + IMimeBody_Release(body); IMimeMessage_Release(msg); } @@ -493,8 +716,10 @@ test_Allocator(); test_CreateMessage(); test_MessageSetProp(); + test_MessageGetPropInfo(); test_MessageOptions(); test_BindToObject(); + test_BodyDeleteProp(); test_MimeOleGetPropertySchema(); OleUninitialize(); }
8 years, 4 months
1
0
0
0
[akhaldi] 72344: [INETCOMM] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:33:16 2016 New Revision: 72344 URL:
http://svn.reactos.org/svn/reactos?rev=72344&view=rev
Log: [INETCOMM] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/dll/win32/inetcomm/CMakeLists.txt trunk/reactos/dll/win32/inetcomm/mimeole.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/inetcomm/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/CMakeLists.txt [iso-8859-1] Fri Aug 19 09:33:16 2016 @@ -22,6 +22,6 @@ set_module_type(inetcomm win32dll) target_link_libraries(inetcomm uuid wine) -add_importlibs(inetcomm ole32 oleaut32 ws2_32 user32 msvcrt kernel32 ntdll) +add_importlibs(inetcomm ole32 oleaut32 ws2_32 user32 propsys msvcrt kernel32 ntdll) add_pch(inetcomm inetcomm_private.h SOURCE) add_cd_file(TARGET inetcomm DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/inetcomm/mimeole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/mimeole…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] Fri Aug 19 09:33:16 2016 @@ -21,6 +21,9 @@ #include "inetcomm_private.h" +#include <winreg.h> +#include <propvarutil.h> + typedef struct { LPCSTR name; @@ -37,26 +40,81 @@ static const property_t default_props[] = { - {"References", PID_HDR_REFS, 0, VT_LPSTR}, - {"Subject", PID_HDR_SUBJECT, 0, VT_LPSTR}, - {"From", PID_HDR_FROM, MPF_ADDRESS, VT_LPSTR}, - {"Message-ID", PID_HDR_MESSAGEID, 0, VT_LPSTR}, - {"Return-Path", PID_HDR_RETURNPATH, MPF_ADDRESS, VT_LPSTR}, - {"Date", PID_HDR_DATE, 0, VT_LPSTR}, - {"Received", PID_HDR_RECEIVED, 0, VT_LPSTR}, - {"Reply-To", PID_HDR_REPLYTO, MPF_ADDRESS, VT_LPSTR}, - {"X-Mailer", PID_HDR_XMAILER, 0, VT_LPSTR}, - {"Bcc", PID_HDR_BCC, MPF_ADDRESS, VT_LPSTR}, - {"MIME-Version", PID_HDR_MIMEVER, MPF_MIME, VT_LPSTR}, - {"Content-Type", PID_HDR_CNTTYPE, MPF_MIME | MPF_HASPARAMS, VT_LPSTR}, - {"Content-Transfer-Encoding", PID_HDR_CNTXFER, MPF_MIME, VT_LPSTR}, - {"Content-ID", PID_HDR_CNTID, MPF_MIME, VT_LPSTR}, - {"Content-Disposition", PID_HDR_CNTDISP, MPF_MIME | MPF_HASPARAMS, VT_LPSTR}, - {"To", PID_HDR_TO, MPF_ADDRESS, VT_LPSTR}, - {"Cc", PID_HDR_CC, MPF_ADDRESS, VT_LPSTR}, - {"Sender", PID_HDR_SENDER, MPF_ADDRESS, VT_LPSTR}, - {"In-Reply-To", PID_HDR_INREPLYTO, 0, VT_LPSTR}, - {NULL, 0, 0, 0} + {"X-Newsgroup", PID_HDR_NEWSGROUP, 0, VT_LPSTR}, + {"Newsgroups", PID_HDR_NEWSGROUPS, 0, VT_LPSTR}, + {"References", PID_HDR_REFS, 0, VT_LPSTR}, + {"Subject", PID_HDR_SUBJECT, 0, VT_LPSTR}, + {"From", PID_HDR_FROM, MPF_ADDRESS, VT_LPSTR}, + {"Message-ID", PID_HDR_MESSAGEID, 0, VT_LPSTR}, + {"Return-Path", PID_HDR_RETURNPATH, MPF_ADDRESS, VT_LPSTR}, + {"Rr", PID_HDR_RR, 0, VT_LPSTR}, + {"Return-Receipt-To", PID_HDR_RETRCPTO, MPF_ADDRESS, VT_LPSTR}, + {"Apparently-To", PID_HDR_APPARTO, MPF_ADDRESS, VT_LPSTR}, + {"Date", PID_HDR_DATE, 0, VT_LPSTR}, + {"Received", PID_HDR_RECEIVED, 0, VT_LPSTR}, + {"Reply-To", PID_HDR_REPLYTO, MPF_ADDRESS, VT_LPSTR}, + {"X-Mailer", PID_HDR_XMAILER, 0, VT_LPSTR}, + {"Bcc", PID_HDR_BCC, MPF_ADDRESS, VT_LPSTR}, + {"MIME-Version", PID_HDR_MIMEVER, MPF_MIME, VT_LPSTR}, + {"Content-Type", PID_HDR_CNTTYPE, MPF_MIME | MPF_HASPARAMS, VT_LPSTR}, + {"Content-Transfer-Encoding", PID_HDR_CNTXFER, MPF_MIME, VT_LPSTR}, + {"Content-ID", PID_HDR_CNTID, MPF_MIME, VT_LPSTR}, + {"Content-Description", PID_HDR_CNTDESC, MPF_MIME, VT_LPSTR}, + {"Content-Disposition", PID_HDR_CNTDISP, MPF_MIME | MPF_HASPARAMS, VT_LPSTR}, + {"Content-Base", PID_HDR_CNTBASE, MPF_MIME, VT_LPSTR}, + {"Content-Location", PID_HDR_CNTLOC, MPF_MIME, VT_LPSTR}, + {"To", PID_HDR_TO, MPF_ADDRESS, VT_LPSTR}, + {"Path", PID_HDR_PATH, 0, VT_LPSTR}, + {"Followup-To", PID_HDR_FOLLOWUPTO, 0, VT_LPSTR}, + {"Expires", PID_HDR_EXPIRES, 0, VT_LPSTR}, + {"Cc", PID_HDR_CC, MPF_ADDRESS, VT_LPSTR}, + {"Control", PID_HDR_CONTROL, 0, VT_LPSTR}, + {"Distribution", PID_HDR_DISTRIB, 0, VT_LPSTR}, + {"Keywords", PID_HDR_KEYWORDS, 0, VT_LPSTR}, + {"Summary", PID_HDR_SUMMARY, 0, VT_LPSTR}, + {"Approved", PID_HDR_APPROVED, 0, VT_LPSTR}, + {"Lines", PID_HDR_LINES, 0, VT_LPSTR}, + {"Xref", PID_HDR_XREF, 0, VT_LPSTR}, + {"Organization", PID_HDR_ORG, 0, VT_LPSTR}, + {"X-Newsreader", PID_HDR_XNEWSRDR, 0, VT_LPSTR}, + {"X-Priority", PID_HDR_XPRI, 0, VT_LPSTR}, + {"X-MSMail-Priority", PID_HDR_XMSPRI, 0, VT_LPSTR}, + {"par:content-disposition:filename", PID_PAR_FILENAME, 0, VT_LPSTR}, + {"par:content-type:boundary", PID_PAR_BOUNDARY, 0, VT_LPSTR}, + {"par:content-type:charset", PID_PAR_CHARSET, 0, VT_LPSTR}, + {"par:content-type:name", PID_PAR_NAME, 0, VT_LPSTR}, + {"att:filename", PID_ATT_FILENAME, 0, VT_LPSTR}, + {"att:pri-content-type", PID_ATT_PRITYPE, 0, VT_LPSTR}, + {"att:sub-content-type", PID_ATT_SUBTYPE, 0, VT_LPSTR}, + {"att:illegal-lines", PID_ATT_ILLEGAL, 0, VT_LPSTR}, + {"att:rendered", PID_ATT_RENDERED, 0, VT_LPSTR}, + {"att:sent-time", PID_ATT_SENTTIME, 0, VT_LPSTR}, + {"att:priority", PID_ATT_PRIORITY, 0, VT_LPSTR}, + {"Comment", PID_HDR_COMMENT, 0, VT_LPSTR}, + {"Encoding", PID_HDR_ENCODING, 0, VT_LPSTR}, + {"Encrypted", PID_HDR_ENCRYPTED, 0, VT_LPSTR}, + {"X-Offsets", PID_HDR_OFFSETS, 0, VT_LPSTR}, + {"X-Unsent", PID_HDR_XUNSENT, 0, VT_LPSTR}, + {"X-ArticleId", PID_HDR_ARTICLEID, 0, VT_LPSTR}, + {"Sender", PID_HDR_SENDER, MPF_ADDRESS, VT_LPSTR}, + {"att:athena-server", PID_ATT_SERVER, 0, VT_LPSTR}, + {"att:athena-account-id", PID_ATT_ACCOUNT, 0, VT_LPSTR}, + {"att:athena-pop3-uidl", PID_ATT_UIDL, 0, VT_LPSTR}, + {"att:athena-store-msgid", PID_ATT_STOREMSGID, 0, VT_LPSTR}, + {"att:athena-user-name", PID_ATT_USERNAME, 0, VT_LPSTR}, + {"att:athena-forward-to", PID_ATT_FORWARDTO, 0, VT_LPSTR}, + {"att:athena-store-fdrid", PID_ATT_STOREFOLDERID,0, VT_LPSTR}, + {"att:athena-ghosted", PID_ATT_GHOSTED, 0, VT_LPSTR}, + {"att:athena-uncachedsize", PID_ATT_UNCACHEDSIZE, 0, VT_LPSTR}, + {"att:athena-combined", PID_ATT_COMBINED, 0, VT_LPSTR}, + {"att:auto-inlined", PID_ATT_AUTOINLINED, 0, VT_LPSTR}, + {"Disposition-Notification-To", PID_HDR_DISP_NOTIFICATION_TO, 0, VT_LPSTR}, + {"par:Content-Type:reply-type", PID_PAR_REPLYTYPE, 0, VT_LPSTR}, + {"par:Content-Type:format", PID_PAR_FORMAT , 0, VT_LPSTR}, + {"att:format", PID_ATT_FORMAT , 0, VT_LPSTR}, + {"In-Reply-To", PID_HDR_INREPLYTO, 0, VT_LPSTR}, + {"att:athena-account-name", PID_ATT_ACCOUNTNAME, 0, VT_LPSTR}, + {NULL, 0, 0, 0} }; typedef struct @@ -478,7 +536,15 @@ LIST_FOR_EACH_ENTRY(header, &body->headers, header_t, entry) { - if(!lstrcmpiA(name, header->prop->name)) + if(ISPIDSTR(name)) + { + if(STRTOPID(name) == header->prop->id) + { + *prop = header; + return S_OK; + } + } + else if(!lstrcmpiA(name, header->prop->name)) { *prop = header; return S_OK; @@ -486,6 +552,33 @@ } return MIME_E_NOT_FOUND; +} + +static const property_t *find_default_prop(const char *name) +{ + const property_t *prop_def = NULL; + + for(prop_def = default_props; prop_def->name; prop_def++) + { + if(ISPIDSTR(name)) + { + if(STRTOPID(name) == prop_def->id) + { + break; + } + } + else if(!lstrcmpiA(name, prop_def->name)) + { + break; + } + } + + if(prop_def->id) + TRACE("%s: found match with default property id %d\n", prop_def->name, prop_def->id); + else + prop_def = NULL; + + return prop_def; } static HRESULT WINAPI MimeBody_QueryInterface(IMimeBody* iface, @@ -603,8 +696,42 @@ LPMIMEPROPINFO pInfo) { MimeBody *This = impl_from_IMimeBody(iface); - FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(pszName), pInfo); - return E_NOTIMPL; + header_t *header; + HRESULT hr; + DWORD supported = PIM_PROPID | PIM_VTDEFAULT; + + TRACE("(%p)->(%s, %p) semi-stub\n", This, debugstr_a(pszName), pInfo); + + if(!pszName || !pInfo) + return E_INVALIDARG; + + TRACE("mask 0x%04x\n", pInfo->dwMask); + + if(pInfo->dwMask & ~supported) + FIXME("Unsupported mask flags 0x%04x\n", pInfo->dwMask & ~supported); + + hr = find_prop(This, pszName, &header); + if(hr == S_OK) + { + if(pInfo->dwMask & PIM_CHARSET) + pInfo->hCharset = 0; + if(pInfo->dwMask & PIM_FLAGS) + pInfo->dwFlags = 0x00000000; + if(pInfo->dwMask & PIM_ROWNUMBER) + pInfo->dwRowNumber = 0; + if(pInfo->dwMask & PIM_ENCODINGTYPE) + pInfo->ietEncoding = 0; + if(pInfo->dwMask & PIM_VALUES) + pInfo->cValues = 0; + if(pInfo->dwMask & PIM_PROPID) + pInfo->dwPropId = header->prop->id; + if(pInfo->dwMask & PIM_VTDEFAULT) + pInfo->vtDefault = header->prop->default_vt; + if(pInfo->dwMask & PIM_VTCURRENT) + pInfo->vtCurrent = 0; + } + + return hr; } static HRESULT WINAPI MimeBody_SetPropInfo( @@ -632,7 +759,7 @@ if(!pszName || !pValue) return E_INVALIDARG; - if(!lstrcmpiA(pszName, "att:pri-content-type")) + if(!ISPIDSTR(pszName) && !lstrcmpiA(pszName, "att:pri-content-type")) { PropVariantClear(pValue); pValue->vt = VT_LPSTR; @@ -643,7 +770,11 @@ hr = find_prop(This, pszName, &header); if(hr == S_OK) { - PropVariantCopy(pValue, &header->value); + TRACE("type %d->%d\n", header->value.vt, pValue->vt); + + hr = PropVariantChangeType(pValue, &header->value, 0, pValue->vt); + if(FAILED(hr)) + FIXME("Conversion not currently supported (%d->%d)\n", header->value.vt, pValue->vt); } return hr; @@ -672,7 +803,16 @@ LIST_FOR_EACH_ENTRY(prop_entry, &This->new_props, property_list_entry_t, entry) { - if(!lstrcmpiA(pszName, prop_entry->prop.name)) + if(ISPIDSTR(pszName)) + { + if(STRTOPID(pszName) == prop_entry->prop.id) + { + TRACE("Found match with already added new property id %d\n", prop_entry->prop.id); + prop = &prop_entry->prop; + break; + } + } + else if(!lstrcmpiA(pszName, prop_entry->prop.name)) { TRACE("Found match with already added new property id %d\n", prop_entry->prop.id); prop = &prop_entry->prop; @@ -686,14 +826,33 @@ if(!prop) { + const property_t *prop_def = NULL; prop_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*prop_entry)); if(!prop_entry) { HeapFree(GetProcessHeap(), 0, header); return E_OUTOFMEMORY; } - prop_entry->prop.name = strdupA(pszName); - prop_entry->prop.id = This->next_prop_id++; + + prop_def = find_default_prop(pszName); + if(prop_def) + { + prop_entry->prop.name = strdupA(prop_def->name); + prop_entry->prop.id = prop_def->id; + } + else + { + if(ISPIDSTR(pszName)) + { + HeapFree(GetProcessHeap(), 0, prop_entry); + HeapFree(GetProcessHeap(), 0, header); + return MIME_E_NOT_FOUND; + } + + prop_entry->prop.name = strdupA(pszName); + prop_entry->prop.id = This->next_prop_id++; + } + prop_entry->prop.flags = 0; prop_entry->prop.default_vt = pValue->vt; list_add_tail(&This->new_props, &prop_entry->entry); @@ -728,8 +887,27 @@ LPCSTR pszName) { MimeBody *This = impl_from_IMimeBody(iface); - FIXME("(%p)->(%s) stub\n", This, debugstr_a(pszName)); - return E_NOTIMPL; + header_t *cursor; + BOOL found; + + TRACE("(%p)->(%s) stub\n", This, debugstr_a(pszName)); + + LIST_FOR_EACH_ENTRY(cursor, &This->headers, header_t, entry) + { + if(ISPIDSTR(pszName)) + found = STRTOPID(pszName) == cursor->prop->id; + else + found = !lstrcmpiA(pszName, cursor->prop->name); + + if(found) + { + list_remove(&cursor->entry); + HeapFree(GetProcessHeap(), 0, cursor); + return S_OK; + } + } + + return MIME_E_NOT_FOUND; } static HRESULT WINAPI MimeBody_CopyProps( @@ -1119,6 +1297,9 @@ { MimeBody *This = impl_from_IMimeBody(iface); TRACE("(%p)->(%p)\n", iface, phBody); + + if(!phBody) + return E_INVALIDARG; *phBody = This->handle; return This->handle ? S_OK : MIME_E_NO_DATA; @@ -1625,6 +1806,8 @@ body->index = index; list_init(&body->children); body->parent = parent; + + mime_body->handle = UlongToHandle(body->index); } return body; } @@ -1888,7 +2071,7 @@ DWORD dwFlags) { FIXME("(%p)->(0x%x)\n", iface, dwFlags); - return E_NOTIMPL; + return S_OK; } @@ -1976,7 +2159,10 @@ switch(location) { case IBL_PARENT: - *out = body->parent; + if(body->parent) + *out = body->parent; + else + hr = MIME_E_NOT_FOUND; break; case IBL_FIRST: @@ -2039,6 +2225,11 @@ HRESULT hr; TRACE("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody); + + if(!phBody) + return E_INVALIDARG; + + *phBody = NULL; hr = get_body(This, location, hPivot, &body); @@ -2319,6 +2510,9 @@ break; case OID_SAVEBODY_KEEPBOUNDARY: FIXME("OID_SAVEBODY_KEEPBOUNDARY (value %d): ignoring\n", pValue->u.boolVal); + break; + case OID_CLEANUP_TREE_ON_SAVE: + FIXME("OID_CLEANUP_TREE_ON_SAVE (value %d): ignoring\n", pValue->u.boolVal); break; default: FIXME("Unhandled oid %08x\n", oid); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Aug 19 09:33:16 2016 @@ -78,7 +78,7 @@ reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.11 reactos/dll/win32/imagehlp # Synced to WineStaging-1.9.11 reactos/dll/win32/imm32 # Synced to Wine-1.7.27 -reactos/dll/win32/inetcomm # Synced to WineStaging-1.9.11 +reactos/dll/win32/inetcomm # Synced to WineStaging-1.9.16 reactos/dll/win32/inetmib1 # Synced to WineStaging-1.9.11 reactos/dll/win32/initpki # Synced to WineStaging-1.9.11 reactos/dll/win32/inseng # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72343: [PSDK] Update mimeole.idl. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:30:21 2016 New Revision: 72343 URL:
http://svn.reactos.org/svn/reactos?rev=72343&view=rev
Log: [PSDK] Update mimeole.idl. CORE-11866 Modified: trunk/reactos/sdk/include/psdk/mimeole.idl Modified: trunk/reactos/sdk/include/psdk/mimeole.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/mimeole.i…
============================================================================== --- trunk/reactos/sdk/include/psdk/mimeole.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/mimeole.idl [iso-8859-1] Fri Aug 19 09:30:21 2016 @@ -153,6 +153,10 @@ cpp_quote(" PID_LAST = 79,") cpp_quote("} MIMEPROPID;") +cpp_quote("#define ISPIDSTR(_name) (((DWORD_PTR)(_name) >> 16) == 0)") +cpp_quote("#define STRTOPID(_name) ((DWORD)((DWORD_PTR)((LPCSTR)(_name))))") +cpp_quote("#define PIDTOSTR(_id) ((LPCSTR)((DWORD_PTR)(_id)))") + cpp_quote("#define TYPEDID_ID(_typedid) (((ULONG)(_typedid))>>16)") cpp_quote("#define TYPEDID_MASK ((ULONG)0xffff)") cpp_quote("#define TYPEDID_TYPE(t) ((VARTYPE)((t) & TYPEDID_MASK))") @@ -701,6 +705,22 @@ AFT_RFC822_TRANSMIT, } ADDRESSFORMAT; + cpp_quote("#define IAT_UNKNOWN 0x00000000") + cpp_quote("#define IAT_FROM 0x00000001") + cpp_quote("#define IAT_SENDER 0x00000002") + cpp_quote("#define IAT_TO 0x00000004") + cpp_quote("#define IAT_CC 0x00000008") + cpp_quote("#define IAT_BCC 0x00000010") + cpp_quote("#define IAT_REPLYTO 0x00000020") + cpp_quote("#define IAT_RETURNPATH 0x00000040") + cpp_quote("#define IAT_RETRCPTTO 0x00000080") + cpp_quote("#define IAT_RR 0x00000100") + cpp_quote("#define IAT_APPARTO 0x00000200") + cpp_quote("#define IAT_DISP_NOTIFICATION_TO 0x00000400") + cpp_quote("#define IAT_ALL 0xffffffff") + cpp_quote("#define IAT_KNOWN (IAT_FROM | IAT_TO | IAT_CC | IAT_BCC | IAT_REPLYTO | IAT_SENDER)") + cpp_quote("#define IAT_RECIPS (IAT_TO | IAT_CC | IAT_BCC)") + typedef struct tagADDRESSPROPS { DWORD dwProps; @@ -719,13 +739,89 @@ DWORD dwReserved2; } ADDRESSPROPS, *LPADDRESSPROPS; + cpp_quote("#define IAP_CHARSET 0x00000001") + cpp_quote("#define IAP_HANDLE 0x00000002") + cpp_quote("#define IAP_ADRTYPE 0x00000004") + cpp_quote("#define IAP_FRIENDLY 0x00000008") + cpp_quote("#define IAP_EMAIL 0x00000020") + cpp_quote("#define IAP_CERTSTATE 0x00000100") + cpp_quote("#define IAP_SIGNING_PRINT 0x00000200") + cpp_quote("#define IAP_ENCRYPTION_PRINT 0x00000400") + cpp_quote("#define IAP_ENCODING 0x00000800") + cpp_quote("#define IAP_COOKIE 0x00001000") + cpp_quote("#define IAP_FRIENDLYW 0x00002000") + cpp_quote("#define IAP_ALL 0xffffffff") + typedef struct tagADDRESSLIST { ULONG cAdrs; LPADDRESSPROPS prgAdr; } ADDRESSLIST, *LPADDRESSLIST; - /* FIXME: fill this in */ + HRESULT Append( + [in] DWORD addrtype, + [in] ENCODINGTYPE encoding, + [in] const char *friendly, + [in,unique] const char *email, + [in,out,unique] HADDRESS *address); + + HRESULT Insert( + [in] ADDRESSPROPS *addressprop, + [in,out,unique] HADDRESS *address); + + HRESULT SetProps( + [in] HADDRESS address, + [in] ADDRESSPROPS *addressprop); + + HRESULT GetProps( + [in] HADDRESS address, + [in] ADDRESSPROPS *addressprop); + + HRESULT GetSender( + [in,out] ADDRESSPROPS *addressprop); + + HRESULT CountTypes( + [in] DWORD addrtype, + [out] ULONG *count); + + HRESULT GetTypes( + [in] DWORD addrtype, + [in] DWORD dwProps, + [in,out] ADDRESSLIST *list); + + HRESULT EnumTypes( + [in] DWORD addrtype, + [in] DWORD props, + [out] IMimeEnumAddressTypes **types); + + HRESULT Delete( + [in] HADDRESS hAddress); + + HRESULT DeleteTypes( + [in] DWORD addrtype); + + HRESULT GetFormat( + [in] DWORD addrtype, + [in] ADDRESSFORMAT addrformat, + [out] char **format); + + HRESULT AppendRfc822( + [in] DWORD addrtype, + [in] ENCODINGTYPE encoding, + [in] const char *rfcaddr); + + HRESULT ParseRfc822( + [in] DWORD addrtype, + [in] ENCODINGTYPE encoding, + [in] const char *rfcaddr, + [in,out] ADDRESSLIST *list); + + HRESULT Clone( + [out] IMimeAddressTable **table); + + HRESULT BindToObject( + [in] REFIID riid, + [out, iid_is(riid)] void **obj); } [
8 years, 4 months
1
0
0
0
[akhaldi] 72342: [GDIPLUS_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:29:03 2016 New Revision: 72342 URL:
http://svn.reactos.org/svn/reactos?rev=72342&view=rev
Log: [GDIPLUS_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/rostests/winetests/gdiplus/font.c trunk/rostests/winetests/gdiplus/graphics.c trunk/rostests/winetests/gdiplus/image.c trunk/rostests/winetests/gdiplus/metafile.c trunk/rostests/winetests/gdiplus/region.c Modified: trunk/rostests/winetests/gdiplus/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/font.c?…
============================================================================== --- trunk/rostests/winetests/gdiplus/font.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/font.c [iso-8859-1] Fri Aug 19 09:29:03 2016 @@ -81,7 +81,7 @@ stat = GdipDeleteFontFamily(fontfamily2); expect(Ok, stat); - /* Test to see if returned size is based on unit (its not) */ + /* Test to see if returned size is based on unit (it's not) */ GdipGetFontSize(font, &size); ok (size == 12, "Expected 12, got %f\n", size); GdipDeleteFont(font); @@ -788,6 +788,7 @@ expect(Ok, status); strcpy(fallback_font,lf.lfFaceName); trace("fallback font %s\n", fallback_font); + GdipDeleteFont(font); lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist"); status = GdipCreateFontFromLogfontA(hdc, &lf, &font); Modified: trunk/rostests/winetests/gdiplus/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphic…
============================================================================== --- trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] Fri Aug 19 09:29:03 2016 @@ -2317,6 +2317,29 @@ "Expected clip bounds (%d, %d, %d, %d) to be the size of " "the visible clipping rect (%0.f, %0.f, %0.f, %0.f)\n", recti.X, recti.Y, recti.Width, recti.Height, + exp.X, exp.Y, exp.Width, exp.Height); + + /* window bounds with transform applied */ + status = GdipResetClip(graphics); + expect(Ok, status); + + status = GdipScaleWorldTransform(graphics, 0.5, 0.5, MatrixOrderPrepend); + expect(Ok, status); + + exp.X = window.X * 2.0; + exp.Y = window.Y * 2.0; + exp.Width = window.Width * 2.0; + exp.Height = window.Height * 2.0; + + status = GdipGetVisibleClipBounds(graphics, &rectf); + expect(Ok, status); + ok(rectf.X == exp.X && + rectf.Y == exp.Y && + rectf.Width == exp.Width && + rectf.Height == exp.Height, + "Expected clip bounds (%0.f, %0.f, %0.f, %0.f) to be " + "twice the window size (%0.f, %0.f, %0.f, %0.f)\n", + rectf.X, rectf.Y, rectf.Width, rectf.Height, exp.X, exp.Y, exp.Width, exp.Height); GdipDeleteGraphics(graphics); @@ -3746,10 +3769,8 @@ expected_width = base_cx * pt.Y; expected_height = base_cy * pt.Y; - if (td[i].unit == UnitDisplay || td[i].unit == UnitPixel) + todo_wine_if(td[i].unit != UnitDisplay && td[i].unit != UnitPixel) ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width); - else - todo_wine ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width); ok(fabs(expected_height - bounds.Height) <= 0.001, "%u: expected %f, got %f\n", i, expected_height, bounds.Height); GdipDeleteGraphics(graphics); @@ -4846,7 +4867,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45, - "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); @@ -4854,7 +4875,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -4871,7 +4892,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -4879,7 +4900,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820, - "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 210.0; @@ -4918,7 +4939,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45, - "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 45,20-95,45, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); @@ -4926,7 +4947,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -4943,7 +4964,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -4951,7 +4972,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820, - "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 210.0; @@ -4999,7 +5020,7 @@ /* rounding under Wine is slightly different */ (rc.left == 14 && rc.top == 4 && rc.right == 33 && rc.bottom == 14) /* Wine */ || broken(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45) /* before Win7 */, - "expected 14,5-33,14, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 14,5-33,14, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); @@ -5008,7 +5029,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) || broken(rc.left == 267 && rc.top == 267 && rc.right == 534 && rc.bottom == 534) /* before Win7 */, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5026,7 +5047,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -5036,7 +5057,7 @@ ok((rc.left == 560 && rc.top == 1120 && rc.right == 1094 && rc.bottom == 2187) || /* rounding under Wine is slightly different */ (rc.left == 560 && rc.top == 1120 && rc.right == 1093 && rc.bottom == 2187) /* Wine */, - "expected 560,1120-1094,2187, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 560,1120-1094,2187, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 560.0; @@ -5073,7 +5094,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820, - "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -5083,7 +5104,7 @@ ok((rc.left == 1147 && rc.top == 4534 && rc.right == 2214 && rc.bottom == 8800) || /* rounding under Wine is slightly different */ (rc.left == 1147 && rc.top == 4533 && rc.right == 2213 && rc.bottom == 8800) /* Wine */, - "expected 1147,4534-2214,8800, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 1147,4534-2214,8800, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 1147.0; @@ -5143,7 +5164,7 @@ ok((rc.left == 22 && rc.top == -6 && rc.right == 46 && rc.bottom == 7) || /* rounding under Wine is slightly different */ (rc.left == 21 && rc.top == -5 && rc.right == 46 && rc.bottom == 7) /* Wine */, - "expected (22,-6)-(46,7), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + "expected (22,-6)-(46,7), got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); @@ -5151,7 +5172,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5178,7 +5199,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820, - "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -5188,7 +5209,7 @@ ok((rc.left == -3406 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) || /* rounding under Wine is slightly different */ (rc.left == -3407 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) /* Wine */, - "expected (-3406,4500)-(-350,8728), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + "expected (-3406,4500)-(-350,8728), got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = -3406.0; @@ -5246,7 +5267,7 @@ ok((rc.left == -27 && rc.top == 8 && rc.right == -2 && rc.bottom == 21) || /* rounding under Wine is slightly different */ (rc.left == -28 && rc.top == 9 && rc.right == -2 && rc.bottom == 21) /* Wine */, - "expected (-27,8)-(-2,21), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + "expected (-27,8)-(-2,21), got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); @@ -5254,7 +5275,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5281,7 +5302,7 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820, - "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 210,420-410,820, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region100x100, graphics, &hrgn); @@ -5291,7 +5312,7 @@ ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) || /* rounding under Wine is slightly different */ (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */, - "expected (4500,351)-(8728,3407), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + "expected (4500,351)-(8728,3407), got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = -3406.0; @@ -5363,14 +5384,14 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200, - "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 9600.0; @@ -5394,7 +5415,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 7200 && rc.top == 7200 && rc.right == 14400 && rc.bottom == 14400) || broken(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) /* before Win7 */, - "expected 7200,7200-14400,14400, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 7200,7200-14400,14400, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); @@ -5402,7 +5423,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200) || broken(rc.left == 134 && rc.top == 134 && rc.right == 267 && rc.bottom == 267) /* before Win7 */, - "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 9600,9600-19200,19200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 9600.0; @@ -5445,7 +5466,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) || broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); @@ -5453,7 +5474,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) || broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5483,7 +5504,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 75 && rc.top == 75 && rc.right == 150 && rc.bottom == 150) || broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */, - "expected 75,75-150,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 75,75-150,150, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); @@ -5491,7 +5512,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) || broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5526,14 +5547,14 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 65 && rc.top == 65 && rc.right == 140 && rc.bottom == 140, - "expected 65,65-140,140, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 65,65-140,140, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5562,14 +5583,14 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300, - "expected 300,150-600,300, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 300,150-600,300, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5594,7 +5615,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 150 && rc.top == 75 && rc.right == 300 && rc.bottom == 150) || broken(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300) /* before Win7 */, - "expected 150,75-300,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 150,75-300,150, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); @@ -5602,7 +5623,7 @@ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) || broken(rc.left == 200 && rc.top == 200 && rc.right == 400 && rc.bottom == 400) /* before Win7 */, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5643,14 +5664,14 @@ ok((rc.left == 54 && rc.top == -26 && rc.right == 107 && rc.bottom == 27) || /* rounding under Wine is slightly different */ (rc.left == 53 && rc.top == -26 && rc.right == 106 && rc.bottom == 27) /* Wine */, - "expected 54,-26-107,27, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 54,-26-107,27, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; @@ -5689,14 +5710,14 @@ ok((rc.left == -26 && rc.top == 54 && rc.right == 27 && rc.bottom == 107) || /* rounding under Wine is slightly different */ (rc.left == -27 && rc.top == 54 && rc.right == 27 && rc.bottom == 106) /* Wine */, - "expected -26,54-27,107, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected -26,54-27,107, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); status = GdipGetRegionHRgn(region, graphics, &hrgn); expect(Ok, status); ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200, - "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + "expected 100,100-200,200, got %s\n", wine_dbgstr_rect(&rc)); DeleteObject(hrgn); ptf[0].X = 100.0; Modified: trunk/rostests/winetests/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c…
============================================================================== --- trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] Fri Aug 19 09:29:03 2016 @@ -2,7 +2,7 @@ * Unit test suite for images * * Copyright (C) 2007 Google (Evan Stade) - * Copyright (C) 2012 Dmitry Timoshkov + * Copyright (C) 2012,2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -3187,12 +3187,7 @@ status = GdipGetPropertyCount(image, &prop_count); ok(status == Ok, "%u: GdipGetPropertyCount error %d\n", i, status); - if (td[i].image_data == pngimage || td[i].image_data == jpgimage) - todo_wine - ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count, - " %u: expected property count %u or %u, got %u\n", - i, td[i].prop_count, td[i].prop_count2, prop_count); - else + todo_wine_if(td[i].image_data == pngimage || td[i].image_data == jpgimage) ok(td[i].prop_count == prop_count || td[i].prop_count2 == prop_count, " %u: expected property count %u or %u, got %u\n", i, td[i].prop_count, td[i].prop_count2, prop_count); @@ -4745,6 +4740,135 @@ } } +static void test_getadjustedpalette(void) +{ + ColorMap colormap; + GpImageAttributes *imageattributes; + ColorPalette *palette; + GpStatus stat; + + stat = GdipCreateImageAttributes(&imageattributes); + expect(Ok, stat); + + colormap.oldColor.Argb = 0xffffff00; + colormap.newColor.Argb = 0xffff00ff; + stat = GdipSetImageAttributesRemapTable(imageattributes, ColorAdjustTypeBitmap, + TRUE, 1, &colormap); + expect(Ok, stat); + + colormap.oldColor.Argb = 0xffffff80; + colormap.newColor.Argb = 0xffff80ff; + stat = GdipSetImageAttributesRemapTable(imageattributes, ColorAdjustTypeDefault, + TRUE, 1, &colormap); + expect(Ok, stat); + + palette = GdipAlloc(sizeof(*palette) + sizeof(ARGB) * 2); + palette->Count = 0; + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBitmap); + expect(InvalidParameter, stat); + + palette->Count = 3; + palette->Entries[0] = 0xffffff00; + palette->Entries[1] = 0xffffff80; + palette->Entries[2] = 0xffffffff; + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBitmap); + expect(Ok, stat); + expect(0xffff00ff, palette->Entries[0]); + expect(0xffffff80, palette->Entries[1]); + expect(0xffffffff, palette->Entries[2]); + + palette->Entries[0] = 0xffffff00; + palette->Entries[1] = 0xffffff80; + palette->Entries[2] = 0xffffffff; + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeBrush); + expect(Ok, stat); + expect(0xffffff00, palette->Entries[0]); + expect(0xffff80ff, palette->Entries[1]); + expect(0xffffffff, palette->Entries[2]); + + stat = GdipGetImageAttributesAdjustedPalette(NULL, palette, ColorAdjustTypeBitmap); + expect(InvalidParameter, stat); + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, NULL, ColorAdjustTypeBitmap); + expect(InvalidParameter, stat); + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, -1); + expect(InvalidParameter, stat); + + stat = GdipGetImageAttributesAdjustedPalette(imageattributes, palette, ColorAdjustTypeDefault); + expect(InvalidParameter, stat); + + GdipFree(palette); + GdipDisposeImageAttributes(imageattributes); +} + +/* RGB 24 bpp 1x1 pixel PNG image */ +static const char png_1x1_data[] = { + 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a, + 0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,0xde, + 0x00,0x00,0x00,0x0c,'I','D','A','T',0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,0xe7, + 0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82 +}; + +static void test_png_color_formats(void) +{ + static const struct + { + char bit_depth, color_type; + PixelFormat format; + UINT flags; + } td[] = + { + /* 2 - PNG_COLOR_TYPE_RGB */ + { 8, 2, PixelFormat24bppRGB, ImageFlagsColorSpaceRGB }, + /* 0 - PNG_COLOR_TYPE_GRAY */ + { 1, 0, PixelFormat1bppIndexed, ImageFlagsColorSpaceRGB }, + { 2, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY }, + { 4, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY }, + { 8, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY }, + { 16, 0, PixelFormat32bppARGB, ImageFlagsColorSpaceGRAY }, + }; + BYTE buf[sizeof(png_1x1_data)]; + GpStatus status; + GpImage *image; + ImageType type; + PixelFormat format; + UINT flags; + int i; + + for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + { + memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); + buf[24] = td[i].bit_depth; + buf[25] = td[i].color_type; + + image = load_image(buf, sizeof(buf)); + ok(image != NULL, "%d: failed to load image data\n", i); + if (!image) continue; + + status = GdipGetImageType(image, &type); + ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status); + ok(type == ImageTypeBitmap, "%d: wrong image type %d\n", i, type); + + status = GdipGetImagePixelFormat(image, &format); + expect(Ok, status); + ok(format == td[i].format || + broken(td[i].bit_depth == 1 && td[i].color_type == 0 && format == PixelFormat32bppARGB), /* XP */ + "%d: expected %#x, got %#x\n", i, td[i].format, format); + + status = GdipGetImageFlags(image, &flags); + expect(Ok, status); + ok((flags & td[i].flags) == td[i].flags || + broken(td[i].bit_depth == 1 && td[i].color_type == 0 && (flags & ImageFlagsColorSpaceGRAY)), /* XP */ + "%d: expected %#x, got %#x\n", i, td[i].flags, flags); + + GdipDisposeImage(image); + } +} + START_TEST(image) { struct GdiplusStartupInput gdiplusStartupInput; @@ -4757,6 +4881,7 @@ GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + test_png_color_formats(); test_supported_encoders(); test_CloneBitmapArea(); test_ARGB_conversion(); @@ -4802,6 +4927,7 @@ test_colorkey(); test_dispose(); test_createeffect(); + test_getadjustedpalette(); GdiplusShutdown(gdiplusToken); } Modified: trunk/rostests/winetests/gdiplus/metafile.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/metafil…
============================================================================== --- trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] Fri Aug 19 09:29:03 2016 @@ -867,6 +867,95 @@ expect(Ok, stat); } +static const emfplus_record clear_emf_records[] = { + {0, EMR_HEADER}, + {0, EmfPlusRecordTypeHeader}, + {0, EmfPlusRecordTypeClear}, + {1, EMR_SAVEDC}, + {1, EMR_SETICMMODE}, + {1, EMR_BITBLT}, + {1, EMR_RESTOREDC}, + {0, EmfPlusRecordTypeEndOfFile}, + {0, EMR_EOF}, + {0} +}; + +static void test_clear(void) +{ + GpStatus stat; + GpMetafile *metafile; + GpGraphics *graphics; + HDC hdc; + HENHMETAFILE hemf; + static const GpRectF frame = {0.0, 0.0, 100.0, 100.0}; + static const GpPointF dst_points[3] = {{10.0,10.0},{20.0,10.0},{10.0,20.0}}; + static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0}; + GpBitmap *bitmap; + ARGB color; + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + if (stat != Ok) + return; + + stat = GdipGetHemfFromMetafile(metafile, &hemf); + expect(InvalidParameter, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipGraphicsClear(graphics, 0xffffff00); + expect(Ok, stat); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + save_metafile(metafile, "clear.emf"); + + stat = GdipCreateBitmapFromScan0(30, 30, 0, PixelFormat32bppRGB, NULL, &bitmap); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); + expect(Ok, stat); + + stat = GdipDrawImagePointsRect(graphics, (GpImage*)metafile, dst_points, 3, + 0.0, 0.0, 100.0, 100.0, UnitPixel, NULL, NULL, NULL); + expect(Ok, stat); + + stat = GdipBitmapGetPixel(bitmap, 5, 5, &color); + expect(Ok, stat); + expect(0xff000000, color); + + stat = GdipBitmapGetPixel(bitmap, 15, 15, &color); + expect(Ok, stat); + expect(0xffffff00, color); + + stat = GdipBitmapGetPixel(bitmap, 25, 25, &color); + expect(Ok, stat); + expect(0xff000000, color); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipDisposeImage((GpImage*)bitmap); + expect(Ok, stat); + + stat = GdipGetHemfFromMetafile(metafile, &hemf); + expect(Ok, stat); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); + + check_emfplus(hemf, clear_emf_records, "clear emf"); + + DeleteEnhMetaFile(hemf); +} + static void test_nullframerect(void) { GpStatus stat; GpMetafile *metafile; @@ -893,8 +982,10 @@ expect(UnitPixel, unit); expectf(0.0, bounds.X); expectf(0.0, bounds.Y); - expectf(1.0, bounds.Width); - expectf(1.0, bounds.Height); + ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Width); + ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Height); stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); expect(Ok, stat); @@ -913,8 +1004,10 @@ expect(UnitPixel, unit); expectf(0.0, bounds.X); expectf(0.0, bounds.Y); - expectf(1.0, bounds.Width); - expectf(1.0, bounds.Height); + ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Width); + ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Height); stat = GdipDeleteGraphics(graphics); expect(Ok, stat); @@ -922,10 +1015,10 @@ stat = GdipGetImageBounds((GpImage*)metafile, &bounds, &unit); expect(Ok, stat); expect(UnitPixel, unit); - todo_wine expectf_(25.0, bounds.X, 0.05); - todo_wine expectf_(25.0, bounds.Y, 0.05); - todo_wine expectf_(75.0, bounds.Width, 0.05); - todo_wine expectf_(75.0, bounds.Height, 0.05); + expectf_(25.0, bounds.X, 0.05); + expectf_(25.0, bounds.Y, 0.05); + expectf_(75.0, bounds.Width, 0.05); + expectf_(75.0, bounds.Height, 0.05); stat = GdipDisposeImage((GpImage*)metafile); expect(Ok, stat); @@ -1179,6 +1272,157 @@ expect(Ok, stat); } +static const emfplus_record worldtransform_records[] = { + {0, EMR_HEADER}, + {0, EmfPlusRecordTypeHeader}, + {0, EmfPlusRecordTypeFillRects}, + {0, EmfPlusRecordTypeScaleWorldTransform}, + {0, EmfPlusRecordTypeFillRects}, + {0, EmfPlusRecordTypeResetWorldTransform}, + {0, EmfPlusRecordTypeFillRects}, + {0, EmfPlusRecordTypeEndOfFile}, + {0, EMR_EOF}, + {0} +}; + +static void test_worldtransform(void) +{ + GpStatus stat; + GpMetafile *metafile; + GpGraphics *graphics; + HDC hdc; + static const GpRectF frame = {0.0, 0.0, 5.0, 5.0}; + static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}}; + static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0}; + GpBitmap *bitmap; + ARGB color; + GpBrush *brush; + GpMatrix *transform; + BOOL identity; + REAL elements[6]; + + hdc = CreateCompatibleDC(0); + + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile); + expect(Ok, stat); + + DeleteDC(hdc); + + if (stat != Ok) + return; + + stat = GdipCreateMatrix(&transform); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + /* initial transform */ + stat = GdipGetWorldTransform(graphics, transform); + expect(Ok, stat); + + stat = GdipIsMatrixIdentity(transform, &identity); + expect(Ok, stat); + expect(TRUE, identity); + + stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush); + expect(Ok, stat); + + stat = GdipFillRectangleI(graphics, brush, 0, 0, 1, 1); + expect(Ok, stat); + + stat = GdipDeleteBrush(brush); + expect(Ok, stat); + + /* scale transform */ + stat = GdipScaleWorldTransform(graphics, 2.0, 4.0, MatrixOrderPrepend); + expect(Ok, stat); + + stat = GdipGetWorldTransform(graphics, transform); + expect(Ok, stat); + + stat = GdipGetMatrixElements(transform, elements); + expect(Ok, stat); + expectf(2.0, elements[0]); + expectf(0.0, elements[1]); + expectf(0.0, elements[2]); + expectf(4.0, elements[3]); + expectf(0.0, elements[4]); + expectf(0.0, elements[5]); + + stat = GdipCreateSolidFill((ARGB)0xff00ff00, (GpSolidFill**)&brush); + expect(Ok, stat); + + stat = GdipFillRectangle(graphics, brush, 0.5, 0.5, 0.5, 0.25); + expect(Ok, stat); + + stat = GdipDeleteBrush(brush); + expect(Ok, stat); + + /* reset transform */ + stat = GdipResetWorldTransform(graphics); + expect(Ok, stat); + + stat = GdipGetWorldTransform(graphics, transform); + expect(Ok, stat); + + stat = GdipIsMatrixIdentity(transform, &identity); + expect(Ok, stat); + expect(TRUE, identity); + + stat = GdipCreateSolidFill((ARGB)0xff00ffff, (GpSolidFill**)&brush); + expect(Ok, stat); + + stat = GdipFillRectangle(graphics, brush, 1.0, 0.0, 1.0, 1.0); + expect(Ok, stat); + + stat = GdipDeleteBrush(brush); + expect(Ok, stat); + + stat = GdipDeleteMatrix(transform); + expect(Ok, stat); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + check_metafile(metafile, worldtransform_records, "worldtransform metafile", dst_points, &frame, UnitPixel); + + save_metafile(metafile, "worldtransform.emf"); + + stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); + expect(Ok, stat); + + play_metafile(metafile, graphics, worldtransform_records, "worldtransform playback", dst_points, &frame, UnitPixel); + + stat = GdipBitmapGetPixel(bitmap, 80, 80, &color); + expect(Ok, stat); + expect(0, color); + + stat = GdipBitmapGetPixel(bitmap, 10, 10, &color); + expect(Ok, stat); + expect(0xff0000ff, color); + + stat = GdipBitmapGetPixel(bitmap, 30, 50, &color); + expect(Ok, stat); + expect(0xff00ff00, color); + + stat = GdipBitmapGetPixel(bitmap, 30, 10, &color); + expect(Ok, stat); + expect(0xff00ffff, color); + + stat = GdipDeleteGraphics(graphics); + expect(Ok, stat); + + stat = GdipDisposeImage((GpImage*)bitmap); + expect(Ok, stat); + + stat = GdipDisposeImage((GpImage*)metafile); + expect(Ok, stat); +} + static void test_converttoemfplus(void) { GpStatus (WINAPI *pGdipConvertToEmfPlus)( const GpGraphics *graphics, GpMetafile *metafile, BOOL *succ, @@ -1284,8 +1528,10 @@ expect(UnitPixel, unit); expectf(0.0, bounds.X); expectf(0.0, bounds.Y); - expectf(1.0, bounds.Width); - expectf(1.0, bounds.Height); + ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Width); + ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Height); stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); expect(Ok, stat); @@ -1295,8 +1541,10 @@ expect(UnitPixel, unit); expectf(0.0, bounds.X); expectf(0.0, bounds.Y); - expectf(1.0, bounds.Width); - expectf(1.0, bounds.Height); + ok(bounds.Width == 1.0 || broken(bounds.Width == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Width); + ok(bounds.Height == 1.0 || broken(bounds.Height == 0.0) /* xp sp1 */, + "expected 1.0, got %f\n", bounds.Height); stat = GdipDeleteGraphics(graphics); expect(Ok, stat); @@ -1342,8 +1590,10 @@ test_getdc(); test_emfonly(); test_fillrect(); + test_clear(); test_nullframerect(); test_pagetransform(); + test_worldtransform(); test_converttoemfplus(); test_frameunit(); Modified: trunk/rostests/winetests/gdiplus/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/region.…
============================================================================== --- trunk/rostests/winetests/gdiplus/region.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdiplus/region.c [iso-8859-1] Fri Aug 19 09:29:03 2016 @@ -76,18 +76,16 @@ else ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret); - trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n", + trace("size %u, type %u, count %u, rgn size %u, bound %s\n", rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize, - rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top, - rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom); + wine_dbgstr_rect(&rgn.data.rdh.rcBound)); if (rgn.data.rdh.nCount != 0) { rect = (const RECT *)rgn.data.Buffer; - trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom); - ok(EqualRect(rect, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rc->left, rc->top, rc->right, rc->bottom, - rect->left, rect->top, rect->right, rect->bottom); + trace("rect %s\n", wine_dbgstr_rect(rect)); + ok(EqualRect(rect, rc), "expected %s, got %s\n", + wine_dbgstr_rect(rc), wine_dbgstr_rect(rect)); } ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize); @@ -102,9 +100,8 @@ ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount); ok(rgn.data.rdh.nRgnSize == sizeof(RECT), "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize); } - ok(EqualRect(&rgn.data.rdh.rcBound, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rc->left, rc->top, rc->right, rc->bottom, - rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top, rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom); + ok(EqualRect(&rgn.data.rdh.rcBound, rc), "expected %s, got %s\n", + wine_dbgstr_rect(rc), wine_dbgstr_rect(&rgn.data.rdh.rcBound)); } static void test_region_data(DWORD *data, UINT size, INT line)
8 years, 4 months
1
0
0
0
[akhaldi] 72341: [GDIPLUS] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:28:13 2016 New Revision: 72341 URL:
http://svn.reactos.org/svn/reactos?rev=72341&view=rev
Log: [GDIPLUS] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/dll/win32/gdiplus/brush.c trunk/reactos/dll/win32/gdiplus/gdiplus.spec trunk/reactos/dll/win32/gdiplus/gdiplus_private.h trunk/reactos/dll/win32/gdiplus/graphics.c trunk/reactos/dll/win32/gdiplus/image.c trunk/reactos/dll/win32/gdiplus/imageattributes.c trunk/reactos/dll/win32/gdiplus/metafile.c trunk/reactos/dll/win32/gdiplus/region.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/gdiplus/brush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/brush.c?…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -191,7 +191,7 @@ if (stat == Ok) { new_texture->transform = texture->transform; - *clone = (GpBrush*)new_texture; + *clone = &new_texture->brush; } else *clone = NULL; Modified: trunk/reactos/dll/win32/gdiplus/gdiplus.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus.…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -264,7 +264,7 @@ 264 stdcall GdipGetHatchForegroundColor(ptr ptr) 265 stdcall GdipGetHatchStyle(ptr ptr) 266 stdcall GdipGetHemfFromMetafile(ptr ptr) -267 stub GdipGetImageAttributesAdjustedPalette +267 stdcall GdipGetImageAttributesAdjustedPalette(ptr ptr long) 268 stdcall GdipGetImageBounds(ptr ptr ptr) 269 stdcall GdipGetImageDecoders(long long ptr) 270 stdcall GdipGetImageDecodersSize(ptr ptr) Modified: trunk/reactos/dll/win32/gdiplus/gdiplus_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus_…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -94,9 +94,12 @@ extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN; extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_GraphicsClear(GpMetafile* metafile, ARGB color) DECLSPEC_HIDDEN; extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush, GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN; extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile) DECLSPEC_HIDDEN; extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN; extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, @@ -183,6 +186,9 @@ extern GpStatus convert_pixels(INT width, INT height, INT dst_stride, BYTE *dst_bits, PixelFormat dst_format, INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN; + +extern PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data, + UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt) DECLSPEC_HIDDEN; struct GpMatrix{ REAL matrix[6]; @@ -322,7 +328,7 @@ REAL scale; }; -struct GpAdustableArrowCap{ +struct GpAdjustableArrowCap{ GpCustomLineCap cap; }; @@ -351,6 +357,8 @@ DWORD comment_data_size; DWORD comment_data_length; IStream *record_stream; + BOOL auto_frame; /* If true, determine the frame automatically */ + GpPointF auto_frame_min, auto_frame_max; /* playback */ GpGraphics *playback_graphics; @@ -362,6 +370,7 @@ GpMatrix *world_transform; GpUnit page_unit; REAL page_scale; + GpRegion *base_clip; /* clip region in device space for all metafile output */ }; struct GpBitmap{ Modified: trunk/reactos/dll/win32/gdiplus/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -657,7 +657,7 @@ } /* returns preferred pixel format for the applied attributes */ -static PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data, +PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data, UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt) { UINT x, y; @@ -4277,6 +4277,7 @@ { GpRegion *clip_rgn; GpStatus stat; + GpMatrix device_to_world; TRACE("(%p, %p)\n", graphics, rect); @@ -4291,6 +4292,13 @@ return stat; if((stat = get_visible_clip_region(graphics, clip_rgn)) != Ok) + goto cleanup; + + /* transform to world coordinates */ + if((stat = get_graphics_transform(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &device_to_world)) != Ok) + goto cleanup; + + if((stat = GdipTransformRegion(clip_rgn, &device_to_world)) != Ok) goto cleanup; /* get bounds of the region */ @@ -4351,10 +4359,13 @@ if(graphics->busy) return ObjectBusy; + if (graphics->image && graphics->image->type == ImageTypeMetafile) + return METAFILE_GraphicsClear((GpMetafile*)graphics->image, color); + if((stat = GdipCreateSolidFill(color, &brush)) != Ok) return stat; - if((stat = get_graphics_bounds(graphics, &wnd_rect)) != Ok){ + if((stat = GdipGetVisibleClipBounds(graphics, &wnd_rect)) != Ok){ GdipDeleteBrush((GpBrush*)brush); return stat; } @@ -5097,6 +5108,8 @@ GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics) { + GpStatus stat; + TRACE("(%p)\n", graphics); if(!graphics) @@ -5104,6 +5117,13 @@ if(graphics->busy) return ObjectBusy; + + if (graphics->image && graphics->image->type == ImageTypeMetafile) { + stat = METAFILE_ResetWorldTransform((GpMetafile*)graphics->image); + + if (stat != Ok) + return stat; + } return GdipSetMatrixElements(&graphics->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); } @@ -5211,6 +5231,8 @@ GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order) { + GpStatus stat; + TRACE("(%p, %.2f, %.2f, %d)\n", graphics, sx, sy, order); if(!graphics) @@ -5218,6 +5240,13 @@ if(graphics->busy) return ObjectBusy; + + if (graphics->image && graphics->image->type == ImageTypeMetafile) { + stat = METAFILE_ScaleWorldTransform((GpMetafile*)graphics->image, sx, sy, order); + + if (stat != Ok) + return stat; + } return GdipScaleMatrix(&graphics->worldtrans, sx, sy, order); } Modified: trunk/reactos/dll/win32/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/image.c?…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -1245,7 +1245,7 @@ } if (stat != Ok) - GdipDisposeImage((GpImage*)*dstBitmap); + GdipDisposeImage(&(*dstBitmap)->image); } if (stat != Ok) @@ -1445,8 +1445,8 @@ if (!bitmap || !hbmReturn) return InvalidParameter; - GdipGetImageWidth((GpImage*)bitmap, &width); - GdipGetImageHeight((GpImage*)bitmap, &height); + GdipGetImageWidth(&bitmap->image, &width); + GdipGetImageHeight(&bitmap->image, &height); bih.biSize = sizeof(bih); bih.biWidth = width; @@ -1570,7 +1570,7 @@ if (stat != Ok) { DeleteObject(iinfo.hbmColor); DeleteObject(iinfo.hbmMask); - GdipDisposeImage((GpImage*)*bitmap); + GdipDisposeImage(&(*bitmap)->image); return stat; } @@ -2932,7 +2932,7 @@ UINT i; char *item_value; - GdipGetPropertySize((GpImage *)bitmap, &prop_size, &prop_count); + GdipGetPropertySize(&bitmap->image, &prop_size, &prop_count); prop_item = heap_alloc_zero(prop_size + item->length + sizeof(PropertyItem)); if (!prop_item) return; @@ -3388,7 +3388,7 @@ { "Source", PropertyTagEquipModel }, { "Comment", PropertyTagExifUserComment }, }; - BOOL seen_gamma=FALSE; + BOOL seen_gamma=FALSE, seen_whitepoint=FALSE, seen_chrm=FALSE; hr = IWICBitmapDecoder_GetFrame(decoder, active_frame, &frame); if (hr != S_OK) return; @@ -3454,6 +3454,57 @@ add_property(bitmap, item); seen_gamma = TRUE; heap_free(item); + } + } + } + else if (SUCCEEDED(hr) && IsEqualGUID(&GUID_MetadataFormatChunkcHRM, &format)) + { + PropertyItem* item; + + if (!seen_whitepoint) + { + item = GdipAlloc(sizeof(PropertyItem) + sizeof(ULONG) * 4); + if (item) + { + ULONG *rational; + item->length = sizeof(ULONG) * 4; + item->type = PropertyTagTypeRational; + item->id = PropertyTagWhitePoint; + rational = item->value = item + 1; + rational[0] = get_ulong_by_index(reader, 0); + rational[1] = 100000; + rational[2] = get_ulong_by_index(reader, 1); + rational[3] = 100000; + add_property(bitmap, item); + seen_whitepoint = TRUE; + GdipFree(item); + } + } + if (!seen_chrm) + { + item = GdipAlloc(sizeof(PropertyItem) + sizeof(ULONG) * 12); + if (item) + { + ULONG *rational; + item->length = sizeof(ULONG) * 12; + item->type = PropertyTagTypeRational; + item->id = PropertyTagPrimaryChromaticities; + rational = item->value = item + 1; + rational[0] = get_ulong_by_index(reader, 2); + rational[1] = 100000; + rational[2] = get_ulong_by_index(reader, 3); + rational[3] = 100000; + rational[4] = get_ulong_by_index(reader, 4); + rational[5] = 100000; + rational[6] = get_ulong_by_index(reader, 5); + rational[7] = 100000; + rational[8] = get_ulong_by_index(reader, 6); + rational[9] = 100000; + rational[10] = get_ulong_by_index(reader, 7); + rational[11] = 100000; + add_property(bitmap, item); + seen_chrm = TRUE; + GdipFree(item); } } } @@ -3568,11 +3619,11 @@ } if (SUCCEEDED(hr) && status == Ok) - *image = (GpImage*)bitmap; + *image = &bitmap->image; else { *image = NULL; - GdipDisposeImage((GpImage*)bitmap); + GdipDisposeImage(&bitmap->image); } if (SUCCEEDED(hr) && status == Ok) @@ -3614,7 +3665,14 @@ if (status == Ok) { /* Native GDI+ used to be smarter, but since Win7 it just sets these flags. */ - bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI|ImageFlagsColorSpaceRGB; + bitmap->image.flags |= ImageFlagsReadOnly|ImageFlagsHasRealPixelSize|ImageFlagsHasRealDPI; + if (IsEqualGUID(&wic_format, &GUID_WICPixelFormat2bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat4bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat8bppGray) || + IsEqualGUID(&wic_format, &GUID_WICPixelFormat16bppGray)) + bitmap->image.flags |= ImageFlagsColorSpaceGRAY; + else + bitmap->image.flags |= ImageFlagsColorSpaceRGB; bitmap->image.frame_count = frame_count; bitmap->image.current_frame = active_frame; bitmap->image.decoder = decoder; @@ -3856,7 +3914,37 @@ static GpStatus decode_image_png(IStream* stream, GpImage **image) { - return decode_image_wic(stream, &GUID_ContainerFormatPng, png_metadata_reader, image); + IWICBitmapDecoder *decoder; + IWICBitmapFrameDecode *frame; + GpStatus status; + HRESULT hr; + GUID format; + BOOL force_conversion = FALSE; + + status = initialize_decoder_wic(stream, &GUID_ContainerFormatPng, &decoder); + if (status != Ok) + return status; + + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + if (hr == S_OK) + { + hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); + if (hr == S_OK) + { + if (IsEqualGUID(&format, &GUID_WICPixelFormat8bppGray)) + force_conversion = TRUE; + status = decode_frame_wic(decoder, force_conversion, 0, png_metadata_reader, image); + } + else + status = hresult_to_status(hr); + + IWICBitmapFrameDecode_Release(frame); + } + else + status = hresult_to_status(hr); + + IWICBitmapDecoder_Release(decoder); + return status; } static GpStatus decode_image_gif(IStream* stream, GpImage **image) @@ -4987,7 +5075,7 @@ entry[i].peGreen << 8 | entry[i].peBlue; } - retval = GdipSetImagePalette((GpImage*)*bitmap, palette); + retval = GdipSetImagePalette(&(*bitmap)->image, palette); } heap_free(palette); @@ -4995,7 +5083,7 @@ if (retval != Ok) { - GdipDisposeImage((GpImage*)*bitmap); + GdipDisposeImage(&(*bitmap)->image); *bitmap = NULL; } } @@ -5250,7 +5338,7 @@ if (stat == Ok) move_bitmap(bitmap, new_bitmap, FALSE); else - GdipDisposeImage((GpImage*)new_bitmap); + GdipDisposeImage(&new_bitmap->image); return stat; } Modified: trunk/reactos/dll/win32/gdiplus/imageattributes.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/imageatt…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/imageattributes.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/imageattributes.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -68,6 +68,21 @@ return Ok; } +GpStatus WINGDIPAPI GdipGetImageAttributesAdjustedPalette(GpImageAttributes *imageattr, + ColorPalette *palette, ColorAdjustType type) +{ + TRACE("(%p,%p,%u)\n", imageattr, palette, type); + + if (!imageattr || !palette || !palette->Count || + type >= ColorAdjustTypeCount || type == ColorAdjustTypeDefault) + return InvalidParameter; + + apply_image_attributes(imageattr, (LPBYTE)palette->Entries, palette->Count, 1, 0, + type, PixelFormat32bppARGB); + + return Ok; +} + GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh) { Modified: trunk/reactos/dll/win32/gdiplus/metafile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/metafile…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/metafile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/metafile.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -35,6 +35,12 @@ DWORD LogicalDpiY; } EmfPlusHeader; +typedef struct EmfPlusClear +{ + EmfPlusRecordHeader Header; + DWORD Color; +} EmfPlusClear; + typedef struct EmfPlusFillRects { EmfPlusRecordHeader Header; @@ -55,6 +61,13 @@ SHORT Width; SHORT Height; } EmfPlusRect; + +typedef struct EmfPlusScaleWorldTransform +{ + EmfPlusRecordHeader Header; + REAL Sx; + REAL Sy; +} EmfPlusScaleWorldTransform; static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void **result) { @@ -248,6 +261,15 @@ (*metafile)->comment_data_length = 0; (*metafile)->hemf = NULL; + if (!frameRect) + { + (*metafile)->auto_frame = TRUE; + (*metafile)->auto_frame_min.X = 0; + (*metafile)->auto_frame_min.Y = 0; + (*metafile)->auto_frame_max.X = -1; + (*metafile)->auto_frame_max.Y = -1; + } + stat = METAFILE_WriteHeader(*metafile, hdc); if (stat != Ok) @@ -306,6 +328,30 @@ return stat; } +static void METAFILE_AdjustFrame(GpMetafile* metafile, const GpPointF *points, + UINT num_points) +{ + int i; + + if (!metafile->auto_frame || !num_points) + return; + + if (metafile->auto_frame_max.X < metafile->auto_frame_min.X) + metafile->auto_frame_max = metafile->auto_frame_min = points[0]; + + for (i=0; i<num_points; i++) + { + if (points[i].X < metafile->auto_frame_min.X) + metafile->auto_frame_min.X = points[i].X; + if (points[i].X > metafile->auto_frame_max.X) + metafile->auto_frame_max.X = points[i].X; + if (points[i].Y < metafile->auto_frame_min.Y) + metafile->auto_frame_min.Y = points[i].Y; + if (points[i].Y > metafile->auto_frame_max.Y) + metafile->auto_frame_max.Y = points[i].Y; + } +} + GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) { GpStatus stat; @@ -343,6 +389,27 @@ } *hdc = metafile->record_dc; + + return Ok; +} + +GpStatus METAFILE_GraphicsClear(GpMetafile* metafile, ARGB color) +{ + if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusClear *record; + GpStatus stat; + + stat = METAFILE_AllocateRecord(metafile, sizeof(EmfPlusClear), (void**)&record); + if (stat != Ok) + return stat; + + record->Header.Type = EmfPlusRecordTypeClear; + record->Header.Flags = 0; + record->Color = color; + + METAFILE_WriteRecords(metafile); + } return Ok; } @@ -423,6 +490,29 @@ METAFILE_WriteRecords(metafile); } + if (metafile->auto_frame) + { + GpPointF corners[4]; + int i; + + for (i=0; i<count; i++) + { + corners[0].X = rects[i].X; + corners[0].Y = rects[i].Y; + corners[1].X = rects[i].X + rects[i].Width; + corners[1].Y = rects[i].Y; + corners[2].X = rects[i].X; + corners[2].Y = rects[i].Y + rects[i].Height; + corners[3].X = rects[i].X + rects[i].Width; + corners[3].Y = rects[i].Y + rects[i].Height; + + GdipTransformPoints(metafile->record_graphics, CoordinateSpaceDevice, + CoordinateSpaceWorld, corners, 4); + + METAFILE_AdjustFrame(metafile, corners, 4); + } + } + return Ok; } @@ -449,6 +539,52 @@ return Ok; } +GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) +{ + if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusScaleWorldTransform *record; + GpStatus stat; + + stat = METAFILE_AllocateRecord(metafile, + sizeof(EmfPlusScaleWorldTransform), + (void**)&record); + if (stat != Ok) + return stat; + + record->Header.Type = EmfPlusRecordTypeScaleWorldTransform; + record->Header.Flags = (order == MatrixOrderAppend ? 4 : 0); + record->Sx = sx; + record->Sy = sy; + + METAFILE_WriteRecords(metafile); + } + + return Ok; +} + +GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile) +{ + if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusRecordHeader *record; + GpStatus stat; + + stat = METAFILE_AllocateRecord(metafile, + sizeof(EmfPlusRecordHeader), + (void**)&record); + if (stat != Ok) + return stat; + + record->Type = EmfPlusRecordTypeResetWorldTransform; + record->Flags = 0; + + METAFILE_WriteRecords(metafile); + } + + return Ok; +} + GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) { if (hdc != metafile->record_dc) @@ -476,6 +612,57 @@ MetafileHeader header; stat = GdipGetMetafileHeaderFromEmf(metafile->hemf, &header); + if (stat == Ok && metafile->auto_frame && + metafile->auto_frame_max.X >= metafile->auto_frame_min.X) + { + RECTL bounds_rc, gdi_bounds_rc; + REAL x_scale = 2540.0 / header.DpiX; + REAL y_scale = 2540.0 / header.DpiY; + BYTE* buffer; + UINT buffer_size; + + bounds_rc.left = floorf(metafile->auto_frame_min.X * x_scale); + bounds_rc.top = floorf(metafile->auto_frame_min.Y * y_scale); + bounds_rc.right = ceilf(metafile->auto_frame_max.X * x_scale); + bounds_rc.bottom = ceilf(metafile->auto_frame_max.Y * y_scale); + + gdi_bounds_rc = header.u.EmfHeader.rclBounds; + if (gdi_bounds_rc.right > gdi_bounds_rc.left && gdi_bounds_rc.bottom > gdi_bounds_rc.top) + { + bounds_rc.left = min(bounds_rc.left, gdi_bounds_rc.left); + bounds_rc.top = min(bounds_rc.top, gdi_bounds_rc.top); + bounds_rc.right = max(bounds_rc.right, gdi_bounds_rc.right); + bounds_rc.bottom = max(bounds_rc.bottom, gdi_bounds_rc.bottom); + } + + buffer_size = GetEnhMetaFileBits(metafile->hemf, 0, NULL); + buffer = heap_alloc(buffer_size); + if (buffer) + { + HENHMETAFILE new_hemf; + + GetEnhMetaFileBits(metafile->hemf, buffer_size, buffer); + + ((ENHMETAHEADER*)buffer)->rclFrame = bounds_rc; + + new_hemf = SetEnhMetaFileBits(buffer_size, buffer); + + if (new_hemf) + { + DeleteEnhMetaFile(metafile->hemf); + metafile->hemf = new_hemf; + } + else + stat = OutOfMemory; + + heap_free(buffer); + } + else + stat = OutOfMemory; + + if (stat == Ok) + stat = GdipGetMetafileHeaderFromEmf(metafile->hemf, &header); + } if (stat == Ok) { metafile->bounds.X = header.X; @@ -568,6 +755,11 @@ } } +static GpStatus METAFILE_PlaybackUpdateClip(GpMetafile *metafile) +{ + return GdipCombineRegionRegion(metafile->playback_graphics->clip, metafile->base_clip, CombineModeReplace); +} + static GpStatus METAFILE_PlaybackUpdateWorldTransform(GpMetafile *metafile) { GpMatrix *real_transform; @@ -645,6 +837,12 @@ case EmfPlusRecordTypeGetDC: METAFILE_PlaybackGetDC((GpMetafile*)metafile); break; + case EmfPlusRecordTypeClear: + { + EmfPlusClear *record = (EmfPlusClear*)header; + + return GdipGraphicsClear(metafile->playback_graphics, record->Color); + } case EmfPlusRecordTypeFillRects: { EmfPlusFillRects *record = (EmfPlusFillRects*)header; @@ -724,6 +922,24 @@ return METAFILE_PlaybackUpdateWorldTransform(real_metafile); } + case EmfPlusRecordTypeScaleWorldTransform: + { + EmfPlusScaleWorldTransform *record = (EmfPlusScaleWorldTransform*)header; + MatrixOrder order = (flags & 0x4) ? MatrixOrderAppend : MatrixOrderPrepend; + + if (dataSize + sizeof(EmfPlusRecordHeader) < sizeof(EmfPlusScaleWorldTransform)) + return InvalidParameter; + + GdipScaleMatrix(real_metafile->world_transform, record->Sx, record->Sy, order); + + return METAFILE_PlaybackUpdateWorldTransform(real_metafile); + } + case EmfPlusRecordTypeResetWorldTransform: + { + GdipSetMatrixElements(real_metafile->world_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + + return METAFILE_PlaybackUpdateWorldTransform(real_metafile); + } default: FIXME("Not implemented for record type %x\n", recordType); return NotImplemented; @@ -799,6 +1015,7 @@ GpStatus stat; GpMetafile *real_metafile = (GpMetafile*)metafile; /* whoever made this const was joking */ GraphicsContainer state; + GpPath *dst_path; TRACE("(%p,%p,%p,%i,%p,%i,%p,%p,%p)\n", graphics, metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, @@ -839,6 +1056,38 @@ stat = GdipSetPageUnit(graphics, UnitPixel); if (stat == Ok) + stat = GdipResetWorldTransform(graphics); + + if (stat == Ok) + stat = GdipCreateRegion(&real_metafile->base_clip); + + if (stat == Ok) + stat = GdipGetClip(graphics, real_metafile->base_clip); + + if (stat == Ok) + stat = GdipCreatePath(FillModeAlternate, &dst_path); + + if (stat == Ok) + { + GpPointF clip_points[4]; + + clip_points[0] = real_metafile->playback_points[0]; + clip_points[1] = real_metafile->playback_points[1]; + clip_points[2].X = real_metafile->playback_points[1].X + real_metafile->playback_points[2].X + - real_metafile->playback_points[0].X; + clip_points[2].Y = real_metafile->playback_points[1].Y + real_metafile->playback_points[2].Y + - real_metafile->playback_points[0].Y; + clip_points[3] = real_metafile->playback_points[2]; + + stat = GdipAddPathPolygon(dst_path, clip_points, 4); + + if (stat == Ok) + stat = GdipCombineRegionPath(real_metafile->base_clip, dst_path, CombineModeIntersect); + + GdipDeletePath(dst_path); + } + + if (stat == Ok) stat = GdipCreateMatrix(&real_metafile->world_transform); if (stat == Ok) @@ -846,6 +1095,11 @@ real_metafile->page_unit = UnitDisplay; real_metafile->page_scale = 1.0; stat = METAFILE_PlaybackUpdateWorldTransform(real_metafile); + } + + if (stat == Ok) + { + stat = METAFILE_PlaybackUpdateClip(real_metafile); } if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf || @@ -860,6 +1114,9 @@ GdipDeleteMatrix(real_metafile->world_transform); real_metafile->world_transform = NULL; + + GdipDeleteRegion(real_metafile->base_clip); + real_metafile->base_clip = NULL; GdipEndContainer(graphics, state); } @@ -1205,8 +1462,22 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR *file, GpMetafile **metafile) { - FIXME("(%p, %p): stub\n", file, metafile); - return NotImplemented; + GpStatus status; + IStream *stream; + + TRACE("(%p, %p)\n", file, metafile); + + if (!file || !metafile) return InvalidParameter; + + *metafile = NULL; + + status = GdipCreateStreamOnFile(file, GENERIC_READ, &stream); + if (status == Ok) + { + status = GdipCreateMetafileFromStream(stream, metafile); + IStream_Release(stream); + } + return status; } GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, Modified: trunk/reactos/dll/win32/gdiplus/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/region.c…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -809,7 +809,7 @@ * their code followed by a second header for the path followed by the actual * path data. Followed by the flags for each point. The pathheader contains * the size of the data to follow, a version number again, followed by a count - * of how many points, and any special flags which may apply. 0x4000 means its + * of how many points, and any special flags which may apply. 0x4000 means it's * a path of shorts instead of FLOAT. * * Combining Ops are stored in reverse order from when they were constructed; @@ -1101,6 +1101,12 @@ GpGraphics *new_graphics=NULL; GpStatus stat; INT save_state; + + if (!path->pathdata.Count) /* PathToRegion doesn't support empty paths */ + { + *hrgn = CreateRectRgn( 0, 0, 0, 0 ); + return *hrgn ? Ok : OutOfMemory; + } if (!graphics) { @@ -1384,11 +1390,7 @@ return Ok; } - rect.left = ceilr(x); - rect.top = ceilr(y); - rect.right = ceilr(x + w); - rect.bottom = ceilr(y + h); - + SetRect(&rect, ceilr(x), ceilr(y), ceilr(x + w), ceilr(y + h)); *res = RectInRegion(hrgn, &rect); DeleteObject(hrgn); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Aug 19 09:28:13 2016 @@ -68,7 +68,7 @@ reactos/dll/win32/faultrep # Synced to WineStaging-1.9.11 reactos/dll/win32/fontsub # Synced to WineStaging-1.9.13 reactos/dll/win32/fusion # Synced to WineStaging-1.9.11 -reactos/dll/win32/gdiplus # Synced to WineStaging-1.9.11 +reactos/dll/win32/gdiplus # Synced to WineStaging-1.9.16 reactos/dll/win32/hhctrl.ocx # Synced to WineStaging-1.9.16 reactos/dll/win32/hlink # Synced to WineStaging-1.9.16 reactos/dll/win32/hnetcfg # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72340: [PSDK] Update netfw.idl. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:26:49 2016 New Revision: 72340 URL:
http://svn.reactos.org/svn/reactos?rev=72340&view=rev
Log: [PSDK] Update netfw.idl. CORE-11866 Modified: trunk/reactos/sdk/include/psdk/netfw.idl Modified: trunk/reactos/sdk/include/psdk/netfw.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/netfw.idl…
============================================================================== --- trunk/reactos/sdk/include/psdk/netfw.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/netfw.idl [iso-8859-1] Fri Aug 19 09:26:49 2016 @@ -333,6 +333,149 @@ } [ + local, + object, + uuid(af230d27-baba-4e42-aced-f524f22cfce2), + dual +] +interface INetFwRule : IDispatch +{ + [id(1), propget] + HRESULT Name( [out, retval] BSTR *name ); + [id(1), propput] + HRESULT Name( [in] BSTR name ); + + [id(2), propget] + HRESULT Description( [out, retval] BSTR* desc ); + [id(2), propput] + HRESULT Description( [in] BSTR desc ); + + [id(3), propget] + HRESULT ApplicationName( [out, retval] BSTR *imagename ); + [id(3), propput] + HRESULT ApplicationName( [in] BSTR imagename ); + + [id(4), propget] + HRESULT ServiceName( [out, retval] BSTR *service ); + [id(4), propput] + HRESULT ServiceName( [in] BSTR service ); + + [id(5), propget] + HRESULT Protocol( [out, retval] long* protocol ); + [id(5), propput] + HRESULT Protocol( [in] long protocol ); + + [id(6), propget] + HRESULT LocalPorts( [out, retval] BSTR* ports ); + [id(6), propput] + HRESULT LocalPorts( [in] BSTR ports ); + + [id(7), propget] + HRESULT RemotePorts( [out, retval] BSTR *ports ); + [id(7), propput] + HRESULT RemotePorts( [in] BSTR ports ); + + [id(8), propget] + HRESULT LocalAddresses([out, retval] BSTR* address ); + [id(8), propput] + HRESULT LocalAddresses([in] BSTR address); + + [id(9), propget] + HRESULT RemoteAddresses( [out, retval] BSTR* address ); + [id(9), propput] + HRESULT RemoteAddresses( [in] BSTR address ); + + [id(10), propget] + HRESULT IcmpTypesAndCodes( [out, retval] BSTR *codes ); + [id(10), propput] + HRESULT IcmpTypesAndCodes( [in] BSTR codes ); + + [id(11), propget] + HRESULT Direction( [out, retval] NET_FW_RULE_DIRECTION* dir ); + [id(11), propput] + HRESULT Direction( [in] NET_FW_RULE_DIRECTION dir ); + + [id(12), propget] + HRESULT Interfaces( [out, retval] VARIANT* interfaces ); + [id(12), propput] + HRESULT Interfaces( [in] VARIANT interfaces ); + + [id(13), propget] + HRESULT InterfaceTypes( [out, retval] BSTR* types ); + [id(13), propput] + HRESULT InterfaceTypes( [in] BSTR types ); + + [id(14), propget] + HRESULT Enabled( [out, retval] VARIANT_BOOL* enabled ); + [id(14), propput] + HRESULT Enabled( [in] VARIANT_BOOL enabled ); + + [id(15), propget] + HRESULT Grouping( [out, retval] BSTR* context ); + [id(15), propput] + HRESULT Grouping( [in] BSTR context ); + + [id(16), propget] + HRESULT Profiles( [out, retval] long* profiles ); + [id(16), propput] + HRESULT Profiles( [in] long profiles ); + + [id(17), propget] + HRESULT EdgeTraversal( [out, retval] VARIANT_BOOL* enabled ); + [id(17), propput] + HRESULT EdgeTraversal( [in] VARIANT_BOOL enabled ); + + [id(18), propget] + HRESULT Action( [out, retval] NET_FW_ACTION* action ); + [id(18), propput] + HRESULT Action( [in] NET_FW_ACTION action ); +} + +[ + local, + object, + uuid(9c4c6277-5027-441e-afae-ca1f542da009), + dual +] +interface INetFwRules : IDispatch +{ + [id(1), propget] + HRESULT Count( [out, retval] long* count ); + + [id(2)] + HRESULT Add( [in] INetFwRule* rule ); + + [id(3)] + HRESULT Remove( [in] BSTR name ); + + [id(4)] + HRESULT Item( [in] BSTR name, [out, retval] INetFwRule** rule ); + + [id(DISPID_NEWENUM), propget, restricted] + HRESULT _NewEnum( [out, retval] IUnknown** newEnum ); +} + +[ + local, + object, + uuid(8267bbe3-f890-491c-b7b6-2db1ef0e5d2b), + dual +] +interface INetFwServiceRestriction : IDispatch +{ + [id(1)] + HRESULT RestrictService( [in] BSTR serviceName, [in] BSTR appName, + [in] VARIANT_BOOL restrictService, [in] VARIANT_BOOL serviceSidRestricted ); + + [id(2)] + HRESULT ServiceRestricted( [in] BSTR serviceName, [in] BSTR appName, + [out, retval] VARIANT_BOOL* serviceRestricted ); + + [id(3), propget] + HRESULT Rules( [out, retval] INetFwRules** rules ); +} + +[ object, uuid(174A0DDA-E9F9-449D-993B-21AB667CA456), dual @@ -395,6 +538,81 @@ [id(2)] HRESULT GetProfileByType( [in] NET_FW_PROFILE_TYPE profileType, [out, retval] INetFwProfile** profile ); +} + +[ + local, + object, + uuid(98325047-c671-4174-8d81-defcd3f03186), + dual +] +interface INetFwPolicy2 : IDispatch +{ + [id(1), propget] + HRESULT CurrentProfileTypes( [out, retval] long *profile ); + + [id(2), propget] + HRESULT FirewallEnabled( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] VARIANT_BOOL* enabled ); + + [id(2), propput] + HRESULT FirewallEnabled( [in] NET_FW_PROFILE_TYPE2 profileType, [in] VARIANT_BOOL enabled ); + + [id(3), propget] + HRESULT ExcludedInterfaces( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] VARIANT *interfaces ); + + [id(3), propput] + HRESULT ExcludedInterfaces( [in] NET_FW_PROFILE_TYPE2 profileType, [in] VARIANT interfaces ); + + [id(4), propget] + HRESULT BlockAllInboundTraffic( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] VARIANT_BOOL* block ); + + [id(4), propput] + HRESULT BlockAllInboundTraffic( [in] NET_FW_PROFILE_TYPE2 profileType, [in] VARIANT_BOOL block ); + + [id(5), propget] + HRESULT NotificationsDisabled( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] VARIANT_BOOL* disabled ); + [id(5), propput] + HRESULT NotificationsDisabled( [in] NET_FW_PROFILE_TYPE2 profileType, [in] VARIANT_BOOL disabled ); + + [id(6), propget] + HRESULT UnicastResponsesToMulticastBroadcastDisabled( [in] NET_FW_PROFILE_TYPE2 profileType, + [out, retval] VARIANT_BOOL* disabled ); + [id(6), propput] + HRESULT UnicastResponsesToMulticastBroadcastDisabled( [in] NET_FW_PROFILE_TYPE2 profileType, + [in] VARIANT_BOOL disabled ); + + [id(7), propget] + HRESULT Rules( [out, retval] INetFwRules** rules ); + + [id(8), propget] + HRESULT ServiceRestriction( [out, retval] INetFwServiceRestriction **ServiceRestriction ); + + [id(9)] + HRESULT EnableRuleGroup( [in] long profileTypesBitmask, [in] BSTR group, [in] VARIANT_BOOL enable ); + + [id(10)] + HRESULT IsRuleGroupEnabled( [in] long profileTypesBitmask, [in] BSTR group, [out, retval] VARIANT_BOOL *enabled ); + + [id(11)] + HRESULT RestoreLocalFirewallDefaults(); + + [id(12), propget] + HRESULT DefaultInboundAction( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] NET_FW_ACTION* action ); + + [id(12), propput] + HRESULT DefaultInboundAction( [in] NET_FW_PROFILE_TYPE2 profileType, [in] NET_FW_ACTION action ); + + [id(13), propget] + HRESULT DefaultOutboundAction( [in] NET_FW_PROFILE_TYPE2 profileType, [out, retval] NET_FW_ACTION* action ); + + [id(13), propput] + HRESULT DefaultOutboundAction( [in] NET_FW_PROFILE_TYPE2 profileType, [in] NET_FW_ACTION action ); + + [id(14), propget] + HRESULT IsRuleGroupCurrentlyEnabled( [in] BSTR group, [out, retval] VARIANT_BOOL* enabled ); + + [id(15), propget] + HRESULT LocalPolicyModifyState( [out, retval] NET_FW_MODIFY_STATE* modifyState ); } [ @@ -442,6 +660,7 @@ interface INetFwAuthorizedApplications; interface INetFwProfile; interface INetFwPolicy; + interface INetFwPolicy2; interface INetFwMgr; [ @@ -467,4 +686,12 @@ { [default] interface INetFwMgr; } -} + + [ + uuid(e2b3c97f-6ae1-41ac-817a-f6f92166d7dd) + ] + coclass NetFwPolicy2 + { + [default] interface INetFwPolicy2; + } +}
8 years, 4 months
1
0
0
0
[akhaldi] 72339: [COMDLG32_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Aug 19 09:24:50 2016 New Revision: 72339 URL:
http://svn.reactos.org/svn/reactos?rev=72339&view=rev
Log: [COMDLG32_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/rostests/winetests/comdlg32/filedlg.c trunk/rostests/winetests/comdlg32/itemdlg.c Modified: trunk/rostests/winetests/comdlg32/filedlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/filedl…
============================================================================== --- trunk/rostests/winetests/comdlg32/filedlg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comdlg32/filedlg.c [iso-8859-1] Fri Aug 19 09:24:50 2016 @@ -430,63 +430,56 @@ case cmb1: case edt1: ok( TESTRECTS( ctrlrcs[i], rc, 0, 10, 10, 0), - "control id %03x should have sized horizontally and moved vertically, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x should have sized horizontally and moved vertically, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* sized horizontal and vertical */ case lst2: ok( TESTRECTS( ctrlrcs[i], rc, 0, 0, 10, 10), - "control id %03x should have sized horizontally and vertically, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x should have sized horizontally and vertically, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* moved horizontal and vertical */ case IDCANCEL: case pshHelp: ok( TESTRECTS( ctrlrcs[i], rc, 10, 10, 0, 0), - "control id %03x should have moved horizontally and vertically, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x should have moved horizontally and vertically, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* moved vertically */ case chx1: case stc2: case stc3: ok( TESTRECTS( ctrlrcs[i], rc, 0, 10, 0, 0), - "control id %03x should have moved vertically, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x should have moved vertically, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* resized horizontal */ case cmb2: /* aka IDC_LOOKIN */ ok( TESTRECTS( ctrlrcs[i], rc, 0, 0, 10, 0)|| TESTRECTS( ctrlrcs[i], rc, 0, 0, 0, 0), /* Vista and higher */ - "control id %03x should have resized horizontally, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x should have resized horizontally, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* non moving non sizing controls */ case stc4: ok( TESTRECTS( rc, ctrlrcs[i], 0, 0, 0, 0), - "control id %03x was moved/resized, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x was moved/resized, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* todo_wine: non moving non sizing controls */ case lst1: todo_wine ok( TESTRECTS( rc, ctrlrcs[i], 0, 0, 0, 0), - "control id %03x was moved/resized, before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + "control id %03x was moved/resized, before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); break; /* don't test: id is not unique */ case IDOK: @@ -495,10 +488,9 @@ case -1: break; default: - trace("untested control id %03x before %d,%d-%d,%d after %d,%d-%d,%d\n", - ctrlids[i], ctrlrcs[i].left, ctrlrcs[i].top, - ctrlrcs[i].right, ctrlrcs[i].bottom, - rc.left, rc.top, rc.right, rc.bottom); + trace("untested control id %03x before %s after %s\n", + ctrlids[i], wine_dbgstr_rect( &ctrlrcs[i] ), + wine_dbgstr_rect( &rc )); #undef TESTRECTS #undef MAXNRCTRLS } Modified: trunk/rostests/winetests/comdlg32/itemdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/itemdl…
============================================================================== --- trunk/rostests/winetests/comdlg32/itemdlg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comdlg32/itemdlg.c [iso-8859-1] Fri Aug 19 09:24:50 2016 @@ -802,6 +802,21 @@ ok(hr == S_OK, "got 0x%08x\n", hr); hr = IFileOpenDialog_SetFileName(pfod, null); ok(hr == S_OK, "got 0x%08x\n", hr); + + filename = NULL; + hr = IFileOpenDialog_GetFileName(pfod, &filename); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(!lstrcmpW(filename, null), "Strings do not match.\n"); + CoTaskMemFree(filename); + + hr = IFileOpenDialog_SetFileName(pfod, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + filename = (void*)0xdeadbeef; + hr = IFileOpenDialog_GetFileName(pfod, &filename); + ok(hr == E_FAIL, "Got 0x%08x\n", hr); + ok(filename == NULL, "got %p.\n", filename); + hr = IFileOpenDialog_SetFileName(pfod, txt); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IFileOpenDialog_GetFileName(pfod, &filename);
8 years, 4 months
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
47
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
Results per page:
10
25
50
100
200