winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
629 discussions
Start a n
N
ew thread
Zebediah Figura : devenum: Use separate factories for CLSID_SystemDeviceEnum and CLSID_CDeviceMoniker.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 47921c19e06254a0b66b41c73979aca2978afd5b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=47921c19e06254a0b66b41c7…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Jun 26 09:05:30 2018 -0500 devenum: Use separate factories for CLSID_SystemDeviceEnum and CLSID_CDeviceMoniker. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/devenum/devenum_main.c | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c index 7bfc593..3499f99 100644 --- a/dlls/devenum/devenum_main.c +++ b/dlls/devenum/devenum_main.c @@ -56,6 +56,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) return TRUE; } +struct class_factory +{ + IClassFactory IClassFactory_iface; + IUnknown *obj; +}; + +static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct class_factory, IClassFactory_iface ); +} + static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj) { TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj); @@ -87,24 +98,15 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **obj) { + struct class_factory *This = impl_from_IClassFactory( iface ); + TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj); if (!obj) return E_POINTER; if (outer) return CLASS_E_NOAGGREGATION; - if (IsEqualGUID(&IID_ICreateDevEnum, iid)) - { - *obj = &DEVENUM_CreateDevEnum; - return S_OK; - } - if (IsEqualGUID(&IID_IParseDisplayName, iid)) - { - *obj = &DEVENUM_ParseDisplayName; - return S_OK; - } - - return CLASS_E_CLASSNOTAVAILABLE; + return IUnknown_QueryInterface(This->obj, iid, obj); } static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock) @@ -124,24 +126,24 @@ static const IClassFactoryVtbl ClassFactory_vtbl = { ClassFactory_LockServer }; -static IClassFactory devenum_cf = { &ClassFactory_vtbl }; +static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_CreateDevEnum }; +static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_ParseDisplayName }; /*********************************************************************** * DllGetClassObject (DEVENUM.@) */ -HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **obj) { - TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), obj); - *ppv = NULL; + *obj = NULL; - /* FIXME: we should really have two class factories. - * Oh well - works just fine as it is */ - if (IsEqualGUID(rclsid, &CLSID_SystemDeviceEnum) || - IsEqualGUID(rclsid, &CLSID_CDeviceMoniker)) - return IClassFactory_QueryInterface(&devenum_cf, iid, ppv); + if (IsEqualGUID(clsid, &CLSID_SystemDeviceEnum)) + return IClassFactory_QueryInterface(&create_devenum_cf.IClassFactory_iface, iid, obj); + else if (IsEqualGUID(clsid, &CLSID_CDeviceMoniker)) + return IClassFactory_QueryInterface(&device_moniker_cf.IClassFactory_iface, iid, obj); - FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid)); + FIXME("class %s not available\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE; }
1
0
0
0
Zebediah Figura : devenum: Merge factory.c into devenum_main.c.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: b371cc5130b2393878733834ed97dcfd784cc7d4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b371cc5130b2393878733834…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Jun 26 09:05:29 2018 -0500 devenum: Merge factory.c into devenum_main.c. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/devenum/Makefile.in | 1 - dlls/devenum/devenum_main.c | 74 ++++++++++++++++++++++- dlls/devenum/devenum_private.h | 10 --- dlls/devenum/factory.c | 134 ----------------------------------------- 4 files changed, 72 insertions(+), 147 deletions(-) diff --git a/dlls/devenum/Makefile.in b/dlls/devenum/Makefile.in index ae138b6..d1407a9 100644 --- a/dlls/devenum/Makefile.in +++ b/dlls/devenum/Makefile.in @@ -5,7 +5,6 @@ DELAYIMPORTS = msvfw32 C_SRCS = \ createdevenum.c \ devenum_main.c \ - factory.c \ mediacatenum.c \ parsedisplayname.c diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c index cb4b454..7bfc593 100644 --- a/dlls/devenum/devenum_main.c +++ b/dlls/devenum/devenum_main.c @@ -1,5 +1,5 @@ /* - * exported dll functions for devenum.dll + * Device Enumeration * * Copyright (C) 2002 John K. Hohm * Copyright (C) 2002 Robert Shearman @@ -56,6 +56,76 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) return TRUE; } +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **obj) +{ + TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), obj); + + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory)) + { + IClassFactory_AddRef(iface); + *obj = iface; + return S_OK; + } + + *obj = NULL; + WARN("no interface for %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + DEVENUM_LockModule(); + return 2; +} + +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + DEVENUM_UnlockModule(); + return 1; +} + +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, + IUnknown *outer, REFIID iid, void **obj) +{ + TRACE("(%p, %s, %p)\n", outer, debugstr_guid(iid), obj); + + if (!obj) return E_POINTER; + + if (outer) return CLASS_E_NOAGGREGATION; + + if (IsEqualGUID(&IID_ICreateDevEnum, iid)) + { + *obj = &DEVENUM_CreateDevEnum; + return S_OK; + } + if (IsEqualGUID(&IID_IParseDisplayName, iid)) + { + *obj = &DEVENUM_ParseDisplayName; + return S_OK; + } + + return CLASS_E_CLASSNOTAVAILABLE; +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock) +{ + if (lock) + DEVENUM_LockModule(); + else + DEVENUM_UnlockModule(); + return S_OK; +} + +static const IClassFactoryVtbl ClassFactory_vtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ClassFactory_CreateInstance, + ClassFactory_LockServer +}; + +static IClassFactory devenum_cf = { &ClassFactory_vtbl }; + /*********************************************************************** * DllGetClassObject (DEVENUM.@) */ @@ -69,7 +139,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) * Oh well - works just fine as it is */ if (IsEqualGUID(rclsid, &CLSID_SystemDeviceEnum) || IsEqualGUID(rclsid, &CLSID_CDeviceMoniker)) - return IClassFactory_QueryInterface(&DEVENUM_ClassFactory.IClassFactory_iface, iid, ppv); + return IClassFactory_QueryInterface(&devenum_cf, iid, ppv); FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index df0080d..ea4e017 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -51,15 +51,6 @@ extern LONG dll_refs DECLSPEC_HIDDEN; static inline void DEVENUM_LockModule(void) { InterlockedIncrement(&dll_refs); } static inline void DEVENUM_UnlockModule(void) { InterlockedDecrement(&dll_refs); } - -/********************************************************************** - * ClassFactory declaration for devenum.dll - */ -typedef struct -{ - IClassFactory IClassFactory_iface; -} ClassFactoryImpl; - enum device_type { DEVICE_FILTER, @@ -84,7 +75,6 @@ typedef struct MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) DECLSPEC_HIDDEN; HRESULT create_EnumMoniker(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN; -extern ClassFactoryImpl DEVENUM_ClassFactory DECLSPEC_HIDDEN; extern ICreateDevEnum DEVENUM_CreateDevEnum DECLSPEC_HIDDEN; extern IParseDisplayName DEVENUM_ParseDisplayName DECLSPEC_HIDDEN; diff --git a/dlls/devenum/factory.c b/dlls/devenum/factory.c deleted file mode 100644 index c808fa5..0000000 --- a/dlls/devenum/factory.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * ClassFactory implementation for DEVENUM.dll - * - * Copyright (C) 2002 John K. Hohm - * Copyright (C) 2002 Robert Shearman - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "devenum_private.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(devenum); - -/********************************************************************** - * DEVENUM_IClassFactory_QueryInterface (also IUnknown) - */ -static HRESULT WINAPI DEVENUM_IClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, - void **ppvObj) -{ - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObj); - - if (ppvObj == NULL) return E_POINTER; - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IClassFactory)) - { - *ppvObj = iface; - IClassFactory_AddRef(iface); - return S_OK; - } - else if (IsEqualGUID(riid, &IID_IParseDisplayName)) - { - return IClassFactory_CreateInstance(iface, NULL, riid, ppvObj); - } - - FIXME("- no interface IID: %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; -} - -/********************************************************************** - * DEVENUM_IClassFactory_AddRef (also IUnknown) - */ -static ULONG WINAPI DEVENUM_IClassFactory_AddRef(IClassFactory *iface) -{ - TRACE("\n"); - - DEVENUM_LockModule(); - - return 2; /* non-heap based object */ -} - -/********************************************************************** - * DEVENUM_IClassFactory_Release (also IUnknown) - */ -static ULONG WINAPI DEVENUM_IClassFactory_Release(IClassFactory *iface) -{ - TRACE("\n"); - - DEVENUM_UnlockModule(); - - return 1; /* non-heap based object */ -} - -/********************************************************************** - * DEVENUM_IClassFactory_CreateInstance - */ -static HRESULT WINAPI DEVENUM_IClassFactory_CreateInstance(IClassFactory *iface, - IUnknown *pUnkOuter, REFIID riid, void **ppvObj) -{ - TRACE("(%p)->(%p, %s, %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppvObj); - - if (ppvObj == NULL) return E_POINTER; - - /* Don't support aggregation (Windows doesn't) */ - if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION; - - if (IsEqualGUID(&IID_ICreateDevEnum, riid)) - { - *ppvObj = &DEVENUM_CreateDevEnum; - return S_OK; - } - if (IsEqualGUID(&IID_IParseDisplayName, riid)) - { - *ppvObj = &DEVENUM_ParseDisplayName; - return S_OK; - } - - return CLASS_E_CLASSNOTAVAILABLE; -} - -/********************************************************************** - * DEVENUM_IClassFactory_LockServer - */ -static HRESULT WINAPI DEVENUM_IClassFactory_LockServer(IClassFactory *iface, BOOL fLock) -{ - TRACE("\n"); - - if (fLock) - DEVENUM_LockModule(); - else - DEVENUM_UnlockModule(); - return S_OK; -} - -/********************************************************************** - * IClassFactory_Vtbl - */ -static const IClassFactoryVtbl IClassFactory_Vtbl = -{ - DEVENUM_IClassFactory_QueryInterface, - DEVENUM_IClassFactory_AddRef, - DEVENUM_IClassFactory_Release, - DEVENUM_IClassFactory_CreateInstance, - DEVENUM_IClassFactory_LockServer -}; - -/********************************************************************** - * static ClassFactory instance - */ -ClassFactoryImpl DEVENUM_ClassFactory = { { &IClassFactory_Vtbl } };
1
0
0
0
Hua Meng : msvcp120: Add test for Concurrent_vector_grow_to_at_least_with_result.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 1367904871954af99ee0f00a24541ed86a39c9f1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1367904871954af99ee0f00a…
Author: Hua Meng <161220092(a)smail.nju.edu.cn> Date: Tue Jun 26 18:35:57 2018 +0800 msvcp120: Add test for Concurrent_vector_grow_to_at_least_with_result. Signed-off-by: Hua Meng <161220092(a)smail.nju.edu.cn> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcp120/tests/msvcp120.c | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index b5e470c..2974482 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -420,6 +420,8 @@ static void* (__thiscall *p_vector_base_v4__Internal_compact)( void (__cdecl*)(void*, const void*, size_t)); static size_t (__thiscall *p_vector_base_v4__Internal_grow_by)( vector_base_v4*, size_t, size_t, void (__cdecl*)(void*, const void*, size_t), const void *); +static size_t (__thiscall *p_vector_base_v4__Internal_grow_to_at_least_with_result)( + vector_base_v4*, size_t, size_t, void (__cdecl*)(void*, const void*, size_t), const void *); static HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) @@ -572,6 +574,8 @@ static BOOL init(void) "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IEAAPEAX_KPEAXP6AX10@ZP6AX1PEBX0@Z@Z"); SET(p_vector_base_v4__Internal_grow_by, "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z"); + SET(p_vector_base_v4__Internal_grow_to_at_least_with_result, + "?_Internal_grow_to_at_least_with_result@_Concurrent_vector_base_v4@details@Concurrency@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z"); } else { SET(p_tr2_sys__File_size, "?_File_size@sys@tr2@std@@YA_KPBD@Z"); @@ -693,6 +697,8 @@ static BOOL init(void) "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IAEPAXIPAXP6AX0I@ZP6AX0PBXI@Z@Z"); SET(p_vector_base_v4__Internal_grow_by, "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IAEIIIP6AXPAXPBXI@Z1@Z"); + SET(p_vector_base_v4__Internal_grow_to_at_least_with_result, + "?_Internal_grow_to_at_least_with_result@_Concurrent_vector_base_v4@details@Concurrency@@IAEIIIP6AXPAXPBXI@Z1@Z"); #else SET(p__Thrd_current, "_Thrd_current"); @@ -742,6 +748,8 @@ static BOOL init(void) "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IAAPAXIPAXP6AX0I@ZP6AX0PBXI@Z@Z"); SET(p_vector_base_v4__Internal_grow_by, "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IAAIIIP6AXPAXPBXI@Z1@Z"); + SET(p_vector_base_v4__Internal_grow_to_at_least_with_result, + "?_Internal_grow_to_at_least_with_result@_Concurrent_vector_base_v4@details@Concurrency@@IAAIIIP6AXPAXPBXI@Z1@Z"); #endif } SET(p__Thrd_equal, @@ -3036,6 +3044,44 @@ static void test_vector_base_v4(void) CHECK_CALLED(concurrent_vector_int_destroy); concurrent_vector_int_dtor(&v2); + /* test for Internal_grow_to_at_least_with_result */ + concurrent_vector_int_ctor(&v2); + SET_EXPECT(concurrent_vector_int_alloc); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + CHECK_CALLED(concurrent_vector_int_alloc); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + vector_elem_count += 2; + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 2, "v2.early_size got %ld expected 2\n", (long)v2.early_size); + i = 0; + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_to_at_least_with_result, + &v2, 3, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 2, "_Internal_grow_to_at_least_with_result returned %ld expected 2\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 3, "v2.early_size got %ld expected 3\n", (long)v2.early_size); + i = 0; + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_to_at_least_with_result, + &v2, 5, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 3, "_Internal_grow_to_at_least_with_result returned %ld expected 3\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n", (long)v2.early_size); + SET_EXPECT(concurrent_vector_int_destroy); + size = (size_t)call_func2(p_vector_base_v4__Internal_clear, + &v2, concurrent_vector_int_destroy); + ok(size == 3, "_Internal_clear returned %ld expected 3\n", (long)size); + CHECK_CALLED(concurrent_vector_int_destroy); + concurrent_vector_int_dtor(&v2); + SET_EXPECT(concurrent_vector_int_destroy); size = (size_t)call_func2(p_vector_base_v4__Internal_clear, &vector, concurrent_vector_int_destroy);
1
0
0
0
Hua Meng : msvcp120: Add test for Concurrent_vector_grow_by.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 6ea1c9da6315843db56599c90adadf01d7052ae0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6ea1c9da6315843db56599c9…
Author: Hua Meng <161220092(a)smail.nju.edu.cn> Date: Tue Jun 26 18:35:39 2018 +0800 msvcp120: Add test for Concurrent_vector_grow_by. Signed-off-by: Hua Meng <161220092(a)smail.nju.edu.cn> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcp120/tests/msvcp120.c | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 0ec9fbd..b5e470c 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -418,6 +418,8 @@ static void (__thiscall *p_vector_base_v4__Internal_swap)( static void* (__thiscall *p_vector_base_v4__Internal_compact)( vector_base_v4*, size_t, void*, void (__cdecl*)(void*, size_t), void (__cdecl*)(void*, const void*, size_t)); +static size_t (__thiscall *p_vector_base_v4__Internal_grow_by)( + vector_base_v4*, size_t, size_t, void (__cdecl*)(void*, const void*, size_t), const void *); static HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) @@ -568,6 +570,8 @@ static BOOL init(void) "?_Internal_swap@_Concurrent_vector_base_v4@details@Concurrency@@IEAAXAEAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IEAAPEAX_KPEAXP6AX10@ZP6AX1PEBX0@Z@Z"); + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IEAA_K_K0P6AXPEAXPEBX0@Z2@Z"); } else { SET(p_tr2_sys__File_size, "?_File_size@sys@tr2@std@@YA_KPBD@Z"); @@ -687,6 +691,8 @@ static BOOL init(void) "?_Internal_swap@_Concurrent_vector_base_v4@details@Concurrency@@IAEXAAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IAEPAXIPAXP6AX0I@ZP6AX0PBXI@Z@Z"); + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IAEIIIP6AXPAXPBXI@Z1@Z"); #else SET(p__Thrd_current, "_Thrd_current"); @@ -734,7 +740,8 @@ static BOOL init(void) "?_Internal_swap@_Concurrent_vector_base_v4@details@Concurrency@@IAAXAAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact@_Concurrent_vector_base_v4@details@Concurrency@@IAAPAXIPAXP6AX0I@ZP6AX0PBXI@Z@Z"); - + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by@_Concurrent_vector_base_v4@details@Concurrency@@IAAIIIP6AXPAXPBXI@Z1@Z"); #endif } SET(p__Thrd_equal, @@ -2992,6 +2999,43 @@ static void test_vector_base_v4(void) CHECK_CALLED(concurrent_vector_int_destroy); concurrent_vector_int_dtor(&v2); + /* test for Internal_grow_by */ + concurrent_vector_int_ctor(&v2); + SET_EXPECT(concurrent_vector_int_alloc); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + CHECK_CALLED(concurrent_vector_int_alloc); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + vector_elem_count += 2; + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 2, "v2.early_size got %ld expected 2\n", (long)v2.early_size); + i = 0; + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_by, + &v2, 1, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 2, "_Internal_grow_by returned %ld expected 2\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 3, "v2.early_size got %ld expected 3\n", (long)v2.early_size); + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_by, + &v2, 2, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 3, "_Internal_grow_by returned %ld expected 3\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n", (long)v2.early_size); + SET_EXPECT(concurrent_vector_int_destroy); + size = (size_t)call_func2(p_vector_base_v4__Internal_clear, + &v2, concurrent_vector_int_destroy); + ok(size == 3, "_Internal_clear returned %ld expected 3\n", (long)size); + CHECK_CALLED(concurrent_vector_int_destroy); + concurrent_vector_int_dtor(&v2); + SET_EXPECT(concurrent_vector_int_destroy); size = (size_t)call_func2(p_vector_base_v4__Internal_clear, &vector, concurrent_vector_int_destroy);
1
0
0
0
Zebediah Figura : hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName ().
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: e46f84a86b46e8c63a16302b667c7a38701a2937 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e46f84a86b46e8c63a16302b…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Mon Jun 25 15:41:14 2018 -0500 hnetcfg: Store the full path in INetFwAuthorizedApplication_put_ProcessImageFileName(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hnetcfg/apps.c | 17 ++++++++++++----- dlls/hnetcfg/tests/policy.c | 5 ++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c index 34ef108..69eabd6 100644 --- a/dlls/hnetcfg/apps.c +++ b/dlls/hnetcfg/apps.c @@ -268,7 +268,7 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName( { fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); UNIVERSAL_NAME_INFOW *info; - WCHAR *netpath; + WCHAR *path; DWORD res; DWORD sz; @@ -281,22 +281,29 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName( res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz); if (res == WN_MORE_DATA) { - if (!(netpath = heap_alloc(sz))) + if (!(path = heap_alloc(sz))) return E_OUTOFMEMORY; - info = (UNIVERSAL_NAME_INFOW *)&netpath; + info = (UNIVERSAL_NAME_INFOW *)&path; res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz); if (res == NO_ERROR) { SysFreeString(This->filename); This->filename = SysAllocString(info->lpUniversalName); } - heap_free(netpath); + heap_free(path); return HRESULT_FROM_WIN32(res); } + sz = GetFullPathNameW(image, 0, NULL, NULL); + if (!(path = heap_alloc(++sz * sizeof(WCHAR)))) + return E_OUTOFMEMORY; + + GetFullPathNameW(image, sz, path, NULL); + SysFreeString( This->filename ); - This->filename = SysAllocString(image); + This->filename = SysAllocString(path); + heap_free(path); return This->filename ? S_OK : E_OUTOFMEMORY; } diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c index b28535d..389be16 100644 --- a/dlls/hnetcfg/tests/policy.c +++ b/dlls/hnetcfg/tests/policy.c @@ -107,6 +107,7 @@ static void test_NetFwAuthorizedApplication(void) INetFwAuthorizedApplication *app; static WCHAR empty[] = {0}; UNIVERSAL_NAME_INFOW *info; + WCHAR fullpath[MAX_PATH]; WCHAR netpath[MAX_PATH]; WCHAR image[MAX_PATH]; HRESULT hr; @@ -138,13 +139,15 @@ static void test_NetFwAuthorizedApplication(void) ok(hr == S_OK, "got: %08x\n", hr); SysFreeString(bstr); + GetFullPathNameW(image, ARRAY_SIZE(fullpath), fullpath, NULL); + info = (UNIVERSAL_NAME_INFOW *)&netpath; sz = sizeof(netpath); hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz); if (hr != NO_ERROR) { info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR); - lstrcpyW(info->lpUniversalName, image); + lstrcpyW(info->lpUniversalName, fullpath); } hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
1
0
0
0
Nikolay Sivov : crypt32: Fix string arguments tracing.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 3dcdbba6ef0f7602a342bd4e80238fdab0e14e7c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3dcdbba6ef0f7602a342bd4e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Jun 26 10:59:38 2018 +0300 crypt32: Fix string arguments tracing. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/base64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/crypt32/base64.c b/dlls/crypt32/base64.c index 4a904d4..2ba8055 100644 --- a/dlls/crypt32/base64.c +++ b/dlls/crypt32/base64.c @@ -622,7 +622,7 @@ static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString, if (!(headerBegins = strstr(pszString, header))) { - TRACE("Can't find %s in %s.\n", header, pszString); + TRACE("Can't find %s in %s.\n", header, debugstr_an(pszString, cchString)); return ERROR_INVALID_DATA; } @@ -746,7 +746,7 @@ BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString, StringToBinaryAFunc decoder; LONG ret; - TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_a(pszString), + TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_an(pszString, cchString ? cchString : -1), cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags); if (!pszString) @@ -833,7 +833,7 @@ static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString, if (!(headerBegins = strstrW(pszString, header))) { - TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_w(pszString)); + TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_wn(pszString, cchString)); return ERROR_INVALID_DATA; } @@ -957,7 +957,7 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString, StringToBinaryWFunc decoder; LONG ret; - TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_w(pszString), + TRACE("(%s, %d, %08x, %p, %p, %p, %p)\n", debugstr_wn(pszString, cchString ? cchString : -1), cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags); if (!pszString)
1
0
0
0
Michael Müller : crypt32: Implement verification of ECDSA signatures.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 4d1190f5a80443d36d1ab49297830e92e9b4f82f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4d1190f5a80443d36d1ab492…
Author: Michael Müller <michael(a)fds-team.de> Date: Tue Jun 26 10:59:37 2018 +0300 crypt32: Implement verification of ECDSA signatures. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/Makefile.in | 2 +- dlls/crypt32/cert.c | 260 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 250 insertions(+), 12 deletions(-) diff --git a/dlls/crypt32/Makefile.in b/dlls/crypt32/Makefile.in index d3a409f..0934222 100644 --- a/dlls/crypt32/Makefile.in +++ b/dlls/crypt32/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D_CRYPT32_ MODULE = crypt32.dll IMPORTLIB = crypt32 -IMPORTS = user32 advapi32 +IMPORTS = user32 advapi32 bcrypt DELAYIMPORTS = cryptnet EXTRALIBS = $(SECURITY_LIBS) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 83aac5d..1667b42 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -21,9 +21,14 @@ #include <stdarg.h> #define NONAMELESSUNION +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" +#include "winternl.h" +#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS #include "wincrypt.h" +#include "bcrypt.h" #include "winnls.h" #include "rpc.h" #include "wine/debug.h" @@ -2408,22 +2413,13 @@ BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV_LEGACY hCryptProv, CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, pPublicKey, 0, NULL); } -static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv, - DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pubKeyInfo, - const CERT_SIGNED_CONTENT_INFO *signedCert) +static BOOL CRYPT_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, + CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info) { BOOL ret; HCRYPTKEY key; - PCCRYPT_OID_INFO info; ALG_ID pubKeyID, hashID; - info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, - signedCert->SignatureAlgorithm.pszObjId, 0); - if (!info || info->dwGroupId != CRYPT_SIGN_ALG_OID_GROUP_ID) - { - SetLastError(NTE_BAD_ALGID); - return FALSE; - } hashID = info->u.Algid; if (info->ExtraInfo.cbData >= sizeof(ALG_ID)) pubKeyID = *(ALG_ID *)info->ExtraInfo.pbData; @@ -2453,6 +2449,248 @@ static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptP return ret; } +static BOOL CNG_CalcHash(const WCHAR *algorithm, const CERT_SIGNED_CONTENT_INFO *signedCert, + BYTE **hash_value, DWORD *hash_len) +{ + BCRYPT_HASH_HANDLE hash = NULL; + BCRYPT_ALG_HANDLE alg = NULL; + NTSTATUS status; + DWORD size; + + if ((status = BCryptOpenAlgorithmProvider(&alg, algorithm, NULL, 0))) + goto done; + + if ((status = BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0))) + goto done; + + if ((status = BCryptHashData(hash, signedCert->ToBeSigned.pbData, signedCert->ToBeSigned.cbData, 0))) + goto done; + + if ((status = BCryptGetProperty(hash, BCRYPT_HASH_LENGTH, (BYTE *)hash_len, sizeof(*hash_len), &size, 0))) + goto done; + + if (!(*hash_value = CryptMemAlloc(*hash_len))) + { + status = STATUS_NO_MEMORY; + goto done; + } + + if ((status = BCryptFinishHash(hash, *hash_value, *hash_len, 0))) + { + CryptMemFree(*hash_value); + goto done; + } + +done: + if (hash) BCryptDestroyHash(hash); + if (alg) BCryptCloseAlgorithmProvider(alg, 0); + if (status) SetLastError(RtlNtStatusToDosError(status)); + return status == 0; +} + +static BOOL CNG_ImportECCPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key) +{ + DWORD blob_magic, ecckey_len, size; + BCRYPT_ALG_HANDLE alg = NULL; + BCRYPT_ECCKEY_BLOB *ecckey; + const WCHAR *sign_algo; + char **ecc_curve; + NTSTATUS status; + + if (!pubKeyInfo->PublicKey.cbData) + { + SetLastError(NTE_BAD_ALGID); + return FALSE; + } + + if (pubKeyInfo->PublicKey.pbData[0] != 0x4) + { + FIXME("Compressed ECC curves (%02x) not yet supported\n", pubKeyInfo->PublicKey.pbData[0]); + SetLastError(NTE_BAD_ALGID); + return FALSE; + } + + if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OBJECT_IDENTIFIER, pubKeyInfo->Algorithm.Parameters.pbData, + pubKeyInfo->Algorithm.Parameters.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_curve, &size)) + return FALSE; + + if (!strcmp(*ecc_curve, szOID_ECC_CURVE_P256)) + { + sign_algo = BCRYPT_ECDSA_P256_ALGORITHM; + blob_magic = BCRYPT_ECDSA_PUBLIC_P256_MAGIC; + } + else if (!strcmp(*ecc_curve, szOID_ECC_CURVE_P384)) + { + sign_algo = BCRYPT_ECDSA_P384_ALGORITHM; + blob_magic = BCRYPT_ECDSA_PUBLIC_P384_MAGIC; + } + else + { + FIXME("Unsupported ecc curve type: %s\n", *ecc_curve); + sign_algo = NULL; + blob_magic = 0; + } + LocalFree(ecc_curve); + + if (!sign_algo) + { + SetLastError(NTE_BAD_ALGID); + return FALSE; + } + + if ((status = BCryptOpenAlgorithmProvider(&alg, sign_algo, NULL, 0))) + goto done; + + ecckey_len = sizeof(BCRYPT_ECCKEY_BLOB) + pubKeyInfo->PublicKey.cbData - 1; + if (!(ecckey = CryptMemAlloc(ecckey_len))) + { + status = STATUS_NO_MEMORY; + goto done; + } + + ecckey->dwMagic = blob_magic; + ecckey->cbKey = (pubKeyInfo->PublicKey.cbData - 1) / 2; + memcpy(ecckey + 1, pubKeyInfo->PublicKey.pbData + 1, pubKeyInfo->PublicKey.cbData - 1); + + status = BCryptImportKeyPair(alg, NULL, BCRYPT_ECCPUBLIC_BLOB, key, (BYTE*)ecckey, ecckey_len, 0); + +done: + if (alg) BCryptCloseAlgorithmProvider(alg, 0); + if (status) SetLastError(RtlNtStatusToDosError(status)); + return !status; +} + +static BOOL CNG_ImportPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key) +{ + if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY)) + return CNG_ImportECCPubKey(pubKeyInfo, key); + + FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId)); + SetLastError(NTE_BAD_ALGID); + return FALSE; +} + +static BOOL CNG_PrepareSignatureECC(BYTE *encoded_sig, DWORD encoded_size, BYTE **sig_value, DWORD *sig_len) +{ + CERT_ECC_SIGNATURE *ecc_sig; + DWORD size; + int i; + + if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ECC_SIGNATURE, encoded_sig, encoded_size, + CRYPT_DECODE_ALLOC_FLAG, NULL, &ecc_sig, &size)) + return FALSE; + + if (!ecc_sig->r.cbData || !ecc_sig->s.cbData) + { + LocalFree(ecc_sig); + SetLastError(ERROR_INVALID_DATA); + return FALSE; + } + + *sig_len = ecc_sig->r.cbData + ecc_sig->s.cbData; + if (!(*sig_value = CryptMemAlloc(*sig_len))) + { + LocalFree(ecc_sig); + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + + for (i = 0; i < ecc_sig->r.cbData; i++) + (*sig_value)[i] = ecc_sig->r.pbData[ecc_sig->r.cbData - i - 1]; + for (i = 0; i < ecc_sig->s.cbData; i++) + (*sig_value)[ecc_sig->r.cbData + i] = ecc_sig->s.pbData[ecc_sig->s.cbData - i - 1]; + + LocalFree(ecc_sig); + return TRUE; +} + +static BOOL CNG_PrepareSignature(CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, + BYTE **sig_value, DWORD *sig_len) +{ + BYTE *encoded_sig; + BOOL ret = FALSE; + int i; + + if (!signedCert->Signature.cbData) + { + SetLastError(ERROR_INVALID_DATA); + return FALSE; + } + + if (!(encoded_sig = CryptMemAlloc(signedCert->Signature.cbData))) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + + for (i = 0; i < signedCert->Signature.cbData; i++) + encoded_sig[i] = signedCert->Signature.pbData[signedCert->Signature.cbData - i - 1]; + + if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY)) + ret = CNG_PrepareSignatureECC(encoded_sig, signedCert->Signature.cbData, sig_value, sig_len); + else + { + FIXME("Unsupported public key type: %s\n", debugstr_a(pubKeyInfo->Algorithm.pszObjId)); + SetLastError(NTE_BAD_ALGID); + } + + CryptMemFree(encoded_sig); + return ret; +} + +static BOOL CNG_VerifySignature(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, + CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert, const CRYPT_OID_INFO *info) +{ + BCRYPT_KEY_HANDLE key = NULL; + BYTE *hash_value = NULL, *sig_value; + DWORD hash_len, sig_len; + NTSTATUS status; + BOOL ret; + + ret = CNG_ImportPubKey(pubKeyInfo, &key); + if (ret) + { + ret = CNG_CalcHash(info->pwszCNGAlgid, signedCert, &hash_value, &hash_len); + if (ret) + { + ret = CNG_PrepareSignature(pubKeyInfo, signedCert, &sig_value, &sig_len); + if (ret) + { + status = BCryptVerifySignature(key, NULL, hash_value, hash_len, sig_value, sig_len, 0); + if (status) + { + FIXME("Failed to verify signature: %08x\n", status); + SetLastError(RtlNtStatusToDosError(status)); + ret = FALSE; + } + CryptMemFree(sig_value); + } + CryptMemFree(hash_value); + } + BCryptDestroyKey(key); + } + + return ret; +} + +static BOOL CRYPT_VerifyCertSignatureFromPublicKeyInfo(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, + CERT_PUBLIC_KEY_INFO *pubKeyInfo, const CERT_SIGNED_CONTENT_INFO *signedCert) +{ + CCRYPT_OID_INFO *info; + + info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, signedCert->SignatureAlgorithm.pszObjId, 0); + if (!info || info->dwGroupId != CRYPT_SIGN_ALG_OID_GROUP_ID) + { + SetLastError(NTE_BAD_ALGID); + return FALSE; + } + + if (info->u.Algid == CALG_OID_INFO_CNG_ONLY) + return CNG_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info); + else + return CRYPT_VerifySignature(hCryptProv, dwCertEncodingType, pubKeyInfo, signedCert, info); +} + BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, DWORD dwSubjectType, void *pvSubject, DWORD dwIssuerType, void *pvIssuer, DWORD dwFlags, void *pvReserved)
1
0
0
0
Michael Stefaniuc : gdi32/tests: Use the available ARRAY_SIZE() macro.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 314a276f19e78c3498942b9cdec3be0dfacf84fc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=314a276f19e78c3498942b9c…
Author: Michael Stefaniuc <mstefani(a)winehq.org> Date: Mon Jun 25 21:46:41 2018 +0200 gdi32/tests: Use the available ARRAY_SIZE() macro. Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/tests/bitmap.c | 10 ++++----- dlls/gdi32/tests/brush.c | 2 +- dlls/gdi32/tests/dc.c | 6 +++--- dlls/gdi32/tests/dib.c | 38 ++++++++++++++++----------------- dlls/gdi32/tests/font.c | 52 ++++++++++++++++++++++----------------------- dlls/gdi32/tests/gdiobj.c | 2 +- dlls/gdi32/tests/icm.c | 2 +- dlls/gdi32/tests/metafile.c | 7 +++--- dlls/gdi32/tests/path.c | 14 ++++++------ dlls/gdi32/tests/pen.c | 2 +- 10 files changed, 67 insertions(+), 68 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=314a276f19e78c349894…
1
0
0
0
Alexandre Julliard : schedsvc: Only restart the directory watch once we' ve received data.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 6a1ce3c114b1e1fa94bedd270299d127680f6d33 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6a1ce3c114b1e1fa94bedd27…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jun 26 13:09:13 2018 +0200 schedsvc: Only restart the directory watch once we've received data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/schedsvc/svc_main.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/dlls/schedsvc/svc_main.c b/dlls/schedsvc/svc_main.c index 8e23a04..8830d59 100644 --- a/dlls/schedsvc/svc_main.c +++ b/dlls/schedsvc/svc_main.c @@ -47,9 +47,17 @@ static DWORD WINAPI tasks_monitor_thread(void *arg) static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 }; WCHAR path[MAX_PATH]; HANDLE htasks, hport, htimer; - JOBOBJECT_ASSOCIATE_COMPLETION_PORT info; + JOBOBJECT_ASSOCIATE_COMPLETION_PORT job_info; OVERLAPPED ov; LARGE_INTEGER period; + struct + { + FILE_NOTIFY_INFORMATION data; + WCHAR name_buffer[MAX_PATH]; + } info; + + /* the buffer must be DWORD aligned */ + C_ASSERT(!(sizeof(info) & 3)); TRACE("Starting...\n"); @@ -91,9 +99,9 @@ static DWORD WINAPI tasks_monitor_thread(void *arg) return -1; } - info.CompletionKey = hjob_queue; - info.CompletionPort = hport; - if (!SetInformationJobObject(hjob_queue, JobObjectAssociateCompletionPortInformation, &info, sizeof(info))) + job_info.CompletionKey = hjob_queue; + job_info.CompletionPort = hport; + if (!SetInformationJobObject(hjob_queue, JobObjectAssociateCompletionPortInformation, &job_info, sizeof(job_info))) { ERR("SetInformationJobObject failed\n"); return -1; @@ -102,29 +110,16 @@ static DWORD WINAPI tasks_monitor_thread(void *arg) memset(&ov, 0, sizeof(ov)); ov.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + memset(&info, 0, sizeof(info)); + ReadDirectoryChangesW(htasks, &info, sizeof(info), FALSE, + FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE, + NULL, &ov, NULL); + for (;;) { - struct - { - FILE_NOTIFY_INFORMATION data; - WCHAR name_buffer[MAX_PATH]; - } info; HANDLE events[4]; DWORD ret; - /* the buffer must be DWORD aligned */ - C_ASSERT(!(sizeof(info) & 3)); - - memset(&info, 0, sizeof(info)); - - ret = ReadDirectoryChangesW(htasks, &info, sizeof(info), FALSE, - FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE, - NULL, &ov, NULL); - if (!ret) break; - - if (info.data.NextEntryOffset) - FIXME("got multiple entries\n"); - events[0] = done_event; events[1] = htimer; events[2] = hport; @@ -160,6 +155,9 @@ static DWORD WINAPI tasks_monitor_thread(void *arg) continue; } + if (info.data.NextEntryOffset) + FIXME("got multiple entries\n"); + /* Directory change notification */ info.data.FileName[info.data.FileNameLength/sizeof(WCHAR)] = 0; @@ -204,6 +202,11 @@ static DWORD WINAPI tasks_monitor_thread(void *arg) if (!SetWaitableTimer(htimer, &period, 0, NULL, NULL, FALSE)) ERR("SetWaitableTimer failed\n"); } + + memset(&info, 0, sizeof(info)); + if (!ReadDirectoryChangesW(htasks, &info, sizeof(info), FALSE, + FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE, + NULL, &ov, NULL)) break; } CancelWaitableTimer(htimer);
1
0
0
0
Andrey Gusev : msi: Remove checks for negative value.
by Alexandre Julliard
26 Jun '18
26 Jun '18
Module: wine Branch: master Commit: 5bd1b6f41032d1e133a8d9a96fba711ee491d634 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5bd1b6f41032d1e133a8d9a9…
Author: Andrey Gusev <andrey.goosev(a)gmail.com> Date: Tue Jun 26 09:06:48 2018 +0200 msi: Remove checks for negative value. Signed-off-by: Andrey Gusev <andrey.goosev(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msi/format.c | 2 +- dlls/msi/string.c | 5 ++--- dlls/msi/table.c | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/dlls/msi/format.c b/dlls/msi/format.c index 9356c9e..d32afb2 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -242,7 +242,7 @@ static WCHAR *deformat_file( FORMAT *format, FORMSTR *str, BOOL shortname, int * if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret ); goto done; } - if ((len = GetShortPathNameW(file->TargetPath, NULL, 0)) <= 0) + if (!(len = GetShortPathNameW(file->TargetPath, NULL, 0))) { if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret ); goto done; diff --git a/dlls/msi/string.c b/dlls/msi/string.c index f094a53..7383fdd 100644 --- a/dlls/msi/string.c +++ b/dlls/msi/string.c @@ -233,7 +233,7 @@ static void set_st_entry( string_table *st, UINT n, WCHAR *str, int len, USHORT static UINT string2id( const string_table *st, const char *buffer, UINT *id ) { - DWORD sz; + int sz; UINT r = ERROR_INVALID_PARAMETER; LPWSTR str; @@ -245,8 +245,7 @@ static UINT string2id( const string_table *st, const char *buffer, UINT *id ) return ERROR_SUCCESS; } - sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 ); - if( sz <= 0 ) + if (!(sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 ))) return r; str = msi_alloc( sz*sizeof(WCHAR) ); if( !str ) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 45a1814..e046c5c 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -1279,9 +1279,7 @@ static UINT get_table_value_from_record( MSITABLEVIEW *tv, MSIRECORD *rec, UINT UINT r; int ival; - if ( (iField <= 0) || - (iField > tv->num_cols) || - MSI_RecordIsNull( rec, iField ) ) + if (!iField || iField > tv->num_cols || MSI_RecordIsNull( rec, iField )) return ERROR_FUNCTION_FAILED; columninfo = tv->columns[ iField - 1 ];
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
63
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Results per page:
10
25
50
100
200