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
Jactry Zeng : include: Add MIL/DWM HRESULT codes.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 3f7c08096af8143c6f5177ddb40ea18236903ee6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3f7c08096af8143c6f5177dd…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Wed May 11 02:44:19 2022 -0500 include: Add MIL/DWM HRESULT codes. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winerror.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/include/winerror.h b/include/winerror.h index d51d5648cdb..fb44eaacbed 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -3884,6 +3884,47 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x) #define WINCODEC_ERR_WIN32ERROR _HRESULT_TYPEDEF_(0x88982f94) #define WINCODEC_ERR_INVALIDPROGRESSIVELEVEL _HRESULT_TYPEDEF_(0x88982f95) +#define MILERR_OBJECTBUSY _HRESULT_TYPEDEF_(0x88980001) +#define MILERR_INSUFFICIENTBUFFER _HRESULT_TYPEDEF_(0x88980002) +#define MILERR_WIN32ERROR _HRESULT_TYPEDEF_(0x88980003) +#define MILERR_SCANNER_FAILED _HRESULT_TYPEDEF_(0x88980004) +#define MILERR_SCREENACCESSDENIED _HRESULT_TYPEDEF_(0x88980005) +#define MILERR_DISPLAYSTATEINVALID _HRESULT_TYPEDEF_(0x88980006) +#define MILERR_NONINVERTIBLEMATRIX _HRESULT_TYPEDEF_(0x88980007) +#define MILERR_ZEROVECTOR _HRESULT_TYPEDEF_(0x88980008) +#define MILERR_TERMINATED _HRESULT_TYPEDEF_(0x88980009) +#define MILERR_BADNUMBER _HRESULT_TYPEDEF_(0x8898000a) +#define MILERR_INTERNALERROR _HRESULT_TYPEDEF_(0x88980080) +#define MILERR_DISPLAYFORMATNOTSUPPORTED _HRESULT_TYPEDEF_(0x88980084) +#define MILERR_INVALIDCALL _HRESULT_TYPEDEF_(0x88980085) +#define MILERR_ALREADYLOCKED _HRESULT_TYPEDEF_(0x88980086) +#define MILERR_NOTLOCKED _HRESULT_TYPEDEF_(0x88980087) +#define MILERR_DEVICECANNOTRENDERTEXT _HRESULT_TYPEDEF_(0x88980088) +#define MILERR_GLYPHBITMAPMISSED _HRESULT_TYPEDEF_(0x88980089) +#define MILERR_MALFORMEDGLYPHCACHE _HRESULT_TYPEDEF_(0x8898008a) +#define MILERR_GENERIC_IGNORE _HRESULT_TYPEDEF_(0x8898008b) +#define MILERR_MALFORMED_GUIDELINE_DATA _HRESULT_TYPEDEF_(0x8898008c) +#define MILERR_NO_HARDWARE_DEVICE _HRESULT_TYPEDEF_(0x8898008d) +#define MILERR_NEED_RECREATE_AND_PRESENT _HRESULT_TYPEDEF_(0x8898008e) +#define MILERR_ALREADY_INITIALIZED _HRESULT_TYPEDEF_(0x8898008f) +#define MILERR_MISMATCHED_SIZE _HRESULT_TYPEDEF_(0x88980090) +#define MILERR_NO_REDIRECTION_SURFACE_AVAILABLE _HRESULT_TYPEDEF_(0x88980091) +#define MILERR_REMOTING_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x88980092) +#define MILERR_QUEUED_PRESENT_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x88980093) +#define MILERR_NOT_QUEUING_PRESENTS _HRESULT_TYPEDEF_(0x88980094) +#define MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER _HRESULT_TYPEDEF_(0x88980095) +#define MILERR_TOOMANYSHADERELEMNTS _HRESULT_TYPEDEF_(0x88980096) +#define MILERR_MROW_READLOCK_FAILED _HRESULT_TYPEDEF_(0x88980097) +#define MILERR_MROW_UPDATE_FAILED _HRESULT_TYPEDEF_(0x88980098) +#define MILERR_SHADER_COMPILE_FAILED _HRESULT_TYPEDEF_(0x88980099) +#define MILERR_MAX_TEXTURE_SIZE_EXCEEDED _HRESULT_TYPEDEF_(0x8898009a) +#define MILERR_QPC_TIME_WENT_BACKWARD _HRESULT_TYPEDEF_(0x8898009b) +#define MILERR_DXGI_ENUMERATION_OUT_OF_SYNC _HRESULT_TYPEDEF_(0x8898009d) +#define MILERR_ADAPTER_NOT_FOUND _HRESULT_TYPEDEF_(0x8898009e) +#define MILERR_COLORSPACE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8898009f) +#define MILERR_PREFILTER_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x889800a0) +#define MILERR_DISPLAYID_ACCESS_DENIED _HRESULT_TYPEDEF_(0x889800a1) + #define DWRITE_E_FILEFORMAT _HRESULT_TYPEDEF_(0x88985000) #define DWRITE_E_UNEXPECTED _HRESULT_TYPEDEF_(0x88985001) #define DWRITE_E_NOFONT _HRESULT_TYPEDEF_(0x88985002)
1
0
0
0
Brendan Shanks : include: Add WINE_ALLOC_SIZE attribute to MmAllocate functions.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 7e973421d1e37f788118254722b058d37e6f1c19 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7e973421d1e37f7881182547…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Wed May 11 15:22:20 2022 -0700 include: Add WINE_ALLOC_SIZE attribute to MmAllocate functions. Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/ddk/wdm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 2abe5ad574d..b75f452d0da 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1791,8 +1791,8 @@ BOOLEAN WINAPI KeSignalCallDpcSynchronize(void*); NTSTATUS WINAPI KeWaitForMultipleObjects(ULONG,void*[],WAIT_TYPE,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*,KWAIT_BLOCK*); NTSTATUS WINAPI KeWaitForSingleObject(void*,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*); -PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS); -PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T); +PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS) __WINE_ALLOC_SIZE(1); +PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T) __WINE_ALLOC_SIZE(1); PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,SIZE_T); void WINAPI MmBuildMdlForNonPagedPool(MDL*); NTSTATUS WINAPI MmCopyVirtualMemory(PEPROCESS,void*,PEPROCESS,void*,SIZE_T,KPROCESSOR_MODE,SIZE_T*);
1
0
0
0
Brendan Shanks : include: Add WINE_ALLOC_SIZE attribute to ExAllocatePool functions.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 09704a155eb29ee13f04af27cafb9e8ff6cd1fee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=09704a155eb29ee13f04af27…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Wed May 11 15:22:19 2022 -0700 include: Add WINE_ALLOC_SIZE attribute to ExAllocatePool functions. Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/ddk/wdm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index b798d339561..2abe5ad574d 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1656,10 +1656,10 @@ BOOLEAN WINAPI ExAcquireResourceExclusiveLite(ERESOURCE*,BOOLEAN); BOOLEAN WINAPI ExAcquireResourceSharedLite(ERESOURCE*,BOOLEAN); BOOLEAN WINAPI ExAcquireSharedStarveExclusive(ERESOURCE*,BOOLEAN); BOOLEAN WINAPI ExAcquireSharedWaitForExclusive(ERESOURCE*,BOOLEAN); -PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T); -PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T); -PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG); -PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG); +PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2); +PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2); +PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2); +PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2); void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST); void WINAPI ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST); NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
1
0
0
0
Brendan Shanks : include: Add WINE_ALLOC_SIZE attribute to RtlReAllocateHeap().
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 26297e7a2f0e48f8bfb66936bd0bf26f04d8a51f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=26297e7a2f0e48f8bfb66936…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Wed May 11 15:22:18 2022 -0700 include: Add WINE_ALLOC_SIZE attribute to RtlReAllocateHeap(). Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winternl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/winternl.h b/include/winternl.h index 84babcbb0e9..a4cbcb316cb 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4457,7 +4457,7 @@ NTSYSAPI NTSTATUS WINAPI RtlQueueWorkItem(PRTL_WORK_ITEM_ROUTINE,PVOID,ULONG); NTSYSAPI void WINAPI RtlRaiseException(PEXCEPTION_RECORD); NTSYSAPI void WINAPI RtlRaiseStatus(NTSTATUS); NTSYSAPI ULONG WINAPI RtlRandom(PULONG); -NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,SIZE_T); +NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,SIZE_T) __WINE_ALLOC_SIZE(4); NTSYSAPI NTSTATUS WINAPI RtlRegisterWait(PHANDLE,HANDLE,RTL_WAITORTIMERCALLBACKFUNC,PVOID,ULONG,ULONG); NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE); NTSYSAPI void WINAPI RtlReleasePath(PWSTR);
1
0
0
0
Brendan Shanks : include: Add WINE_ALLOC_SIZE attribute to CoTaskMemRealloc().
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: c392ac8678bab9edbca82807d4c1f93e9eaad9af URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c392ac8678bab9edbca82807…
Author: Brendan Shanks <bshanks(a)codeweavers.com> Date: Wed May 11 15:22:17 2022 -0700 include: Add WINE_ALLOC_SIZE attribute to CoTaskMemRealloc(). Signed-off-by: Brendan Shanks <bshanks(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/objbase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/objbase.h b/include/objbase.h index 8bf6ad9da84..11bfc95d989 100644 --- a/include/objbase.h +++ b/include/objbase.h @@ -319,7 +319,7 @@ HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsi HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc); LPVOID WINAPI CoTaskMemAlloc(SIZE_T size) __WINE_ALLOC_SIZE(1); void WINAPI CoTaskMemFree(LPVOID ptr); -LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size); +LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size) __WINE_ALLOC_SIZE(2); HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy); HRESULT WINAPI CoRevokeMallocSpy(void);
1
0
0
0
Rémi Bernon : ntdll: Split RtlSizeHeap to a separate heap_size helper.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 1c873e87194ebb7b0870726beb9b1127f8d84684 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1c873e87194ebb7b0870726b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Apr 28 01:33:23 2022 +0200 ntdll: Split RtlSizeHeap to a separate heap_size helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 71 +++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 2d03cd59729..51567d0552b 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -1958,58 +1958,47 @@ BOOLEAN WINAPI RtlUnlockHeap( HANDLE heap ) } -/*********************************************************************** - * RtlSizeHeap (NTDLL.@) - * - * Get the actual size of a memory block allocated from a Heap. - * - * PARAMS - * heap [I] Heap that block was allocated from - * flags [I] HEAP_ flags from "winnt.h" - * ptr [I] Block to get the size of - * - * RETURNS - * Success: The size of the block. - * Failure: -1, heap or ptr are invalid. - * - * NOTES - * The size may be bigger than what was passed to RtlAllocateHeap(). - */ -SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr ) +static NTSTATUS heap_size( HEAP *heap, const void *ptr, SIZE_T *size ) { - SIZE_T ret; - const ARENA_INUSE *pArena; + const ARENA_INUSE *block; SUBHEAP *subheap; - HEAP *heapPtr = HEAP_GetPtr( heap ); - - if (!heapPtr) - { - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE ); - return ~(SIZE_T)0; - } - - heap_lock( heapPtr, flags ); - pArena = (const ARENA_INUSE *)ptr - 1; - if (!validate_block_pointer( heapPtr, &subheap, pArena )) - { - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); - ret = ~(SIZE_T)0; - } - else if (!subheap) + block = (const ARENA_INUSE *)ptr - 1; + if (!validate_block_pointer( heap, &subheap, block )) return STATUS_INVALID_PARAMETER; + if (!subheap) { const ARENA_LARGE *large_arena = (const ARENA_LARGE *)ptr - 1; - ret = large_arena->data_size; + *size = large_arena->data_size; } else { - ret = (pArena->size & ARENA_SIZE_MASK) - pArena->unused_bytes; + *size = (block->size & ARENA_SIZE_MASK) - block->unused_bytes; } - heap_unlock( heapPtr, flags ); + return STATUS_SUCCESS; +} - TRACE("(%p,%08x,%p): returning %08lx\n", heap, flags, ptr, ret ); - return ret; +/*********************************************************************** + * RtlSizeHeap (NTDLL.@) + */ +SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr ) +{ + SIZE_T size = ~(SIZE_T)0; + NTSTATUS status; + HEAP *heapPtr; + + if (!(heapPtr = HEAP_GetPtr( heap ))) + status = STATUS_INVALID_PARAMETER; + else + { + heap_lock( heapPtr, flags ); + status = heap_size( heapPtr, ptr, &size ); + heap_unlock( heapPtr, flags ); + } + + TRACE( "heap %p, flags %#x, ptr %p, return %#Ix, status %#x.\n", heap, flags, ptr, size, status ); + heap_set_status( heapPtr, flags, status ); + return size; }
1
0
0
0
Rémi Bernon : ntdll: Split RtlReAllocateHeap to a separate heap_reallocate helper.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 8dd04c77cb3f1f24833f002499bf6299da38dcd6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8dd04c77cb3f1f24833f0024…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 3 14:53:07 2022 +0200 ntdll: Split RtlReAllocateHeap to a separate heap_reallocate helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 100 +++++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 61 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 1a4d5b1a2bb..2d03cd59729 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -333,7 +333,7 @@ static RTL_CRITICAL_SECTION_DEBUG process_heap_cs_debug = static inline ULONG heap_get_flags( const HEAP *heap, ULONG flags ) { - flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY; + flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY | HEAP_REALLOC_IN_PLACE_ONLY; return heap->flags | flags; } @@ -1767,53 +1767,23 @@ BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE heap, ULONG flags, void *pt } -/*********************************************************************** - * RtlReAllocateHeap (NTDLL.@) - * - * Change the size of a memory block allocated with RtlAllocateHeap(). - * - * PARAMS - * heap [I] Heap that block was allocated from - * flags [I] HEAP_ flags from "winnt.h" - * ptr [I] Block to resize - * size [I] Size of the memory block to allocate - * - * RETURNS - * Success: A pointer to the resized block (which may be different). - * Failure: NULL. - */ -PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size ) +static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size, void **ret ) { ARENA_INUSE *pArena; - HEAP *heapPtr; SUBHEAP *subheap; SIZE_T oldBlockSize, oldActualSize, rounded_size; - void *ret; - - if (!ptr) return NULL; - if (!(heapPtr = HEAP_GetPtr( heap ))) - { - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE ); - return NULL; - } - - /* Validate the parameters */ - - flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY | - HEAP_REALLOC_IN_PLACE_ONLY; - flags |= heapPtr->flags; - heap_lock( heapPtr, flags ); rounded_size = ROUND_SIZE(size) + HEAP_TAIL_EXTRA_SIZE(flags); - if (rounded_size < size) goto oom; /* overflow */ + if (rounded_size < size) return STATUS_NO_MEMORY; /* overflow */ if (rounded_size < HEAP_MIN_DATA_SIZE) rounded_size = HEAP_MIN_DATA_SIZE; pArena = (ARENA_INUSE *)ptr - 1; - if (!validate_block_pointer( heapPtr, &subheap, pArena )) goto error; + if (!validate_block_pointer( heap, &subheap, pArena )) return STATUS_INVALID_PARAMETER; + if (!subheap) { - if (!(ret = realloc_large_block( heapPtr, flags, ptr, size ))) goto oom; - goto done; + if (!(*ret = realloc_large_block( heap, flags, ptr, size ))) return STATUS_NO_MEMORY; + return STATUS_SUCCESS; } /* Check if we need to grow the block */ @@ -1826,12 +1796,12 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size if (rounded_size >= HEAP_MIN_LARGE_BLOCK_SIZE && (flags & HEAP_GROWABLE)) { - if (flags & HEAP_REALLOC_IN_PLACE_ONLY) goto oom; - if (!(ret = allocate_large_block( heapPtr, flags, size ))) goto oom; - memcpy( ret, pArena + 1, oldActualSize ); + if (flags & HEAP_REALLOC_IN_PLACE_ONLY) return STATUS_NO_MEMORY; + if (!(*ret = allocate_large_block( heap, flags, size ))) return STATUS_NO_MEMORY; + memcpy( *ret, pArena + 1, oldActualSize ); notify_free( pArena + 1 ); HEAP_MakeInUseBlockFree( subheap, pArena ); - goto done; + return STATUS_SUCCESS; } if ((pNext < (char *)subheap->base + subheap->size) && (*(DWORD *)pNext & ARENA_FLAG_FREE) && @@ -1841,7 +1811,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size ARENA_FREE *pFree = (ARENA_FREE *)pNext; list_remove( &pFree->entry ); pArena->size += (pFree->size & ARENA_SIZE_MASK) + sizeof(*pFree); - if (!HEAP_Commit( subheap, pArena, rounded_size )) goto oom; + if (!HEAP_Commit( subheap, pArena, rounded_size )) return STATUS_NO_MEMORY; notify_realloc( pArena + 1, oldActualSize, size ); HEAP_ShrinkBlock( subheap, pArena, rounded_size ); } @@ -1851,9 +1821,8 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size ARENA_INUSE *pInUse; SUBHEAP *newsubheap; - if ((flags & HEAP_REALLOC_IN_PLACE_ONLY) || - !(pNew = HEAP_FindFreeBlock( heapPtr, rounded_size, &newsubheap ))) - goto oom; + if (flags & HEAP_REALLOC_IN_PLACE_ONLY) return STATUS_NO_MEMORY; + if (!(pNew = HEAP_FindFreeBlock( heap, rounded_size, &newsubheap ))) return STATUS_NO_MEMORY; /* Build the in-use arena */ @@ -1894,24 +1863,33 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size /* Return the new arena */ - ret = pArena + 1; -done: - heap_unlock( heapPtr, flags ); - TRACE("(%p,%08x,%p,%08lx): returning %p\n", heap, flags, ptr, size, ret ); - return ret; + *ret = pArena + 1; + return STATUS_SUCCESS; +} -oom: - heap_unlock( heapPtr, flags ); - if (flags & HEAP_GENERATE_EXCEPTIONS) RtlRaiseStatus( STATUS_NO_MEMORY ); - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_NO_MEMORY ); - TRACE("(%p,%08x,%p,%08lx): returning NULL\n", heap, flags, ptr, size ); - return NULL; +/*********************************************************************** + * RtlReAllocateHeap (NTDLL.@) + */ +void *WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, void *ptr, SIZE_T size ) +{ + void *ret = NULL; + NTSTATUS status; + HEAP *heapPtr; -error: - heap_unlock( heapPtr, flags ); - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); - TRACE("(%p,%08x,%p,%08lx): returning NULL\n", heap, flags, ptr, size ); - return NULL; + if (!ptr) return NULL; + + if (!(heapPtr = HEAP_GetPtr( heap ))) + status = STATUS_INVALID_HANDLE; + else + { + heap_lock( heapPtr, flags ); + status = heap_reallocate( heapPtr, heap_get_flags( heapPtr, flags ), ptr, size, &ret ); + heap_unlock( heapPtr, flags ); + } + + TRACE( "heap %p, flags %#x, ptr %p, size %#Ix, return %p, status %#x.\n", heap, flags, ptr, size, ret, status ); + heap_set_status( heap, flags, status ); + return ret; }
1
0
0
0
Rémi Bernon : ntdll: Split RtlFreeHeap to a separate heap_free helper.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: e2258ef559c8b0a8265437933ddad2743287d352 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e2258ef559c8b0a826543793…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Apr 28 01:04:20 2022 +0200 ntdll: Split RtlFreeHeap to a separate heap_free helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 2 ++ dlls/ntdll/heap.c | 71 ++++++++++++++++++---------------------------- 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 92e90b56deb..45a22adcf2e 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -229,6 +229,8 @@ static void test_HeapCreate(void) /* test some border cases */ + ret = HeapFree( NULL, 0, NULL ); + ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); ret = HeapFree( heap, 0, NULL ); ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); #if 0 /* crashes */ diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index f3dd6ab6c67..1a4d5b1a2bb 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -1725,60 +1725,45 @@ void *WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T } -/*********************************************************************** - * RtlFreeHeap (NTDLL.@) - * - * Free a memory block allocated with RtlAllocateHeap(). - * - * PARAMS - * heap [I] Heap that block was allocated from - * flags [I] HEAP_ flags from "winnt.h" - * ptr [I] Block to free - * - * RETURNS - * Success: TRUE, if ptr is NULL or was freed successfully. - * Failure: FALSE. - */ -BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE heap, ULONG flags, void *ptr ) +static NTSTATUS heap_free( HEAP *heap, void *ptr ) { - ARENA_INUSE *pInUse; + ARENA_INUSE *block; SUBHEAP *subheap; - HEAP *heapPtr; - /* Validate the parameters */ + /* Inform valgrind we are trying to free memory, so it can throw up an error message */ + notify_free( ptr ); - if (!ptr) return TRUE; /* freeing a NULL ptr isn't an error in Win2k */ + block = (ARENA_INUSE *)ptr - 1; + if (!validate_block_pointer( heap, &subheap, block )) return STATUS_INVALID_PARAMETER; - heapPtr = HEAP_GetPtr( heap ); - if (!heapPtr) - { - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE ); - return FALSE; - } + if (!subheap) free_large_block( heap, ptr ); + else HEAP_MakeInUseBlockFree( subheap, block ); - heap_lock( heapPtr, flags ); + return STATUS_SUCCESS; +} - /* Inform valgrind we are trying to free memory, so it can throw up an error message */ - notify_free( ptr ); +/*********************************************************************** + * RtlFreeHeap (NTDLL.@) + */ +BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE heap, ULONG flags, void *ptr ) +{ + NTSTATUS status; + HEAP *heapPtr; - /* Some sanity checks */ - pInUse = (ARENA_INUSE *)ptr - 1; - if (!validate_block_pointer( heapPtr, &subheap, pInUse )) goto error; + if (!ptr) return TRUE; - if (!subheap) - free_large_block( heapPtr, ptr ); + if (!(heapPtr = HEAP_GetPtr( heap ))) + status = STATUS_INVALID_PARAMETER; else - HEAP_MakeInUseBlockFree( subheap, pInUse ); - - heap_unlock( heapPtr, flags ); - TRACE("(%p,%08x,%p): returning TRUE\n", heap, flags, ptr ); - return TRUE; + { + heap_lock( heapPtr, flags ); + status = heap_free( heapPtr, ptr ); + heap_unlock( heapPtr, flags ); + } -error: - heap_unlock( heapPtr, flags ); - RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER ); - TRACE("(%p,%08x,%p): returning FALSE\n", heap, flags, ptr ); - return FALSE; + TRACE( "heap %p, flags %#x, ptr %p, return %u, status %#x.\n", heap, flags, ptr, !status, status ); + heap_set_status( heapPtr, flags, status ); + return !status; }
1
0
0
0
Rémi Bernon : ntdll: Split RtlAllocateHeap to a separate heap_allocate helper.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: dadb1fa72ff7e708ac8202b1c365e376ddd75da7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dadb1fa72ff7e708ac8202b1…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 3 14:53:07 2022 +0200 ntdll: Split RtlAllocateHeap to a separate heap_allocate helper. Factoring out locking and status handling. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 2 +- dlls/ntdll/heap.c | 84 ++++++++++++++++++++-------------------------- 2 files changed, 37 insertions(+), 49 deletions(-) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index cc02140f453..92e90b56deb 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -411,6 +411,7 @@ static void test_HeapCreate(void) /* shrinking a very large block decommits pages and fail to grow in place */ ptr1 = HeapReAlloc( heap, HEAP_REALLOC_IN_PLACE_ONLY, ptr, alloc_size * 3 / 2 ); ok( ptr1 == ptr, "HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY failed, error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); ptr1 = HeapReAlloc( heap, HEAP_REALLOC_IN_PLACE_ONLY, ptr, 2 * alloc_size ); todo_wine ok( ptr1 != ptr, "HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY succeeded\n" ); @@ -482,7 +483,6 @@ static void test_HeapCreate(void) SetLastError( 0xdeadbeef ); ptr1 = HeapAlloc( heap, 0, 4 * alloc_size ); ok( !ptr1, "HeapAlloc succeeded\n" ); - todo_wine ok( GetLastError() == ERROR_NOT_ENOUGH_MEMORY, "got error %lu\n", GetLastError() ); ret = HeapFree( heap, 0, ptr1 ); ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index cd7e44cc717..f3dd6ab6c67 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -349,6 +349,12 @@ static void heap_unlock( HEAP *heap, ULONG flags ) RtlLeaveCriticalSection( &heap->cs ); } +static void heap_set_status( const HEAP *heap, ULONG flags, NTSTATUS status ) +{ + if (status == STATUS_NO_MEMORY && (flags & HEAP_GENERATE_EXCEPTIONS)) RtlRaiseStatus( status ); + if (status) RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status ); +} + /*********************************************************************** * HEAP_Dump */ @@ -1648,66 +1654,27 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap ) return 0; } - -/*********************************************************************** - * RtlAllocateHeap (NTDLL.@) - * - * Allocate a memory block from a Heap. - * - * PARAMS - * heap [I] Heap to allocate block from - * flags [I] HEAP_ flags from "winnt.h" - * size [I] Size of the memory block to allocate - * - * RETURNS - * Success: A pointer to the newly allocated block - * Failure: NULL. - * - * NOTES - * This call does not SetLastError(). - */ -void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size ) +static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret ) { ARENA_FREE *pArena; ARENA_INUSE *pInUse; SUBHEAP *subheap; - HEAP *heapPtr = HEAP_GetPtr( heap ); SIZE_T rounded_size; - /* Validate the parameters */ - - if (!heapPtr) return NULL; - flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY; - flags |= heapPtr->flags; rounded_size = ROUND_SIZE(size) + HEAP_TAIL_EXTRA_SIZE( flags ); - if (rounded_size < size) /* overflow */ - { - if (flags & HEAP_GENERATE_EXCEPTIONS) RtlRaiseStatus( STATUS_NO_MEMORY ); - return NULL; - } - if (rounded_size < HEAP_MIN_DATA_SIZE) rounded_size = HEAP_MIN_DATA_SIZE; - heap_lock( heapPtr, flags ); + if (rounded_size < size) return STATUS_NO_MEMORY; /* overflow */ + if (rounded_size < HEAP_MIN_DATA_SIZE) rounded_size = HEAP_MIN_DATA_SIZE; if (rounded_size >= HEAP_MIN_LARGE_BLOCK_SIZE && (flags & HEAP_GROWABLE)) { - void *ret = allocate_large_block( heap, flags, size ); - heap_unlock( heapPtr, flags ); - if (!ret && (flags & HEAP_GENERATE_EXCEPTIONS)) RtlRaiseStatus( STATUS_NO_MEMORY ); - TRACE("(%p,%08x,%08lx): returning %p\n", heap, flags, size, ret ); - return ret; + if (!(*ret = allocate_large_block( heap, flags, size ))) return STATUS_NO_MEMORY; + return STATUS_SUCCESS; } /* Locate a suitable free block */ - if (!(pArena = HEAP_FindFreeBlock( heapPtr, rounded_size, &subheap ))) - { - TRACE("(%p,%08x,%08lx): returning NULL\n", - heap, flags, size ); - heap_unlock( heapPtr, flags ); - if (flags & HEAP_GENERATE_EXCEPTIONS) RtlRaiseStatus( STATUS_NO_MEMORY ); - return NULL; - } + if (!(pArena = HEAP_FindFreeBlock( heap, rounded_size, &subheap ))) return STATUS_NO_MEMORY; /* Remove the arena from the free list */ @@ -1730,10 +1697,31 @@ void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_ notify_alloc( pInUse + 1, size, flags & HEAP_ZERO_MEMORY ); initialize_block( pInUse + 1, size, pInUse->unused_bytes, flags ); - heap_unlock( heapPtr, flags ); + *ret = pInUse + 1; + return STATUS_SUCCESS; +} + +/*********************************************************************** + * RtlAllocateHeap (NTDLL.@) + */ +void *WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size ) +{ + void *ptr = NULL; + NTSTATUS status; + HEAP *heapPtr; + + if (!(heapPtr = HEAP_GetPtr( heap ))) + status = STATUS_INVALID_HANDLE; + else + { + heap_lock( heapPtr, flags ); + status = heap_allocate( heapPtr, heap_get_flags( heapPtr, flags ), size, &ptr ); + heap_unlock( heapPtr, flags ); + } - TRACE("(%p,%08x,%08lx): returning %p\n", heap, flags, size, pInUse + 1 ); - return pInUse + 1; + TRACE( "heap %p, flags %#x, size %#Ix, return %p, status %#x.\n", heap, flags, size, ptr, status ); + heap_set_status( heapPtr, flags, status ); + return ptr; }
1
0
0
0
Rémi Bernon : ntdll: Split HEAP_IsRealArena to heap_validate and heap_validate_ptr.
by Alexandre Julliard
12 May '22
12 May '22
Module: wine Branch: master Commit: 80a1155ca8f344e892c995c036523c4ce563841d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=80a1155ca8f344e892c995c0…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 3 15:43:45 2022 +0200 ntdll: Split HEAP_IsRealArena to heap_validate and heap_validate_ptr. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 53 +++++++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 10140fed339..cd7e44cc717 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -181,7 +181,7 @@ typedef struct tagHEAP static HEAP *processHeap; /* main process heap */ -static BOOL HEAP_IsRealArena( HEAP *heapPtr, LPCVOID block, BOOL quiet ); +static BOOL heap_validate( HEAP *heap, BOOL quiet ); /* mark a block of memory as free for debugging purposes */ static inline void mark_block_free( void *ptr, SIZE_T size, DWORD flags ) @@ -480,7 +480,7 @@ static HEAP *HEAP_GetPtr( if (heapPtr->flags & HEAP_VALIDATE_ALL) { heap_lock( heapPtr, 0 ); - valid = HEAP_IsRealArena( heapPtr, NULL, NOISY ); + valid = heap_validate( heapPtr, NOISY ); heap_unlock( heapPtr, 0 ); if (!valid && TRACE_ON(heap)) @@ -1344,44 +1344,32 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE * } -/*********************************************************************** - * HEAP_IsRealArena [Internal] - * Validates a block is a valid arena. - * - * RETURNS - * TRUE: Success - * FALSE: Failure - */ -static BOOL HEAP_IsRealArena( HEAP *heap, /* [in] ptr to the heap */ - LPCVOID block, /* [in] Optional pointer to memory block to validate */ - BOOL quiet ) /* [in] Flag - if true, HEAP_ValidateInUseArena - * does not complain */ +static BOOL heap_validate_ptr( HEAP *heap, const void *ptr ) { - SUBHEAP *subheap; + const ARENA_INUSE *arena = (const ARENA_INUSE *)ptr - 1; const ARENA_LARGE *large_arena; + SUBHEAP *subheap; - if (block) /* only check this single memory block */ + if (!(subheap = HEAP_FindSubHeap( heap, arena )) || + ((const char *)arena < (char *)subheap->base + subheap->headerSize)) { - const ARENA_INUSE *arena = (const ARENA_INUSE *)block - 1; - - if (!(subheap = HEAP_FindSubHeap( heap, arena )) || - ((const char *)arena < (char *)subheap->base + subheap->headerSize)) + if (!(large_arena = find_large_block( heap, ptr ))) { - if (!(large_arena = find_large_block( heap, block ))) - { - if (quiet == NOISY) - ERR("Heap %p: block %p is not inside heap\n", heap, block ); - else if (WARN_ON(heap)) - WARN("Heap %p: block %p is not inside heap\n", heap, block ); - return FALSE; - } - - return validate_large_arena( heap, large_arena, quiet ); + if (WARN_ON(heap)) WARN("heap %p, ptr %p is not inside heap\n", heap, ptr ); + return FALSE; } - return HEAP_ValidateInUseArena( subheap, arena, quiet ); + return validate_large_arena( heap, large_arena, QUIET ); } + return HEAP_ValidateInUseArena( subheap, arena, QUIET ); +} + +static BOOL heap_validate( HEAP *heap, BOOL quiet ) +{ + const ARENA_LARGE *large_arena; + SUBHEAP *subheap; + LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) { char *ptr = (char *)subheap->base + subheap->headerSize; @@ -2087,7 +2075,8 @@ BOOLEAN WINAPI RtlValidateHeap( HANDLE heap, ULONG flags, const void *ptr ) else { heap_lock( heapPtr, flags ); - ret = HEAP_IsRealArena( heapPtr, ptr, QUIET ); + if (ptr) ret = heap_validate_ptr( heapPtr, ptr ); + else ret = heap_validate( heapPtr, QUIET ); heap_unlock( heapPtr, flags ); }
1
0
0
0
← Newer
1
...
56
57
58
59
60
61
62
...
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