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
Francois Gouget : testbot: Add the VM 'off' state to the database creation SQL script.
by Alexandre Julliard
09 Oct '13
09 Oct '13
Module: tools Branch: master Commit: ec2175d73b0c704b99be4adfff350449bf431ed7 URL:
http://source.winehq.org/git/tools.git/?a=commit;h=ec2175d73b0c704b99be4adf…
Author: Francois Gouget <fgouget(a)codeweavers.com> Date: Wed Oct 9 17:39:28 2013 +0200 testbot: Add the VM 'off' state to the database creation SQL script. --- testbot/ddl/winetestbot.sql | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql index e46d5e0..5e79bd3 100644 --- a/testbot/ddl/winetestbot.sql +++ b/testbot/ddl/winetestbot.sql @@ -48,7 +48,7 @@ CREATE TABLE VMs SortOrder INT(3) NOT NULL, Type ENUM('win32', 'win64', 'build') NOT NULL, Role ENUM('extra', 'base', 'winetest', 'retired', 'deleted') NOT NULL, - Status ENUM('dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline', 'maintenance') NOT NULL, + Status ENUM('dirty', 'reverting', 'sleeping', 'idle', 'running', 'off', 'offline', 'maintenance') NOT NULL, ChildPid INT(5) NULL, VirtURI VARCHAR(64) NOT NULL, VirtDomain VARCHAR(32) NOT NULL,
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer used contextSize argument in Context_CopyProperties.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: 09121895fda57e9c4f8ba66435abd70530442422 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=09121895fda57e9c4f8ba6643…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:24:44 2013 +0200 crypt32: Get rid of no longer used contextSize argument in Context_CopyProperties. --- dlls/crypt32/context.c | 3 +-- dlls/crypt32/crypt32_private.h | 3 +-- dlls/crypt32/ctl.c | 9 +++------ dlls/crypt32/store.c | 15 ++++++--------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 83e6133..cda1f4c 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -174,8 +174,7 @@ BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) return ret; } -void Context_CopyProperties(const void *to, const void *from, - size_t contextSize) +void Context_CopyProperties(const void *to, const void *from) { CONTEXT_PROPERTY_LIST *toProperties, *fromProperties; diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index e98bc75..d978e5c 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -351,8 +351,7 @@ void *Context_GetExtra(const void *context, size_t contextSize) DECLSPEC_HIDDEN; void *Context_GetLinkedContext(void *context) DECLSPEC_HIDDEN; /* Copies properties from fromContext to toContext. */ -void Context_CopyProperties(const void *to, const void *from, - size_t contextSize) DECLSPEC_HIDDEN; +void Context_CopyProperties(const void *to, const void *from) DECLSPEC_HIDDEN; /* Returns context's properties, or the linked context's properties if context * is a link context. diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 6daa53a..ce534e9 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -29,9 +29,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt); -#define CtlContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CTL_CONTEXT)) - BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT* ppStoreContext) @@ -91,7 +88,7 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, if (newer < 0) { toAdd = CertDuplicateCTLContext(pCtlContext); - CtlContext_CopyProperties(existing, pCtlContext); + Context_CopyProperties(existing, pCtlContext); } else { @@ -109,12 +106,12 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: toAdd = CertDuplicateCTLContext(pCtlContext); if (existing) - CtlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); break; case CERT_STORE_ADD_USE_EXISTING: if (existing) { - CtlContext_CopyProperties(existing, pCtlContext); + Context_CopyProperties(existing, pCtlContext); if (ppStoreContext) *ppStoreContext = CertDuplicateCTLContext(existing); } diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 5e60644..9bc14de 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -877,9 +877,6 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv, CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol); } -#define CertContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CERT_CONTEXT)) - BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext) @@ -944,12 +941,12 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: toAdd = CertDuplicateCertificateContext(pCertContext); if (existing) - CertContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); break; case CERT_STORE_ADD_USE_EXISTING: if (existing) { - CertContext_CopyProperties(existing, pCertContext); + Context_CopyProperties(existing, pCertContext); if (ppStoreContext) *ppStoreContext = CertDuplicateCertificateContext(existing); } @@ -985,7 +982,7 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, else { toAdd = CertDuplicateCertificateContext(pCertContext); - CertContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); } } else @@ -1116,7 +1113,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, if (newer < 0) { toAdd = CertDuplicateCRLContext(pCrlContext); - CrlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); } else { @@ -1134,12 +1131,12 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES: toAdd = CertDuplicateCRLContext(pCrlContext); if (existing) - CrlContext_CopyProperties(toAdd, existing); + Context_CopyProperties(toAdd, existing); break; case CERT_STORE_ADD_USE_EXISTING: if (existing) { - CrlContext_CopyProperties(existing, pCrlContext); + Context_CopyProperties(existing, pCrlContext); if (ppStoreContext) *ppStoreContext = CertDuplicateCRLContext(existing); }
1
0
0
0
Jacek Caban : crypt32: Don't follow linked contexts in AddRef/ Release implementations.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: bb2c32d776f9be3773e9297d3627ab72a85c880e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bb2c32d776f9be3773e9297d3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 17:01:38 2013 +0200 crypt32: Don't follow linked contexts in AddRef/Release implementations. --- dlls/crypt32/context.c | 32 +++----------------------------- 1 files changed, 3 insertions(+), 29 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index cda1f4c..915ad5e 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -41,7 +41,7 @@ typedef struct _BASE_CONTEXT } u; } BASE_CONTEXT; -#define CONTEXT_FROM_BASE_CONTEXT(p) (LPBYTE)(p+1) +#define CONTEXT_FROM_BASE_CONTEXT(p) (void*)(p+1) #define BASE_CONTEXT_FROM_CONTEXT(p) ((BASE_CONTEXT*)(p)-1) void *Context_CreateDataContext(size_t contextSize) @@ -93,26 +93,6 @@ void Context_AddRef(void *context) InterlockedIncrement(&baseContext->ref); TRACE("%p's ref count is %d\n", context, baseContext->ref); - if (baseContext->type == ContextTypeLink) - { - BASE_CONTEXT *linkedBase = baseContext->u.linked; - - /* Add-ref the linked contexts too */ - while (linkedBase && linkedBase->type == ContextTypeLink) - { - InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedBase, linkedBase->ref); - linkedBase = linkedBase->u.linked; - } - if (linkedBase) - { - /* It's not a link context, so it wasn't add-ref'ed in the while - * loop, so add-ref it here. - */ - InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedBase, linkedBase->ref); - } - } } void *Context_GetExtra(const void *context, size_t contextSize) @@ -151,14 +131,6 @@ BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) ERR("%p's ref count is %d\n", context, base->ref); return FALSE; } - if (base->type == ContextTypeLink) - { - /* The linked context is of the same type as this, so release - * it as well, using the same offset and data free function. - */ - ret = Context_Release(CONTEXT_FROM_BASE_CONTEXT( - base->u.linked), dataContextFree); - } if (InterlockedDecrement(&base->ref) == 0) { TRACE("freeing %p\n", context); @@ -166,6 +138,8 @@ BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) { ContextPropertyList_Free(base->u.properties); dataContextFree(context); + } else { + Context_Release(CONTEXT_FROM_BASE_CONTEXT(base->u.linked), dataContextFree); } CryptMemFree(base); }
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer used contextSize argument in Context_Release.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: c1fa23ac5d8e4b2ec77d40a50a721c6c6a13c8fe URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c1fa23ac5d8e4b2ec77d40a50…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:24:28 2013 +0200 crypt32: Get rid of no longer used contextSize argument in Context_Release. --- dlls/crypt32/cert.c | 3 +-- dlls/crypt32/context.c | 5 ++--- dlls/crypt32/crl.c | 3 +-- dlls/crypt32/crypt32_private.h | 3 +-- dlls/crypt32/ctl.c | 3 +-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 7c6a18c..e9d8717 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -203,8 +203,7 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext) TRACE("(%p)\n", pCertContext); if (pCertContext) - ret = Context_Release((void *)pCertContext, sizeof(CERT_CONTEXT), - CertDataContext_Free); + ret = Context_Release((void *)pCertContext, CertDataContext_Free); return ret; } diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 53fb022..83e6133 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -141,8 +141,7 @@ CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context) return (ptr && ptr->type == ContextTypeData) ? ptr->u.properties : NULL; } -BOOL Context_Release(void *context, size_t contextSize, - ContextFreeFunc dataContextFree) +BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) { BASE_CONTEXT *base = BASE_CONTEXT_FROM_CONTEXT(context); BOOL ret = TRUE; @@ -158,7 +157,7 @@ BOOL Context_Release(void *context, size_t contextSize, * it as well, using the same offset and data free function. */ ret = Context_Release(CONTEXT_FROM_BASE_CONTEXT( - base->u.linked), contextSize, dataContextFree); + base->u.linked), dataContextFree); } if (InterlockedDecrement(&base->ref) == 0) { diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index e79dd4a..6ed27f7 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -346,8 +346,7 @@ BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext) TRACE("(%p)\n", pCrlContext); if (pCrlContext) - ret = Context_Release((void *)pCrlContext, sizeof(CRL_CONTEXT), - CrlDataContext_Free); + ret = Context_Release((void *)pCrlContext, CrlDataContext_Free); return ret; } diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index f60bfae..e98bc75 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -368,8 +368,7 @@ typedef void (*ContextFreeFunc)(void *context); * If a data context has its ref count reach 0, calls dataContextFree on it. * Returns FALSE if the reference count is <= 0 when called. */ -BOOL Context_Release(void *context, size_t contextSize, - ContextFreeFunc dataContextFree) DECLSPEC_HIDDEN; +BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) DECLSPEC_HIDDEN; /** * Context property list functions diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 04ec03d..6daa53a 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -481,8 +481,7 @@ BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext) TRACE("(%p)\n", pCTLContext); if (pCTLContext) - ret = Context_Release((void *)pCTLContext, sizeof(CTL_CONTEXT), - CTLDataContext_Free); + ret = Context_Release((void *)pCTLContext, CTLDataContext_Free); return ret; }
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer used contextSize argument in Context_GetProperties.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: c6fd036b54fd1ee832ab59a96a564f1f24e4b58f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c6fd036b54fd1ee832ab59a96…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:24:19 2013 +0200 crypt32: Get rid of no longer used contextSize argument in Context_GetProperties. --- dlls/crypt32/cert.c | 9 +++------ dlls/crypt32/context.c | 6 +++--- dlls/crypt32/crl.c | 9 +++------ dlls/crypt32/crypt32_private.h | 2 +- dlls/crypt32/ctl.c | 8 +++----- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 3c60310..7c6a18c 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -211,8 +211,7 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext) DWORD WINAPI CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext, DWORD dwPropId) { - CONTEXT_PROPERTY_LIST *properties = Context_GetProperties( - pCertContext, sizeof(CERT_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCertContext); DWORD ret; TRACE("(%p, %d)\n", pCertContext, dwPropId); @@ -264,8 +263,7 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId, void *pvData, DWORD *pcbData) { PCCERT_CONTEXT pCertContext = context; - CONTEXT_PROPERTY_LIST *properties = - Context_GetProperties(context, sizeof(CERT_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; CRYPT_DATA_BLOB blob; @@ -515,8 +513,7 @@ static BOOL CertContext_SetKeyProvInfoProperty(CONTEXT_PROPERTY_LIST *properties static BOOL CertContext_SetProperty(void *context, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - CONTEXT_PROPERTY_LIST *properties = - Context_GetProperties(context, sizeof(CERT_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData); diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index d57e0bf..53fb022 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -131,7 +131,7 @@ void *Context_GetLinkedContext(void *context) return CONTEXT_FROM_BASE_CONTEXT(baseContext->u.linked); } -CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t contextSize) +CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context) { BASE_CONTEXT *ptr = BASE_CONTEXT_FROM_CONTEXT(context); @@ -180,8 +180,8 @@ void Context_CopyProperties(const void *to, const void *from, { CONTEXT_PROPERTY_LIST *toProperties, *fromProperties; - toProperties = Context_GetProperties(to, contextSize); - fromProperties = Context_GetProperties(from, contextSize); + toProperties = Context_GetProperties(to); + fromProperties = Context_GetProperties(from); assert(toProperties && fromProperties); ContextPropertyList_Copy(toProperties, fromProperties); } diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index dc23183..e79dd4a 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -354,8 +354,7 @@ BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext) DWORD WINAPI CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext, DWORD dwPropId) { - CONTEXT_PROPERTY_LIST *properties = Context_GetProperties( - pCRLContext, sizeof(CRL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCRLContext); DWORD ret; TRACE("(%p, %d)\n", pCRLContext, dwPropId); @@ -388,8 +387,7 @@ static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId, static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData) { - CONTEXT_PROPERTY_LIST *properties = - Context_GetProperties(context, sizeof(CRL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; CRYPT_DATA_BLOB blob; @@ -488,8 +486,7 @@ BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext, static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - CONTEXT_PROPERTY_LIST *properties = - Context_GetProperties(context, sizeof(CRL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData); diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 5a0232f..f60bfae 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -357,7 +357,7 @@ void Context_CopyProperties(const void *to, const void *from, /* Returns context's properties, or the linked context's properties if context * is a link context. */ -CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t contextSize) DECLSPEC_HIDDEN; +CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context) DECLSPEC_HIDDEN; void Context_AddRef(void *context) DECLSPEC_HIDDEN; diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index bb29a71..04ec03d 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -489,8 +489,7 @@ BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext) DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext, DWORD dwPropId) { - CONTEXT_PROPERTY_LIST *properties = Context_GetProperties( - pCTLContext, sizeof(CTL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(pCTLContext); DWORD ret; TRACE("(%p, %d)\n", pCTLContext, dwPropId); @@ -523,8 +522,7 @@ static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId, static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData) { - CONTEXT_PROPERTY_LIST *properties = - Context_GetProperties(context, sizeof(CTL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; CRYPT_DATA_BLOB blob; @@ -621,7 +619,7 @@ BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId, DWORD dwFlags, const void *pvData) { - CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context, sizeof(CTL_CONTEXT)); + CONTEXT_PROPERTY_LIST *properties = Context_GetProperties(context); BOOL ret; TRACE("(%p, %d, %08x, %p)\n", context, dwPropId, dwFlags, pvData);
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer used contextSize argument in Context_AddRef.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: f82237102b30baaa70b8ad0702127342bae843c1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f82237102b30baaa70b8ad070…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:24:00 2013 +0200 crypt32: Get rid of no longer used contextSize argument in Context_AddRef. --- dlls/crypt32/cert.c | 2 +- dlls/crypt32/context.c | 4 ++-- dlls/crypt32/crl.c | 2 +- dlls/crypt32/crypt32_private.h | 2 +- dlls/crypt32/ctl.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 04d16a0..3c60310 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -184,7 +184,7 @@ PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext( if (!pCertContext) return NULL; - Context_AddRef((void *)pCertContext, sizeof(CERT_CONTEXT)); + Context_AddRef((void *)pCertContext); return pCertContext; } diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 19fe98a..a31dccf 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -81,13 +81,13 @@ void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned context->type = ContextTypeLink; context->u.linked = BASE_CONTEXT_FROM_CONTEXT(linked); if (addRef) - Context_AddRef(linked, contextSize); + Context_AddRef(linked); TRACE("returning %p\n", context); return CONTEXT_FROM_BASE_CONTEXT(context); } -void Context_AddRef(void *context, size_t contextSize) +void Context_AddRef(void *context) { BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context); diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index dfb9a60..dc23183 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -327,7 +327,7 @@ PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext) { TRACE("(%p)\n", pCrlContext); if (pCrlContext) - Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT)); + Context_AddRef((void *)pCrlContext); return pCrlContext; } diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 6793e3d..d1cc4ad 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -359,7 +359,7 @@ void Context_CopyProperties(const void *to, const void *from, */ CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t contextSize) DECLSPEC_HIDDEN; -void Context_AddRef(void *context, size_t contextSize) DECLSPEC_HIDDEN; +void Context_AddRef(void *context) DECLSPEC_HIDDEN; typedef void (*ContextFreeFunc)(void *context); diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 005f6ba..bb29a71 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -460,7 +460,7 @@ PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext) { TRACE("(%p)\n", pCtlContext); if (pCtlContext) - Context_AddRef((void *)pCtlContext, sizeof(CTL_CONTEXT)); + Context_AddRef((void *)pCtlContext); return pCtlContext; }
1
0
0
0
Jacek Caban : crypt32: Get rid of no longer used contextSize argument in Context_GetLinkedContext .
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: 5b5bb5085251043d01c356f03925633378e29ee2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5b5bb5085251043d01c356f03…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:24:09 2013 +0200 crypt32: Get rid of no longer used contextSize argument in Context_GetLinkedContext. --- dlls/crypt32/collectionstore.c | 10 +++++----- dlls/crypt32/context.c | 2 +- dlls/crypt32/crypt32_private.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/crypt32/collectionstore.c b/dlls/crypt32/collectionstore.c index 677f7bd..6ab2d2b 100644 --- a/dlls/crypt32/collectionstore.c +++ b/dlls/crypt32/collectionstore.c @@ -87,7 +87,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, ret = FALSE; if (toReplace) { - void *existingLinked = Context_GetLinkedContext(toReplace, contextSize); + void *existingLinked = Context_GetLinkedContext(toReplace); CONTEXT_FUNCS *contextFuncs; storeEntry = *(WINE_STORE_LIST_ENTRY **)Context_GetExtra(toReplace, @@ -147,7 +147,7 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, /* Ref-counting funny business: "duplicate" (addref) the child, because * the free(pPrev) below can cause the ref count to become negative. */ - child = Context_GetLinkedContext(pPrev, contextSize); + child = Context_GetLinkedContext(pPrev); contextInterface->duplicate(child); child = contextFuncs->enumContext(storeEntry->store, child); contextInterface->free(pPrev); @@ -265,7 +265,7 @@ static BOOL CRYPT_CollectionDeleteCert(WINECRYPT_CERTSTORE *store, * CertFreeCertificateContext. Increase ref count of linked context to * compensate. */ - linked = Context_GetLinkedContext(pCertContext, sizeof(CERT_CONTEXT)); + linked = Context_GetLinkedContext(pCertContext); CertDuplicateCertificateContext(linked); ret = CertDeleteCertificateFromStore(linked); return ret; @@ -349,7 +349,7 @@ static BOOL CRYPT_CollectionDeleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlCont * decreases pCrlContext's ref count, by calling CertFreeCRLContext. * Increase ref count of linked context to compensate. */ - linked = Context_GetLinkedContext(pCrlContext, sizeof(CRL_CONTEXT)); + linked = Context_GetLinkedContext(pCrlContext); CertDuplicateCRLContext(linked); ret = CertDeleteCRLFromStore(linked); return ret; @@ -433,7 +433,7 @@ static BOOL CRYPT_CollectionDeleteCTL(WINECRYPT_CERTSTORE *store, * decreases pCtlContext's ref count, by calling CertFreeCTLContext. * Increase ref count of linked context to compensate. */ - linked = Context_GetLinkedContext(pCtlContext, sizeof(CTL_CONTEXT)); + linked = Context_GetLinkedContext(pCtlContext); CertDuplicateCTLContext(linked); ret = CertDeleteCTLFromStore(linked); return ret; diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index a31dccf..d57e0bf 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -123,7 +123,7 @@ void *Context_GetExtra(const void *context, size_t contextSize) return (LPBYTE)CONTEXT_FROM_BASE_CONTEXT(baseContext) + contextSize; } -void *Context_GetLinkedContext(void *context, size_t contextSize) +void *Context_GetLinkedContext(void *context) { BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context); diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index d1cc4ad..5a0232f 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -348,7 +348,7 @@ void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned void *Context_GetExtra(const void *context, size_t contextSize) DECLSPEC_HIDDEN; /* Gets the context linked to by context, which must be a link context. */ -void *Context_GetLinkedContext(void *context, size_t contextSize) DECLSPEC_HIDDEN; +void *Context_GetLinkedContext(void *context) DECLSPEC_HIDDEN; /* Copies properties from fromContext to toContext. */ void Context_CopyProperties(const void *to, const void *from,
1
0
0
0
Jacek Caban : crypt32: Allocate BASE_CONTEXT in the beginning of the memory block.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: ad912961db613daae200eb1d05d7496a1bd3a840 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ad912961db613daae200eb1d0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:23:48 2013 +0200 crypt32: Allocate BASE_CONTEXT in the beginning of the memory block. --- dlls/crypt32/context.c | 105 +++++++++++++++++++++--------------------------- dlls/crypt32/store.c | 3 +- 2 files changed, 48 insertions(+), 60 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index e52f096..19fe98a 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -41,123 +41,110 @@ typedef struct _BASE_CONTEXT } u; } BASE_CONTEXT; -#define CONTEXT_FROM_BASE_CONTEXT(p, s) ((LPBYTE)(p) - (s)) -#define BASE_CONTEXT_FROM_CONTEXT(p, s) (BASE_CONTEXT*)((LPBYTE)(p) + (s)) +#define CONTEXT_FROM_BASE_CONTEXT(p) (LPBYTE)(p+1) +#define BASE_CONTEXT_FROM_CONTEXT(p) ((BASE_CONTEXT*)(p)-1) void *Context_CreateDataContext(size_t contextSize) { - void *ret = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT)); + BASE_CONTEXT *context; - if (ret) - { - BASE_CONTEXT *context = (BASE_CONTEXT*)((LPBYTE)ret + contextSize); + context = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT)); + if (!context) + return NULL; - context->ref = 1; - context->type = ContextTypeData; - context->u.properties = ContextPropertyList_Create(); - if (!context->u.properties) - { - CryptMemFree(ret); - ret = NULL; - } + context->ref = 1; + context->type = ContextTypeData; + context->u.properties = ContextPropertyList_Create(); + if (!context->u.properties) + { + CryptMemFree(context); + return NULL; } - TRACE("returning %p\n", ret); - return ret; + + TRACE("returning %p\n", context); + return CONTEXT_FROM_BASE_CONTEXT(context); } void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned int extra, BOOL addRef) { - void *context = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT) + extra); + BASE_CONTEXT *context; TRACE("(%d, %p, %d)\n", contextSize, linked, extra); - if (context) - { - BASE_CONTEXT *linkContext = (BASE_CONTEXT*)BASE_CONTEXT_FROM_CONTEXT( - context, contextSize); - BASE_CONTEXT *linkedBase = BASE_CONTEXT_FROM_CONTEXT(linked, - contextSize); - - memcpy(context, linked, contextSize); - linkContext->ref = 1; - linkContext->type = ContextTypeLink; - linkContext->u.linked = linkedBase; - if (addRef) - Context_AddRef(linked, contextSize); - TRACE("%p's ref count is %d\n", context, linkContext->ref); - } + context = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT) + extra); + if (!context) + return NULL; + + memcpy(CONTEXT_FROM_BASE_CONTEXT(context), linked, contextSize); + context->ref = 1; + context->type = ContextTypeLink; + context->u.linked = BASE_CONTEXT_FROM_CONTEXT(linked); + if (addRef) + Context_AddRef(linked, contextSize); + TRACE("returning %p\n", context); - return context; + return CONTEXT_FROM_BASE_CONTEXT(context); } void Context_AddRef(void *context, size_t contextSize) { - BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context); InterlockedIncrement(&baseContext->ref); TRACE("%p's ref count is %d\n", context, baseContext->ref); if (baseContext->type == ContextTypeLink) { - void *linkedContext = Context_GetLinkedContext(context, contextSize); - BASE_CONTEXT *linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); + BASE_CONTEXT *linkedBase = baseContext->u.linked; /* Add-ref the linked contexts too */ - while (linkedContext && linkedBase->type == ContextTypeLink) + while (linkedBase && linkedBase->type == ContextTypeLink) { InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedContext, linkedBase->ref); - linkedContext = Context_GetLinkedContext(linkedContext, - contextSize); - if (linkedContext) - linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); - else - linkedBase = NULL; + TRACE("%p's ref count is %d\n", linkedBase, linkedBase->ref); + linkedBase = linkedBase->u.linked; } - if (linkedContext) + if (linkedBase) { /* It's not a link context, so it wasn't add-ref'ed in the while * loop, so add-ref it here. */ - linkedBase = BASE_CONTEXT_FROM_CONTEXT(linkedContext, - contextSize); InterlockedIncrement(&linkedBase->ref); - TRACE("%p's ref count is %d\n", linkedContext, linkedBase->ref); + TRACE("%p's ref count is %d\n", linkedBase, linkedBase->ref); } } } void *Context_GetExtra(const void *context, size_t contextSize) { - BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context); assert(baseContext->type == ContextTypeLink); - return (LPBYTE)baseContext + sizeof(BASE_CONTEXT); + return (LPBYTE)CONTEXT_FROM_BASE_CONTEXT(baseContext) + contextSize; } void *Context_GetLinkedContext(void *context, size_t contextSize) { - BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context); assert(baseContext->type == ContextTypeLink); - return CONTEXT_FROM_BASE_CONTEXT(baseContext->u.linked, contextSize); + return CONTEXT_FROM_BASE_CONTEXT(baseContext->u.linked); } CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t contextSize) { - BASE_CONTEXT *ptr = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + BASE_CONTEXT *ptr = BASE_CONTEXT_FROM_CONTEXT(context); while (ptr && ptr->type == ContextTypeLink) ptr = ptr->u.linked; + return (ptr && ptr->type == ContextTypeData) ? ptr->u.properties : NULL; } BOOL Context_Release(void *context, size_t contextSize, ContextFreeFunc dataContextFree) { - BASE_CONTEXT *base = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); + BASE_CONTEXT *base = BASE_CONTEXT_FROM_CONTEXT(context); BOOL ret = TRUE; if (base->ref <= 0) @@ -171,7 +158,7 @@ BOOL Context_Release(void *context, size_t contextSize, * it as well, using the same offset and data free function. */ ret = Context_Release(CONTEXT_FROM_BASE_CONTEXT( - base->u.linked, contextSize), contextSize, dataContextFree); + base->u.linked), contextSize, dataContextFree); } if (InterlockedDecrement(&base->ref) == 0) { @@ -181,7 +168,7 @@ BOOL Context_Release(void *context, size_t contextSize, ContextPropertyList_Free(base->u.properties); dataContextFree(context); } - CryptMemFree(context); + CryptMemFree(base); } else TRACE("%p's ref count is %d\n", context, base->ref); @@ -238,7 +225,7 @@ static inline struct list *ContextList_ContextToEntry(const struct ContextList * static inline void *ContextList_EntryToContext(const struct ContextList *list, struct list *entry) { - return (LPBYTE)entry - sizeof(BASE_CONTEXT) - list->contextSize; + return (LPBYTE)entry - list->contextSize; } void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace) diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 0fffa5b..5e60644 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -160,8 +160,9 @@ static BOOL CRYPT_MemAddCert(WINECRYPT_CERTSTORE *store, void *cert, if (context) { context->hCertStore = store; - if (ppStoreContext) + if (ppStoreContext) { *ppStoreContext = CertDuplicateCertificateContext(context); + } } return context != 0; }
1
0
0
0
Hans Leidekker : iphlpapi: Add support for GAA_FLAG_INCLUDE_PREFIX in GetAdaptersAddresses.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: 5674f16649838e46e36f80e2e5c14bd1d15d612d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5674f16649838e46e36f80e2e…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Oct 8 13:30:00 2013 +0200 iphlpapi: Add support for GAA_FLAG_INCLUDE_PREFIX in GetAdaptersAddresses. --- dlls/iphlpapi/ifenum.c | 27 ++++++- dlls/iphlpapi/ifenum.h | 3 +- dlls/iphlpapi/iphlpapi_main.c | 157 +++++++++++++++++++++++++++++++++++------ 3 files changed, 160 insertions(+), 27 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=5674f16649838e46e36f8…
1
0
0
0
Jacek Caban : crypt32: Use BASE_CONTEXT for both data and link contexts.
by Alexandre Julliard
08 Oct '13
08 Oct '13
Module: wine Branch: master Commit: 12982d867a4ab45057fbdfbb139b150643a9d42d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=12982d867a4ab45057fbdfbb1…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Oct 8 16:23:29 2013 +0200 crypt32: Use BASE_CONTEXT for both data and link contexts. --- dlls/crypt32/context.c | 47 ++++++++++++++++++----------------------------- 1 files changed, 18 insertions(+), 29 deletions(-) diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index c5f609b..e52f096 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -35,37 +35,27 @@ typedef struct _BASE_CONTEXT { LONG ref; ContextType type; + union { + CONTEXT_PROPERTY_LIST *properties; + struct _BASE_CONTEXT *linked; + } u; } BASE_CONTEXT; -typedef struct _DATA_CONTEXT -{ - LONG ref; - ContextType type; /* always ContextTypeData */ - CONTEXT_PROPERTY_LIST *properties; -} DATA_CONTEXT; - -typedef struct _LINK_CONTEXT -{ - LONG ref; - ContextType type; /* always ContextTypeLink */ - BASE_CONTEXT *linked; -} LINK_CONTEXT; - #define CONTEXT_FROM_BASE_CONTEXT(p, s) ((LPBYTE)(p) - (s)) #define BASE_CONTEXT_FROM_CONTEXT(p, s) (BASE_CONTEXT*)((LPBYTE)(p) + (s)) void *Context_CreateDataContext(size_t contextSize) { - void *ret = CryptMemAlloc(contextSize + sizeof(DATA_CONTEXT)); + void *ret = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT)); if (ret) { - DATA_CONTEXT *context = (DATA_CONTEXT*)((LPBYTE)ret + contextSize); + BASE_CONTEXT *context = (BASE_CONTEXT*)((LPBYTE)ret + contextSize); context->ref = 1; context->type = ContextTypeData; - context->properties = ContextPropertyList_Create(); - if (!context->properties) + context->u.properties = ContextPropertyList_Create(); + if (!context->u.properties) { CryptMemFree(ret); ret = NULL; @@ -78,13 +68,13 @@ void *Context_CreateDataContext(size_t contextSize) void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned int extra, BOOL addRef) { - void *context = CryptMemAlloc(contextSize + sizeof(LINK_CONTEXT) + extra); + void *context = CryptMemAlloc(contextSize + sizeof(BASE_CONTEXT) + extra); TRACE("(%d, %p, %d)\n", contextSize, linked, extra); if (context) { - LINK_CONTEXT *linkContext = (LINK_CONTEXT*)BASE_CONTEXT_FROM_CONTEXT( + BASE_CONTEXT *linkContext = (BASE_CONTEXT*)BASE_CONTEXT_FROM_CONTEXT( context, contextSize); BASE_CONTEXT *linkedBase = BASE_CONTEXT_FROM_CONTEXT(linked, contextSize); @@ -92,7 +82,7 @@ void *Context_CreateLinkContext(unsigned int contextSize, void *linked, unsigned memcpy(context, linked, contextSize); linkContext->ref = 1; linkContext->type = ContextTypeLink; - linkContext->linked = linkedBase; + linkContext->u.linked = linkedBase; if (addRef) Context_AddRef(linked, contextSize); TRACE("%p's ref count is %d\n", context, linkContext->ref); @@ -144,7 +134,7 @@ void *Context_GetExtra(const void *context, size_t contextSize) BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); assert(baseContext->type == ContextTypeLink); - return (LPBYTE)baseContext + sizeof(LINK_CONTEXT); + return (LPBYTE)baseContext + sizeof(BASE_CONTEXT); } void *Context_GetLinkedContext(void *context, size_t contextSize) @@ -152,7 +142,7 @@ void *Context_GetLinkedContext(void *context, size_t contextSize) BASE_CONTEXT *baseContext = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); assert(baseContext->type == ContextTypeLink); - return CONTEXT_FROM_BASE_CONTEXT(((LINK_CONTEXT*)baseContext)->linked, contextSize); + return CONTEXT_FROM_BASE_CONTEXT(baseContext->u.linked, contextSize); } CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t contextSize) @@ -160,8 +150,8 @@ CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context, size_t context BASE_CONTEXT *ptr = BASE_CONTEXT_FROM_CONTEXT(context, contextSize); while (ptr && ptr->type == ContextTypeLink) - ptr = ((LINK_CONTEXT*)ptr)->linked; - return (ptr && ptr->type == ContextTypeData) ? ((DATA_CONTEXT*)ptr)->properties : NULL; + ptr = ptr->u.linked; + return (ptr && ptr->type == ContextTypeData) ? ptr->u.properties : NULL; } BOOL Context_Release(void *context, size_t contextSize, @@ -181,15 +171,14 @@ BOOL Context_Release(void *context, size_t contextSize, * it as well, using the same offset and data free function. */ ret = Context_Release(CONTEXT_FROM_BASE_CONTEXT( - ((LINK_CONTEXT*)base)->linked, contextSize), contextSize, - dataContextFree); + base->u.linked, contextSize), contextSize, dataContextFree); } if (InterlockedDecrement(&base->ref) == 0) { TRACE("freeing %p\n", context); if (base->type == ContextTypeData) { - ContextPropertyList_Free(((DATA_CONTEXT*)base)->properties); + ContextPropertyList_Free(base->u.properties); dataContextFree(context); } CryptMemFree(context); @@ -249,7 +238,7 @@ static inline struct list *ContextList_ContextToEntry(const struct ContextList * static inline void *ContextList_EntryToContext(const struct ContextList *list, struct list *entry) { - return (LPBYTE)entry - sizeof(LINK_CONTEXT) - list->contextSize; + return (LPBYTE)entry - sizeof(BASE_CONTEXT) - list->contextSize; } void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace)
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
...
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