flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > Win-64 Alternate method of populating WNDCLASSEX |
Author |
|
bitRAKE 02 Dec 2018, 10:51
The class ATOM is word sized, and can even be used to create the window. Why not TEST AX,AX? The only concern I have with the code is that RSP is not always 32-bit -- mostly it can be, but there is no guarantee.
In the past, compact window creation was done by setting a single bit in DLGTEMPLATE (WS_POPUP is bit 31 - nothing else is needed) and calling DialogBoxIndirectParamW. It seems like you are trying to do something more general. Code: entry $ pop rax ; 5A align stack, lol mov ecx,[rcx] ; 8B09 HINSTANCE #32# lea rdx,[DlgMain] ; DLGTEMPLATE xor r8,r8 ; 4D 31C0 HWND_DESKTOP lea r9,[DialogFunc] ; 4C 8D0D D5FFFFFF ; LPARAM on stack (0) call [DialogBoxIndirectParamW] ; FF15 49000000 xchg ecx,eax ; 91 call [ExitProcess] ; FF15 52000000
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||||||||||
02 Dec 2018, 10:51 |
|
TightCoderEx 02 Dec 2018, 15:09
test ax,ax is definitely a better alternative and code has been changed to reflect that. It's too bad API didn't sign extend to 32 bits, then test eax,eax could have been used.
I wasn't able to assemble "DlgMain" as ZIP is missing format/format.inc. This was helpful, as some time ago I had played around with passing this to linker and even modifying PE, but hadn't read documentation yet to see how it works with FASM. This did make object file 24% smaller although I do realize it hasn't optimized application in any way. Code: format PE64 GUI 6.0 at $10000 on "NUL" stack 1000h,1000h heap 1000h,1000h It's been 10 yrs or so since I've played with Win applications, but when I did use dialog boxes, it was the predefined ones like file, font, color selection. There was an issue I ran into with DialogBoxParam though, and if I remember correctly is was subclassing controls in the window. I'm not sure though. I'm attaching the entire source as it exists to date and you'll notice the stack stays at least QWORD aligned and when shadow space is required, then PAGE (128 bit) aligned.
|
|||||||||||
02 Dec 2018, 15:09 |
|
bitRAKE 04 Dec 2018, 00:56
Oh, DlgMain is built with FASMG - it's in the regular download - no other fancy includes.
Dialog boxes should be able to create any controls registered in the application or global space. Yet, they are themselves a subclass of a standard window. So, I can see how their blocking of regular window functionality might change the way another control is designed to function. If small or reuse of existing code is the goal then dialogs offer a model one can design for. |
|||
04 Dec 2018, 00:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.