News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Viewing Animated GIF files

Started by bluedevil, May 18, 2017, 02:31:14 AM

Previous topic - Next topic

jj2007

Quote from: hutch-- on May 19, 2017, 01:12:37 AM
Just tried your build, will not run on my Win10 64 bit.

On Win10, CreateWindowEx fails with invalid menu handle.

On Win7-64, the OS set esi initially to zero, so this succeeds:
    fnx esi = CreateWindowEx,0,wc.lpszClassName,"Foo32",WS_VISIBLE or WS_SYSMENU or WS_MAXIMIZEBOX or WS_MINIMIZEBOX or WS_SIZEBOX,edi,ecx,ebx,eax,0,esi,hInstance,0

And in any case, mov ecx,[edx].value will fail unless the linker is explicitly told to align the structure. The problem is lack of a padding word in Windows.inc (the default Masm32 strategy) for that structure.

qWord

Quote from: jj2007 on May 19, 2017, 01:48:41 AM
On Win10, CreateWindowEx fails with invalid menu handle.

On Win7-64, the OS set esi initially to zero, so this succeeds:
    fnx esi = CreateWindowEx,0,wc.lpszClassName,"Foo32",WS_VISIBLE or WS_SYSMENU or WS_MAXIMIZEBOX or WS_MINIMIZEBOX or WS_SIZEBOX,edi,ecx,ebx,eax,0,esi,hInstance,0
yes, thats it.
MREAL macros - when you need floating point arithmetic while assembling!

hutch--

I did JJ's mod and it was still failing but not ending up in memory.

Commented out this section in the WM_CREATE,

;         .if frameCount > 1
;             
;             add frameNumber,1
;             
;             invoke getDelayForFrame,delayProp,frameNumber
;             invoke SetTimer,hWnd,123,eax,NULL
;             
;         .endif


And the Window appears with the gif image but of course no animation.

This is the ML command line in the batch file.

\masm32\bin\ml /c /coff /Zp8 "qword_gdip.asm"


I currently have ML version 14 running.

jj2007

Quote from: hutch-- on May 19, 2017, 02:15:00 AM
I did JJ's mod and it was still failing but not ending up in memory.

Yes, sometimes it ends up in no man's land. But most of the time it works in Win10 with an xor esi, esi.

bluedevil

Hello everyone;

1. I also cannot managed to run on Win10x64. I am stuck like hutch--.
2. @jj2007, i attach my version on your codes please check it out. It is working, but not perfect. Try the other gif files in the zip package. If the gif file is rectangular or square, it is ok. But if it has some kinda transparent background, it show improperly. BTW jj2007 i admire your work on MasmBasic, i will spend on time with that. But my approach is more on reverse engineering so i want to learn winapi and masm/assembly much deeply.  On the contrary, masmbasic is really practical and very good if you develop or solve problems. But ineed deep understanding of the system.
3. So i will go an anigif library guys. If someone find a solution, i am here to listen.
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

jj2007

#20
Quote from: blue_devil on May 26, 2017, 10:33:17 PMIf the gif file is rectangular or square, it is ok. But if it has some kinda transparent background, it show improperly. BTW jj2007 i admire your work on MasmBasic

Thanks ;)

The size is not a factor afaik but the background is. Either add a timer event that forces an erase:
Event Timer
  GuiCls


Or load a non-transparent background GIF first:Event Paint
  GuiImage "Tweetie.gif", fit  ; not the best example, of course
  GuiImage "cross.gif", fit
GuiEnd


P.S.: It's actually easier to just add GuiCls:

include \masm32\MasmBasic\Res\MbGui.asm      ; part of MasmBasic

Event Paint
  GuiCls            ; needed only for images with transparent background
  GuiImage "cross.gif", fit
GuiEnd


Tested OK on Win7-64, Win10-64, and my XP VM.

qWord

Quote from: blue_devil on May 26, 2017, 10:33:17 PM
1. I also cannot managed to run on Win10x64. I am stuck like hutch--.
yes, sorry for that. I've run it on an VM with Win10x64 and it did work (free running and in a Debugger). I've currently no access to a real installation, so no change to track that bug for me. You might insert some INT3's and step though the program using OllyDbg to see were it goes wrong.
JJ could jump in with showing his implementation, but he is unfortunately more interested in making people using his library  :(
MREAL macros - when you need floating point arithmetic while assembling!

RuiLoureiro

Hello qWord,
                   How are you ?
:icon14:

hutch--

qword,

I can sympathise to this extent that code that has worked for years from XP and earlier needed to be changed for both Win7 64 and more recently Win10 64 so with code that I regularly use I build it in Win10 64 then back test it on Win7 and XP. So far with 64 bit MASM I have only developed on Win10 64 but so far it has all worked on Win7 64 so I don't have any problems there.

avcaballero

Hello, here is my version. Works in W7 64bits. Nevertheless I have noticed that the memory asigned to it grows each time you resize the window, surely it is any create_something that needs destroy it. I left it to the good reader  :bgrin:

bluedevil

Quote from: caballero on May 27, 2017, 06:37:58 AM
Hello, here is my version. Works in W7 64bits. Nevertheless I have noticed that the memory asigned to it grows each time you resize the window, surely it is any create_something that needs destroy it. I left it to the good reader  :bgrin:
Caballero thank you. I have compiled sources on Win7x86 and Win10x64 with old ML.exe. And they both worked on x86 and x64 virtual machines.
@qWord, today i worked on your sources and debuged them a lot but i couldn't find the differences that jj mentioned earlier. I xored the esi but nothing changed. And i also tried old ML and new ML.exe from Visual Studio :/

I am now preparing sources, when finished i will publish here.  8) And then i will come with new topic new sources and new questions :icon_redface: :idea:
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

jj2007

Quote from: caballero on May 27, 2017, 06:37:58 AMthe memory asigned to it grows each time you resize the window

To test it, use SetTimer to call InvalidateRect, i.e. to trigger WM_PAINT events. After a while, Task Manager should show a trend.

The screenshot below shows the behaviour of an enlarged cross.gif (reply #20) after 55 minutes of cpu time. Looks quite ok, especially when compared to Firefox. Noteworthy: The working set starts at around 4.x MB and then increases steadily. This looks like a leak, but strangely enough, it stabilises after 10-20 minutes at 5.3 MB. I have no explanation for this behaviour. The page errors are also high in comparison to Firefox.

Your GDIPlusWM04.exe starts with a somewhat higher working set, but it remains remarkably stable when running - except when you resize the window, as you rightly noticed. What exactly do you do when the size changes?

bluedevil

@caballero
I want to ask some questions
1. You did define the path of the gif file by:
WSTR                szAnimGif, "Gangster.gif"
So why did you used WSTR macro, instead of defining directly

2. I wrote "FileOpen" function. By this function user can open any gif file s/he wants. Not a single one. So i need to change "szAnimGif" variable under my "FileOpen" funtion before calling your "prLoadAnimGif" function. I used lstrcpy but it didnt worked:
invoke lstrcpy, addr szAnimGif, addr ofn.lpstrFile
invoke    prLoadAnimGif

Any ideas?
Thanks.
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

jj2007

1+2: Gdi+ needs the Unicode versions! Put an int 3 before the lstrcpy and launch Olly. Unless you are explicitly using the "W" version, i.e. GetOpenFileNameW, you have Ansi there.

newrobert

Olly,this software seems not to download.