flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
ouadji 20 Jan 2011, 20:41
Code: "0.95.05" save_cancelled: ;mov eax,[lparam] ;xchg eax,[ei.pszpath] ;cmp eax,[ei.pszpath] ;je finish ;invoke VirtualFree,eax,0,MEM_RELEASE invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0 invoke SendMessage,[hwnd_tabctrl],TCM_SETITEM,eax,ei jmp finish Your solution is another way of looking at things, but I checked it, everything works correctly. |
|||
![]() |
|
ouadji 21 Jan 2011, 01:25
Code: fmsave: mov [ei.header.mask],TCIF_PARAM invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei or eax,eax jz failed mov eax,[ei.pszpath] ;eax != 0, but *eax="" => CreateFile fail! or eax,eax jz failed invoke CreateFile,eax,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0 *[ei.pszpath] == "" and CreateFile fail. Yes ...it does not matter! (but this is not aesthetic) I think my solution was better. |
|||
![]() |
|
Tomasz Grysztar 21 Jan 2011, 05:06
Yes, I now leave the memory block allocated but unused (until the next time). It may appear a bit "dirty"... But, on the other hand, if you then do "save" once again, the memory is already allocated -why allocate it two times?
|
|||
![]() |
|
ouadji 21 Jan 2011, 09:37
Quote:
![]() ![]() Quote:
but in this case, the string "path" is empty and in "fmsave", this is not : Code: mov eax,[ei.pszpath] or eax,eax jz failed ;-----> out Code: invoke CreateFile cmp eax,-1 je failed ;-----> here out and that ... it's a bit "dirty". sorry, I'm a perfectionist ... (only with code ![]() then, maybe this ? (to be politically perfect ![]() Code: mov eax,[ei.pszpath] or eax,eax jz failed mov ebx,[eax] ;+ or ebx,ebx ;+ Memory allocated by VirtualAlloc jz failed ;+ is automatically initialized to zero invoke CreateFile have a good day Tomasz, and thank you for your reply. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.