flat assembler
Message board for the users of flat assembler.
Index
> Windows > [solved]WIC+D2D1+LayeredWindow+headache Goto page 1, 2, 3 Next |
Author |
|
Overclick 25 Jul 2021, 00:01
Hi
Please read the end of conversation to see my current issue Last edited by Overclick on 19 Aug 2021, 16:09; edited 3 times in total |
|||
25 Jul 2021, 00:01 |
|
revolution 26 Jul 2021, 01:46
You can load any data into any place you want within the exe.
The only reason to use the resource section is to allow other programs to read and/or write and/or update data from/into the exe file without having to recompile from source. |
|||
26 Jul 2021, 01:46 |
|
Overclick 26 Jul 2021, 08:12
Res is easy to manage, that why we use it for many options it's provide: manifest, dialog items, etc.
Many converter examples works by external image files, not ID of that preloaded files. I had few options to use: 1) WIC with temporary files 2) WIC with external resourses 3) ID based conversion technique like GDI+,OLE,etc 4) ... or do as I said to keep it working by WIC. |
|||
26 Jul 2021, 08:12 |
|
Furs 26 Jul 2021, 12:10
Overclick wrote: Seems it is IWICImagingFactory::CreateBitmapFromMemory method, just don't understand what exactly the stride means?.. For 24-bit RGB, it's ROUND_TO_DWORD(width * 3) bytes (it always rounds up to a DWORD, i.e. 4 bytes). So it can have padding if width isn't divisible by 4. |
|||
26 Jul 2021, 12:10 |
|
Overclick 27 Jul 2021, 09:24
Thanks for your help but if it always rounds up to DWORD why they made it editable? And isn't it Width * 4 then?
|
|||
27 Jul 2021, 09:24 |
|
Furs 27 Jul 2021, 12:31
Overclick wrote: Thanks for your help but if it always rounds up to DWORD why they made it editable? And isn't it Width * 4 then? For example consider width == 7, 24 bpp, a stride would be: Code: ROUND_TO_DWORD(7*3) = 24 (from 21, so 3 extra bytes of padding at the end) Code: 7*4 = 28 |
|||
27 Jul 2021, 12:31 |
|
Overclick 04 Aug 2021, 07:12
What I'm doing wrong?
Code: .idata import D2d1,\ D2D1CreateFactory,'D2D1CreateFactory' import ole32,\ CoInitializeEx,'CoInitializeEx',\ CoUninitialize,'CoUninitialize',\ CoCreateInstance,'CoCreateInstance',\ CoGetClassObject,'CoGetClassObject',\ CoTaskMemFree,'CoTaskMemFree' .data interface IWICImagingFactory,\ QueryInterface,\ AddRef,\ Release,\ CreateDecoderFromFilename,\ CreateDecoderFromStream,\ CreateDecoderFromFileHandle,\ CreateComponentInfo,\ CreateDecoder,\ CreateEncoder,\ CreatePalette,\ CreateFormatConverter,\ CreateBitmapScaler,\ CreateBitmapClipper,\ CreateBitmapFlipRotator,\ CreateStream,\ CreateColorContext,\ CreateColorTransformer,\ CreateBitmap,\ CreateBitmapFromSource,\ CreateBitmapFromSourceRect,\ CreateBitmapFromMemory,\ CreateBitmapFromHBITMAP,\ CreateBitmapFromHICON,\ CreateComponentEnumerator,\ CreateFastMetadataEncoderFromDecoder,\ CreateFastMetadataEncoderFromFrameDecode,\ CreateQueryWriter,\ CreateQueryWriterFromReader interface ID2D1Factory,\ QueryInterface,\ AddRef,\ Release,\ ReloadSystemMetrics,\ GetDesktopDpi,\ CreateRectangleGeometry,\ CreateRoundedRectangleGeometry,\ CreateEllipseGeometry,\ CreateGeometryGroup,\ CreateTransformedGeometry,\ CreatePathGeometry,\ CreateStrokeStyle,\ CreateDrawingStateBlock,\ CreateWicBitmapRenderTarget,\ CreateHwndRenderTarget,\ CreateDxgiSurfaceRenderTarget,\ CreateDCRenderTarget interface ID2D1RenderTarget,\ QueryInterface,\ AddRef,\ Release,\ GetFactory,\ CreateBitmap,\ CreateBitmapFromWicBitmap,\ CreateSharedBitmap,\ CreateBitmapBrush,\ CreateSolidColorBrush,\ CreateGradientStopCollection,\ CreateLinearGradientBrush,\ CreateRadialGradientBrush,\ CreateCompatibleRenderTarget,\ CreateLayer,\ CreateMesh,\ DrawLine,\ DrawRectangle,\ FillRectangle,\ DrawRoundedRectangle,\ FillRoundedRectangle,\ DrawEllipse,\ FillEllipse,\ DrawGeometry,\ FillGeometry,\ FillMesh,\ FillOpacityMask,\ DrawBitmap,\ DrawText,\ DrawTextLayout,\ DrawGlyphRun,\ SetTransform,\ GetTransform,\ SetAntialiasMode,\ GetAntialiasMode,\ SetTextAntialiasMode,\ GetTextAntialiasMode,\ SetTextRenderingParams,\ GetTextRenderingParams,\ SetTags,\ GetTags,\ PushLayer,\ PopLayer,\ Flush,\ SaveDrawingState,\ RestoreDrawingState,\ PushAxisAlignedClip,\ PopAxisAlignedClip,\ Clear,\ BeginDraw,\ EndDraw,\ GetPixelFormat,\ SetDpi,\ GetDpi,\ GetSize,\ GetPixelSize,\ GetMaximumBitmapSize,\ IsSupported interface ID2D1Bitmap,\ QueryInterface,\ AddRef,\ Release,\ GetFactory,\ GetSize,\ GetPixelSize,\ GetPixelFormat,\ GetDpi,\ CopyFromBitmap,\ CopyFromRenderTarget,\ CopyFromMemory interface IWICBitmapDecoder,\ QueryInterface,\ AddRef,\ Release,\ QueryCapability,\ Initialize,\ GetContainerFormat,\ GetDecoderInfo,\ CopyPalette,\ GetMetadataQueryReader,\ GetPreview,\ GetColorContexts,\ GetThumbnail,\ GetFrameCount,\ GetFrame interface IWICBitmap,\ QueryInterface,\ AddRef,\ Release,\ GetSize,\ GetPixelFormat,\ GetResolution,\ CopyPalette,\ CopyPixels,\ Lock,\ SetPalette,\ SetResolution pIWICFactory IWICImagingFactory pD2DFactory ID2D1Factory pDecoder IWICBitmapDecoder pIWICBitmap IWICBitmap pD2D1Bitmap ID2D1Bitmap pRenderTarget ID2D1RenderTarget CLSID_WICImagingFactory GUID cacaf262-9370-4615-a13b-9f5539da4c0a IID_IWICImagingFactory GUID ec5ec8a9-c395-4314-9c77-54d7a935ff70 IID_ID2D1Factory GUID 06152247-6f50-465a-9245-118bfd3b6007 GUID_WICPixelFormat32bppPBGRA GUID 6fddc324-4e03-4bfe-b185-3d77768dc910 CLSCTX_INPROC_SERVER = 1 COINIT_APARTMENTTHREADED = 0x2 COINIT_DISABLE_OLE1DDE = 0x4 D2D1_FACTORY_TYPE_SINGLE_THREADED = 0 .code invoke CoInitializeEx,0,\ COINIT_APARTMENTTHREADED or COINIT_DISABLE_OLE1DDE invoke CoCreateInstance,CLSID_WICImagingFactory,0,\ CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,pIWICFactory invoke D2D1CreateFactory,D2D1_FACTORY_TYPE_SINGLE_THREADED,\ IID_ID2D1Factory,0,pD2DFactory ;rax 0 but last error "no procedure found cominvk pIWICFactory,CreateBitmapFromMemory,640,480,\ GUID_WICPixelFormat32bppPBGRA,640*4,640*480*4,\ image,pIWICBitmap ;rax 0 cominvk pRenderTarget,CreateBitmapFromWicBitmap,[pIWICBitmap],0,\ pD2D1Bitmap ;it drops app .data image file 'Res\Tray.png' db 1228800 dup(0) |
|||
04 Aug 2021, 07:12 |
|
revolution 04 Aug 2021, 07:17
Your .code section just drops off to nothing. No ret, or jmp, or anything.
|
|||
04 Aug 2021, 07:17 |
|
Overclick 04 Aug 2021, 16:27
Quote:
It is cutted to show required parts. Read the comments |
|||
04 Aug 2021, 16:27 |
|
Overclick 04 Aug 2021, 16:31
1) I have to check the pD2DFactory created correctly
2) Check syntax of pRenderTarget,CreateBitmapFromWicBitmap
|
||||||||||
04 Aug 2021, 16:31 |
|
Roman 05 Aug 2021, 10:28
Cool error info!
How you do this? How get registers values? |
|||
05 Aug 2021, 10:28 |
|
Overclick 06 Aug 2021, 04:46
Quote:
Macro. I want to rebuild it to dlgbox with memory mapping, float converter and more registers. Quote:
Save them to stack and load values from there. |
|||
06 Aug 2021, 04:46 |
|
Overclick 06 Aug 2021, 07:01
1) At debugger seems ok. I lost in deep jumps of function where it sets error code 127
2) In deep jumps it trying to read from zero address taken from data section. I'm not sure what it is. Seems it's one of the I-pointers prepared incorrectly. |
|||
06 Aug 2021, 07:01 |
|
Overclick 06 Aug 2021, 09:38
Code: macro cominvk object,proc,[arg] { common assert defined object#.com.object ; must be a COM object macro call dummy \{ mov rax,[rcx] ;that is the place where read from zero call [rax+object#.#proc] \} fastcall ,[object],arg purge call } Is that mean my ID2D1RenderTarget Interface wrongly implemented or I have to initialize it somehow?
|
||||||||||
06 Aug 2021, 09:38 |
|
bitRAKE 06 Aug 2021, 10:56
When that is zero, it lacks a pointer to an interface. Although it may be defined correctly, you'll need to back up to where the interface pointer is populated. Typically, the address of that location is passed into another function.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
06 Aug 2021, 10:56 |
|
Overclick 06 Aug 2021, 11:13
I trying to do that by
Code: cominvk pD2DFactory,CreateWicBitmapRenderTarget,pIWICBitmap,0,\ pRenderTarget It drops too. Maybe I need to pass all of arguments instead of Null. I'll try it later. But I never seen that on c/c++ examples |
|||
06 Aug 2021, 11:13 |
|
bitRAKE 06 Aug 2021, 15:19
Sure love to see the assembly for that. Difficult to grok the types on these abstractions. For example, that last one should be a pointer to a pointer. If I saw an ADDR in there I'd be more comfortable.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
06 Aug 2021, 15:19 |
|
Overclick 07 Aug 2021, 07:29
I added BitmapProperties arg to CreateWicBitmapRenderTarget and now it doesn't drop but 0x80070057
Code: struct D2D1_PIXEL_FORMAT format dw 0 alphaMode dw 0 ends struct D2D1_BITMAP_PROPERTIES pixelFormat D2D1_PIXEL_FORMAT dpiX dd 96.0f dpiY dd 96.0f ends BitmapProperties D2D1_BITMAP_PROPERTIES |
|||
07 Aug 2021, 07:29 |
|
Overclick 07 Aug 2021, 08:20
OMG IWICBitmapSource is an Interface too
|
|||
07 Aug 2021, 08:20 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.