http://bugs.winehq.org/show_bug.cgi?id=33384
--- Comment #8 from Anastasius Focht focht@gmx.net 2013-04-14 18:13:26 CDT --- Hello folks,
well it seems I was wrong on "exact" the same parameters. It seems there is at least another deviation in the interface.
For testing I added IMILBitmapSource to .idl file and allowed BitmapImpl_QueryInterface to return BitmapImpl for IID_IMILBitmapSource.
This gets the app a little farther only to run into:
--- snip --- ... 002b:CALL wpfgfx_v0300.MilResource_SendCommandBitmapSource(<unknown, check return>) ret=044123d7 002b:trace:wincodecs:BitmapImpl_GetPixelFormat (0x1b2de8,0x32dbc4) 002b:trace:wincodecs:BitmapImpl_AddRef (0x1b2de8) refcount=5 002b:trace:wincodecs:BitmapImpl_GetSize (0x1b2de8,0x32dbb4,0x32dbb0) 002b:trace:wincodecs:BitmapImpl_GetResolution (0x1b2de8,0x32dc40,0x32dc38) 002b:fixme:wer:WerRegisterMemoryBlock (0x5418ebf0 6144) stub 002b:fixme:wer:WerRegisterMemoryBlock (0x5418ebe8 4) stub 002b:trace:wincodecs:BitmapImpl_Release (0x1b2de8) refcount=4 002b:RET wpfgfx_v0300.MilResource_SendCommandBitmapSource(00000010,001b2de8,00000001,00000001,0018b1d0) retval=80070216 ret=044123d7 ... 002b:trace:seh:raise_exception code=e0434f4d flags=1 addr=0x7b83aabb ip=7b83aabb tid=002b 002b:trace:seh:raise_exception info[0]=80131516 002b:trace:seh:raise_exception eax=7b826891 ebx=7b8b96b0 ecx=80131516 edx=0032db38 esi=0032dbc0 edi=00133148 002b:trace:seh:raise_exception ebp=0032db78 esp=0032db14 cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00000283 002b:trace:seh:call_stack_handlers calling handler at 0x79f908a2 code=e0434f4d flags=1 ... 0033:err:eventlog:ReportEventW L"clr20r3" 0033:err:eventlog:ReportEventW L"winetest.exe" 0033:err:eventlog:ReportEventW L"1.0.0.0" 0033:err:eventlog:ReportEventW L"5168fd72" 0033:err:eventlog:ReportEventW L"presentationcore" 0033:err:eventlog:ReportEventW L"3.0.0.0" 0033:err:eventlog:ReportEventW L"488f140b" 0033:err:eventlog:ReportEventW L"480" 0033:err:eventlog:ReportEventW L"29" 0033:err:eventlog:ReportEventW L"system.overflowexception" 0033:err:eventlog:ReportEventW L"NIL" --- snip ---
Managed backtrace:
--- snip --- System.OverflowException: The image data generated an overflow during processing. ---> System.ArithmeticException: Overflow or underflow in the arithmetic operation. --- End of inner exception stack trace --- 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) at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle) at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx) at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle) at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx) at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle) at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx) at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle) at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx) at System.Windows.Media.Visual.UpdateChildren(RenderContext ctx, ResourceHandle handle) at System.Windows.Media.Visual.RenderRecursive(RenderContext ctx) at System.Windows.Media.Visual.Render(RenderContext ctx, UInt32 childIndex) at System.Windows.Media.CompositionTarget.Compile(Channel channel) at System.Windows.Media.CompositionTarget.System.Windows.Media.ICompositionTarget.Render(Boolean inResize, Channel channel) at System.Windows.Media.MediaContext.Render(ICompositionTarget resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget) at System.Windows.Interop.HwndTarget.OnResize() --- snip ---
After a bit of debugging it seems the pixel format is not correct. The overflow happens when .NET MIL looks at BitmapImpl_GetPixelFormat() data. It seems IMILBitmapSource::GetPixelFormat is expected as integer value (enum?), not a GUID. The code verifies the parameter value range to 0..0x2c and throws the overflow error > 0x2c.
I don't have the WIC SDK but maybe there exist an enumerator for pixel formats (which maps to GUIDs and vise versa).
So we need a separate impl to cope with different GetPixelFormat() at least. Still BitmapImpl code could be reused.
Regards