[PATCH] mfplat: Implement MFHeap[Alloc|Free].

Nikolay Sivov nsivov at codeweavers.com
Thu Feb 21 12:42:07 CST 2019


On 2/21/19 8:36 PM, Gijs Vermeulen wrote:

> Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
> ---
>   dlls/mfplat/main.c      | 12 ++++++++++++
>   dlls/mfplat/mfplat.spec |  4 ++--
>   include/mfapi.h         |  7 +++++++
>   3 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
> index 21240dfbeb..a4c185733e 100644
> --- a/dlls/mfplat/main.c
> +++ b/dlls/mfplat/main.c
> @@ -3871,3 +3871,15 @@ HRESULT WINAPI MFCreateSample(IMFSample **sample)
>   
>       return S_OK;
>   }
> +
> +void *WINAPI MFHeapAlloc(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type)
> +{
> +    TRACE("%lu %x %s %d %x\n", size, flags, file, line, type);
> +    return HeapAlloc(GetProcessHeap(), flags, size);
> +}

If we're going to trace this, please use debugstr_a().

Also please add a basic test like alloc(16) -> free() or similar, to 
cover at least something.

Did you find some application calling this directly?

> diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec
> index 8f5ee77406..57a87ef8d2 100644
> --- a/dlls/mfplat/mfplat.spec
> +++ b/dlls/mfplat/mfplat.spec
> @@ -103,8 +103,8 @@
>   @ stub MFGetUncompressedVideoFormat
>   @ stub MFGetWorkQueueMMCSSClass
>   @ stub MFGetWorkQueueMMCSSTaskId
> -@ stub MFHeapAlloc
> -@ stub MFHeapFree
> +@ stdcall MFHeapAlloc(long long str long long)
> +@ stdcall MFHeapFree(ptr)
>   @ stub MFInitAMMediaTypeFromMFMediaType
>   @ stub MFInitAttributesFromBlob
>   @ stub MFInitMediaTypeFromAMMediaType
> diff --git a/include/mfapi.h b/include/mfapi.h
> index d70a300a3c..79b05c69e1 100644
> --- a/include/mfapi.h
> +++ b/include/mfapi.h
> @@ -68,6 +68,13 @@ typedef struct tagMFASYNCRESULT
>       HANDLE hEvent;
>   } MFASYNCRESULT;
>   
> +typedef enum _EAllocationType {
> +    eAllocationTypeDynamic,
> +    eAllocationTypeRT,
> +    eAllocationTypePageable,
> +    eAllocationTypeIgnore
> +} EAllocationType;
> +
>   DEFINE_GUID(MF_MT_AVG_BITRATE,         0x20332624, 0xfb0d, 0x4d9e, 0xbd, 0x0d, 0xcb, 0xf6, 0x78, 0x6c, 0x10, 0x2e);
>   DEFINE_GUID(MF_MT_FRAME_RATE,          0xc459a2e8, 0x3d2c, 0x4e44, 0xb1, 0x32, 0xfe, 0xe5, 0x15, 0x6c, 0x7b, 0xb0);
>   DEFINE_GUID(MF_MT_FRAME_SIZE,          0x1652c33d, 0xd6b2, 0x4012, 0xb8, 0x34, 0x72, 0x03, 0x08, 0x49, 0xa3, 0x7d);



More information about the wine-devel mailing list