|
-
July 18th, 2010, 06:02 PM
#1
how to pop a "hello world!"messagebox?
hello:
i am a beginner in assembly,and i can't wait to test some code. i want to write a simple "hello world" program using inline assembly, how can i pass the string argument to the MessageBoxA()?
if i pass all the NULL value, it works,but not what i want.
i am using wxDevC++7.0, windows xp sp3. thanks, have a good day!
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main(int argc, char *argv[])
{
LPCTSTR user32="user32.dll";
HMODULE hd=LoadLibrary(user32);
if(hd)
printf("User32.dll is loaded!\n");
//0x7e4507ea is the address of MessageBoxA
__asm__(
"xor %eax,%eax\n"
"xor %ebx,%ebx\n"
"mov $0x7e4507ea,%ebx\n"
"push %eax\n"
"push %eax\n"
"push %eax\n"
"push %eax\n"
"call %ebx\n"
);
system("PAUSE");
return 0;
}
-
July 25th, 2010, 12:02 AM
#2
Re: how to pop a "hello world!"messagebox?
Last edited by Eri523; July 27th, 2010 at 08:18 PM.
-
July 31st, 2010, 07:15 AM
#3
Re: how to pop a "hello world!"messagebox?
 Originally Posted by Eri523
BTW: The assembly syntax used by your compiler is pretty unusual and definitely non-Intel! How come they use such a home-grown syntax? Could it be they would have needed a pretty expensive license from Intel to use the standard syntax?
HTH
The syntax he's using is the AT&T syntax, which is the only syntax I know of besides Intel. I do not believe any license is required to implement the Intel syntax, many compilers recognize it. But I could be wrong.
The AT&T syntax has been choice for GNU applications I've seen, such as their assembler (gas) and for inline assembly in their C compiler (gcc).
-
July 31st, 2010, 05:01 PM
#4
Re: how to pop a "hello world!"messagebox?
 Originally Posted by Bluefox815
The syntax he's using is the AT&T syntax, which is the only syntax I know of besides Intel. I do not believe any license is required to implement the Intel syntax, many compilers recognize it. But I could be wrong.
No, knowing that now, I don't think you're wrong. AT&T is a mighty company by itself, and they certainly don't have to bother paying some bucks to Intel for an assembly syntax license.
In fact I never heard that anyone had to pay any license fee for any assembler syntax at all, I was just wondering about that syntax I never saw yet.
If it's the AT&T syntax, I don't have to wonder any longer why so many C++ compilers use it: You certainly know that it's AT&T that stands behind Bjarne Stroustrup, and that Bjarne Stroustrup is the guy who stands behind the initial design of C++...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|