ntoskrnl: Reimplement ExAllocatePool* on top of ExAllocatePool2.
Microsoft deprecated all of these functions except ExAllocatePool2 and ExAllocatePool3, so it's a safe bet that in Windows the old functions are just wrappers around the new ones now. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54362
This commit is contained in:
parent
87761a8a92
commit
cba29adf06
3 changed files with 52 additions and 11 deletions
|
@ -2212,44 +2212,83 @@ __ASM_FASTCALL_FUNC(RtlUlonglongByteSwap, 8,
|
|||
|
||||
#endif /* __i386__ */
|
||||
|
||||
/***********************************************************************
|
||||
* ExAllocatePool2 (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
void * WINAPI ExAllocatePool2( POOL_FLAGS flags, SIZE_T size, ULONG tag )
|
||||
{
|
||||
/* FIXME: handle page alignment constraints */
|
||||
void *ret = HeapAlloc( ntoskrnl_heap, 0, size );
|
||||
TRACE( "(0x%I64x, %Iu, %s) -> %p\n", flags, size, debugstr_fourcc(tag), ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static POOL_FLAGS pool_type_to_flags( POOL_TYPE type )
|
||||
{
|
||||
switch (type & 7)
|
||||
{
|
||||
case NonPagedPool:
|
||||
case NonPagedPoolMustSucceed:
|
||||
return POOL_FLAG_NON_PAGED;
|
||||
case PagedPool:
|
||||
return POOL_FLAG_PAGED;
|
||||
case NonPagedPoolCacheAligned:
|
||||
case NonPagedPoolCacheAlignedMustS:
|
||||
return POOL_FLAG_NON_PAGED|POOL_FLAG_CACHE_ALIGNED;
|
||||
case PagedPoolCacheAligned:
|
||||
return POOL_FLAG_PAGED|POOL_FLAG_CACHE_ALIGNED;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExAllocatePool (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
PVOID WINAPI ExAllocatePool( POOL_TYPE type, SIZE_T size )
|
||||
{
|
||||
return ExAllocatePoolWithTag( type, size, 0 );
|
||||
}
|
||||
POOL_FLAGS flags = pool_type_to_flags( type );
|
||||
if (type & POOL_RAISE_IF_ALLOCATION_FAILURE)
|
||||
flags |= POOL_FLAG_RAISE_ON_FAILURE;
|
||||
|
||||
return ExAllocatePool2( flags, size, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExAllocatePoolWithQuota (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
PVOID WINAPI ExAllocatePoolWithQuota( POOL_TYPE type, SIZE_T size )
|
||||
{
|
||||
return ExAllocatePoolWithTag( type, size, 0 );
|
||||
}
|
||||
POOL_FLAGS flags = pool_type_to_flags( type ) | POOL_FLAG_USE_QUOTA;
|
||||
if (!(type & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))
|
||||
flags |= POOL_FLAG_RAISE_ON_FAILURE;
|
||||
|
||||
return ExAllocatePool2( flags, size, 0 );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExAllocatePoolWithTag (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
PVOID WINAPI ExAllocatePoolWithTag( POOL_TYPE type, SIZE_T size, ULONG tag )
|
||||
{
|
||||
/* FIXME: handle page alignment constraints */
|
||||
void *ret = HeapAlloc( ntoskrnl_heap, 0, size );
|
||||
TRACE( "%Iu pool %u -> %p\n", size, type, ret );
|
||||
return ret;
|
||||
}
|
||||
POOL_FLAGS flags = pool_type_to_flags( type );
|
||||
if (type & POOL_RAISE_IF_ALLOCATION_FAILURE)
|
||||
flags |= POOL_FLAG_RAISE_ON_FAILURE;
|
||||
|
||||
return ExAllocatePool2( flags, size, tag );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExAllocatePoolWithQuotaTag (NTOSKRNL.EXE.@)
|
||||
*/
|
||||
PVOID WINAPI ExAllocatePoolWithQuotaTag( POOL_TYPE type, SIZE_T size, ULONG tag )
|
||||
{
|
||||
return ExAllocatePoolWithTag( type, size, tag );
|
||||
}
|
||||
POOL_FLAGS flags = pool_type_to_flags( type ) | POOL_FLAG_USE_QUOTA;
|
||||
if (!(type & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE))
|
||||
flags |= POOL_FLAG_RAISE_ON_FAILURE;
|
||||
|
||||
return ExAllocatePool2( flags, size, tag );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ExCreateCallback (NTOSKRNL.EXE.@)
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
@ stdcall ExAcquireSharedWaitForExclusive(ptr long)
|
||||
@ stub ExAllocateFromPagedLookasideList
|
||||
@ stdcall ExAllocatePool(long long)
|
||||
@ stdcall ExAllocatePool2(int64 long long)
|
||||
@ stdcall ExAllocatePoolWithQuota(long long)
|
||||
@ stdcall ExAllocatePoolWithQuotaTag(long long long)
|
||||
@ stdcall ExAllocatePoolWithTag(long long long)
|
||||
|
|
|
@ -1704,6 +1704,7 @@ BOOLEAN WINAPI ExAcquireSharedStarveExclusive(ERESOURCE*,BOOLEAN);
|
|||
BOOLEAN WINAPI ExAcquireSharedWaitForExclusive(ERESOURCE*,BOOLEAN);
|
||||
void WINAPI ExFreePool(PVOID);
|
||||
PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePool) __WINE_MALLOC;
|
||||
PVOID WINAPI ExAllocatePool2(POOL_FLAGS,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePool) __WINE_MALLOC;
|
||||
PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePool) __WINE_MALLOC;
|
||||
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
|
||||
PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePoolWithTag) __WINE_MALLOC;
|
||||
|
|
Loading…
Add table
Reference in a new issue