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
May 2022
----- 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
907 discussions
Start a n
N
ew thread
Hans Leidekker : crypt32: Add support for decoding OCSP_BASIC_REVOKED_INFO structures.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 8a463a335bff516833edf20fdfe7abb3de70fd03 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8a463a335bff516833edf20f…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue May 24 09:46:20 2022 +0200 crypt32: Add support for decoding OCSP_BASIC_REVOKED_INFO structures. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/decode.c | 113 ++++++++++++++++++++++++++++++++++++++++++-- dlls/crypt32/tests/encode.c | 4 +- 2 files changed, 110 insertions(+), 7 deletions(-) diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index 762d1b54661..60f9868ed67 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -6351,6 +6351,112 @@ static BOOL CRYPT_AsnDecodeOCSPNextUpdate(const BYTE *pbEncoded, return ret; } +static BOOL CRYPT_AsnDecodeCertStatus(const BYTE *pbEncoded, + DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, + DWORD *pcbDecoded) +{ + BOOL ret = TRUE; + BYTE tag = pbEncoded[0] & ~3, status = pbEncoded[0] & 3; + DWORD bytesNeeded = FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, ThisUpdate) - + FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, dwCertStatus); + + if (!cbEncoded) + { + SetLastError(CRYPT_E_ASN1_EOD); + return FALSE; + } + + switch (status) + { + case 0: + if (tag != ASN_CONTEXT) + { + WARN("Unexpected tag %02x\n", tag); + SetLastError(CRYPT_E_ASN1_BADTAG); + return FALSE; + } + if (cbEncoded < 2 || pbEncoded[1]) + { + SetLastError(CRYPT_E_ASN1_CORRUPT); + return FALSE; + } + if (!pvStructInfo) + *pcbStructInfo = bytesNeeded; + else if (*pcbStructInfo < bytesNeeded) + { + *pcbStructInfo = bytesNeeded; + SetLastError(ERROR_MORE_DATA); + return FALSE; + } + if (pvStructInfo) + { + *(DWORD *)pvStructInfo = 0; + *(OCSP_BASIC_REVOKED_INFO **)((char *)pvStructInfo + + FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, u.pRevokedInfo) + - FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, dwCertStatus)) = NULL; + } + *pcbStructInfo = bytesNeeded; + *pcbDecoded = 2; + break; + + case 1: + { + DWORD dataLen; + + if (tag != (ASN_CONTEXT | ASN_CONSTRUCTOR)) + { + WARN("Unexpected tag %02x\n", tag); + SetLastError(CRYPT_E_ASN1_BADTAG); + return FALSE; + } + if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) + { + BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]); + DWORD bytesDecoded, size; + FILETIME date; + + if (dataLen) + { + size = sizeof(date); + ret = CRYPT_AsnDecodeGeneralizedTime(pbEncoded + 1 + lenBytes, cbEncoded - 1 - lenBytes, + dwFlags, &date, &size, &bytesDecoded); + if (ret) + { + OCSP_BASIC_REVOKED_INFO *info; + + bytesNeeded += sizeof(*info); + if (!pvStructInfo) + *pcbStructInfo = bytesNeeded; + else if (*pcbStructInfo < bytesNeeded) + { + *pcbStructInfo = bytesNeeded; + SetLastError(ERROR_MORE_DATA); + return FALSE; + } + if (pvStructInfo) + { + *(DWORD *)pvStructInfo = 1; + info = *(OCSP_BASIC_REVOKED_INFO **)((char *)pvStructInfo + + FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, u.pRevokedInfo) + - FIELD_OFFSET(OCSP_BASIC_RESPONSE_ENTRY, dwCertStatus)); + info->RevocationDate = date; + } + *pcbStructInfo = bytesNeeded; + *pcbDecoded = 1 + lenBytes + bytesDecoded; + } + } + } + break; + } + default: + FIXME("Unhandled status %u\n", status); + SetLastError(CRYPT_E_ASN1_BADTAG); + return FALSE; + } + + return ret; +} + static BOOL CRYPT_AsnDecodeOCSPBasicResponseEntry(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded) { @@ -6367,10 +6473,9 @@ static BOOL CRYPT_AsnDecodeOCSPBasicResponseEntry(const BYTE *pbEncoded, DWORD c { ASN_INTEGER, offsetof(OCSP_BASIC_RESPONSE_ENTRY, CertId.SerialNumber), CRYPT_AsnDecodeIntegerInternal, sizeof(CRYPT_INTEGER_BLOB), FALSE, TRUE, offsetof(OCSP_BASIC_RESPONSE_ENTRY, CertId.SerialNumber.pbData), 0 }, - { ASN_CONTEXT, offsetof(OCSP_BASIC_RESPONSE_ENTRY, dwCertStatus), - CRYPT_AsnDecodeIntInternal, sizeof(DWORD), FALSE, FALSE, - 0, 0 }, - /* FIXME: pRevokedInfo */ + { 0, offsetof(OCSP_BASIC_RESPONSE_ENTRY, dwCertStatus), + CRYPT_AsnDecodeCertStatus, sizeof(DWORD), FALSE, TRUE, + offsetof(OCSP_BASIC_RESPONSE_ENTRY, u.pRevokedInfo), 0 }, { ASN_GENERALTIME, offsetof(OCSP_BASIC_RESPONSE_ENTRY, ThisUpdate), CRYPT_AsnDecodeGeneralizedTime, sizeof(FILETIME), FALSE, FALSE, 0, 0 }, diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index b65ffde3a84..c611bb63936 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -8824,9 +8824,8 @@ static void test_decodeOCSPBasicResponseInfo(DWORD dwEncoding) size = 0; ret = CryptDecodeObjectEx(dwEncoding, OCSP_BASIC_RESPONSE, ocsp_basic_response_revoked, sizeof(ocsp_basic_response_revoked), CRYPT_DECODE_ALLOC_FLAG, NULL, &info, &size); - todo_wine ok(ret, "got %08lx\n", GetLastError()); + ok(ret, "got %08lx\n", GetLastError()); - if (ret) { ok(!info->dwVersion, "got %lu\n", info->dwVersion); ok(info->dwResponderIdChoice == 2, "got %lu\n", info->dwResponderIdChoice); ok(info->ByKeyResponderId.cbData == sizeof(resp_id), "got %lu\n", info->ByKeyResponderId.cbData); @@ -8864,7 +8863,6 @@ static void test_decodeOCSPBasicResponseInfo(DWORD dwEncoding) ok(!info->cExtension, "got %lu\n", info->cExtension); ok(info->rgExtension == NULL, "got %p\n", info->rgExtension); - } LocalFree(info); }
1
0
0
0
Rémi Bernon : ntdll: Introduce a new subheap_overhead helper.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: c2b89fd77615334d1c4abd3cd81905731657b6fc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c2b89fd77615334d1c4abd3c…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat May 21 08:54:03 2022 +0200 ntdll: Introduce a new subheap_overhead helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 40fbd379772..540625bff27 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -271,6 +271,11 @@ static inline SIZE_T subheap_size( const SUBHEAP *subheap ) return subheap->size; } +static inline SIZE_T subheap_overhead( const SUBHEAP *subheap ) +{ + return subheap->headerSize; +} + static inline const void *subheap_commit_end( const SUBHEAP *subheap ) { return (char *)subheap_base( subheap ) + subheap->commitSize; @@ -499,7 +504,7 @@ static void heap_dump( const HEAP *heap ) if (!check_subheap( subheap )) return; - overhead += (char *)first_block( subheap ) - base; + overhead += subheap_overhead( subheap ); for (block = first_block( subheap ); block; block = next_block( subheap, block )) { if (block_get_flags( block ) & ARENA_FLAG_FREE) @@ -1008,7 +1013,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, /* Create the first free block */ - create_free_block( subheap, first_block( subheap ), subheap->size - subheap->headerSize ); + create_free_block( subheap, first_block( subheap ), subheap_size( subheap ) - subheap_overhead( subheap ) ); return subheap; } @@ -1863,7 +1868,7 @@ static NTSTATUS heap_walk( const HEAP *heap, struct rtl_heap_entry *entry ) subheap = LIST_ENTRY( next, SUBHEAP, entry ); base = subheap_base( subheap ); entry->lpData = base; - entry->cbData = (char *)first_block( subheap ) - base; + entry->cbData = subheap_overhead( subheap ); entry->cbOverhead = 0; entry->iRegionIndex = 0; entry->wFlags = RTL_HEAP_ENTRY_REGION;
1
0
0
0
Rémi Bernon : ntdll: Use the subheap helpers in HEAP_Commit / HEAP_Decommit.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 37b1011135b590e9ce885f23454ec16b6f786b01 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=37b1011135b590e9ce885f23…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 24 08:47:11 2022 +0200 ntdll: Use the subheap helpers in HEAP_Commit / HEAP_Decommit. And rename them to subheap_commit / subheap_decommit. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 81 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 8e578d19d05..40fbd379772 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -125,6 +125,7 @@ typedef struct C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 ); +#define ROUND_ADDR(addr, mask) ((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask))) #define ROUND_SIZE(size) ((((size) + ALIGNMENT - 1) & ~(ALIGNMENT-1)) + ARENA_OFFSET) /* minimum data size (without arenas) of an allocated block */ @@ -612,56 +613,54 @@ static SUBHEAP *find_subheap( const HEAP *heap, const struct block *block, BOOL } -/*********************************************************************** - * HEAP_Commit - * - * Make sure the heap storage is committed for a given size in the specified arena. - */ -static inline BOOL HEAP_Commit( SUBHEAP *subheap, ARENA_INUSE *pArena, SIZE_T data_size ) -{ - void *ptr = (char *)(pArena + 1) + data_size + sizeof(ARENA_FREE); - SIZE_T size = (char *)ptr - (char *)subheap->base; - size = (size + COMMIT_MASK) & ~COMMIT_MASK; - if (size > subheap->size) size = subheap->size; - if (size <= subheap->commitSize) return TRUE; - size -= subheap->commitSize; - ptr = (char *)subheap->base + subheap->commitSize; - if (NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 0, - &size, MEM_COMMIT, get_protection_type( subheap->heap->flags ) )) - { - WARN("Could not commit %08lx bytes at %p for heap %p\n", - size, ptr, subheap->heap ); +static inline BOOL subheap_commit( SUBHEAP *subheap, const struct block *block, SIZE_T data_size ) +{ + const char *end = (char *)subheap_base( subheap ) + subheap_size( subheap ), *commit_end; + HEAP *heap = subheap->heap; + ULONG flags = heap->flags; + SIZE_T size; + void *addr; + + commit_end = (char *)(block + 1) + data_size + sizeof(ARENA_FREE); + commit_end = ROUND_ADDR((char *)commit_end + COMMIT_MASK, COMMIT_MASK); + + if (commit_end > end) commit_end = end; + if (commit_end <= (char *)subheap_commit_end( subheap )) return TRUE; + + addr = (void *)subheap_commit_end( subheap ); + size = commit_end - (char *)addr; + + if (NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, + get_protection_type( flags ) )) + { + WARN( "Could not commit %#Ix bytes at %p for heap %p\n", size, addr, heap ); return FALSE; } - subheap->commitSize += size; + + subheap->commitSize = (char *)commit_end - (char *)subheap_base( subheap ); return TRUE; } - -/*********************************************************************** - * HEAP_Decommit - * - * If possible, decommit the heap storage from (including) 'ptr'. - */ -static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr ) +static inline BOOL subheap_decommit( SUBHEAP *subheap, const void *commit_end ) { + HEAP *heap = subheap->heap; + SIZE_T size; void *addr; - SIZE_T decommit_size; - SIZE_T size = (char *)ptr - (char *)subheap->base; - size = ((size + COMMIT_MASK) & ~COMMIT_MASK); - size = max( size, subheap->min_commit ); - if (size >= subheap->commitSize) return TRUE; - decommit_size = subheap->commitSize - size; - addr = (char *)subheap->base + size; + commit_end = ROUND_ADDR((char *)commit_end + COMMIT_MASK, COMMIT_MASK); + commit_end = max( (char *)commit_end, (char *)subheap_base( subheap ) + subheap->min_commit ); + if (commit_end >= subheap_commit_end( subheap )) return TRUE; - if (NtFreeVirtualMemory( NtCurrentProcess(), &addr, &decommit_size, MEM_DECOMMIT )) + size = (char *)subheap_commit_end( subheap ) - (char *)commit_end; + addr = (void *)commit_end; + + if (NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_DECOMMIT )) { - WARN("Could not decommit %08lx bytes at %p for heap %p\n", - decommit_size, (char *)subheap->base + size, subheap->heap ); + WARN( "Could not decommit %#Ix bytes at %p for heap %p\n", size, addr, heap ); return FALSE; } - subheap->commitSize -= decommit_size; + + subheap->commitSize = (char *)commit_end - (char *)subheap_base( subheap ); return TRUE; } @@ -750,7 +749,7 @@ static void free_used_block( SUBHEAP *subheap, struct block *block ) else if (!heap->shared) { /* keep room for a full commited block as hysteresis */ - HEAP_Decommit( subheap, (char *)(entry + 1) + (COMMIT_MASK + 1) ); + subheap_decommit( subheap, (char *)(entry + 1) + (COMMIT_MASK + 1) ); } } @@ -1032,7 +1031,7 @@ static struct block *find_free_block( HEAP *heap, SIZE_T data_size, SUBHEAP **su if (block_get_size( block ) - sizeof(*block) >= data_size) { *subheap = find_subheap( heap, block, FALSE ); - if (!HEAP_Commit( *subheap, block, data_size )) return NULL; + if (!subheap_commit( *subheap, block, data_size )) return NULL; list_remove( &entry->entry ); return block; } @@ -1609,7 +1608,7 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size struct entry *entry = (struct entry *)next; list_remove( &entry->entry ); old_data_size += block_get_size( next ); - if (!HEAP_Commit( subheap, block, data_size )) return STATUS_NO_MEMORY; + if (!subheap_commit( subheap, block, data_size )) return STATUS_NO_MEMORY; notify_realloc( block + 1, old_size, size ); shrink_used_block( subheap, block, block_get_flags( block ), old_data_size, data_size, size ); }
1
0
0
0
Rémi Bernon : ntdll: Move subheap decommit hysteresis to free_used_block.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 2c46ee18904b6fef0110d61dabf95046e9e88f2f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2c46ee18904b6fef0110d61d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 24 08:54:04 2022 +0200 ntdll: Move subheap decommit hysteresis to free_used_block. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 1093fde41ca..8e578d19d05 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -649,8 +649,7 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr ) SIZE_T decommit_size; SIZE_T size = (char *)ptr - (char *)subheap->base; - /* round to next block and add one full block */ - size = ((size + COMMIT_MASK) & ~COMMIT_MASK) + COMMIT_MASK + 1; + size = ((size + COMMIT_MASK) & ~COMMIT_MASK); size = max( size, subheap->min_commit ); if (size >= subheap->commitSize) return TRUE; decommit_size = subheap->commitSize - size; @@ -748,7 +747,11 @@ static void free_used_block( SUBHEAP *subheap, struct block *block ) list_remove( &subheap->entry ); NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE ); } - else if (!heap->shared) HEAP_Decommit( subheap, entry + 1 ); + else if (!heap->shared) + { + /* keep room for a full commited block as hysteresis */ + HEAP_Decommit( subheap, (char *)(entry + 1) + (COMMIT_MASK + 1) ); + } }
1
0
0
0
Rémi Bernon : ntdll: Use block helpers in free_used_block.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: d0ad5d6a9c68449b999247e42a8a38c61bcdac53 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d0ad5d6a9c68449b999247e4…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 24 08:44:11 2022 +0200 ntdll: Use block helpers in free_used_block. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 51fdbc370f5..1093fde41ca 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -720,39 +720,35 @@ static void free_used_block( SUBHEAP *subheap, struct block *block ) heap->pending_free[heap->pending_pos] = block; heap->pending_pos = (heap->pending_pos + 1) % MAX_FREE_PENDING; block_set_type( block, ARENA_PENDING_MAGIC ); - mark_block_free( block + 1, block->size & ARENA_SIZE_MASK, heap->flags ); + mark_block_free( block + 1, block_get_size( block ) - sizeof(*block), heap->flags ); if (!(block = tmp) || !(subheap = find_subheap( heap, block, FALSE ))) return; } - block_size = (block->size & ARENA_SIZE_MASK) + sizeof(*block); - if (block->size & ARENA_FLAG_PREV_FREE) + block_size = block_get_size( block ); + if (block_get_flags( block ) & ARENA_FLAG_PREV_FREE) { /* merge with previous block if it is free */ block = *((struct block **)block - 1); - block_size += (block->size & ARENA_SIZE_MASK) + sizeof(*entry); + block_size += block_get_size( block ); entry = (struct entry *)block; list_remove( &entry->entry ); } else entry = (struct entry *)block; create_free_block( subheap, block, block_size ); - block_size = (block->size & ARENA_SIZE_MASK) + sizeof(*entry); - if ((char *)block + block_size < (char *)subheap->base + subheap->size) return; /* not the last block */ + if (next_block( subheap, block )) return; /* not the last block */ - if (((char *)block == (char *)subheap->base + subheap->headerSize) && - (subheap != &subheap->heap->subheap)) + if (block == first_block( subheap ) && subheap != &heap->subheap) { /* free the subheap if it's empty and not the main one */ - void *addr = subheap->base; + void *addr = subheap_base( subheap ); SIZE_T size = 0; list_remove( &entry->entry ); list_remove( &subheap->entry ); NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE ); - return; } - - if (!heap->shared) HEAP_Decommit( subheap, entry + 1 ); + else if (!heap->shared) HEAP_Decommit( subheap, entry + 1 ); }
1
0
0
0
Rémi Bernon : ntdll: Cleanup and rename HEAP_MakeInUseBlockFree to free_used_block.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: a87d0211487a61eda3821c345b44880603d46b54 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a87d0211487a61eda3821c34…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Sat May 21 08:59:57 2022 +0200 ntdll: Cleanup and rename HEAP_MakeInUseBlockFree to free_used_block. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 71 ++++++++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 45 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 5fe23a3502e..51fdbc370f5 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -708,70 +708,51 @@ static void create_free_block( SUBHEAP *subheap, struct block *block, SIZE_T blo } -/*********************************************************************** - * HEAP_MakeInUseBlockFree - * - * Turn an in-use block into a free block. Can also decommit the end of - * the heap, and possibly even free the sub-heap altogether. - */ -static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena ) +static void free_used_block( SUBHEAP *subheap, struct block *block ) { HEAP *heap = subheap->heap; - ARENA_FREE *pFree; - SIZE_T size; + struct entry *entry; + SIZE_T block_size; if (heap->pending_free) { - ARENA_INUSE *prev = heap->pending_free[heap->pending_pos]; - heap->pending_free[heap->pending_pos] = pArena; + struct block *tmp = heap->pending_free[heap->pending_pos]; + heap->pending_free[heap->pending_pos] = block; heap->pending_pos = (heap->pending_pos + 1) % MAX_FREE_PENDING; - block_set_type( pArena, ARENA_PENDING_MAGIC ); - mark_block_free( pArena + 1, pArena->size & ARENA_SIZE_MASK, heap->flags ); - if (!prev) return; - pArena = prev; - subheap = find_subheap( heap, pArena, FALSE ); + block_set_type( block, ARENA_PENDING_MAGIC ); + mark_block_free( block + 1, block->size & ARENA_SIZE_MASK, heap->flags ); + if (!(block = tmp) || !(subheap = find_subheap( heap, block, FALSE ))) return; } - /* Check if we can merge with previous block */ - - size = (pArena->size & ARENA_SIZE_MASK) + sizeof(*pArena); - if (pArena->size & ARENA_FLAG_PREV_FREE) + block_size = (block->size & ARENA_SIZE_MASK) + sizeof(*block); + if (block->size & ARENA_FLAG_PREV_FREE) { - pFree = *((ARENA_FREE **)pArena - 1); - size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE); - /* Remove it from the free list */ - list_remove( &pFree->entry ); + /* merge with previous block if it is free */ + block = *((struct block **)block - 1); + block_size += (block->size & ARENA_SIZE_MASK) + sizeof(*entry); + entry = (struct entry *)block; + list_remove( &entry->entry ); } - else pFree = (ARENA_FREE *)pArena; - - /* Create a free block */ - - create_free_block( subheap, (struct block *)pFree, size ); - size = (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE); - if ((char *)pFree + size < (char *)subheap->base + subheap->size) - return; /* Not the last block, so nothing more to do */ + else entry = (struct entry *)block; - /* Free the whole sub-heap if it's empty and not the original one */ + create_free_block( subheap, block, block_size ); + block_size = (block->size & ARENA_SIZE_MASK) + sizeof(*entry); + if ((char *)block + block_size < (char *)subheap->base + subheap->size) return; /* not the last block */ - if (((char *)pFree == (char *)subheap->base + subheap->headerSize) && + if (((char *)block == (char *)subheap->base + subheap->headerSize) && (subheap != &subheap->heap->subheap)) { + /* free the subheap if it's empty and not the main one */ void *addr = subheap->base; + SIZE_T size = 0; - size = 0; - /* Remove the free block from the list */ - list_remove( &pFree->entry ); - /* Remove the subheap from the list */ + list_remove( &entry->entry ); list_remove( &subheap->entry ); - /* Free the memory */ - subheap->magic = 0; NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE ); return; } - /* Decommit the end of the heap */ - - if (!(subheap->heap->shared)) HEAP_Decommit( subheap, pFree + 1 ); + if (!heap->shared) HEAP_Decommit( subheap, entry + 1 ); } @@ -1568,7 +1549,7 @@ static NTSTATUS heap_free( HEAP *heap, void *ptr ) if (!(block = unsafe_block_from_ptr( heap, ptr, &subheap ))) return STATUS_INVALID_PARAMETER; if (!subheap) free_large_block( heap, ptr ); - else HEAP_MakeInUseBlockFree( subheap, block ); + else free_used_block( subheap, block ); return STATUS_SUCCESS; } @@ -1640,7 +1621,7 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size memcpy( *ret, block + 1, old_size ); if (flags & HEAP_ZERO_MEMORY) memset( (char *)*ret + old_size, 0, size - old_size ); notify_free( ptr ); - HEAP_MakeInUseBlockFree( subheap, block ); + free_used_block( subheap, block ); return STATUS_SUCCESS; } }
1
0
0
0
Rémi Bernon : ntdll: Merge HEAP_InsertFreeBlock with create_free_block.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 66036effdf8f017a0e0f2bea0f830f6054691ee7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=66036effdf8f017a0e0f2bea…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed May 4 20:50:48 2022 +0200 ntdll: Merge HEAP_InsertFreeBlock with create_free_block. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 767a010d93e..5fe23a3502e 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -595,28 +595,6 @@ static HEAP *HEAP_GetPtr( } -/*********************************************************************** - * HEAP_InsertFreeBlock - * - * Insert a free block into the free list. - */ -static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL last ) -{ - SIZE_T block_size = (pArena->size & ARENA_SIZE_MASK) + sizeof(*pArena); - struct entry *list = find_free_list( heap, block_size, last ); - if (last) - { - /* insert at end of free list, i.e. before the next free list entry */ - list_add_before( &list->entry, &pArena->entry ); - } - else - { - /* insert at head of free list */ - list_add_after( &list->entry, &pArena->entry ); - } -} - - static SUBHEAP *find_subheap( const HEAP *heap, const struct block *block, BOOL heap_walk ) { SUBHEAP *subheap; @@ -692,7 +670,7 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr ) static void create_free_block( SUBHEAP *subheap, struct block *block, SIZE_T block_size ) { const char *end = (char *)block + block_size, *commit_end = subheap_commit_end( subheap ); - struct entry *entry = (struct entry *)block; + struct entry *entry = (struct entry *)block, *list; HEAP *heap = subheap->heap; DWORD flags = heap->flags; struct block *next; @@ -724,7 +702,9 @@ static void create_free_block( SUBHEAP *subheap, struct block *block, SIZE_T blo *((struct block **)next - 1) = block; } - HEAP_InsertFreeBlock( heap, entry, !next ); + list = find_free_list( heap, block_get_size( block ), !next ); + if (!next) list_add_before( &list->entry, &entry->entry ); + else list_add_after( &list->entry, &entry->entry ); }
1
0
0
0
Jacek Caban : winemac: Store driver thread data pointer in TEB.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 47e5a0bb5d8aef98557ddf65d10674e3b03877f3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=47e5a0bb5d8aef98557ddf65…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 23 20:32:11 2022 +0200 winemac: Store driver thread data pointer in TEB. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/macdrv.h | 4 +--- dlls/winemac.drv/macdrv_main.c | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 68ab74dc56e..04a8af81c53 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -114,13 +114,11 @@ struct macdrv_thread_data WORD keyc2scan[128]; }; -extern DWORD thread_data_tls_index DECLSPEC_HIDDEN; - extern struct macdrv_thread_data *macdrv_init_thread_data(void) DECLSPEC_HIDDEN; static inline struct macdrv_thread_data *macdrv_thread_data(void) { - return TlsGetValue(thread_data_tls_index); + return NtUserGetThreadInfo()->driver_data; } diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 2f05e55cb23..8c101576e99 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -46,8 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(macdrv); C_ASSERT(NUM_EVENT_TYPES <= sizeof(macdrv_event_mask) * 8); -DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES; - int topmost_float_inactive = TOPMOST_FLOAT_INACTIVE_NONFULLSCREEN; int capture_displays_for_fullscreen = 0; BOOL skip_single_buffer_flushes = FALSE; @@ -463,8 +461,6 @@ static BOOL process_attach(void) setup_options(); load_strings(macdrv_module); - if ((thread_data_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE; - macdrv_err_on = ERR_ON(macdrv); if (macdrv_start_cocoa_app(GetTickCount64())) { @@ -493,7 +489,7 @@ void macdrv_ThreadDetach(void) CFRelease(data->keyboard_layout_uchr); HeapFree(GetProcessHeap(), 0, data); /* clear data in case we get re-entered from user32 before the thread is truly dead */ - TlsSetValue(thread_data_tls_index, NULL); + NtUserGetThreadInfo()->driver_data = 0; } } @@ -556,7 +552,7 @@ struct macdrv_thread_data *macdrv_init_thread_data(void) macdrv_compute_keyboard_layout(data); set_queue_display_fd(macdrv_get_event_queue_fd(data->queue)); - TlsSetValue(thread_data_tls_index, data); + NtUserGetThreadInfo()->driver_data = data; NtUserActivateKeyboardLayout(data->active_keyboard_layout, 0); return data;
1
0
0
0
Jacek Caban : winex11: Properly initialize set_clipboard_params struct.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 08f5d2adf9c6e9d9e479cc668bfa03e54fd5bedd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=08f5d2adf9c6e9d9e479cc66…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue May 24 01:28:51 2022 +0200 winex11: Properly initialize set_clipboard_params struct. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winex11.drv/clipboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 80c3e8520d3..f2be4386e65 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -1337,11 +1337,10 @@ static BOOL render_format( UINT id ) for (i = 0; i < nb_current_x11_formats; i++) { - struct set_clipboard_params params; + struct set_clipboard_params params = { 0 }; if (current_x11_formats[i]->id != id) continue; if (!(params.data = import_selection( display, import_window, current_selection, current_x11_formats[i], ¶ms.size ))) continue; - params.seqno = 0; NtUserSetClipboardData( id, 0, ¶ms ); if (params.size) free( params.data ); return TRUE;
1
0
0
0
Jacek Caban : winemac: Use NtUserSetClipboardData to import clipboard data.
by Alexandre Julliard
24 May '22
24 May '22
Module: wine Branch: master Commit: 11ee4f3fabbf2f1fccad21dcb836d7c114b0f34f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=11ee4f3fabbf2f1fccad21dc…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat May 21 23:02:29 2022 +0200 winemac: Use NtUserSetClipboardData to import clipboard data. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 153 ++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 98 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=11ee4f3fabbf2f1fccad…
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
91
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Results per page:
10
25
50
100
200