[2/3] msvfw32: Ask the driver about how much data is required for lpbiOut
Bruno Jesus
00cpxxx at gmail.com
Wed Oct 21 00:30:48 CDT 2015
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Depending on bpp the colors will be put just after the
BITMAPINFOHEADER so allocating a fixed buffer size is not enough.
Noticed while making a test with the MSRLE codec.
-------------- next part --------------
---
dlls/msvfw32/msvideo_main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index db71014..717bcf9 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -1458,7 +1458,13 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
if (!pc->lpbiOut)
{
- pc->lpbiOut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFO));
+ /* Ask compressor for needed header size */
+ int size = ICSendMessage(pc->hic, ICM_COMPRESS_GET_FORMAT,
+ (DWORD_PTR)pc->lpbiIn, 0);
+ if (size <= 0)
+ goto error;
+
+ pc->lpbiOut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (!pc->lpbiOut)
goto error;
/* Flag to show that we allocated lpbiOut for proper cleanup */
--
2.1.4
More information about the wine-patches
mailing list