* Win32 function call using GNU assembler
@ 2009-09-02 8:11 uglyhunK
2009-09-02 16:16 ` Robert Plantz
2009-09-02 18:35 ` Brian Raiter
0 siblings, 2 replies; 3+ messages in thread
From: uglyhunK @ 2009-09-02 8:11 UTC (permalink / raw)
To: linux-assembly
Hi,
The following assembly source is not working. Really not sure where I'm going wrong.
Any guidance will be appreciated.
.section .data
CLASS_NAME:
.ascii "M\0a\0i\0n\0\0\0" # Main
WINDOW_NAME:
.ascii "A\0S\0M\0 \0W\0i\0n\0d\0o\0w\0\0\0" # ASM Window
.section .text
.globl _WinMain@16
_WinMain@16:
# function prologue
pushl %ebp
movl %esp, %ebp
pushl $0 # LPVOID lpParam
movl 8(%ebp), %eax
pushl %eax # HINSTANCE hInstance
pushl $0 # HMENU hMenu
pushl $0 # HWND hWndParent
pushl $120 # nHeight
pushl $240 # nWidth
pushl $-2147483648 # y
pushl $-2147483648 # x
pushl $13565952 # dwStyle
pushl $WINDOW_NAME # lpWindowName
pushl $CLASS_NAME # lpClassName
pushl $512 # dwExStyle
call _CreateWindowExA@48
add $48, %esp
# function epilogue
movl %ebp, %esp
popl %ebp
ret
Thank you
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Win32 function call using GNU assembler
2009-09-02 8:11 Win32 function call using GNU assembler uglyhunK
@ 2009-09-02 16:16 ` Robert Plantz
2009-09-02 18:35 ` Brian Raiter
1 sibling, 0 replies; 3+ messages in thread
From: Robert Plantz @ 2009-09-02 16:16 UTC (permalink / raw)
To: uglyhunK; +Cc: linux-assembly
What do you mean by "not working"? What is the behavior?
I do note that the
add $48, %esp
instruction is irrelevant since it is immediately followed by
movl %ebp, %esp
BTW, I'm not a Win32 programmer, so I don't know if I can add any
further insight.
-- Bob
On Wed, 2009-09-02 at 13:41 +0530, uglyhunK wrote:
> Hi,
>
> The following assembly source is not working. Really not sure where I'm going wrong.
> Any guidance will be appreciated.
>
> .section .data
> CLASS_NAME:
> .ascii "M\0a\0i\0n\0\0\0" # Main
> WINDOW_NAME:
> .ascii "A\0S\0M\0 \0W\0i\0n\0d\0o\0w\0\0\0" # ASM Window
>
> .section .text
> .globl _WinMain@16
> _WinMain@16:
> # function prologue
> pushl %ebp
> movl %esp, %ebp
>
> pushl $0 # LPVOID lpParam
> movl 8(%ebp), %eax
> pushl %eax # HINSTANCE hInstance
> pushl $0 # HMENU hMenu
> pushl $0 # HWND hWndParent
> pushl $120 # nHeight
> pushl $240 # nWidth
> pushl $-2147483648 # y
> pushl $-2147483648 # x
> pushl $13565952 # dwStyle
> pushl $WINDOW_NAME # lpWindowName
> pushl $CLASS_NAME # lpClassName
> pushl $512 # dwExStyle
> call _CreateWindowExA@48
> add $48, %esp
>
> # function epilogue
> movl %ebp, %esp
> popl %ebp
> ret
>
> Thank you--
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Win32 function call using GNU assembler
2009-09-02 8:11 Win32 function call using GNU assembler uglyhunK
2009-09-02 16:16 ` Robert Plantz
@ 2009-09-02 18:35 ` Brian Raiter
1 sibling, 0 replies; 3+ messages in thread
From: Brian Raiter @ 2009-09-02 18:35 UTC (permalink / raw)
To: uglyhunK; +Cc: linux-assembly
> The following assembly source is not working. Really not sure where
> I'm going wrong.
Well, you're posting a windows programming question to a list called
linux-assembly. So that's the first thing I'd say that you're doing
wrong.
But, marshalling my vestigial Windows programming knowledge, it looks
like you're defining a WinMain function that calls CreateWindowEx and
then immediately exits, thus destroying the window well before it has
a chance to display itself. So that's your central problem.
b
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-02 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-02 8:11 Win32 function call using GNU assembler uglyhunK
2009-09-02 16:16 ` Robert Plantz
2009-09-02 18:35 ` Brian Raiter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).