[Bug 33384] Basic WPF applications using .NET 3.5 WPF fails to handle images (windowscodecs {7543696a-bc8d-46b0-5f81-8d95728972be} = IMILBitmapSource unsupported)

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Apr 15 16:45:08 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33384

--- Comment #10 from Anastasius Focht <focht at gmx.net> 2013-04-15 16:45:08 CDT ---
Hello Vincent,

--- quote ---
There isn't any such enum, but most of the pixel formats that were there
originally differ only by the last byte, which happens to be within the needed
range: http://source.winehq.org/source/include/wincodec.idl#L177
--- quote ---

the last byte of the format GUID seems indeed to map to enum int value.

--- snip ---
Indexed1 = 1, 
Indexed2 = 2,
Indexed4 = 3,
Indexed8 = 4,
BlackWhite = 5,
Gray2 = 6,
Gray4 = 7,
Gray8 = 8,
...
--- snip ---

To avoid duplicating BitmapImpl/iface code I quickly hacked
BitmapImpl_QueryInterface() to set a hint in BitmapImpl struct when
IID_IMILBitmapSource is requested.
With that hint I was able to distinguish the out parameter type for
BitmapImpl_GetPixelFormat() -> WICPixelFormatGUID* vs. int* (enum).
I used a GUID to enum translator similar to what converter.c/FormatConverter
does (pixelformat).
That worked but the whole thing crashed later...

There is a vtable access/call after CopyPixels method offset which happens to
be "BitmapImpl_Lock" in Wine (4 params).
Unfortunately the stack got imbalanced by 8 bytes after the method call (only 2
params get pushed).
This hints at a different BitmapImpl vtable layout for MIL.

+0x00: QueryInterface
+0x04: AddRef
+0x08: Release
+0x0C: GetSize
+0x10: GetPixelFormat
+0x14: GetResolution
+0x18: CopyPalette/GetPalette
+0x1C: CopyPixels
+0x20: ???

--- snip ---
...
0024:CALL wpfgfx_v0300.MILQueryInterface(001babb0,0032dc34,0032dc9c)
ret=042f123d
0024:trace:wincodecs:BitmapImpl_QueryInterface
(0x1babb0,{7543696a-bc8d-46b0-5f81-8d95728972be},0x32dc9c)
0024:trace:wincodecs:BitmapImpl_AddRef (0x1babb0) refcount=4
0024:RET  wpfgfx_v0300.MILQueryInterface() retval=00000000 ret=042f123d
0024:CALL wpfgfx_v0300.MilResource_SendCommandBitmapSource(<unknown, check
return>) ret=042f23d7
0024:trace:wincodecs:BitmapImpl_GetPixelFormat (0x1babb0,0x32dbc4)
0024:trace:wincodecs:BitmapImpl_AddRef (0x1babb0) refcount=5
0024:trace:wincodecs:BitmapImpl_GetSize (0x1babb0,0x32dbb4,0x32dbb0)
0024:trace:wincodecs:BitmapImpl_GetResolution (0x1babb0,0x32dc40,0x32dc38)
0024:trace:wincodecs:BitmapImpl_Lock (0x1babb0,0x32db90,32dc38,0x180)
0024:trace:wincodecs:BitmapImpl_GetSize (0x1babb0,0x49907a8,0x49907ac)
0024:trace:wincodecs:BitmapImpl_GetPixelFormat (0x1babb0,0x49907b8)
0024:trace:wincodecs:BitmapImpl_GetResolution (0x1babb0,0x32db54,0x32db4c)
0024:trace:wincodecs:BitmapImpl_QueryInterface
(0x1babb0,{b1784d3f-8115-4763-13aa-32eddb68294a},0x49907ec)
0024:trace:wincodecs:BitmapImpl_AddRef (0x1babb0) refcount=6
0024:trace:seh:raise_exception code=c0000005 flags=0 addr=0x32dc39 ip=0032dc39
tid=0024
0024:trace:seh:raise_exception  info[0]=00000001
0024:trace:seh:raise_exception  info[1]=00000000
0024:trace:seh:raise_exception  eax=00000000 ebx=5403fd31 ecx=54008b30
edx=0499076d esi=0032dc48 edi=00000000
0024:trace:seh:raise_exception  ebp=04990768 esp=0032db9c cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010202 
...
--- snip ---

Managed backtrace:

--- snip ---
System.AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
   at
System.Windows.Media.Composition.DUCE.UnsafeNativeMethods.MilResource_SendCommandBitmapSource(ResourceHandle
handle, BitmapSourceSafeMILHandle pBitmapSource, Boolean shareBitmap, Boolean
systemMemoryBitmap, IntPtr pChannel)
   at
System.Windows.Media.Composition.DUCE.Channel.SendCommandBitmapSource(ResourceHandle
imageHandle, BitmapSourceSafeMILHandle pBitmapSource, Boolean shareBitmap,
Boolean systemMemoryBitmap)
   at
System.Windows.Media.Imaging.BitmapSource.UpdateBitmapSourceResource(Channel
channel, Boolean skipOnChannelCheck)
   at System.Windows.Media.Imaging.BitmapSource.UpdateResource(Channel channel,
Boolean skipOnChannelCheck)
   at System.Windows.Media.Imaging.BitmapSource.AddRefOnChannelCore(Channel
channel)
   at
System.Windows.Media.Imaging.BitmapSource.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel
channel)
   at
System.Windows.Media.RenderData.System.Windows.Media.Composition.DUCE.IResource.AddRefOnChannel(Channel
channel)
   at System.Windows.UIElement.RenderContent(RenderContext ctx, Boolean
isOnChannel)
   at System.Windows.Media.Visual.UpdateContent(RenderContext ctx,
VisualProxyFlags flags, Boolean isOnChannel)
   at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx)
--- snip ---

I'm a bit out of ideas now ... even if IMILBitmapSource seems pretty similar to
IWICBitmapSource, some internal representation seems different. 

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list