Hi guys,
I'm trying to call MessageBoxA() directly in assembly, using gcc inline. However I need to do this in 2 ways: first is using dynamic addressing, with LoadLibrary() and GetProcAddress() - I found a tutorial about this, trying to follow it. But I'm also interested in calling directly the address of MessageBoxA, wich is 0x7e4507ea in my Windows SP3 English.
I'm trying to execute this code:
/*
* eax holds return value
* ebx will hold function addresses
* ecx will hold string pointers
* edx will hold NULL
*
*/
int main(int argc, char **argv)
{
asm(" xor %eax, %eax \t\n\
xor %ebx, %ebx \t\n\
xor %ecx, %ecx \t\n\
xor %edx, %edx \t\n\
push $0x0 \t\n\
push $0x44444444 \t\n\
push $0x44444444 \t\n\
pop %ecx \t\n\
mov %dl,0x3(%ecx) \t\n\
mov $0x7e4507ea, %ebx \t\n\
push %edx \t\n\
push %ecx \t\n\
push %ecx \t\n\
push %edx \t\n\
mov $0x8, %ax \t\n\
call *%ebx \t\n\
");
}
I'm not sure if in Windows is even possible to do this, directly call the address, without specifying the library (user32.dll in this case). I know in Linux it's simple to call write() syscall, but in Windows I'm not so familiar yet..
I expect to see a message box with "DDDDDDDD". Could someone help me on that please? Appreciate any help, with tutorial links also!
Thanks a lot