kernel32: Move heap functions to kernelbase.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
61516e2223
commit
cad0f61808
|
@ -171,85 +171,6 @@ BOOL WINAPI HeapDestroy( HANDLE heap /* [in] Handle of heap */ )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapCompact (KERNEL32.@)
|
||||
*/
|
||||
SIZE_T WINAPI HeapCompact( HANDLE heap, DWORD flags )
|
||||
{
|
||||
return RtlCompactHeap( heap, flags );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapValidate (KERNEL32.@)
|
||||
* Validates a specified heap.
|
||||
*
|
||||
* NOTES
|
||||
* Flags is ignored.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE: Success
|
||||
* FALSE: Failure
|
||||
*/
|
||||
BOOL WINAPI HeapValidate(
|
||||
HANDLE heap, /* [in] Handle to the heap */
|
||||
DWORD flags, /* [in] Bit flags that control access during operation */
|
||||
LPCVOID block /* [in] Optional pointer to memory block to validate */
|
||||
) {
|
||||
return RtlValidateHeap( heap, flags, block );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapWalk (KERNEL32.@)
|
||||
* Enumerates the memory blocks in a specified heap.
|
||||
*
|
||||
* TODO
|
||||
* - handling of PROCESS_HEAP_ENTRY_MOVEABLE and
|
||||
* PROCESS_HEAP_ENTRY_DDESHARE (needs heap.c support)
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE: Success
|
||||
* FALSE: Failure
|
||||
*/
|
||||
BOOL WINAPI HeapWalk(
|
||||
HANDLE heap, /* [in] Handle to heap to enumerate */
|
||||
LPPROCESS_HEAP_ENTRY entry /* [out] Pointer to structure of enumeration info */
|
||||
) {
|
||||
NTSTATUS ret = RtlWalkHeap( heap, entry );
|
||||
if (ret) SetLastError( RtlNtStatusToDosError(ret) );
|
||||
return !ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapLock (KERNEL32.@)
|
||||
* Attempts to acquire the critical section object for a specified heap.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE: Success
|
||||
* FALSE: Failure
|
||||
*/
|
||||
BOOL WINAPI HeapLock(
|
||||
HANDLE heap /* [in] Handle of heap to lock for exclusive access */
|
||||
) {
|
||||
return RtlLockHeap( heap );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapUnlock (KERNEL32.@)
|
||||
* Releases ownership of the critical section object.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE: Success
|
||||
* FALSE: Failure
|
||||
*/
|
||||
BOOL WINAPI HeapUnlock(
|
||||
HANDLE heap /* [in] Handle to the heap to unlock */
|
||||
) {
|
||||
return RtlUnlockHeap( heap );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -278,21 +199,6 @@ SIZE_T WINAPI HeapSize( HANDLE heap, DWORD flags, LPCVOID ptr )
|
|||
return RtlSizeHeap( heap, flags, ptr );
|
||||
}
|
||||
|
||||
BOOL WINAPI HeapQueryInformation( HANDLE heap, HEAP_INFORMATION_CLASS info_class,
|
||||
PVOID info, SIZE_T size_in, PSIZE_T size_out)
|
||||
{
|
||||
NTSTATUS ret = RtlQueryHeapInformation( heap, info_class, info, size_in, size_out );
|
||||
if (ret) SetLastError( RtlNtStatusToDosError(ret) );
|
||||
return !ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI HeapSetInformation( HANDLE heap, HEAP_INFORMATION_CLASS infoclass, PVOID info, SIZE_T size)
|
||||
{
|
||||
NTSTATUS ret = RtlSetHeapInformation( heap, infoclass, info, size );
|
||||
if (ret) SetLastError( RtlNtStatusToDosError(ret) );
|
||||
return !ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Win32 Global heap functions (GlobalXXX).
|
||||
* These functions included in Win32 for compatibility with 16 bit Windows
|
||||
|
|
|
@ -918,24 +918,24 @@
|
|||
@ stub Heap32ListNext
|
||||
@ stub Heap32Next
|
||||
@ stdcall HeapAlloc(long long long) ntdll.RtlAllocateHeap
|
||||
@ stdcall HeapCompact(long long)
|
||||
@ stdcall -import HeapCompact(long long)
|
||||
@ stdcall HeapCreate(long long long)
|
||||
@ stub HeapCreateTagsW
|
||||
@ stdcall HeapDestroy(long)
|
||||
@ stub HeapExtend
|
||||
@ stdcall HeapFree(long long ptr) ntdll.RtlFreeHeap
|
||||
@ stdcall HeapLock(long)
|
||||
@ stdcall HeapQueryInformation(long long ptr long ptr)
|
||||
@ stdcall HeapFree(long long ptr)
|
||||
@ stdcall -import HeapLock(long)
|
||||
@ stdcall -import HeapQueryInformation(long long ptr long ptr)
|
||||
@ stub HeapQueryTagW
|
||||
@ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap
|
||||
@ stub HeapSetFlags
|
||||
@ stdcall HeapSetInformation(ptr long ptr long)
|
||||
@ stdcall -import HeapSetInformation(ptr long ptr long)
|
||||
@ stdcall HeapSize(long long ptr) ntdll.RtlSizeHeap
|
||||
@ stub HeapSummary
|
||||
@ stdcall HeapUnlock(long)
|
||||
@ stdcall -import HeapUnlock(long)
|
||||
@ stub HeapUsage
|
||||
@ stdcall HeapValidate(long long ptr)
|
||||
@ stdcall HeapWalk(long ptr)
|
||||
@ stdcall -import HeapValidate(long long ptr)
|
||||
@ stdcall -import HeapWalk(long ptr)
|
||||
@ stdcall IdnToAscii(long wstr long ptr long)
|
||||
@ stdcall IdnToNameprepUnicode(long wstr long ptr long)
|
||||
@ stdcall IdnToUnicode(long wstr long ptr long)
|
||||
|
|
|
@ -773,19 +773,19 @@
|
|||
# @ stub HasPolicyForegroundProcessingCompletedInternal
|
||||
@ stdcall HashData(ptr long ptr long)
|
||||
@ stdcall HeapAlloc(long long long) ntdll.RtlAllocateHeap
|
||||
@ stdcall HeapCompact(long long) kernel32.HeapCompact
|
||||
@ stdcall HeapCreate(long long long) kernel32.HeapCreate
|
||||
@ stdcall HeapDestroy(long) kernel32.HeapDestroy
|
||||
@ stdcall HeapFree(long long ptr) ntdll.RtlFreeHeap
|
||||
@ stdcall HeapLock(long) kernel32.HeapLock
|
||||
@ stdcall HeapQueryInformation(long long ptr long ptr) kernel32.HeapQueryInformation
|
||||
@ stdcall HeapCompact(long long)
|
||||
@ stdcall HeapCreate(long long long)
|
||||
@ stdcall HeapDestroy(long)
|
||||
@ stdcall HeapFree(long long ptr)
|
||||
@ stdcall HeapLock(long)
|
||||
@ stdcall HeapQueryInformation(long long ptr long ptr)
|
||||
@ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap
|
||||
@ stdcall HeapSetInformation(ptr long ptr long) kernel32.HeapSetInformation
|
||||
@ stdcall HeapSetInformation(ptr long ptr long)
|
||||
@ stdcall HeapSize(long long ptr) ntdll.RtlSizeHeap
|
||||
@ stub HeapSummary
|
||||
@ stdcall HeapUnlock(long) kernel32.HeapUnlock
|
||||
@ stdcall HeapValidate(long long ptr) kernel32.HeapValidate
|
||||
@ stdcall HeapWalk(long ptr) kernel32.HeapWalk
|
||||
@ stdcall HeapUnlock(long)
|
||||
@ stdcall HeapValidate(long long ptr)
|
||||
@ stdcall HeapWalk(long ptr)
|
||||
@ stdcall IdnToAscii(long wstr long ptr long) kernel32.IdnToAscii
|
||||
@ stdcall IdnToNameprepUnicode(long wstr long ptr long) kernel32.IdnToNameprepUnicode
|
||||
@ stdcall IdnToUnicode(long wstr long ptr long) kernel32.IdnToUnicode
|
||||
|
|
|
@ -291,3 +291,94 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteProcessMemory( HANDLE process, void *addr, co
|
|||
{
|
||||
return set_ntstatus( NtWriteVirtualMemory( process, addr, buffer, size, bytes_written ));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Heap functions
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapCompact (kernelbase.@)
|
||||
*/
|
||||
SIZE_T WINAPI DECLSPEC_HOTPATCH HeapCompact( HANDLE heap, DWORD flags )
|
||||
{
|
||||
return RtlCompactHeap( heap, flags );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapCreate (kernelbase.@)
|
||||
*/
|
||||
HANDLE WINAPI DECLSPEC_HOTPATCH HeapCreate( DWORD flags, SIZE_T init_size, SIZE_T max_size )
|
||||
{
|
||||
HANDLE ret = RtlCreateHeap( flags, NULL, max_size, init_size, NULL, NULL );
|
||||
if (!ret) SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapDestroy (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH HeapDestroy( HANDLE heap )
|
||||
{
|
||||
if (!RtlDestroyHeap( heap )) return TRUE;
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapLock (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH HeapLock( HANDLE heap )
|
||||
{
|
||||
return RtlLockHeap( heap );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapQueryInformation (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI HeapQueryInformation( HANDLE heap, HEAP_INFORMATION_CLASS info_class,
|
||||
PVOID info, SIZE_T size, PSIZE_T size_out )
|
||||
{
|
||||
return set_ntstatus( RtlQueryHeapInformation( heap, info_class, info, size, size_out ));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapSetInformation (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI HeapSetInformation( HANDLE heap, HEAP_INFORMATION_CLASS infoclass, PVOID info, SIZE_T size )
|
||||
{
|
||||
return set_ntstatus( RtlSetHeapInformation( heap, infoclass, info, size ));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapUnlock (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI HeapUnlock( HANDLE heap )
|
||||
{
|
||||
return RtlUnlockHeap( heap );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapValidate (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH HeapValidate( HANDLE heap, DWORD flags, LPCVOID ptr )
|
||||
{
|
||||
return RtlValidateHeap( heap, flags, ptr );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HeapWalk (kernelbase.@)
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
|
||||
{
|
||||
return set_ntstatus( RtlWalkHeap( heap, entry ));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue