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
October 2013
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
757 discussions
Start a n
N
ew thread
Qian Hong : atl80: Trace ATL version.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 6611068b5b37b77033583fb68df3c3f31347f9b5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6611068b5b37b77033583fb68…
Author: Qian Hong <qhong(a)codeweavers.com> Date: Thu Oct 17 02:41:58 2013 +0800 atl80: Trace ATL version. --- dlls/atl80/atl80.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/atl80/atl80.c b/dlls/atl80/atl80.c index b5d571b..487ee49 100644 --- a/dlls/atl80/atl80.c +++ b/dlls/atl80/atl80.c @@ -95,7 +95,8 @@ HRESULT WINAPI AtlRegisterTypeLib(HINSTANCE inst, const WCHAR *index) */ DWORD WINAPI AtlGetVersion(void *pReserved) { - return _ATL_VER; + TRACE("version %04x (%p)\n", _ATL_VER, pReserved); + return _ATL_VER; } /********************************************************************** @@ -123,7 +124,7 @@ BOOL WINAPI AtlAxWinInit(void) const WCHAR AtlAxWin80[] = {'A','t','l','A','x','W','i','n','8','0',0}; const WCHAR AtlAxWinLic80[] = {'A','t','l','A','x','W','i','n','L','i','c','8','0',0}; - FIXME("semi-stub\n"); + FIXME("version %04x semi-stub\n", _ATL_VER); if ( FAILED( OleInitialize(NULL) ) ) return FALSE;
1
0
0
0
Qian Hong : atl: Trace ATL version.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 0fb6b350c2380b7292faa78e35dca9e8130e5b73 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0fb6b350c2380b7292faa78e3…
Author: Qian Hong <qhong(a)codeweavers.com> Date: Thu Oct 17 02:41:44 2013 +0800 atl: Trace ATL version. --- dlls/atl/atl_main.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c index 985d706..509d4bb 100644 --- a/dlls/atl/atl_main.c +++ b/dlls/atl/atl_main.c @@ -146,7 +146,7 @@ HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULEW *pM, _ATL_TERMFUNC *pFunc, DWOR { _ATL_TERMFUNC_ELEM *termfunc_elem; - TRACE("(%p %p %ld)\n", pM, pFunc, dw); + TRACE("version %04x (%p %p %ld)\n", _ATL_VER, pM, pFunc, dw); if (pM->cbSize > ATLVer1Size) { @@ -590,7 +590,8 @@ HRESULT WINAPI DllCanUnloadNow(void) */ DWORD WINAPI AtlGetVersion(void *pReserved) { - return _ATL_VER; + TRACE("version %04x (%p)\n", _ATL_VER, pReserved); + return _ATL_VER; } /********************************************************************** @@ -617,7 +618,7 @@ BOOL WINAPI AtlAxWinInit(void) WNDCLASSEXW wcex; const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0}; - FIXME("semi-stub\n"); + FIXME("version %04x semi-stub\n", _ATL_VER); if ( FAILED( OleInitialize(NULL) ) ) return FALSE;
1
0
0
0
Alexandre Julliard : gdi32: Determine the virtual resolution dynamically if it hasn't been set.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 3e88582a78427f33c55ac0d3b2e6c917c6fef916 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3e88582a78427f33c55ac0d3b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 17 12:12:48 2013 +0200 gdi32: Determine the virtual resolution dynamically if it hasn't been set. --- dlls/gdi32/mapping.c | 90 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 54 insertions(+), 36 deletions(-) diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c index 2699ca1..665042a 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -29,6 +29,30 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc); +static SIZE get_dc_virtual_size( DC *dc ) +{ + SIZE ret = dc->virtual_size; + + if (!ret.cx) + { + ret.cx = GetDeviceCaps( dc->hSelf, HORZSIZE ); + ret.cy = GetDeviceCaps( dc->hSelf, VERTSIZE ); + } + return ret; +} + +static SIZE get_dc_virtual_res( DC *dc ) +{ + SIZE ret = dc->virtual_res; + + if (!ret.cx) + { + ret.cx = GetDeviceCaps( dc->hSelf, HORZRES ); + ret.cy = GetDeviceCaps( dc->hSelf, VERTRES ); + } + return ret; +} + /*********************************************************************** * MAPPING_FixIsotropic * @@ -36,10 +60,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dc); */ static void MAPPING_FixIsotropic( DC * dc ) { - double xdim = fabs((double)dc->vportExtX * dc->virtual_size.cx / - (dc->virtual_res.cx * dc->wndExtX)); - double ydim = fabs((double)dc->vportExtY * dc->virtual_size.cy / - (dc->virtual_res.cy * dc->wndExtY)); + SIZE virtual_size = get_dc_virtual_size( dc ); + SIZE virtual_res = get_dc_virtual_res( dc ); + double xdim = fabs((double)dc->vportExtX * virtual_size.cx / (virtual_res.cx * dc->wndExtX)); + double ydim = fabs((double)dc->vportExtY * virtual_size.cy / (virtual_res.cy * dc->wndExtY)); if (xdim > ydim) { @@ -136,14 +160,12 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode ) { DC *dc = get_nulldrv_dc( dev ); INT ret = dc->MapMode; - INT horzSize, vertSize, horzRes, vertRes; + SIZE virtual_size, virtual_res; if (mode == dc->MapMode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return ret; - horzSize = dc->virtual_size.cx; - vertSize = dc->virtual_size.cy; - horzRes = dc->virtual_res.cx; - vertRes = dc->virtual_res.cy; + virtual_size = get_dc_virtual_size( dc ); + virtual_res = get_dc_virtual_res( dc ); switch (mode) { case MM_TEXT: @@ -154,34 +176,34 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode ) break; case MM_LOMETRIC: case MM_ISOTROPIC: - dc->wndExtX = horzSize * 10; - dc->wndExtY = vertSize * 10; - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; + dc->wndExtX = virtual_size.cx * 10; + dc->wndExtY = virtual_size.cy * 10; + dc->vportExtX = virtual_res.cx; + dc->vportExtY = -virtual_res.cy; break; case MM_HIMETRIC: - dc->wndExtX = horzSize * 100; - dc->wndExtY = vertSize * 100; - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; + dc->wndExtX = virtual_size.cx * 100; + dc->wndExtY = virtual_size.cy * 100; + dc->vportExtX = virtual_res.cx; + dc->vportExtY = -virtual_res.cy; break; case MM_LOENGLISH: - dc->wndExtX = MulDiv(1000, horzSize, 254); - dc->wndExtY = MulDiv(1000, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; + dc->wndExtX = MulDiv(1000, virtual_size.cx, 254); + dc->wndExtY = MulDiv(1000, virtual_size.cy, 254); + dc->vportExtX = virtual_res.cx; + dc->vportExtY = -virtual_res.cy; break; case MM_HIENGLISH: - dc->wndExtX = MulDiv(10000, horzSize, 254); - dc->wndExtY = MulDiv(10000, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; + dc->wndExtX = MulDiv(10000, virtual_size.cx, 254); + dc->wndExtY = MulDiv(10000, virtual_size.cy, 254); + dc->vportExtX = virtual_res.cx; + dc->vportExtY = -virtual_res.cy; break; case MM_TWIPS: - dc->wndExtX = MulDiv(14400, horzSize, 254); - dc->wndExtY = MulDiv(14400, vertSize, 254); - dc->vportExtX = horzRes; - dc->vportExtY = -vertRes; + dc->wndExtX = MulDiv(14400, virtual_size.cx, 254); + dc->wndExtY = MulDiv(14400, virtual_size.cy, 254); + dc->vportExtX = virtual_res.cx; + dc->vportExtY = -virtual_res.cy; break; case MM_ANISOTROPIC: break; @@ -596,15 +618,11 @@ BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res, DC * dc; TRACE("(%p %d %d %d %d)\n", hdc, horz_res, vert_res, horz_size, vert_size); - if(horz_res == 0 && vert_res == 0 && horz_size == 0 && vert_size == 0) + if (!horz_res || !vert_res || !horz_size || !vert_size) { - horz_res = GetDeviceCaps(hdc, HORZRES); - vert_res = GetDeviceCaps(hdc, VERTRES); - horz_size = GetDeviceCaps(hdc, HORZSIZE); - vert_size = GetDeviceCaps(hdc, VERTSIZE); + /* they must be all zero */ + if (horz_res || vert_res || horz_size || vert_size) return FALSE; } - else if(horz_res == 0 || vert_res == 0 || horz_size == 0 || vert_size == 0) - return FALSE; dc = get_dc_ptr( hdc ); if (!dc) return FALSE;
1
0
0
0
Jacek Caban : crypt32: Moved ContextList freeing to store. c and get rid of ContextList.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: fa37b63517563460a10ac863ac9526106b939bc4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fa37b63517563460a10ac863a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:10:18 2013 +0200 crypt32: Moved ContextList freeing to store.c and get rid of ContextList. --- dlls/crypt32/context.c | 12 ------------ dlls/crypt32/crypt32_private.h | 7 ------- dlls/crypt32/store.c | 18 +++++++++++++++--- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 82b1021..4809eea 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -109,15 +109,3 @@ void Context_CopyProperties(const void *to, const void *from) assert(toProperties && fromProperties); ContextPropertyList_Copy(toProperties, fromProperties); } - -void ContextList_Free(ContextList *list) -{ - context_t *context, *next; - - LIST_FOR_EACH_ENTRY_SAFE(context, next, list, context_t, u.entry) - { - TRACE("removing %p\n", context); - list_remove(&context->u.entry); - Context_Release(context); - } -} diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index dc66ebf..dbb9ee5 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -433,13 +433,6 @@ void ContextPropertyList_Copy(CONTEXT_PROPERTY_LIST *to, void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; -/** - * Context list functions. A context list is a simple list of link contexts. - */ -typedef struct list ContextList; - -void ContextList_Free(ContextList *list) DECLSPEC_HIDDEN; - extern WINECRYPT_CERTSTORE empty_store; void init_empty_store(void) DECLSPEC_HIDDEN; diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 76ba944..07613ec 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -215,6 +215,18 @@ static BOOL MemStore_deleteContext(WINE_MEMSTORE *store, context_t *context) return TRUE; } +static void free_contexts(struct list *list) +{ + context_t *context, *next; + + LIST_FOR_EACH_ENTRY_SAFE(context, next, list, context_t, u.entry) + { + TRACE("freeing %p\n", context); + list_remove(&context->u.entry); + Context_Release(context); + } +} + static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { @@ -317,9 +329,9 @@ static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) if(ref) return (flags & CERT_CLOSE_STORE_CHECK_FLAG) ? CRYPT_E_PENDING_CLOSE : ERROR_SUCCESS; - ContextList_Free(&store->certs); - ContextList_Free(&store->crls); - ContextList_Free(&store->ctls); + free_contexts(&store->certs); + free_contexts(&store->crls); + free_contexts(&store->ctls); store->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&store->cs); CRYPT_FreeStore(&store->hdr);
1
0
0
0
Jacek Caban : crypt32: Share more code between memory store deleteContext implementations.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: bf464f81a8e71ddc6659b8776c4d4827896606f9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bf464f81a8e71ddc6659b8776…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:10:05 2013 +0200 crypt32: Share more code between memory store deleteContext implementations. --- dlls/crypt32/context.c | 16 ---------------- dlls/crypt32/crypt32_private.h | 6 ------ dlls/crypt32/store.c | 32 ++++++++++++++++++++++---------- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 6a96943..82b1021 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -110,22 +110,6 @@ void Context_CopyProperties(const void *to, const void *from) ContextPropertyList_Copy(toProperties, fromProperties); } -BOOL ContextList_Remove(ContextList *list, CRITICAL_SECTION *cs, context_t *context) -{ - BOOL inList = FALSE; - - EnterCriticalSection(cs); - if (!list_empty(&context->u.entry)) - { - list_remove(&context->u.entry); - list_init(&context->u.entry); - inList = TRUE; - } - LeaveCriticalSection(cs); - - return inList; -} - void ContextList_Free(ContextList *list) { context_t *context, *next; diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 3a6d9d5..dc66ebf 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -438,12 +438,6 @@ void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; */ typedef struct list ContextList; -/* Removes a context from the list. Returns TRUE if the context was removed, - * or FALSE if not. (The context may have been duplicated, so subsequent - * removes have no effect.) - */ -BOOL ContextList_Remove(ContextList *list, CRITICAL_SECTION *cs, context_t *context) DECLSPEC_HIDDEN; - void ContextList_Free(ContextList *list) DECLSPEC_HIDDEN; extern WINECRYPT_CERTSTORE empty_store; diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index bf9c88e..76ba944 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -198,6 +198,22 @@ static context_t *MemStore_enumContext(WINE_MEMSTORE *store, struct list *list, return ret; } +static BOOL MemStore_deleteContext(WINE_MEMSTORE *store, context_t *context) +{ + BOOL in_list = FALSE; + + EnterCriticalSection(&store->cs); + if (!list_empty(&context->u.entry)) { + list_remove(&context->u.entry); + list_init(&context->u.entry); + in_list = TRUE; + } + LeaveCriticalSection(&store->cs); + + if(in_list) + Context_Release(context); + return TRUE; +} static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, context_t *toReplace, context_t **ppStoreContext, BOOL use_link) @@ -205,7 +221,6 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); - return MemStore_addContext(ms, &ms->certs, cert, toReplace, ppStoreContext, use_link); } @@ -222,10 +237,9 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (ContextList_Remove(&ms->certs, &ms->cs, context)) - Context_Release(context); + TRACE("(%p, %p)\n", store, context); - return TRUE; + return MemStore_deleteContext(ms, context); } static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, @@ -251,10 +265,9 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(&ms->crls, &ms->cs, context)) - Context_Release(context); + TRACE("(%p, %p)\n", store, context); - return TRUE; + return MemStore_deleteContext(ms, context); } static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, @@ -280,10 +293,9 @@ static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(&ms->ctls, &ms->cs, context)) - Context_Release(context); + TRACE("(%p, %p)\n", store, context); - return TRUE; + return MemStore_deleteContext(ms, context); } static void MemStore_addref(WINECRYPT_CERTSTORE *store)
1
0
0
0
Jacek Caban : crypt32: Share more code between memory store enumContext implementations.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 4d28e14acb270ad7266ce720c4a8473ccb6ebe6d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4d28e14acb270ad7266ce720c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:09:50 2013 +0200 crypt32: Share more code between memory store enumContext implementations. --- dlls/crypt32/context.c | 25 -------------------- dlls/crypt32/crypt32_private.h | 2 - dlls/crypt32/store.c | 49 ++++++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 48 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 60c82ec..6a96943 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -110,31 +110,6 @@ void Context_CopyProperties(const void *to, const void *from) ContextPropertyList_Copy(toProperties, fromProperties); } -context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) -{ - struct list *listNext; - context_t *ret; - - EnterCriticalSection(cs); - if (prev) - { - listNext = list_next(list, &prev->u.entry); - Context_Release(prev); - } - else - listNext = list_next(list, list); - LeaveCriticalSection(cs); - - if (listNext) - { - ret = LIST_ENTRY(listNext, context_t, u.entry); - Context_AddRef(ret); - } - else - ret = NULL; - return ret; -} - BOOL ContextList_Remove(ContextList *list, CRITICAL_SECTION *cs, context_t *context) { BOOL inList = FALSE; diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 0dd76fc..3a6d9d5 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -438,8 +438,6 @@ void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; */ typedef struct list ContextList; -context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) DECLSPEC_HIDDEN; - /* Removes a context from the list. Returns TRUE if the context was removed, * or FALSE if not. (The context may have been duplicated, so subsequent * removes have no effect.) diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 660219d..bf9c88e 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -174,6 +174,31 @@ static BOOL MemStore_addContext(WINE_MEMSTORE *store, struct list *list, context return TRUE; } +static context_t *MemStore_enumContext(WINE_MEMSTORE *store, struct list *list, context_t *prev) +{ + struct list *next; + context_t *ret; + + EnterCriticalSection(&store->cs); + if (prev) { + next = list_next(list, &prev->u.entry); + Context_Release(prev); + }else { + next = list_next(list, list); + } + LeaveCriticalSection(&store->cs); + + if (!next) { + SetLastError(CRYPT_E_NOT_FOUND); + return NULL; + } + + ret = LIST_ENTRY(next, context_t, u.entry); + Context_AddRef(ret); + return ret; +} + + static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { @@ -187,16 +212,10 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - context_t *ret; TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(&ms->certs, &ms->cs, prev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->certs, prev); } static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) @@ -222,16 +241,10 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - context_t *ret; TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(&ms->crls, &ms->cs, prev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->crls, prev); } static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) @@ -257,16 +270,10 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - context_t *ret; TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(&ms->ctls, &ms->cs, prev); - if (!ret) - SetLastError(CRYPT_E_NOT_FOUND); - - TRACE("returning %p\n", ret); - return ret; + return MemStore_enumContext(ms, &ms->ctls, prev); } static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context)
1
0
0
0
Jacek Caban : crypt32: Share more code between memory store addContext implementations.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 63eed79d25ba63fdbc0aca45e2055ceb40e661f0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=63eed79d25ba63fdbc0aca45e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:09:37 2013 +0200 crypt32: Share more code between memory store addContext implementations. --- dlls/crypt32/context.c | 28 ------------------ dlls/crypt32/crypt32_private.h | 3 -- dlls/crypt32/store.c | 60 +++++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index d6d67d1..60c82ec 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -110,34 +110,6 @@ void Context_CopyProperties(const void *to, const void *from) ContextPropertyList_Copy(toProperties, fromProperties); } -context_t *ContextList_Add(ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, - context_t *existing, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) -{ - context_t *context; - - TRACE("(%p, %p, %p)\n", list, toLink, existing); - - context = toLink->vtbl->clone(toLink, store, use_link); - if (context) - { - TRACE("adding %p\n", context); - EnterCriticalSection(cs); - if (existing) - { - context->u.entry.prev = existing->u.entry.prev; - context->u.entry.next = existing->u.entry.next; - context->u.entry.prev->next = &context->u.entry; - context->u.entry.next->prev = &context->u.entry; - list_init(&existing->u.entry); - Context_Release(existing); - } - else - list_add_head(list, &context->u.entry); - LeaveCriticalSection(cs); - } - return context; -} - context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) { struct list *listNext; diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index a0f96c5..0dd76fc 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -438,9 +438,6 @@ void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; */ typedef struct list ContextList; -context_t *ContextList_Add(ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, context_t *toReplace, - struct WINE_CRYPTCERTSTORE *store, BOOL use_link) DECLSPEC_HIDDEN; - context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) DECLSPEC_HIDDEN; /* Removes a context from the list. Returns TRUE if the context was removed, diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 8222d24..660219d 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -143,25 +143,47 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, return TRUE; } -static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, - context_t *toReplace, context_t **ppStoreContext, BOOL use_link) +static BOOL MemStore_addContext(WINE_MEMSTORE *store, struct list *list, context_t *orig_context, + context_t *existing, context_t **ret_context, BOOL use_link) { - WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; context_t *context; - TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); - - context = ContextList_Add(&ms->certs, &ms->cs, cert, toReplace, store, use_link); + context = orig_context->vtbl->clone(orig_context, &store->hdr, use_link); if (!context) return FALSE; - if (ppStoreContext) { + TRACE("adding %p\n", context); + EnterCriticalSection(&store->cs); + if (existing) { + context->u.entry.prev = existing->u.entry.prev; + context->u.entry.next = existing->u.entry.next; + context->u.entry.prev->next = &context->u.entry; + context->u.entry.next->prev = &context->u.entry; + list_init(&existing->u.entry); + Context_Release(existing); + }else { + list_add_head(list, &context->u.entry); + } + LeaveCriticalSection(&store->cs); + + if(ret_context) { Context_AddRef(context); - *ppStoreContext = context; + *ret_context = context; } + return TRUE; } +static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, + context_t *toReplace, context_t **ppStoreContext, BOOL use_link) +{ + WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; + + TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); + + return MemStore_addContext(ms, &ms->certs, cert, toReplace, ppStoreContext, use_link); +} + static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; @@ -191,19 +213,10 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - context_t *context; TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); - context = ContextList_Add(&ms->crls, &ms->cs, crl, toReplace, store, use_link); - if (!context) - return FALSE; - - if (ppStoreContext) { - Context_AddRef(context); - *ppStoreContext = context; - } - return TRUE; + return MemStore_addContext(ms, &ms->crls, crl, toReplace, ppStoreContext, use_link); } static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) @@ -235,19 +248,10 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, context_t *toReplace, context_t **ppStoreContext, BOOL use_link) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - context_t *context; TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); - context = ContextList_Add(&ms->ctls, &ms->cs, ctl, toReplace, store, use_link); - if (!context) - return FALSE; - - if (ppStoreContext) { - Context_AddRef(context); - *ppStoreContext = context; - } - return TRUE; + return MemStore_addContext(ms, &ms->ctls, ctl, toReplace, ppStoreContext, use_link); } static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev)
1
0
0
0
Jacek Caban : crypt32: Use list struct directly instead of ContextList wrapper.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 23884726f7e584899de6f92e0137027a4df2d4b3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=23884726f7e584899de6f92e0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:09:23 2013 +0200 crypt32: Use list struct directly instead of ContextList wrapper. --- dlls/crypt32/context.c | 38 ++++++++------------------------------ dlls/crypt32/crypt32_private.h | 12 +++++------- dlls/crypt32/store.c | 36 ++++++++++++++++++------------------ 3 files changed, 31 insertions(+), 55 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 25cb8be..d6d67d1 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -110,23 +110,7 @@ void Context_CopyProperties(const void *to, const void *from) ContextPropertyList_Copy(toProperties, fromProperties); } -struct ContextList -{ - struct list contexts; -}; - -struct ContextList *ContextList_Create(void) -{ - struct ContextList *list = CryptMemAlloc(sizeof(struct ContextList)); - - if (list) - { - list_init(&list->contexts); - } - return list; -} - -context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, +context_t *ContextList_Add(ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, context_t *existing, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) { context_t *context; @@ -148,13 +132,13 @@ context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, conte Context_Release(existing); } else - list_add_head(&list->contexts, &context->u.entry); + list_add_head(list, &context->u.entry); LeaveCriticalSection(cs); } return context; } -context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, context_t *prev) +context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) { struct list *listNext; context_t *ret; @@ -162,11 +146,11 @@ context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, cont EnterCriticalSection(cs); if (prev) { - listNext = list_next(&list->contexts, &prev->u.entry); + listNext = list_next(list, &prev->u.entry); Context_Release(prev); } else - listNext = list_next(&list->contexts, &list->contexts); + listNext = list_next(list, list); LeaveCriticalSection(cs); if (listNext) @@ -179,7 +163,7 @@ context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, cont return ret; } -BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_t *context) +BOOL ContextList_Remove(ContextList *list, CRITICAL_SECTION *cs, context_t *context) { BOOL inList = FALSE; @@ -195,20 +179,14 @@ BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_ return inList; } -static void ContextList_Empty(struct ContextList *list) +void ContextList_Free(ContextList *list) { context_t *context, *next; - LIST_FOR_EACH_ENTRY_SAFE(context, next, &list->contexts, context_t, u.entry) + LIST_FOR_EACH_ENTRY_SAFE(context, next, list, context_t, u.entry) { TRACE("removing %p\n", context); list_remove(&context->u.entry); Context_Release(context); } } - -void ContextList_Free(struct ContextList *list) -{ - ContextList_Empty(list); - CryptMemFree(list); -} diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 2061ee4..a0f96c5 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -436,22 +436,20 @@ void ContextPropertyList_Free(CONTEXT_PROPERTY_LIST *list) DECLSPEC_HIDDEN; /** * Context list functions. A context list is a simple list of link contexts. */ -struct ContextList; +typedef struct list ContextList; -struct ContextList *ContextList_Create(void) DECLSPEC_HIDDEN; - -context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, context_t *toReplace, +context_t *ContextList_Add(ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, context_t *toReplace, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) DECLSPEC_HIDDEN; -context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, context_t *prev) DECLSPEC_HIDDEN; +context_t *ContextList_Enum(ContextList *list, CRITICAL_SECTION *cs, context_t *prev) DECLSPEC_HIDDEN; /* Removes a context from the list. Returns TRUE if the context was removed, * or FALSE if not. (The context may have been duplicated, so subsequent * removes have no effect.) */ -BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_t *context) DECLSPEC_HIDDEN; +BOOL ContextList_Remove(ContextList *list, CRITICAL_SECTION *cs, context_t *context) DECLSPEC_HIDDEN; -void ContextList_Free(struct ContextList *list) DECLSPEC_HIDDEN; +void ContextList_Free(ContextList *list) DECLSPEC_HIDDEN; extern WINECRYPT_CERTSTORE empty_store; void init_empty_store(void) DECLSPEC_HIDDEN; diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 3cbf9e4..8222d24 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -83,9 +83,9 @@ typedef struct _WINE_MEMSTORE { WINECRYPT_CERTSTORE hdr; CRITICAL_SECTION cs; - struct ContextList *certs; - struct ContextList *crls; - struct ContextList *ctls; + struct list certs; + struct list crls; + struct list ctls; } WINE_MEMSTORE; void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type, const store_vtbl_t *vtbl) @@ -151,7 +151,7 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); - context = ContextList_Add(ms->certs, &ms->cs, cert, toReplace, store, use_link); + context = ContextList_Add(&ms->certs, &ms->cs, cert, toReplace, store, use_link); if (!context) return FALSE; @@ -169,7 +169,7 @@ static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->certs, &ms->cs, prev); + ret = ContextList_Enum(&ms->certs, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -181,7 +181,7 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (ContextList_Remove(ms->certs, &ms->cs, context)) + if (ContextList_Remove(&ms->certs, &ms->cs, context)) Context_Release(context); return TRUE; @@ -195,7 +195,7 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); - context = ContextList_Add(ms->crls, &ms->cs, crl, toReplace, store, use_link); + context = ContextList_Add(&ms->crls, &ms->cs, crl, toReplace, store, use_link); if (!context) return FALSE; @@ -213,7 +213,7 @@ static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->crls, &ms->cs, prev); + ret = ContextList_Enum(&ms->crls, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -225,7 +225,7 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(ms->crls, &ms->cs, context)) + if (!ContextList_Remove(&ms->crls, &ms->cs, context)) Context_Release(context); return TRUE; @@ -239,7 +239,7 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); - context = ContextList_Add(ms->ctls, &ms->cs, ctl, toReplace, store, use_link); + context = ContextList_Add(&ms->ctls, &ms->cs, ctl, toReplace, store, use_link); if (!context) return FALSE; @@ -257,7 +257,7 @@ static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->ctls, &ms->cs, prev); + ret = ContextList_Enum(&ms->ctls, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -269,7 +269,7 @@ static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(ms->ctls, &ms->cs, context)) + if (!ContextList_Remove(&ms->ctls, &ms->cs, context)) Context_Release(context); return TRUE; @@ -294,9 +294,9 @@ static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) if(ref) return (flags & CERT_CLOSE_STORE_CHECK_FLAG) ? CRYPT_E_PENDING_CLOSE : ERROR_SUCCESS; - ContextList_Free(store->certs); - ContextList_Free(store->crls); - ContextList_Free(store->ctls); + ContextList_Free(&store->certs); + ContextList_Free(&store->crls); + ContextList_Free(&store->ctls); store->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&store->cs); CRYPT_FreeStore(&store->hdr); @@ -350,9 +350,9 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeMem, &MemStoreVtbl); InitializeCriticalSection(&store->cs); store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ContextList.cs"); - store->certs = ContextList_Create(); - store->crls = ContextList_Create(); - store->ctls = ContextList_Create(); + list_init(&store->certs); + list_init(&store->crls); + list_init(&store->ctls); /* Mem store doesn't need crypto provider, so close it */ if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG)) CryptReleaseContext(hCryptProv, 0);
1
0
0
0
Jacek Caban : crypt32: Moved critical section out of ContextList struct.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 724754da64c791f58195d5b1ceaf6eb727b4fc19 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=724754da64c791f58195d5b1c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:09:03 2013 +0200 crypt32: Moved critical section out of ContextList struct. --- dlls/crypt32/context.c | 26 ++++++++++---------------- dlls/crypt32/crypt32_private.h | 6 +++--- dlls/crypt32/store.c | 23 ++++++++++++++--------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 4704154..25cb8be 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -112,7 +112,6 @@ void Context_CopyProperties(const void *to, const void *from) struct ContextList { - CRITICAL_SECTION cs; struct list contexts; }; @@ -122,14 +121,13 @@ struct ContextList *ContextList_Create(void) if (list) { - InitializeCriticalSection(&list->cs); - list->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ContextList.cs"); list_init(&list->contexts); } return list; } -context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_t *existing, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) +context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, + context_t *existing, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) { context_t *context; @@ -139,7 +137,7 @@ context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_ if (context) { TRACE("adding %p\n", context); - EnterCriticalSection(&list->cs); + EnterCriticalSection(cs); if (existing) { context->u.entry.prev = existing->u.entry.prev; @@ -151,17 +149,17 @@ context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_ } else list_add_head(&list->contexts, &context->u.entry); - LeaveCriticalSection(&list->cs); + LeaveCriticalSection(cs); } return context; } -context_t *ContextList_Enum(struct ContextList *list, context_t *prev) +context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, context_t *prev) { struct list *listNext; context_t *ret; - EnterCriticalSection(&list->cs); + EnterCriticalSection(cs); if (prev) { listNext = list_next(&list->contexts, &prev->u.entry); @@ -169,7 +167,7 @@ context_t *ContextList_Enum(struct ContextList *list, context_t *prev) } else listNext = list_next(&list->contexts, &list->contexts); - LeaveCriticalSection(&list->cs); + LeaveCriticalSection(cs); if (listNext) { @@ -181,18 +179,18 @@ context_t *ContextList_Enum(struct ContextList *list, context_t *prev) return ret; } -BOOL ContextList_Remove(struct ContextList *list, context_t *context) +BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_t *context) { BOOL inList = FALSE; - EnterCriticalSection(&list->cs); + EnterCriticalSection(cs); if (!list_empty(&context->u.entry)) { list_remove(&context->u.entry); list_init(&context->u.entry); inList = TRUE; } - LeaveCriticalSection(&list->cs); + LeaveCriticalSection(cs); return inList; } @@ -201,20 +199,16 @@ static void ContextList_Empty(struct ContextList *list) { context_t *context, *next; - EnterCriticalSection(&list->cs); LIST_FOR_EACH_ENTRY_SAFE(context, next, &list->contexts, context_t, u.entry) { TRACE("removing %p\n", context); list_remove(&context->u.entry); Context_Release(context); } - LeaveCriticalSection(&list->cs); } void ContextList_Free(struct ContextList *list) { ContextList_Empty(list); - list->cs.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&list->cs); CryptMemFree(list); } diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index d9f2400..2061ee4 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -440,16 +440,16 @@ struct ContextList; struct ContextList *ContextList_Create(void) DECLSPEC_HIDDEN; -context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_t *toReplace, +context_t *ContextList_Add(struct ContextList *list, CRITICAL_SECTION *cs, context_t *toLink, context_t *toReplace, struct WINE_CRYPTCERTSTORE *store, BOOL use_link) DECLSPEC_HIDDEN; -context_t *ContextList_Enum(struct ContextList *list, context_t *prev) DECLSPEC_HIDDEN; +context_t *ContextList_Enum(struct ContextList *list, CRITICAL_SECTION *cs, context_t *prev) DECLSPEC_HIDDEN; /* Removes a context from the list. Returns TRUE if the context was removed, * or FALSE if not. (The context may have been duplicated, so subsequent * removes have no effect.) */ -BOOL ContextList_Remove(struct ContextList *list, context_t *context) DECLSPEC_HIDDEN; +BOOL ContextList_Remove(struct ContextList *list, CRITICAL_SECTION *cs, context_t *context) DECLSPEC_HIDDEN; void ContextList_Free(struct ContextList *list) DECLSPEC_HIDDEN; diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 7fc6acd..3cbf9e4 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -82,6 +82,7 @@ const WINE_CONTEXT_INTERFACE *pCTLInterface = &gCTLInterface; typedef struct _WINE_MEMSTORE { WINECRYPT_CERTSTORE hdr; + CRITICAL_SECTION cs; struct ContextList *certs; struct ContextList *crls; struct ContextList *ctls; @@ -150,7 +151,7 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); - context = ContextList_Add(ms->certs, cert, toReplace, store, use_link); + context = ContextList_Add(ms->certs, &ms->cs, cert, toReplace, store, use_link); if (!context) return FALSE; @@ -168,7 +169,7 @@ static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->certs, prev); + ret = ContextList_Enum(ms->certs, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -180,7 +181,7 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (ContextList_Remove(ms->certs, context)) + if (ContextList_Remove(ms->certs, &ms->cs, context)) Context_Release(context); return TRUE; @@ -194,7 +195,7 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); - context = ContextList_Add(ms->crls, crl, toReplace, store, use_link); + context = ContextList_Add(ms->crls, &ms->cs, crl, toReplace, store, use_link); if (!context) return FALSE; @@ -212,7 +213,7 @@ static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->crls, prev); + ret = ContextList_Enum(ms->crls, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -224,7 +225,7 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(ms->crls, context)) + if (!ContextList_Remove(ms->crls, &ms->cs, context)) Context_Release(context); return TRUE; @@ -238,7 +239,7 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); - context = ContextList_Add(ms->ctls, ctl, toReplace, store, use_link); + context = ContextList_Add(ms->ctls, &ms->cs, ctl, toReplace, store, use_link); if (!context) return FALSE; @@ -256,7 +257,7 @@ static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev) TRACE("(%p, %p)\n", store, prev); - ret = ContextList_Enum(ms->ctls, prev); + ret = ContextList_Enum(ms->ctls, &ms->cs, prev); if (!ret) SetLastError(CRYPT_E_NOT_FOUND); @@ -268,7 +269,7 @@ static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context) { WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; - if (!ContextList_Remove(ms->ctls, context)) + if (!ContextList_Remove(ms->ctls, &ms->cs, context)) Context_Release(context); return TRUE; @@ -296,6 +297,8 @@ static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) ContextList_Free(store->certs); ContextList_Free(store->crls); ContextList_Free(store->ctls); + store->cs.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&store->cs); CRYPT_FreeStore(&store->hdr); return ERROR_SUCCESS; } @@ -345,6 +348,8 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, { memset(store, 0, sizeof(WINE_MEMSTORE)); CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeMem, &MemStoreVtbl); + InitializeCriticalSection(&store->cs); + store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ContextList.cs"); store->certs = ContextList_Create(); store->crls = ContextList_Create(); store->ctls = ContextList_Create();
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer needed contextSize arguments.
by Alexandre Julliard
17 Oct '13
17 Oct '13
Module: wine Branch: master Commit: 6cf1e0d75cafa34379ca4ed967451875949fd881 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6cf1e0d75cafa34379ca4ed96…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Oct 17 11:08:47 2013 +0200 crypt32: Get rid of no longer needed contextSize arguments. --- dlls/crypt32/collectionstore.c | 41 +++++++++++++++++---------------------- 1 files changed, 18 insertions(+), 23 deletions(-) diff --git a/dlls/crypt32/collectionstore.c b/dlls/crypt32/collectionstore.c index 8f15295..b5d1b8b 100644 --- a/dlls/crypt32/collectionstore.c +++ b/dlls/crypt32/collectionstore.c @@ -72,7 +72,7 @@ static DWORD Collection_release(WINECRYPT_CERTSTORE *store, DWORD flags) } static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *store, - WINE_STORE_LIST_ENTRY *storeEntry, context_t *child, size_t contextSize) + WINE_STORE_LIST_ENTRY *storeEntry, context_t *child) { context_t *ret; @@ -85,15 +85,14 @@ static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *s } static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, - unsigned int contextFuncsOffset, context_t *context, context_t *toReplace, unsigned int contextSize, + unsigned int contextFuncsOffset, context_t *context, context_t *toReplace, context_t **pChildContext) { BOOL ret; context_t *childContext = NULL; WINE_STORE_LIST_ENTRY *storeEntry = NULL; - TRACE("(%p, %d, %p, %p, %d)\n", store, contextFuncsOffset, context, - toReplace, contextSize); + TRACE("(%p, %d, %p, %p)\n", store, contextFuncsOffset, context, toReplace); ret = FALSE; if (toReplace) @@ -143,7 +142,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, */ static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, WINE_STORE_LIST_ENTRY *storeEntry, const CONTEXT_FUNCS *contextFuncs, - const WINE_CONTEXT_INTERFACE *contextInterface, context_t *prev, size_t contextSize) + const WINE_CONTEXT_INTERFACE *contextInterface, context_t *prev) { context_t *child, *ret; struct list *storeNext = list_next(&store->stores, &storeEntry->entry); @@ -166,7 +165,7 @@ static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, child = contextFuncs->enumContext(storeEntry->store, NULL); } if (child) { - ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child, contextSize); + ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child); Context_Release(child); } else @@ -183,7 +182,7 @@ static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, (CONTEXT_FUNCS*)((LPBYTE)storeNextEntry->store->vtbl + offset); ret = CRYPT_CollectionAdvanceEnum(store, storeNextEntry, - storeNextContexts, contextInterface, NULL, contextSize); + storeNextContexts, contextInterface, NULL); } else { @@ -203,12 +202,12 @@ static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, context_t *cert, WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, certs), - cert, toReplace, sizeof(CERT_CONTEXT), &childContext); + cert, toReplace, &childContext); if (ppStoreContext && childContext) { WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; cert_t *context = (cert_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, - childContext, sizeof(CERT_CONTEXT)); + childContext); *ppStoreContext = &context->base; } @@ -230,8 +229,7 @@ static context_t *Collection_enumCert(WINECRYPT_CERTSTORE *store, context_t *pre WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->certs, pCertInterface, prev, - sizeof(CERT_CONTEXT)); + &storeEntry->store->vtbl->certs, pCertInterface, prev); } else { @@ -241,8 +239,7 @@ static context_t *Collection_enumCert(WINECRYPT_CERTSTORE *store, context_t *pre WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->certs, pCertInterface, NULL, - sizeof(CERT_CONTEXT)); + &storeEntry->store->vtbl->certs, pCertInterface, NULL); } else { @@ -277,12 +274,12 @@ static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl, WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, crls), - crl, toReplace, sizeof(CRL_CONTEXT), &childContext); + crl, toReplace, &childContext); if (ppStoreContext && childContext) { WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; crl_t *context = (crl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, - childContext, sizeof(CRL_CONTEXT)); + childContext); *ppStoreContext = &context->base; } @@ -304,7 +301,7 @@ static context_t *Collection_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->crls, pCRLInterface, prev, sizeof(CRL_CONTEXT)); + &storeEntry->store->vtbl->crls, pCRLInterface, prev); } else { @@ -314,8 +311,7 @@ static context_t *Collection_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->crls, pCRLInterface, NULL, - sizeof(CRL_CONTEXT)); + &storeEntry->store->vtbl->crls, pCRLInterface, NULL); } else { @@ -349,12 +345,12 @@ static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl, WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, ctls), - ctl, toReplace, sizeof(CTL_CONTEXT), &childContext); + ctl, toReplace, &childContext); if (ppStoreContext && childContext) { WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr; ctl_t *context = (ctl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, - childContext, sizeof(CTL_CONTEXT)); + childContext); *ppStoreContext = &context->base; } @@ -376,7 +372,7 @@ static context_t *Collection_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr; ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->ctls, pCTLInterface, prev, sizeof(CTL_CONTEXT)); + &storeEntry->store->vtbl->ctls, pCTLInterface, prev); } else { @@ -386,8 +382,7 @@ static context_t *Collection_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev WINE_STORE_LIST_ENTRY, entry); ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, - &storeEntry->store->vtbl->ctls, pCTLInterface, NULL, - sizeof(CTL_CONTEXT)); + &storeEntry->store->vtbl->ctls, pCTLInterface, NULL); } else {
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
76
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
64
65
66
67
68
69
70
71
72
73
74
75
76
Results per page:
10
25
50
100
200