|
-
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;
}
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
|